File size: 17,379 Bytes
8f8bb99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Customer Support Analysis Dashboard</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --primary-blue: #1e3a8a;
            --secondary-blue: #3b82f6;
            --light-blue: #dbeafe;
            --dark-gray: #374151;
            --medium-gray: #9ca3af;
            --light-gray: #f3f4f6;
        }
        
        .gradient-bg {
            background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
        }
        
        .glass-effect {
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }
        
        .hover-scale {
            transition: transform 0.3s ease;
        }
        
        .hover-scale:hover {
            transform: scale(1.02);
        }
        
        .animate-fade-in {
            animation: fadeIn 0.5s ease-in;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .status-badge {
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
        }
        
        .status-open { background-color: #fee2e2; color: #dc2626; }
        .status-in-progress { background-color: #fef3c7; color: #d97706; }
        .status-resolved { background-color: #d1fae5; color: #059669; }
        
        .priority-high { border-left: 4px solid #ef4444; }
        .priority-medium { border-left: 4px solid #f59e0b; }
        .priority-low { border-left: 4px solid #10b981; }
    </style>
</head>
<body class="bg-gray-50 font-sans">
    <div class="flex h-screen">
        <!-- Sidebar -->
        <aside class="w-64 bg-white shadow-lg">
            <div class="p-6">
                <div class="flex items-center space-x-3">
                    <div class="w-10 h-10 gradient-bg rounded-lg flex items-center justify-center">
                        <i class="fas fa-headset text-white"></i>
                    </div>
                    <h1 class="text-xl font-bold text-gray-800">SupportHub</h1>
                </div>
            </div>
            
            <nav class="mt-6">
                <a href="#" class="flex items-center px-6 py-3 text-sm font-medium text-white gradient-bg">
                    <i class="fas fa-chart-line mr-3"></i>
                    Dashboard
                </a>
                <a href="#" class="flex items-center px-6 py-3 text-sm font-medium text-gray-600 hover:bg-gray-50">
                    <i class="fas fa-ticket-alt mr-3"></i>
                    Tickets
                </a>
                <a href="#" class="flex items-center px-6 py-3 text-sm font-medium text-gray-600 hover:bg-gray-50">
                    <i class="fas fa-users mr-3"></i>
                    Agents
                </a>
                <a href="#" class="flex items-center px-6 py-3 text-sm font-medium text-gray-600 hover:bg-gray-50">
                    <i class="fas fa-cog mr-3"></i>
                    Settings
                </a>
            </nav>
        </aside>

        <!-- Main Content -->
        <main class="flex-1 overflow-y-auto">
            <!-- Header -->
            <header class="bg-white shadow-sm">
                <div class="px-8 py-4 flex items-center justify-between">
                    <div>
                        <h2 class="text-2xl font-bold text-gray-800">Customer Support Analytics</h2>
                        <p class="text-sm text-gray-600 mt-1">Monitor and analyze support performance</p>
                    </div>
                    
                    <div class="flex items-center space-x-4">
                        <div class="relative">
                            <input type="text" id="searchInput" placeholder="Search tickets..." 
                                class="pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:border-blue-500">
                            <i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
                        </div>
                        <button onclick="exportCSV()" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition">
                            <i class="fas fa-download mr-2"></i>CSV
                        </button>
                        <button onclick="exportPDF()" class="px-4 py-2 bg-gray-600 text-white rounded-lg hover:bg-gray-700 transition">
                            <i class="fas fa-file-pdf mr-2"></i>PDF
                        </button>
                    </div>
                </div>
            </header>

            <!-- Dashboard Content -->
            <div class="p-8">
                <!-- Metrics Cards -->
                <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
                    <div class="bg-white p-6 rounded-xl shadow-lg hover-scale animate-fade-in">
                        <div class="flex items-center justify-between">
                            <div>
                                <p class="text-sm font-medium text-gray-600">Total Tickets</p>
                                <p class="text-3xl font-bold text-gray-800">1,247</p>
                                <p class="text-sm text-green-600 mt-1">
                                    <i class="fas fa-arrow-up"></i> 12% from last month
                                </p>
                            </div>
                            <div class="w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center">
                                <i class="fas fa-ticket-alt text-blue-600 text-xl"></i>
                            </div>
                        </div>
                    </div>

                    <div class="bg-white p-6 rounded-xl shadow-lg hover-scale animate-fade-in">
                        <div class="flex items-center justify-between">
                            <div>
                                <p class="text-sm font-medium text-gray-600">Avg Response Time</p>
                                <p class="text-3xl font-bold text-gray-800">2.4 hrs</p>
                                <p class="text-sm text-red-600 mt-1">
                                    <i class="fas fa-arrow-up"></i> 0.3 hrs from last week
                                </p>
                            </div>
                            <div class="w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center">
                                <i class="fas fa-clock text-green-600 text-xl"></i>
                            </div>
                        </div>
                    </div>

                    <div class="bg-white p-6 rounded-xl shadow-lg hover-scale animate-fade-in">
                        <div class="flex items-center justify-between">
                            <div>
                                <p class="text-sm font-medium text-gray-600">Resolution Rate</p>
                                <p class="text-3xl font-bold text-gray-800">89.7%</p>
                                <p class="text-sm text-green-600 mt-1">
                                    <i class="fas fa-arrow-up"></i> 3.2% improvement
                                </p>
                            </div>
                            <div class="w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center">
                                <i class="fas fa-check-circle text-purple-600 text-xl"></i>
                            </div>
                        </div>
                    </div>

                    <div class="bg-white p-6 rounded-xl shadow-lg hover-scale animate-fade-in">
                        <div class="flex items-center justify-between">
                            <div>
                                <p class="text-sm font-medium text-gray-600">CSAT Score</p>
                                <p class="text-3xl font-bold text-gray-800">4.7/5</p>
                                <p class="text-sm text-green-600 mt-1">
                                    <i class="fas fa-arrow-up"></i> 0.2 from last month
                                </p>
                            </div>
                            <div class="w-12 h-12 bg-yellow-100 rounded-lg flex items-center justify-center">
                                <i class="fas fa-star text-yellow-600 text-xl"></i>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Chart -->
                <div class="bg-white p-6 rounded-xl shadow-lg mb-8">
                    <h3 class="text-lg font-semibold text-gray-800 mb-4">Ticket Evolution</h3>
                    <canvas id="ticketChart" height="100"></canvas>
                </div>

                <!-- Tickets Table -->
                <div class="bg-white rounded-xl shadow-lg">
                    <div class="p-6 border-b">
                        <h3 class="text-lg font-semibold text-gray-800">Recent Tickets</h3>
                    </div>
                    
                    <div class="overflow-x-auto">
                        <table class="w-full" id="ticketsTable">
                            <thead class="bg-gray-50">
                                <tr>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Subject</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Priority</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Assigned To</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Created</th>
                                </tr>
                            </thead>
                            <tbody id="ticketsTableBody" class="bg-white divide-y divide-gray-200">
                                <!-- Data will be populated by JavaScript -->
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </main>
    </div>

    <script>
        // Sample data
        const ticketsData = [
            { id: 'TCK-001', subject: 'Login issue with 2FA', status: 'open', priority: 'high', assigned: 'John Doe', created: '2024-01-15' },
            { id: 'TCK-002', subject: 'Billing discrepancy', status: 'in-progress', priority: 'medium', assigned: 'Jane Smith', created: '2024-01-14' },
            { id: 'TCK-003', subject: 'Feature request: Dark mode', status: 'resolved', priority: 'low', assigned: 'Mike Johnson', created: '2024-01-13' },
            { id: 'TCK-004', subject: 'API rate limit exceeded', status: 'open', priority: 'high', assigned: 'Sarah Wilson', created: '2024-01-15' },
            { id: 'TCK-005', subject: 'Mobile app crashes', status: 'in-progress', priority: 'medium', assigned: 'Tom Brown', created: '2024-01-12' }
        ];

        // Initialize dashboard
        function initDashboard() {
            renderTicketsTable(ticketsData);
            initChart();
        }

        // Render tickets table
        function renderTicketsTable(data) {
            const tbody = document.getElementById('ticketsTableBody');
            tbody.innerHTML = '';
            
            data.forEach(ticket => {
                const tr = document.createElement('tr');
                tr.className = 'hover:bg-gray-50';
                tr.innerHTML = `
                    <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${ticket.id}</td>
                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">${ticket.subject}</td>
                    <td class="px-6 py-4 whitespace-nowrap">
                        <span class="status-badge status-${ticket.status}">${ticket.status}</span>
                    </td>
                    <td class="px-6 py-4 whitespace-nowrap">
                        <div class="priority-${ticket.priority} pl-4">${ticket.priority}</div>
                    </td>
                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">${ticket.assigned}</td>
                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${ticket.created}</td>
                `;
                tbody.appendChild(tr);
            });
        }

        // Initialize chart
        function initChart() {
            const ctx = document.getElementById('ticketChart').getContext('2d');
            new Chart(ctx, {
                type: 'line',
                data: {
                    labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
                    datasets: [{
                        label: 'Open Tickets',
                        data: [65, 59, 80, 81, 56, 55],
                        borderColor: '#3b82f6',
                        backgroundColor: 'rgba(59, 130, 246, 0.1)',
                        tension: 0.4,
                        fill: true
                    }, {
                        label: 'Resolved Tickets',
                        data: [28, 48, 40, 19, 86, 27],
                        borderColor: '#10b981',
                        backgroundColor: 'rgba(16, 185, 129, 0.1)',
                        tension: 0.4,
                        fill: true
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            position: 'top',
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: true
                        }
                    }
                }
            });
        }

        // Search functionality
        document.getElementById('searchInput').addEventListener('input', function(e) {
            const searchTerm = e.target.value.toLowerCase();
            const filteredData = ticketsData.filter(ticket => 
                ticket.id.toLowerCase().includes(searchTerm) ||
                ticket.subject.toLowerCase().includes(searchTerm) ||
                ticket.status.toLowerCase().includes(searchTerm) ||
                ticket.priority.toLowerCase().includes(searchTerm)
            );
            renderTicketsTable(filteredData);
        });

        // Export functions
        function exportCSV() {
            const csvContent = "data:text/csv;charset=utf-8," 
                + "ID,Subject,Status,Priority,Assigned To,Created\n"
                + ticketsData.map(t => `${t.id},${t.subject},${t.status},${t.priority},${t.assigned},${t.created}`).join("\n");
            
            const link = document.createElement("a");
            link.setAttribute("href", encodeURI(csvContent));
            link.setAttribute("download", "tickets.csv");
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
        }

        function exportPDF() {
            const { jsPDF } = window.jspdf;
            const doc = new jsPDF();
            
            doc.setFontSize(16);
            doc.text("Support Tickets Report", 20, 20);
            
            let y = 40;
            ticketsData.forEach(ticket => {
                doc.setFontSize(12);
                doc.text(`${ticket.id} - ${ticket.subject}`, 20, y);
                doc.text(`Status: ${ticket.status}`, 20, y + 10);
                doc.text(`Priority: ${ticket.priority}`, 20, y + 20);
                y += 30;
            });
            
            doc.save("tickets-report.pdf");
        }

        // Initialize dashboard on load
        initDashboard();
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Ai-ethic/website-theme" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>