KINGFAUS commited on
Commit
2465e98
·
verified ·
1 Parent(s): 8ac1b0c

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +5 -3
  2. index.html +418 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Ticket
3
- emoji: 🐨
4
  colorFrom: purple
5
  colorTo: pink
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: ticket
3
+ emoji: 🐳
4
  colorFrom: purple
5
  colorTo: pink
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,418 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="fr">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Classico Party - Kandi</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/qrcode@1.5.1/build/qrcode.min.js"></script>
9
+ <style>
10
+ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');
11
+
12
+ body {
13
+ font-family: 'Poppins', sans-serif;
14
+ background-color: #f8f9fa;
15
+ }
16
+
17
+ .ticket {
18
+ background: linear-gradient(135deg, #1e3a8a 0%, #7c3aed 100%);
19
+ border-radius: 12px;
20
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
21
+ position: relative;
22
+ overflow: hidden;
23
+ }
24
+
25
+ .ticket::before {
26
+ content: "";
27
+ position: absolute;
28
+ top: 0;
29
+ left: 0;
30
+ right: 0;
31
+ height: 8px;
32
+ background: linear-gradient(90deg, #f59e0b 0%, #ef4444 50%, #f59e0b 100%);
33
+ }
34
+
35
+ .perforation {
36
+ position: absolute;
37
+ width: 20px;
38
+ height: 20px;
39
+ background-color: #f8f9fa;
40
+ border-radius: 50%;
41
+ top: 50%;
42
+ transform: translateY(-50%);
43
+ }
44
+
45
+ .perforation-left {
46
+ left: -10px;
47
+ }
48
+
49
+ .perforation-right {
50
+ right: -10px;
51
+ }
52
+
53
+ .qr-container {
54
+ background: white;
55
+ padding: 8px;
56
+ border-radius: 8px;
57
+ }
58
+
59
+ .ticket-strip {
60
+ background: repeating-linear-gradient(
61
+ 45deg,
62
+ #f59e0b,
63
+ #f59e0b 10px,
64
+ #ef4444 10px,
65
+ #ef4444 20px
66
+ );
67
+ height: 6px;
68
+ margin: 10px 0;
69
+ }
70
+
71
+ .ticket-type {
72
+ background-color: rgba(255, 255, 255, 0.2);
73
+ border-radius: 20px;
74
+ padding: 2px 12px;
75
+ font-weight: 600;
76
+ }
77
+ </style>
78
+ </head>
79
+ <body class="bg-gray-100 min-h-screen">
80
+ <div class="container mx-auto px-4 py-8">
81
+ <div class="max-w-md mx-auto bg-white rounded-xl shadow-md overflow-hidden mb-8">
82
+ <div class="bg-blue-900 p-4">
83
+ <h1 class="text-2xl font-bold text-white text-center">Classico Party</h1>
84
+ <p class="text-white text-center">Hôtel Bide de Kandi</p>
85
+ </div>
86
+
87
+ <div class="p-6">
88
+ <div class="mb-6">
89
+ <h2 class="text-xl font-semibold text-gray-800 mb-4">Générer un ticket</h2>
90
+
91
+ <div class="space-y-4">
92
+ <div>
93
+ <label class="block text-gray-700 mb-2" for="name">Nom du client</label>
94
+ <input type="text" id="name" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
95
+ </div>
96
+
97
+ <div>
98
+ <label class="block text-gray-700 mb-2" for="phone">Téléphone</label>
99
+ <input type="tel" id="phone" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
100
+ </div>
101
+
102
+ <div>
103
+ <label class="block text-gray-700 mb-2" for="type">Type de ticket</label>
104
+ <select id="type" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
105
+ <option value="standard">Standard - 2000 FCFA</option>
106
+ <option value="vip">VIP - 5000 FCFA</option>
107
+ <option value="table">Table VIP - 25000 FCFA</option>
108
+ </select>
109
+ </div>
110
+
111
+ <div>
112
+ <label class="block text-gray-700 mb-2" for="payment">Méthode de paiement</label>
113
+ <select id="payment" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
114
+ <option value="cash">Cash</option>
115
+ <option value="momo">Mobile Money</option>
116
+ <option value="wave">Wave</option>
117
+ </select>
118
+ </div>
119
+
120
+ <button id="generateBtn" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition duration-200">
121
+ Générer le ticket
122
+ </button>
123
+ </div>
124
+ </div>
125
+
126
+ <div class="border-t pt-6">
127
+ <h2 class="text-xl font-semibold text-gray-800 mb-4">Historique des ventes</h2>
128
+
129
+ <div class="overflow-x-auto">
130
+ <table class="min-w-full bg-white rounded-lg overflow-hidden">
131
+ <thead class="bg-gray-100">
132
+ <tr>
133
+ <th class="py-2 px-4 text-left">Nom</th>
134
+ <th class="py-2 px-4 text-left">Type</th>
135
+ <th class="py-2 px-4 text-left">Prix</th>
136
+ </tr>
137
+ </thead>
138
+ <tbody id="salesHistory" class="divide-y divide-gray-200">
139
+ <!-- Sales will be added here -->
140
+ </tbody>
141
+ </table>
142
+ </div>
143
+
144
+ <div class="mt-4 flex space-x-2">
145
+ <button id="exportBtn" class="flex-1 bg-green-600 hover:bg-green-700 text-white font-bold py-2 px-4 rounded-lg transition duration-200">
146
+ Exporter les données
147
+ </button>
148
+ <button id="clearBtn" class="flex-1 bg-red-600 hover:bg-red-700 text-white font-bold py-2 px-4 rounded-lg transition duration-200">
149
+ Effacer tout
150
+ </button>
151
+ </div>
152
+ </div>
153
+ </div>
154
+ </div>
155
+
156
+ <!-- Ticket Preview -->
157
+ <div id="ticketPreview" class="max-w-md mx-auto hidden">
158
+ <div class="ticket text-white p-6 mb-8">
159
+ <div class="flex justify-between items-start mb-4">
160
+ <div>
161
+ <h2 class="text-2xl font-bold">CLASSICO PARTY</h2>
162
+ <p class="text-sm opacity-80">Hôtel Bide de Kandi</p>
163
+ </div>
164
+ <div class="ticket-type" id="ticketTypeDisplay">Standard</div>
165
+ </div>
166
+
167
+ <div class="ticket-strip"></div>
168
+
169
+ <div class="flex justify-between items-center mb-4">
170
+ <div>
171
+ <p class="text-sm opacity-80">Nom</p>
172
+ <p class="font-semibold" id="ticketName">John Doe</p>
173
+ </div>
174
+ <div>
175
+ <p class="text-sm opacity-80">Téléphone</p>
176
+ <p class="font-semibold" id="ticketPhone">+229 XX XX XX XX</p>
177
+ </div>
178
+ </div>
179
+
180
+ <div class="flex justify-between items-center mb-6">
181
+ <div>
182
+ <p class="text-sm opacity-80">Date</p>
183
+ <p class="font-semibold" id="ticketDate">01 Jan 2023</p>
184
+ </div>
185
+ <div>
186
+ <p class="text-sm opacity-80">Prix</p>
187
+ <p class="font-semibold" id="ticketPrice">2000 FCFA</p>
188
+ </div>
189
+ </div>
190
+
191
+ <div class="flex justify-center mb-4">
192
+ <div class="qr-container">
193
+ <canvas id="qrCode"></canvas>
194
+ </div>
195
+ </div>
196
+
197
+ <div class="text-center">
198
+ <p class="text-xs opacity-70">Présentez ce ticket à l'entrée</p>
199
+ <p class="text-xs font-mono mt-1" id="ticketId">ID: CL2024-XXXXX</p>
200
+ </div>
201
+ </div>
202
+
203
+ <div class="flex space-x-4">
204
+ <button id="printBtn" class="flex-1 bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition duration-200">
205
+ Imprimer
206
+ </button>
207
+ <button id="closeTicketBtn" class="flex-1 bg-gray-600 hover:bg-gray-700 text-white font-bold py-3 px-4 rounded-lg transition duration-200">
208
+ Fermer
209
+ </button>
210
+ </div>
211
+ </div>
212
+ </div>
213
+
214
+ <script>
215
+ document.addEventListener('DOMContentLoaded', function() {
216
+ // Initialize sales data from localStorage
217
+ let salesData = JSON.parse(localStorage.getItem('classicoPartySales')) || [];
218
+ updateSalesHistory();
219
+
220
+ // Generate ticket button
221
+ document.getElementById('generateBtn').addEventListener('click', generateTicket);
222
+
223
+ // Export data button
224
+ document.getElementById('exportBtn').addEventListener('click', exportData);
225
+
226
+ // Clear data button
227
+ document.getElementById('clearBtn').addEventListener('click', clearData);
228
+
229
+ // Print ticket button
230
+ document.getElementById('printBtn').addEventListener('click', printTicket);
231
+
232
+ // Close ticket preview button
233
+ document.getElementById('closeTicketBtn').addEventListener('click', function() {
234
+ document.getElementById('ticketPreview').classList.add('hidden');
235
+ });
236
+
237
+ function generateTicket() {
238
+ const name = document.getElementById('name').value.trim();
239
+ const phone = document.getElementById('phone').value.trim();
240
+ const type = document.getElementById('type').value;
241
+ const payment = document.getElementById('payment').value;
242
+
243
+ if (!name) {
244
+ alert('Veuillez entrer le nom du client');
245
+ return;
246
+ }
247
+
248
+ // Generate ticket ID
249
+ const timestamp = new Date().getTime();
250
+ const randomNum = Math.floor(Math.random() * 10000);
251
+ const ticketId = `CL2024-${randomNum.toString().padStart(5, '0')}`;
252
+
253
+ // Set ticket price based on type
254
+ let price;
255
+ let typeDisplay;
256
+ switch(type) {
257
+ case 'vip':
258
+ price = 5000;
259
+ typeDisplay = 'VIP';
260
+ break;
261
+ case 'table':
262
+ price = 25000;
263
+ typeDisplay = 'Table VIP';
264
+ break;
265
+ default:
266
+ price = 2000;
267
+ typeDisplay = 'Standard';
268
+ }
269
+
270
+ // Create ticket data
271
+ const ticketData = {
272
+ id: ticketId,
273
+ name: name,
274
+ phone: phone,
275
+ type: type,
276
+ typeDisplay: typeDisplay,
277
+ price: price,
278
+ payment: payment,
279
+ date: new Date().toLocaleDateString('fr-FR', {
280
+ day: '2-digit',
281
+ month: 'short',
282
+ year: 'numeric'
283
+ }),
284
+ timestamp: timestamp
285
+ };
286
+
287
+ // Add to sales data
288
+ salesData.push(ticketData);
289
+ localStorage.setItem('classicoPartySales', JSON.stringify(salesData));
290
+
291
+ // Update sales history
292
+ updateSalesHistory();
293
+
294
+ // Display ticket
295
+ displayTicket(ticketData);
296
+
297
+ // Clear form
298
+ document.getElementById('name').value = '';
299
+ document.getElementById('phone').value = '';
300
+ }
301
+
302
+ function displayTicket(ticketData) {
303
+ // Set ticket information
304
+ document.getElementById('ticketName').textContent = ticketData.name;
305
+ document.getElementById('ticketPhone').textContent = ticketData.phone;
306
+ document.getElementById('ticketTypeDisplay').textContent = ticketData.typeDisplay;
307
+ document.getElementById('ticketDate').textContent = ticketData.date;
308
+ document.getElementById('ticketPrice').textContent = `${ticketData.price} FCFA`;
309
+ document.getElementById('ticketId').textContent = `ID: ${ticketData.id}`;
310
+
311
+ // Generate QR code
312
+ const qrData = JSON.stringify({
313
+ id: ticketData.id,
314
+ name: ticketData.name,
315
+ event: 'Classico Party Kandi'
316
+ });
317
+
318
+ QRCode.toCanvas(document.getElementById('qrCode'), qrData, {
319
+ width: 150,
320
+ margin: 0,
321
+ color: {
322
+ dark: '#1e3a8a',
323
+ light: '#ffffff'
324
+ }
325
+ }, function(error) {
326
+ if (error) console.error(error);
327
+ });
328
+
329
+ // Show ticket preview
330
+ document.getElementById('ticketPreview').classList.remove('hidden');
331
+ document.getElementById('ticketPreview').scrollIntoView({ behavior: 'smooth' });
332
+ }
333
+
334
+ function updateSalesHistory() {
335
+ const historyTable = document.getElementById('salesHistory');
336
+ historyTable.innerHTML = '';
337
+
338
+ if (salesData.length === 0) {
339
+ const row = document.createElement('tr');
340
+ row.innerHTML = '<td colspan="3" class="py-4 px-4 text-center text-gray-500">Aucune vente enregistrée</td>';
341
+ historyTable.appendChild(row);
342
+ return;
343
+ }
344
+
345
+ // Sort by most recent first
346
+ const sortedSales = [...salesData].sort((a, b) => b.timestamp - a.timestamp);
347
+
348
+ sortedSales.forEach(sale => {
349
+ const row = document.createElement('tr');
350
+ row.innerHTML = `
351
+ <td class="py-2 px-4">${sale.name}</td>
352
+ <td class="py-2 px-4">${sale.typeDisplay}</td>
353
+ <td class="py-2 px-4">${sale.price} FCFA</td>
354
+ `;
355
+ historyTable.appendChild(row);
356
+ });
357
+ }
358
+
359
+ function exportData() {
360
+ if (salesData.length === 0) {
361
+ alert('Aucune donnée à exporter');
362
+ return;
363
+ }
364
+
365
+ // Convert to CSV
366
+ const headers = ['ID', 'Nom', 'Téléphone', 'Type', 'Prix (FCFA)', 'Paiement', 'Date'];
367
+ const csvRows = [
368
+ headers.join(','),
369
+ ...salesData.map(sale =>
370
+ [
371
+ sale.id,
372
+ `"${sale.name.replace(/"/g, '""')}"`,
373
+ sale.phone,
374
+ sale.typeDisplay,
375
+ sale.price,
376
+ sale.payment,
377
+ sale.date
378
+ ].join(',')
379
+ )
380
+ ];
381
+
382
+ const csvContent = csvRows.join('\n');
383
+ const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
384
+ const url = URL.createObjectURL(blob);
385
+
386
+ // Create download link
387
+ const link = document.createElement('a');
388
+ link.setAttribute('href', url);
389
+ link.setAttribute('download', `classico_party_sales_${new Date().toISOString().slice(0, 10)}.csv`);
390
+ link.style.visibility = 'hidden';
391
+ document.body.appendChild(link);
392
+ link.click();
393
+ document.body.removeChild(link);
394
+
395
+ alert('Données exportées avec succès');
396
+ }
397
+
398
+ function clearData() {
399
+ if (confirm('Êtes-vous sûr de vouloir effacer toutes les données de vente ? Cette action est irréversible.')) {
400
+ localStorage.removeItem('classicoPartySales');
401
+ salesData = [];
402
+ updateSalesHistory();
403
+ alert('Toutes les données ont été effacées');
404
+ }
405
+ }
406
+
407
+ function printTicket() {
408
+ // In a real app, this would use a print API or generate a PDF
409
+ // For this demo, we'll just show an alert
410
+ alert('Fonction d\'impression: Dans une application réelle, cela enverrait le ticket à une imprimante Bluetooth ou générerait un PDF.');
411
+
412
+ // Alternative: Open print dialog for the ticket
413
+ // const ticketElement = document.getElementById('ticketPreview').cloneNode(true);
414
+ // ticketElement.classList.remove('hidden');
415
+ // const printWindow = window.open('', '_blank');
416
+ // printWindow.document.write('<html><head><title>Ticket Classico Party</title></head><body>');
417
+ // printWindow.document.write(ticketElement.innerHTML);
418
+ // printWindow.document.write('<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=KINGFAUS/ticket" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body></html>