File size: 4,083 Bytes
c481147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin - Feedback Submissions</title>
    <link rel="stylesheet" href="style.css">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
</head>
<body class="bg-gray-50 min-h-screen">
    <custom-header></custom-header>
    
    <main class="container mx-auto px-4 py-8 max-w-6xl">
        <div class="bg-white rounded-xl shadow-md p-6">
            <h1 class="text-2xl font-bold text-primary mb-6">Feedback Submissions</h1>
            
            <div class="overflow-x-auto">
                <table class="min-w-full divide-y divide-gray-200" id="submissionsTable">
                    <thead class="bg-gray-50">
                        <tr>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Presenter</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Session</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Ratings</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
                        </tr>
                    </thead>
                    <tbody class="bg-white divide-y divide-gray-200" id="submissionsBody">
                        <!-- Filled by JavaScript -->
                    </tbody>
                </table>
            </div>
        </div>
    </main>
    
    <custom-footer></custom-footer>
    
    <script src="components/header.js"></script>
    <script src="components/footer.js"></script>
    <script src="script.js"></script>
    <script>
        feather.replace();
        
        // Load and display submissions
        document.addEventListener('DOMContentLoaded', () => {
            const submissions = JSON.parse(localStorage.getItem('feedbackSubmissions') || '[]');
            const tableBody = document.getElementById('submissionsBody');
            
            submissions.forEach((submission, index) => {
                const row = document.createElement('tr');
                row.className = 'hover:bg-gray-50';
                
                const ratingsHTML = Object.entries(submission)
                    .filter(([key]) => ['Content & Quality', 'Clarity & Organization', 'Engagement & Delivery', 'Design & Visual Appeal'].includes(key))
                    .map(([key, value]) => `${key}: ${value}`)
                    .join('<br>');
                
                row.innerHTML = `
                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${submission.Date || 'N/A'}</td>
                    <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${submission['Presenter Name'] || 'N/A'}</td>
                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${submission['Session Title'] || 'N/A'}</td>
                    <td class="px-6 py-4 text-sm text-gray-500">${ratingsHTML}</td>
                    <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                        <button onclick="deleteSubmission(${index})" class="text-red-600 hover:text-red-900">Delete</button>
                    </td>
                `;
                
                tableBody.appendChild(row);
            });
        });
        
        window.deleteSubmission = function(index) {
            const submissions = JSON.parse(localStorage.getItem('feedbackSubmissions') || '[]');
            submissions.splice(index, 1);
            localStorage.setItem('feedbackSubmissions', JSON.stringify(submissions));
            location.reload();
        };
    </script>
</body>
</html>