Spaces:
Running

File size: 26,493 Bytes
fe51781
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4ee8eee
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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Gestion Équipements - Maison du Monde</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
    <script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js"></script>
    <script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-database.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.8/index.global.min.js"></script>
    <style>
        .device-card {
            transition: all 0.3s ease;
        }
        .device-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
        }
        .reservation-badge {
            animation: pulse 2s infinite;
        }
        @keyframes pulse {
            0% { opacity: 1; }
            50% { opacity: 0.5; }
            100% { opacity: 1; }
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Firebase Configuration -->
    <script>
        const firebaseConfig = {
            apiKey: "AIzaSyDEXAMPLEKEY",
            authDomain: "mdm-equipements.firebaseapp.com",
            databaseURL: "https://mdm-equipements.firebaseio.com",
            projectId: "mdm-equipements",
            storageBucket: "mdm-equipements.appspot.com",
            messagingSenderId: "1234567890",
            appId: "1:1234567890:web:abcdef1234567890"
        };
        firebase.initializeApp(firebaseConfig);
        const database = firebase.database();
    </script>

    <!-- Navigation -->
    <nav class="bg-indigo-600 text-white shadow-lg">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16 items-center">
                <div class="flex items-center">
                    <i data-feather="home" class="mr-2"></i>
                    <span class="text-xl font-semibold">Maison du Monde</span>
                </div>
                <div class="hidden md:block">
                    <div class="ml-10 flex items-baseline space-x-4">
                        <a href="#" class="px-3 py-2 rounded-md text-sm font-medium bg-indigo-700">Tableau de bord</a>
                        <a href="mes-reservations.html" class="px-3 py-2 rounded-md text-sm font-medium hover:bg-indigo-500">Mes réservations</a>
                        <a href="historique.html" class="px-3 py-2 rounded-md text-sm font-medium hover:bg-indigo-500">Historique</a>
                    </div>
                </div>
                <div class="flex items-center">
                    <div class="relative">
                        <button id="user-menu" class="flex items-center text-sm focus:outline-none">
                            <span class="mr-2">Mélinda</span>
                            <i data-feather="user"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </nav>

    <!-- Main Content -->
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
        <div class="mb-8">
            <h1 class="text-3xl font-bold text-gray-800">Gestion des équipements</h1>
            <p class="text-gray-600">Réservez et gérez les appareils disponibles</p>
        </div>

        <!-- Quick Stats -->
        <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
            <div class="bg-white rounded-lg shadow p-6">
                <div class="flex items-center">
                    <div class="p-3 rounded-full bg-green-100 text-green-600">
                        <i data-feather="tablet"></i>
                    </div>
                    <div class="ml-4">
                        <p class="text-sm font-medium text-gray-500">Appareils disponibles</p>
                        <p class="text-2xl font-semibold text-gray-800">3/5</p>
                    </div>
                </div>
            </div>
            <div class="bg-white rounded-lg shadow p-6">
                <div class="flex items-center">
                    <div class="p-3 rounded-full bg-blue-100 text-blue-600">
                        <i data-feather="calendar"></i>
                    </div>
                    <div class="ml-4">
                        <p class="text-sm font-medium text-gray-500">Réservations aujourd'hui</p>
                        <p class="text-2xl font-semibold text-gray-800">2</p>
                    </div>
                </div>
            </div>
            <div class="bg-white rounded-lg shadow p-6">
                <div class="flex items-center">
                    <div class="p-3 rounded-full bg-purple-100 text-purple-600">
                        <i data-feather="clock"></i>
                    </div>
                    <div class="ml-4">
                        <p class="text-sm font-medium text-gray-500">Prochaine réservation</p>
                        <p class="text-xl font-semibold text-gray-800">14:00 - iPad MDM1</p>
                    </div>
                </div>
            </div>
        </div>

        <!-- Devices Grid -->
        <div class="mb-8">
            <h2 class="text-xl font-semibold text-gray-800 mb-4">Appareils disponibles</h2>
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                <!-- iPad MDM1 -->
                <div class="device-card bg-white rounded-lg shadow overflow-hidden">
                    <div class="p-6">
                        <div class="flex justify-between items-start">
                            <div>
                                <h3 class="text-lg font-semibold text-gray-800">iPad MDM1</h3>
                                <p class="text-gray-500">Dernière utilisation: Aujourd'hui 10:00</p>
                            </div>
                            <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
                                Disponible
                            </span>
                        </div>
                        <div class="mt-4">
                            <p class="text-sm text-gray-600">Prochaine réservation: Demain 09:00</p>
                        </div>
                    </div>
                    <div class="bg-gray-50 px-6 py-4 flex justify-end">
                        <button class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none">
                            <i data-feather="plus" class="mr-2"></i> Réserver
                        </button>
                    </div>
                </div>

                <!-- iPad MDM2 -->
                <div class="device-card bg-white rounded-lg shadow overflow-hidden">
                    <div class="p-6">
                        <div class="flex justify-between items-start">
                            <div>
                                <h3 class="text-lg font-semibold text-gray-800">iPad MDM2</h3>
                                <p class="text-gray-500">Dernière utilisation: Hier 16:30</p>
                            </div>
                            <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
                                Disponible
                            </span>
                        </div>
                        <div class="mt-4">
                            <p class="text-sm text-gray-600">Aucune réservation à venir</p>
                        </div>
                    </div>
                    <div class="bg-gray-50 px-6 py-4 flex justify-end">
                        <button class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none">
                            <i data-feather="plus" class="mr-2"></i> Réserver
                        </button>
                    </div>
                </div>

                <!-- iPad MDM3 -->
                <div class="device-card bg-white rounded-lg shadow overflow-hidden">
                    <div class="p-6">
                        <div class="flex justify-between items-start">
                            <div>
                                <h3 class="text-lg font-semibold text-gray-800">iPad MDM3</h3>
                                <p class="text-gray-500">Dernière utilisation: Aujourd'hui 11:45</p>
                            </div>
                            <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
                                Occupé maintenant
                            </span>
                        </div>
                        <div class="mt-4">
                            <p class="text-sm text-gray-600">Réservé par Susanne jusqu'à 15:00</p>
                        </div>
                    </div>
                    <div class="bg-gray-50 px-6 py-4 flex justify-end">
                        <button class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none">
                            <i data-feather="plus" class="mr-2"></i> Réserver
                        </button>
                    </div>
                </div>

                <!-- iPad Cours Alpha -->
                <div class="device-card bg-white rounded-lg shadow overflow-hidden">
                    <div class="p-6">
                        <div class="flex justify-between items-start">
                            <div>
                                <h3 class="text-lg font-semibold text-gray-800">iPad Cours Alpha</h3>
                                <p class="text-gray-500">Dernière utilisation: Lundi 14:00</p>
                            </div>
                            <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
                                Disponible
                            </span>
                        </div>
                        <div class="mt-4">
                            <p class="text-sm text-gray-600">Aucune réservation à venir</p>
                        </div>
                    </div>
                    <div class="bg-gray-50 px-6 py-4 flex justify-end">
                        <button class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none">
                            <i data-feather="plus" class="mr-2"></i> Réserver
                        </button>
                    </div>
                </div>

                <!-- Beamer -->
                <div class="device-card bg-white rounded-lg shadow overflow-hidden">
                    <div class="p-6">
                        <div class="flex justify-between items-start">
                            <div>
                                <h3 class="text-lg font-semibold text-gray-800">Beamer</h3>
                                <p class="text-gray-500">Dernière utilisation: Aujourd'hui 09:30</p>
                            </div>
                            <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
                                Réservé bientôt
                            </span>
                        </div>
                        <div class="mt-4">
                            <p class="text-sm text-gray-600">Réservé par Rachida à 16:00</p>
                        </div>
                    </div>
                    <div class="bg-gray-50 px-6 py-4 flex justify-end">
                        <button class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none">
                            <i data-feather="plus" class="mr-2"></i> Réserver
                        </button>
                    </div>
                </div>
            </div>
        </div>

        <!-- Calendar Section -->
        <div class="mb-8">
            <h2 class="text-xl font-semibold text-gray-800 mb-4">Planning des réservations</h2>
            <div class="bg-white rounded-lg shadow overflow-hidden">
                <div id="calendar" class="p-4"></div>
            </div>
        </div>

        <!-- Recent Reservations -->
        <div>
            <h2 class="text-xl font-semibold text-gray-800 mb-4">Dernières réservations</h2>
            <div class="bg-white shadow overflow-hidden sm:rounded-lg">
                <div class="overflow-x-auto">
                    <table class="min-w-full divide-y divide-gray-200">
                        <thead class="bg-gray-50">
                            <tr>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Appareil</th>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Utilisatrice</th>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Durée</th>
                                <th scope="col" 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">
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">iPad MDM1</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Mélinda</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Aujourd'hui, 10:00-12:00</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2 heures</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                    <button class="text-indigo-600 hover:text-indigo-900 mr-3"><i data-feather="edit" class="w-4 h-4"></i></button>
                                    <button class="text-red-600 hover:text-red-900"><i data-feather="trash-2" class="w-4 h-4"></i></button>
                                </td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">iPad MDM3</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Susanne</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Aujourd'hui, 13:00-15:00</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2 heures</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                    <button class="text-indigo-600 hover:text-indigo-900 mr-3"><i data-feather="edit" class="w-4 h-4"></i></button>
                                    <button class="text-red-600 hover:text-red-900"><i data-feather="trash-2" class="w-4 h-4"></i></button>
                                </td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Beamer</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Rachida</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Aujourd'hui, 16:00-17:30</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">1.5 heures</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                    <button class="text-indigo-600 hover:text-indigo-900 mr-3"><i data-feather="edit" class="w-4 h-4"></i></button>
                                    <button class="text-red-600 hover:text-red-900"><i data-feather="trash-2" class="w-4 h-4"></i></button>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <!-- Reservation Modal -->
    <div id="reservationModal" class="fixed z-10 inset-0 overflow-y-auto hidden">
        <div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
            <div class="fixed inset-0 transition-opacity" aria-hidden="true">
                <div class="absolute inset-0 bg-gray-500 opacity-75"></div>
            </div>
            <span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
            <div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
                <div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
                    <h3 class="text-lg leading-6 font-medium text-gray-900 mb-4" id="modalTitle">Nouvelle réservation</h3>
                    <div class="mt-2">
                        <form>
                            <div class="mb-4">
                                <label for="device" class="block text-sm font-medium text-gray-700">Appareil</label>
                                <select id="device" name="device" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
                                    <option>iPad MDM1</option>
                                    <option>iPad MDM2</option>
                                    <option>iPad MDM3</option>
                                    <option>iPad Cours Alpha</option>
                                    <option>Beamer</option>
                                </select>
                            </div>
                            <div class="mb-4">
                                <label for="date" class="block text-sm font-medium text-gray-700">Date</label>
                                <input type="date" id="date" name="date" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
                            </div>
                            <div class="grid grid-cols-2 gap-4 mb-4">
                                <div>
                                    <label for="startTime" class="block text-sm font-medium text-gray-700">Heure de début</label>
                                    <input type="time" id="startTime" name="startTime" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
                                </div>
                                <div>
                                    <label for="endTime" class="block text-sm font-medium text-gray-700">Heure de fin</label>
                                    <input type="time" id="endTime" name="endTime" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
                                </div>
                            </div>
                            <div class="mb-4">
                                <label for="user" class="block text-sm font-medium text-gray-700">Utilisatrice</label>
                                <select id="user" name="user" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
                                    <option>Mélinda</option>
                                    <option>Susanne</option>
                                    <option>Leyla</option>
                                    <option>Rachida</option>
                                    <option>Animatrice</option>
                                    <option>Stagiaire</option>
                                </select>
                            </div>
                            <div class="mb-4">
                                <label for="notes" class="block text-sm font-medium text-gray-700">Notes (optionnel)</label>
                                <textarea id="notes" name="notes" rows="3" class="mt-1 block w-full shadow-sm sm:text-sm focus:ring-indigo-500 focus:border-indigo-500 border border-gray-300 rounded-md"></textarea>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
                    <button type="button" id="confirmReservation" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-indigo-600 text-base font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:ml-3 sm:w-auto sm:text-sm">
                        Confirmer la réservation
                    </button>
                    <button type="button" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
                        Annuler
                    </button>
                </div>
            </div>
        </div>
    </div>

    <script>
        // Initialize Calendar
        document.addEventListener('DOMContentLoaded', function() {
            const calendarEl = document.getElementById('calendar');
            const calendar = new FullCalendar.Calendar(calendarEl, {
                initialView: 'dayGridMonth',
                headerToolbar: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'dayGridMonth,timeGridWeek,timeGridDay'
                },
                events: [
                    {
                        title: 'iPad MDM1 - Mélinda',
                        start: new Date().toISOString().split('T')[0] + 'T10:00:00',
                        end: new Date().toISOString().split('T')[0] + 'T12:00:00',
                        color: '#6366F1'
                    },
                    {
                        title: 'iPad MDM3 - Susanne',
                        start: new Date().toISOString().split('T')[0] + 'T13:00:00',
                        end: new Date().toISOString().split('T')[0] + 'T15:00:00',
                        color: '#EC4899'
                    },
                    {
                        title: 'Beamer - Rachida',
                        start: new Date().toISOString().split('T')[0] + 'T16:00:00',
                        end: new Date().toISOString().split('T')[0] + 'T17:30:00',
                        color: '#10B981'
                    }
                ]
            });
            calendar.render();

            // Initialize modal
            const modal = document.getElementById('reservationModal');
            const reserveButtons = document.querySelectorAll('.device-card button:not([disabled])');
            
            reserveButtons.forEach(button => {
                button.addEventListener('click', () => {
                    modal.classList.remove('hidden');
                });
            });

            // Close modal when clicking cancel or outside
            const cancelButton = document.querySelector('#reservationModal button:last-child');
            cancelButton.addEventListener('click', () => {
                modal.classList.add('hidden');
            });

            modal.addEventListener('click', (e) => {
                if (e.target === modal) {
                    modal.classList.add('hidden');
                }
            });
        });

        // Handle reservation confirmation
        document.getElementById('confirmReservation').addEventListener('click', function() {
            const device = document.getElementById('device').value;
            const date = document.getElementById('date').value;
            const startTime = document.getElementById('startTime').value;
            const endTime = document.getElementById('endTime').value;
            const user = document.getElementById('user').value;
            const notes = document.getElementById('notes').value;

            const reservation = {
                device: device,
                date: date,
                startTime: startTime,
                endTime: endTime,
                user: user,
                notes: notes,
                timestamp: new Date().toISOString()
            };

            saveReservation(reservation);
            document.getElementById('reservationModal').classList.add('hidden');
            alert('Réservation confirmée avec succès!');
        });

        // Initialize Firebase
        function saveReservation(reservation) {
            console.log('Saving reservation:', reservation);
            // In a real app, we would use:
            // database.ref('reservations').push(reservation);
        }

        // Initialize feather icons
        feather.replace();
        AOS.init();
    </script>
</body>
</html>