tomzarai commited on
Commit
57bbd8b
·
verified ·
1 Parent(s): 555af49

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +1158 -19
index.html CHANGED
@@ -1,19 +1,1158 @@
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="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Device Manager | Apple Style</title>
7
+
8
+ <!-- Import Google Fonts (San Francisco style approximation) -->
9
+ <link rel="preconnect" href="https://fonts.googleapis.com">
10
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
12
+
13
+ <!-- Font Awesome for Icons -->
14
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
15
+
16
+ <style>
17
+ :root {
18
+ --primary-color: #007AFF;
19
+ --primary-hover: #0056b3;
20
+ --danger-color: #FF3B30;
21
+ --danger-hover: #d63226;
22
+ --success-color: #34C759;
23
+ --bg-color: #F5F5F7;
24
+ --card-bg: #FFFFFF;
25
+ --text-main: #1D1D1F;
26
+ --text-secondary: #8E8E93;
27
+ --border-color: #D2D2D7;
28
+ --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
29
+ --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
30
+ }
31
+
32
+ [data-theme="dark"] {
33
+ --bg-color: #000000;
34
+ --card-bg: #1D1D1D;
35
+ --text-main: #F5F5F7;
36
+ --text-secondary: #8E8E93;
37
+ --border-color: #38383A;
38
+ --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
39
+ }
40
+
41
+ * {
42
+ box-sizing: border-box;
43
+ margin: 0;
44
+ padding: 0;
45
+ }
46
+
47
+ body {
48
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
49
+ background-color: var(--bg-color);
50
+ color: var(--text-main);
51
+ line-height: 1.5;
52
+ transition: var(--transition);
53
+ padding: 20px;
54
+ }
55
+
56
+ /* Header Section */
57
+ header {
58
+ display: flex;
59
+ justify-content: space-between;
60
+ align-items: center;
61
+ margin-bottom: 40px;
62
+ flex-wrap: wrap;
63
+ gap: 20px;
64
+ }
65
+
66
+ .brand {
67
+ display: flex;
68
+ align-items: center;
69
+ gap: 12px;
70
+ }
71
+
72
+ .brand-icon {
73
+ width: 40px;
74
+ height: 40px;
75
+ background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
76
+ border-radius: 12px;
77
+ display: flex;
78
+ align-items: center;
79
+ justify-content: center;
80
+ color: white;
81
+ font-size: 20px;
82
+ }
83
+
84
+ h1 {
85
+ font-size: 28px;
86
+ font-weight: 700;
87
+ letter-spacing: -0.5px;
88
+ }
89
+
90
+ .brand-subtitle {
91
+ font-size: 14px;
92
+ color: var(--text-secondary);
93
+ font-weight: 400;
94
+ }
95
+
96
+ .controls {
97
+ display: flex;
98
+ gap: 15px;
99
+ align-items: center;
100
+ }
101
+
102
+ .theme-toggle {
103
+ background: none;
104
+ border: none;
105
+ color: var(--text-main);
106
+ font-size: 20px;
107
+ cursor: pointer;
108
+ padding: 8px;
109
+ border-radius: 50%;
110
+ transition: background 0.2s;
111
+ }
112
+
113
+ .theme-toggle:hover {
114
+ background-color: rgba(128,128,128,0.2);
115
+ }
116
+
117
+ /* Stats Cards */
118
+ .stats-container {
119
+ display: grid;
120
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
121
+ gap: 20px;
122
+ margin-bottom: 40px;
123
+ }
124
+
125
+ .stat-card {
126
+ background-color: var(--card-bg);
127
+ padding: 24px;
128
+ border-radius: 16px;
129
+ box-shadow: var(--shadow);
130
+ display: flex;
131
+ flex-direction: column;
132
+ justify-content: space-between;
133
+ transition: var(--transition);
134
+ }
135
+
136
+ .stat-card:hover {
137
+ transform: translateY(-2px);
138
+ box-shadow: 0 8px 20px rgba(0,0,0,0.12);
139
+ }
140
+
141
+ .stat-label {
142
+ font-size: 14px;
143
+ color: var(--text-secondary);
144
+ font-weight: 500;
145
+ }
146
+
147
+ .stat-value {
148
+ font-size: 36px;
149
+ font-weight: 700;
150
+ margin: 8px 0 16px 0;
151
+ color: var(--primary-color);
152
+ }
153
+
154
+ .stat-trend {
155
+ font-size: 13px;
156
+ color: var(--success-color);
157
+ display: flex;
158
+ align-items: center;
159
+ gap: 5px;
160
+ }
161
+
162
+ /* Main Content Layout */
163
+ .main-container {
164
+ display: grid;
165
+ grid-template-columns: 350px 1fr;
166
+ gap: 30px;
167
+ }
168
+
169
+ @media (max-width: 900px) {
170
+ .main-container {
171
+ grid-template-columns: 1fr;
172
+ }
173
+ }
174
+
175
+ /* Sidebar / Add Device Form */
176
+ .sidebar-panel {
177
+ background-color: var(--card-bg);
178
+ padding: 30px;
179
+ border-radius: 20px;
180
+ box-shadow: var(--shadow);
181
+ height: fit-content;
182
+ }
183
+
184
+ .panel-header {
185
+ font-size: 20px;
186
+ font-weight: 600;
187
+ margin-bottom: 24px;
188
+ padding-bottom: 16px;
189
+ border-bottom: 1px solid var(--border-color);
190
+ }
191
+
192
+ .form-group {
193
+ margin-bottom: 20px;
194
+ }
195
+
196
+ label {
197
+ display: block;
198
+ font-size: 13px;
199
+ font-weight: 600;
200
+ margin-bottom: 8px;
201
+ color: var(--text-secondary);
202
+ }
203
+
204
+ input, select, textarea {
205
+ width: 100%;
206
+ padding: 12px;
207
+ border-radius: 10px;
208
+ border: 1px solid var(--border-color);
209
+ background-color: var(--bg-color);
210
+ color: var(--text-main);
211
+ font-family: inherit;
212
+ font-size: 14px;
213
+ transition: var(--transition);
214
+ outline: none;
215
+ }
216
+
217
+ input:focus, select:focus, textarea:focus {
218
+ border-color: var(--primary-color);
219
+ box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
220
+ }
221
+
222
+ .btn {
223
+ width: 100%;
224
+ padding: 14px;
225
+ border: none;
226
+ border-radius: 12px;
227
+ font-size: 15px;
228
+ font-weight: 600;
229
+ cursor: pointer;
230
+ transition: var(--transition);
231
+ display: flex;
232
+ align-items: center;
233
+ justify-content: center;
234
+ gap: 8px;
235
+ }
236
+
237
+ .btn-primary {
238
+ background-color: var(--primary-color);
239
+ color: white;
240
+ box-shadow: 0 4px 8px rgba(0, 122, 255, 0.3);
241
+ }
242
+
243
+ .btn-primary:hover {
244
+ background-color: var(--primary-hover);
245
+ transform: translateY(-1px);
246
+ }
247
+
248
+ .btn-secondary {
249
+ background-color: var(--bg-color);
250
+ color: var(--text-main);
251
+ border: 1px solid var(--border-color);
252
+ margin-top: 10px;
253
+ }
254
+
255
+ .btn-secondary:hover {
256
+ background-color: var(--border-color);
257
+ }
258
+
259
+ /* Device List */
260
+ .device-list-container {
261
+ background-color: var(--card-bg);
262
+ border-radius: 20px;
263
+ box-shadow: var(--shadow);
264
+ overflow: hidden;
265
+ display: flex;
266
+ flex-direction: column;
267
+ }
268
+
269
+ .list-header {
270
+ padding: 24px;
271
+ border-bottom: 1px solid var(--border-color);
272
+ display: flex;
273
+ justify-content: space-between;
274
+ align-items: center;
275
+ flex-wrap: wrap;
276
+ gap: 15px;
277
+ }
278
+
279
+ .search-box {
280
+ position: relative;
281
+ width: 100%;
282
+ max-width: 300px;
283
+ }
284
+
285
+ .search-box i {
286
+ position: absolute;
287
+ left: 12px;
288
+ top: 50%;
289
+ transform: translateY(-50%);
290
+ color: var(--text-secondary);
291
+ }
292
+
293
+ .search-box input {
294
+ padding-left: 40px;
295
+ }
296
+
297
+ .table-responsive {
298
+ overflow-x: auto;
299
+ }
300
+
301
+ table {
302
+ width: 100%;
303
+ border-collapse: collapse;
304
+ }
305
+
306
+ th {
307
+ background-color: var(--bg-color);
308
+ text-align: left;
309
+ padding: 16px 24px;
310
+ font-size: 12px;
311
+ font-weight: 600;
312
+ color: var(--text-secondary);
313
+ text-transform: uppercase;
314
+ letter-spacing: 0.5px;
315
+ }
316
+
317
+ td {
318
+ padding: 18px 24px;
319
+ border-bottom: 1px solid var(--border-color);
320
+ font-size: 14px;
321
+ color: var(--text-main);
322
+ }
323
+
324
+ tr:hover {
325
+ background-color: rgba(0,0,0,0.02);
326
+ }
327
+
328
+ [data-theme="dark"] tr:hover {
329
+ background-color: rgba(255,255,255,0.05);
330
+ }
331
+
332
+ .status-badge {
333
+ display: inline-block;
334
+ padding: 4px 10px;
335
+ border-radius: 20px;
336
+ font-size: 11px;
337
+ font-weight: 600;
338
+ text-transform: uppercase;
339
+ }
340
+
341
+ .status-active { background-color: rgba(52, 199, 89, 0.2); color: var(--success-color); }
342
+ .status-pending { background-color: rgba(255, 165, 0, 0.2); color: #FF9500; }
343
+ .status-offline { background-color: rgba(255, 59, 48, 0.2); color: var(--danger-color); }
344
+
345
+ .device-name {
346
+ font-weight: 600;
347
+ display: flex;
348
+ align-items: center;
349
+ gap: 10px;
350
+ }
351
+
352
+ .device-icon {
353
+ width: 32px;
354
+ height: 32px;
355
+ background: rgba(0,0,0,0.05);
356
+ border-radius: 8px;
357
+ display: flex;
358
+ align-items: center;
359
+ justify-content: center;
360
+ color: var(--primary-color);
361
+ }
362
+
363
+ [data-theme="dark"] .device-icon {
364
+ background: rgba(255,255,255,0.1);
365
+ }
366
+
367
+ .action-group {
368
+ display: flex;
369
+ gap: 8px;
370
+ }
371
+
372
+ .action-btn {
373
+ width: 32px;
374
+ height: 32px;
375
+ border-radius: 8px;
376
+ border: none;
377
+ display: flex;
378
+ align-items: center;
379
+ justify-content: center;
380
+ cursor: pointer;
381
+ transition: all 0.2s;
382
+ font-size: 14px;
383
+ }
384
+
385
+ .btn-edit {
386
+ background-color: rgba(0, 122, 255, 0.1);
387
+ color: var(--primary-color);
388
+ }
389
+ .btn-edit:hover { background-color: var(--primary-color); color: white; }
390
+
391
+ .btn-delete {
392
+ background-color: rgba(255, 59, 48, 0.1);
393
+ color: var(--danger-color);
394
+ }
395
+ .btn-delete:hover { background-color: var(--danger-color); color: white; }
396
+
397
+ /* Modal Styles */
398
+ .modal-overlay {
399
+ position: fixed;
400
+ top: 0;
401
+ left: 0;
402
+ width: 100%;
403
+ height: 100%;
404
+ background: rgba(0, 0, 0, 0.5);
405
+ backdrop-filter: blur(5px);
406
+ z-index: 1000;
407
+ display: none;
408
+ align-items: center;
409
+ justify-content: center;
410
+ opacity: 0;
411
+ transition: opacity 0.3s ease;
412
+ }
413
+
414
+ .modal-overlay.active {
415
+ display: flex;
416
+ opacity: 1;
417
+ }
418
+
419
+ .modal {
420
+ background-color: var(--card-bg);
421
+ padding: 30px;
422
+ border-radius: 24px;
423
+ width: 90%;
424
+ max-width: 500px;
425
+ box-shadow: 0 20px 40px rgba(0,0,0,0.3);
426
+ transform: scale(0.9);
427
+ transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
428
+ }
429
+
430
+ .modal-overlay.active .modal {
431
+ transform: scale(1);
432
+ }
433
+
434
+ .modal-header {
435
+ display: flex;
436
+ justify-content: space-between;
437
+ align-items: center;
438
+ margin-bottom: 24px;
439
+ }
440
+
441
+ .close-modal {
442
+ background: none;
443
+ border: none;
444
+ font-size: 24px;
445
+ cursor: pointer;
446
+ color: var(--text-secondary);
447
+ }
448
+
449
+ /* Toast Notification */
450
+ .toast {
451
+ position: fixed;
452
+ bottom: 30px;
453
+ right: 30px;
454
+ background-color: var(--card-bg);
455
+ padding: 16px 24px;
456
+ border-radius: 12px;
457
+ box-shadow: 0 10px 30px rgba(0,0,0,0.2);
458
+ display: flex;
459
+ align-items: center;
460
+ gap: 12px;
461
+ transform: translateY(100px);
462
+ transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
463
+ z-index: 2000;
464
+ border-left: 4px solid var(--primary-color);
465
+ }
466
+
467
+ .toast.show {
468
+ transform: translateY(0);
469
+ }
470
+
471
+ .toast.success { border-left-color: var(--success-color); }
472
+ .toast.error { border-left-color: var(--danger-color); }
473
+
474
+ /* Built with Link */
475
+ .attribution {
476
+ margin-top: 50px;
477
+ text-align: center;
478
+ font-size: 12px;
479
+ }
480
+ .attribution a {
481
+ color: var(--text-secondary);
482
+ text-decoration: none;
483
+ transition: color 0.2s;
484
+ }
485
+ .attribution a:hover {
486
+ color: var(--primary-color);
487
+ text-decoration: underline;
488
+ }
489
+
490
+ </style>
491
+ </head>
492
+ <body>
493
+
494
+ <!-- Header -->
495
+ <header>
496
+ <div class="brand">
497
+ <div class="brand-icon">
498
+ <i class="fa-solid fa-device-robot"></i>
499
+ </div>
500
+ <div>
501
+ <h1>Device Manager</h1>
502
+ <span class="brand-subtitle">Apple Ecosystem Management System</span>
503
+ </div>
504
+ </div>
505
+ <div class="controls">
506
+ <button class="theme-toggle" id="themeToggle" title="Toggle Dark Mode">
507
+ <i class="fa-solid fa-moon"></i>
508
+ </button>
509
+ <button class="btn btn-primary" style="width: auto; padding: 10px 24px;" onclick="openModal()">
510
+ <i class="fa-solid fa-plus"></i> Add Device
511
+ </button>
512
+ </div>
513
+ </header>
514
+
515
+ <!-- Statistics -->
516
+ <section class="stats-container">
517
+ <div class="stat-card">
518
+ <span class="stat-label">Total Devices</span>
519
+ <div class="stat-value" id="totalDevices">0</div>
520
+ <span class="stat-trend"><i class="fa-solid fa-circle-chevron-up"></i> +2 this week</span>
521
+ </div>
522
+ <div class="stat-card">
523
+ <span class="stat-label">Active Devices</span>
524
+ <div class="stat-value" id="activeDevices" style="color: var(--success-color)">0</div>
525
+ <span class="stat-trend"><i class="fa-solid fa-check-double"></i> System Online</span>
526
+ </div>
527
+ <div class="stat-card">
528
+ <span class="stat-label">Storage Used</span>
529
+ <div class="stat-value" id="totalStorage">0 TB</div>
530
+ <span class="stat-trend" style="color: var(--primary-color)"><i class="fa-solid fa-hard-drive"></i> Calculating...</span>
531
+ </div>
532
+ </section>
533
+
534
+ <div class="main-container">
535
+ <!-- Sidebar Form -->
536
+ <aside class="sidebar-panel">
537
+ <div class="panel-header">
538
+ <i class="fa-solid fa-circle-plus" style="color: var(--primary-color); margin-right: 8px;"></i>
539
+ Register New Device
540
+ </div>
541
+ <form id="deviceForm">
542
+ <input type="hidden" id="deviceId">
543
+
544
+ <div class="form-group">
545
+ <label for="deviceName">Device Name</label>
546
+ <input type="text" id="deviceName" placeholder="e.g., John's iPhone 15 Pro" required>
547
+ </div>
548
+
549
+ <div class="form-group">
550
+ <label for="deviceType">Product Type</label>
551
+ <select id="deviceType" required>
552
+ <option value="" disabled selected>Select a product</option>
553
+ <optgroup label="iPhone">
554
+ <option value="iPhone 15 Pro Max">iPhone 15 Pro Max</option>
555
+ <option value="iPhone 15 Pro">iPhone 15 Pro</option>
556
+ <option value="iPhone 15 Plus">iPhone 15 Plus</option>
557
+ <option value="iPhone 15">iPhone 15</option>
558
+ <option value="iPhone 14 Pro Max">iPhone 14 Pro Max</option>
559
+ <option value="iPhone 14">iPhone 14</option>
560
+ <option value="iPhone SE (2022)">iPhone SE (2022)</option>
561
+ </optgroup>
562
+ <optgroup label="iPad">
563
+ <option value="iPad Pro 12.9">iPad Pro 12.9 (M2)</option>
564
+ <option value="iPad Pro 11">iPad Pro 11 (M2)</option>
565
+ <option value="iPad Air 10.9">iPad Air 10.9 (M2)</option>
566
+ <option value="iPad (10th Gen)">iPad (10th Generation)</option>
567
+ <option value="iPad Mini (6th Gen)">iPad Mini (6th Generation)</option>
568
+ </optgroup>
569
+ <optgroup label="Mac">
570
+ <option value="MacBook Pro 14">MacBook Pro 14 (M3)</option>
571
+ <option value="MacBook Pro 16">MacBook Pro 16 (M3 Max)</option>
572
+ <option value="MacBook Air 15">MacBook Air 15 (M2)</option>
573
+ <option value="MacBook Air 13">MacBook Air 13 (M2)</option>
574
+ <option value="iMac 24">iMac 24 (M3)</option>
575
+ <option value="Mac mini (M2)">Mac mini (M2)</option>
576
+ <option value="Mac Studio">Mac Studio (M2 Max)</option>
577
+ <option value="Mac Pro">Mac Pro (M2 Ultra)</option>
578
+ </optgroup>
579
+ <optgroup label="Watch">
580
+ <option value="Apple Watch Ultra 2">Apple Watch Ultra 2</option>
581
+ <option value="Apple Watch Series 9">Apple Watch Series 9</option>
582
+ <option value="Apple Watch SE (2nd Gen)">Apple Watch SE (2nd Gen)</option>
583
+ </optgroup>
584
+ <optgroup label="Audio">
585
+ <option value="AirPods Pro 2">AirPods Pro 2 (USB-C)</option>
586
+ <option value="AirPods Max">AirPods Max</option>
587
+ <option value="AirPods 3">AirPods 3</option>
588
+ </optgroup>
589
+ </select>
590
+ </div>
591
+
592
+ <div class="form-group">
593
+ <label for="serialNumber">Serial Number</label>
594
+ <input type="text" id="serialNumber" placeholder="e.g., F2X3L4567890" required pattern="[A-Za-z0-9]+">
595
+ </div>
596
+
597
+ <div class="form-group">
598
+ <label for="ownerName">Owner / User</label>
599
+ <input type="text" id="ownerName" placeholder="e.g., John Doe" required>
600
+ </div>
601
+
602
+ <div class="form-group">
603
+ <label for="purchaseDate">Purchase Date</label>
604
+ <input type="date" id="purchaseDate" required>
605
+ </div>
606
+
607
+ <div class="form-group">
608
+ <label for="status">Device Status</label>
609
+ <select id="status">
610
+ <option value="Active">Active (In Use)</option>
611
+ <option value="Pending">Pending (Setup)</option>
612
+ <option value="Offline">Offline (Repair)</option>
613
+ <option value="Archived">Archived</option>
614
+ </select>
615
+ </div>
616
+
617
+ <div class="form-group">
618
+ <label for="notes">Notes</label>
619
+ <textarea id="notes" rows="3" placeholder="Any specific details..."></textarea>
620
+ </div>
621
+
622
+ <button type="submit" class="btn btn-primary" id="submitBtn">
623
+ <i class="fa-solid fa-floppy-disk"></i> Save Device
624
+ </button>
625
+ <button type="button" class="btn btn-secondary" id="cancelBtn" style="display: none;">Cancel Edit</button>
626
+ </form>
627
+ </aside>
628
+
629
+ <!-- Device List -->
630
+ <main class="device-list-container">
631
+ <div class="list-header">
632
+ <h2 style="font-size: 20px;">Registered Devices</h2>
633
+ <div class="search-box">
634
+ <i class="fa-solid fa-magnifying-glass"></i>
635
+ <input type="text" id="searchInput" placeholder="Search devices, serials, or owners...">
636
+ </div>
637
+ </div>
638
+
639
+ <div class="table-responsive">
640
+ <table>
641
+ <thead>
642
+ <tr>
643
+ <th>Device</th>
644
+ <th>Owner</th>
645
+ <th>Serial Number</th>
646
+ <th>Purchase Date</th>
647
+ <th>Status</th>
648
+ <th>Actions</th>
649
+ </tr>
650
+ </thead>
651
+ <tbody id="deviceTableBody">
652
+ <!-- Rows will be populated by JS -->
653
+ <tr>
654
+ <td colspan="6" style="text-align: center; padding: 40px; color: var(--text-secondary);">
655
+ <i class="fa-solid fa-table-list" style="font-size: 32px; margin-bottom: 10px; display: block;"></i>
656
+ No devices registered yet. Click "Add Device" to get started.
657
+ </td>
658
+ </tr>
659
+ </tbody>
660
+ </table>
661
+ </div>
662
+ </main>
663
+ </div>
664
+
665
+ <div class="attribution">
666
+ Built with <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">anycoder</a>
667
+ </div>
668
+
669
+ <!-- Edit/View Modal -->
670
+ <div class="modal-overlay" id="detailModal">
671
+ <div class="modal">
672
+ <div class="modal-header">
673
+ <h2 id="modalTitle" style="font-size: 22px; font-weight: 600;">Device Details</h2>
674
+ <button class="close-modal" onclick="closeModal()">&times;</button>
675
+ </div>
676
+ <div id="modalContent">
677
+ <!-- Dynamic Content Here -->
678
+ </div>
679
+ <div style="display: flex; justify-content: flex-end; gap: 10px; margin-top: 30px;">
680
+ <button class="btn btn-secondary" onclick="closeModal()">Close</button>
681
+ <button class="btn btn-primary" onclick="editCurrentDevice()">
682
+ <i class="fa-solid fa-pen-to-square"></i> Edit Device
683
+ </button>
684
+ </div>
685
+ </div>
686
+ </div>
687
+
688
+ <!-- Toast Notification -->
689
+ <div class="toast" id="toast">
690
+ <i class="fa-solid fa-circle-check" style="font-size: 24px;"></i>
691
+ <span id="toastMessage">Action Successful</span>
692
+ </div>
693
+
694
+ <script>
695
+ // --- Data Management ---
696
+ let devices = [
697
+ {
698
+ id: '1',
699
+ name: 'Sarah\'s iPhone 15 Pro',
700
+ type: 'iPhone 15 Pro',
701
+ serial: 'F8X2K912345',
702
+ owner: 'Sarah Jenkins',
703
+ purchaseDate: '2023-10-15',
704
+ status: 'Active',
705
+ notes: 'Silver finish, insurance included.'
706
+ },
707
+ {
708
+ id: '2',
709
+ name: 'Work MacBook Air',
710
+ type: 'MacBook Air 15 (M2)',
711
+ serial: 'C8D4M567890',
712
+ owner: 'Company Asset',
713
+ purchaseDate: '2023-02-10',
714
+ status: 'Active',
715
+ notes: 'Company managed device.'
716
+ },
717
+ {
718
+ id: '3',
719
+ name: 'Home iPad Pro',
720
+ type: 'iPad Pro 12.9',
721
+ serial: 'G9H3N123456',
722
+ owner: 'Michael Ross',
723
+ purchaseDate: '2022-07-20',
724
+ status: 'Offline',
725
+ notes: 'Needs screen replacement.'
726
+ }
727
+ ];
728
+
729
+ // --- DOM Elements ---
730
+ const deviceForm = document.getElementById('deviceForm');
731
+ const tableBody = document.getElementById('deviceTableBody');
732
+ const searchInput = document.getElementById('searchInput');
733
+ const themeToggle = document.getElementById('themeToggle');
734
+ const modal = document.getElementById('detailModal');
735
+ const modalContent = document.getElementById('modalContent');
736
+ const submitBtn = document.getElementById('submitBtn');
737
+ const cancelBtn = document.getElementById('cancelBtn');
738
+ const toast = document.getElementById('toast');
739
+
740
+ // --- Initialization ---
741
+ document.addEventListener('DOMContentLoaded', () => {
742
+ renderDevices(devices);
743
+ updateStats();
744
+
745
+ // Check system preference for theme
746
+ if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
747
+ document.body.setAttribute('data-theme', 'dark');
748
+ updateThemeIcon();
749
+ }
750
+ });
751
+
752
+ // --- Core Functions ---
753
+
754
+ function renderDevices(deviceList) {
755
+ tableBody.innerHTML = '';
756
+
757
+ if (deviceList.length === 0) {
758
+ tableBody.innerHTML = `
759
+ <tr>
760
+ <td colspan="6" style="text-align: center; padding: 40px; color: var(--text-secondary);">
761
+ <i class="fa-solid fa-table-list" style="font-size: 32px; margin-bottom: 10px; display: block;"></i>
762
+ No devices found matching your criteria.
763
+ </td>
764
+ </tr>`;
765
+ return;
766
+ }
767
+
768
+ deviceList.forEach(device => {
769
+ const tr = document.createElement('tr');
770
+
771
+ // Determine Icon based on type
772
+ let iconClass = 'fa-mobile';
773
+ if (device.type.includes('iPhone')) iconClass = 'fa-mobile';
774
+ else if (device.type.includes('iPad')) iconClass = 'fa-tablet';
775
+ else if (device.type.includes('Mac')) iconClass = 'fa-laptop';
776
+ else if (device.type.includes('Watch')) iconClass = 'fa-watch';
777
+ else if (device.type.includes('AirPods')) iconClass = 'fa-headphones';
778
+
779
+ // Status Badge Logic
780
+ let statusClass = '';
781
+ if (device.status === 'Active') statusClass = 'status-active';
782
+ else if (device.status === 'Pending') statusClass = 'status-pending';
783
+ else if (device.status === 'Offline') statusClass = 'status-offline';
784
+ else statusClass = 'status-offline'; // Default for archived
785
+
786
+ tr.innerHTML = `
787
+ <td>
788
+ <div class="device-name">
789
+ <div class="device-icon">
790
+ <i class="fa-solid ${iconClass}"></i>
791
+ </div>
792
+ <div>
793
+ <div style="font-weight: 600;">${device.name}</div>
794
+ <div style="font-size: 12px; color: var(--text-secondary);">${device.type}</div>
795
+ </div>
796
+ </div>
797
+ </td>
798
+ <td style="font-weight: 500;">${device.owner}</td>
799
+ <td style="font-family: monospace; font-size: 13px; color: var(--text-secondary);">${device.serial}</td>
800
+ <td>${device.purchaseDate}</td>
801
+ <td><span class="status-badge ${statusClass}">${device.status}</span></td>
802
+ <td>
803
+ <div class="action-group">
804
+ <button class="action-btn btn-edit" title="View Details" onclick="viewDevice('${device.id}')">
805
+ <i class="fa-solid fa-eye"></i>
806
+ </button>
807
+ <button class="action-btn btn-edit" title="Edit" onclick="editDevice('${device.id}')">
808
+ <i class="fa-solid fa-pen-to-square"></i>
809
+ </button>
810
+ <button class="action-btn btn-delete" title="Delete" onclick="deleteDevice('${device.id}')">
811
+ <i class="fa-solid fa-trash"></i>
812
+ </button>
813
+ </div>
814
+ </td>
815
+ `;
816
+ tableBody.appendChild(tr);
817
+ });
818
+ updateStats();
819
+ }
820
+
821
+ function updateStats() {
822
+ const total = devices.length;
823
+ const active = devices.filter(d => d.status === 'Active').length;
824
+
825
+ document.getElementById('totalDevices').innerText = total;
826
+ document.getElementById('activeDevices').innerText = active;
827
+
828
+ // Simple estimation for storage (Mock logic)
829
+ let totalStorage = 0;
830
+ devices.forEach(d => {
831
+ if(d.type.includes('iPhone') || d.type.includes('iPad')) totalStorage += 256; // assume 256GB avg
832
+ else if(d.type.includes('Mac')) totalStorage += 1000; // assume 1TB avg
833
+ else totalStorage += 64; // assume 64GB avg
834
+ });
835
+
836
+ const tb = (totalStorage / 1024).toFixed(1);
837
+ document.getElementById('totalStorage').innerText = `${tb} TB`;
838
+ }
839
+
840
+ function searchDevices(e) {
841
+ const term = e.target.value.toLowerCase();
842
+ const filtered = devices.filter(device =>
843
+ device.name.toLowerCase().includes(term) ||
844
+ device.owner.toLowerCase().includes(term) ||
845
+ device.serial.toLowerCase().includes(term) ||
846
+ device.type.toLowerCase().includes(term)
847
+ );
848
+ renderDevices(filtered);
849
+ }
850
+
851
+ // --- Form Handling ---
852
+
853
+ deviceForm.addEventListener('submit', (e) => {
854
+ e.preventDefault();
855
+
856
+ const deviceId = document.getElementById('deviceId').value;
857
+ const name = document.getElementById('deviceName').value;
858
+ const type = document.getElementById('deviceType').value;
859
+ const serial = document.getElementById('serialNumber').value.toUpperCase();
860
+ const owner = document.getElementById('ownerName').value;
861
+ const purchaseDate = document.getElementById('purchaseDate').value;
862
+ const status = document.getElementById('status').value;
863
+ const notes = document.getElementById('notes').value;
864
+
865
+ if (deviceId) {
866
+ // Edit existing
867
+ const index = devices.findIndex(d => d.id === deviceId);
868
+ if (index !== -1) {
869
+ devices[index] = {
870
+ id: deviceId,
871
+ name,
872
+ type,
873
+ serial,
874
+ owner,
875
+ purchaseDate,
876
+ status,
877
+ notes
878
+ };
879
+ showToast('Device updated successfully!', 'success');
880
+ }
881
+ resetForm();
882
+ } else {
883
+ // Add new
884
+ const newDevice = {
885
+ id: Date.now().toString(),
886
+ name,
887
+ type,
888
+ serial,
889
+ owner,
890
+ purchaseDate,
891
+ status,
892
+ notes
893
+ };
894
+ devices.unshift(newDevice); // Add to top
895
+ showToast('New device added to inventory!', 'success');
896
+ resetForm();
897
+ }
898
+
899
+ renderDevices(devices);
900
+ });
901
+
902
+ function resetForm() {
903
+ deviceForm.reset();
904
+ document.getElementById('deviceId').value = '';
905
+ submitBtn.innerHTML = '<i class="fa-solid fa-floppy-disk"></i> Save Device';
906
+ cancelBtn.style.display = 'none';
907
+ document.querySelector('.panel-header').innerHTML =
908
+ '<i class="fa-solid fa-circle-plus" style="color: var(--primary-color); margin-right: 8px;"></i> Register New Device';
909
+ }
910
+
911
+ function editDevice(id) {
912
+ const device = devices.find(d => d.id === id);
913
+ if (!device) return;
914
+
915
+ document.getElementById('deviceId').value = device.id;
916
+ document.getElementById('deviceName').value = device.name;
917
+ document.getElementById('deviceType').value = device.type;
918
+ document.getElementById('serialNumber').value = device.serial;
919
+ document.getElementById('ownerName').value = device.owner;
920
+ document.getElementById('purchaseDate').value = device.purchaseDate;
921
+ document.getElementById('status').value = device.status;
922
+ document.getElementById('notes').value = device.notes || '';
923
+
924
+ // Update UI for Edit mode
925
+ submitBtn.innerHTML = '<i class="fa-solid fa-check"></i> Update Device';
926
+ cancelBtn.style.display = 'block';
927
+ document.querySelector('.panel-header').innerHTML =
928
+ `<i class="fa-solid fa-pen-to-square" style="color: var(--primary-color); margin-right: 8px;"></i> Edit ${device.name}`;
929
+
930
+ window.scrollTo({ top: 0, behavior: 'smooth' });
931
+ }
932
+
933
+ function deleteDevice(id) {
934
+ if (confirm('Are you sure you want to remove this device from management? This action cannot be undone.')) {
935
+ devices = devices.filter(d => d.id !== id);
936
+ renderDevices(devices);
937
+ showToast('Device removed from system.', 'success');
938
+ updateStats();
939
+ }
940
+ }
941
+
942
+ // --- Modal Functions ---
943
+
944
+ function viewDevice(id) {
945
+ const device = devices.find(d => d.id === id);
946
+ if (!device) return;
947
+
948
+ let iconClass = 'fa-mobile';
949
+ if (device.type.includes('iPhone')) iconClass = 'fa-mobile';
950
+ else if (device.type.includes('iPad')) iconClass = 'fa-tablet';
951
+ else if (device.type.includes('Mac')) iconClass = 'fa-laptop';
952
+ else if (device.type.includes('Watch')) iconClass = 'fa-watch';
953
+
954
+ modalContent.innerHTML = `
955
+ <div style="display: flex; align-items: center; gap: 20px; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid var(--border-color);">
956
+ <div style="font-size: 60px; color: var(--primary-color);">
957
+ <i class="fa-solid ${iconClass}"></i>
958
+ </div>
959
+ <div>
960
+ <h3 style="font-size: 24px; font-weight: 700;">${device.name}</h3>
961
+ <p style="color: var(--text-secondary); font-size: 16px;">${device.type}</p>
962
+ </div>
963
+ </div>
964
+
965
+ <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;">
966
+ <div class="form-group">
967
+ <label>Serial Number</label>
968
+ <div style="font-family: monospace; font-size: 16px; padding: 10px; background: var(--bg-color); border-radius: 8px; border: 1px solid var(--border-color);">
969
+ ${device.serial}
970
+ </div>
971
+ </div>
972
+ <div class="form-group">
973
+ <label>Owner</label>
974
+ <div style="font-size: 16px; padding: 10px; background: var(--bg-color); border-radius: 8px; border: 1px solid var(--border-color);">
975
+ ${device.owner}
976
+ </div>
977
+ </div>
978
+ <div class="form-group">
979
+ <label>Purchase Date</label>
980
+ <div style="font-size: 16px; padding: 10px; background: var(--bg-color); border-radius: 8px; border: 1px solid var(--border-color);">
981
+ ${formatDate(device.purchaseDate)}
982
+ </div>
983
+ </div>
984
+ <div class="form-group">
985
+ <label>Management Status</label>
986
+ <div style="font-size: 16px; padding: 10px; background: var(--bg-color); border-radius: 8px; border: 1px solid var(--border-color);">
987
+ <span class="status-badge ${getStatusClass(device.status)}">${device.status}</span>
988
+ </div>
989
+ </div>
990
+ </div>
991
+
992
+ <div class="form-group">
993
+ <label>Notes</label>
994
+ <div style="font-size: 14px; padding: 10px; background: var(--bg-color); border-radius: 8px; border: 1px solid var(--border-color); color: var(--text-secondary);">
995
+ ${device.notes || 'No notes available.'}
996
+ </div>
997
+ </div>
998
+ `;
999
+
1000
+ modal.classList.add('active');
1001
+ }
1002
+
1003
+ function editCurrentDevice() {
1004
+ // Get ID from the modal content (stored in a data attribute or logic)
1005
+ // Since we don't store ID in modal DOM, we find it by matching content or passing it better.
1006
+ // Let's fix the viewDevice function to pass ID or store it.
1007
+ // For this simple implementation, we'll just grab the first device that matches the name and serial (risky but works for demo)
1008
+ // Better approach: Add ID to modalContent.innerHTML as a hidden field or attribute
1009
+
1010
+ // Let's re-implement viewDevice to store ID globally temporarily
1011
+ const device = devices.find(d =>
1012
+ modalContent.innerText.includes(d.serial) &&
1013
+ modalContent.innerText.includes(d.name)
1014
+ );
1015
+
1016
+ if(device) {
1017
+ closeModal();
1018
+ editDevice(device.id);
1019
+ }
1020
+ }
1021
+
1022
+ // Fix for editCurrentDevice to work reliably
1023
+ let currentModalDeviceId = null;
1024
+
1025
+ function viewDevice(id) {
1026
+ currentModalDeviceId = id;
1027
+ const device = devices.find(d => d.id === id);
1028
+ if (!device) return;
1029
+
1030
+ let iconClass = 'fa-mobile';
1031
+ if (device.type.includes('iPhone')) iconClass = 'fa-mobile';
1032
+ else if (device.type.includes('iPad')) iconClass = 'fa-tablet';
1033
+ else if (device.type.includes('Mac')) iconClass = 'fa-laptop';
1034
+ else if (device.type.includes('Watch')) iconClass = 'fa-watch';
1035
+
1036
+ modalContent.innerHTML = `
1037
+ <div style="display: flex; align-items: center; gap: 20px; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid var(--border-color);">
1038
+ <div style="font-size: 60px; color: var(--primary-color);">
1039
+ <i class="fa-solid ${iconClass}"></i>
1040
+ </div>
1041
+ <div>
1042
+ <h3 style="font-size: 24px; font-weight: 700;">${device.name}</h3>
1043
+ <p style="color: var(--text-secondary); font-size: 16px;">${device.type}</p>
1044
+ </div>
1045
+ </div>
1046
+
1047
+ <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;">
1048
+ <div class="form-group">
1049
+ <label>Serial Number</label>
1050
+ <div style="font-family: monospace; font-size: 16px; padding: 10px; background: var(--bg-color); border-radius: 8px; border: 1px solid var(--border-color);">
1051
+ ${device.serial}
1052
+ </div>
1053
+ </div>
1054
+ <div class="form-group">
1055
+ <label>Owner</label>
1056
+ <div style="font-size: 16px; padding: 10px; background: var(--bg-color); border-radius: 8px; border: 1px solid var(--border-color);">
1057
+ ${device.owner}
1058
+ </div>
1059
+ </div>
1060
+ <div class="form-group">
1061
+ <label>Purchase Date</label>
1062
+ <div style="font-size: 16px; padding: 10px; background: var(--bg-color); border-radius: 8px; border: 1px solid var(--border-color);">
1063
+ ${formatDate(device.purchaseDate)}
1064
+ </div>
1065
+ </div>
1066
+ <div class="form-group">
1067
+ <label>Management Status</label>
1068
+ <div style="font-size: 16px; padding: 10px; background: var(--bg-color); border-radius: 8px; border: 1px solid var(--border-color);">
1069
+ <span class="status-badge ${getStatusClass(device.status)}">${device.status}</span>
1070
+ </div>
1071
+ </div>
1072
+ </div>
1073
+
1074
+ <div class="form-group">
1075
+ <label>Notes</label>
1076
+ <div style="font-size: 14px; padding: 10px; background: var(--bg-color); border-radius: 8px; border: 1px solid var(--border-color); color: var(--text-secondary);">
1077
+ ${device.notes || 'No notes available.'}
1078
+ </div>
1079
+ </div>
1080
+ `;
1081
+
1082
+ modal.classList.add('active');
1083
+ }
1084
+
1085
+ function editCurrentDevice() {
1086
+ if (currentModalDeviceId) {
1087
+ closeModal();
1088
+ editDevice(currentModalDeviceId);
1089
+ }
1090
+ }
1091
+
1092
+ function closeModal() {
1093
+ modal.classList.remove('active');
1094
+ currentModalDeviceId = null;
1095
+ }
1096
+
1097
+ // --- Utilities ---
1098
+
1099
+ function showToast(message, type) {
1100
+ const toastMsg = document.getElementById('toastMessage');
1101
+ toastMsg.innerText = message;
1102
+
1103
+ toast.className = 'toast show ' + type;
1104
+
1105
+ if (type === 'success') {
1106
+ document.getElementById('toast').innerHTML = '<i class="fa-solid fa-circle-check"></i> <span id="toastMessage">' + message + '</span>';
1107
+ } else {
1108
+ document.getElementById('toast').innerHTML = '<i class="fa-solid fa-circle-exclamation"></i> <span id="toastMessage">' + message + '</span>';
1109
+ }
1110
+
1111
+ setTimeout(() => {
1112
+ toast.classList.remove('show');
1113
+ }, 3000);
1114
+ }
1115
+
1116
+ function updateThemeIcon() {
1117
+ const isDark = document.body.getAttribute('data-theme') === 'dark';
1118
+ const icon = themeToggle.querySelector('i');
1119
+ if (isDark) {
1120
+ icon.className = 'fa-solid fa-sun';
1121
+ } else {
1122
+ icon.className = 'fa-solid fa-moon';
1123
+ }
1124
+ }
1125
+
1126
+ themeToggle.addEventListener('click', () => {
1127
+ if (document.body.getAttribute('data-theme') === 'dark') {
1128
+ document.body.removeAttribute('data-theme');
1129
+ } else {
1130
+ document.body.setAttribute('data-theme', 'dark');
1131
+ }
1132
+ updateThemeIcon();
1133
+ });
1134
+
1135
+ function getStatusClass(status) {
1136
+ if (status === 'Active') return 'status-active';
1137
+ if (status === 'Pending') return 'status-pending';
1138
+ if (status === 'Offline') return 'status-offline';
1139
+ return 'status-offline';
1140
+ }
1141
+
1142
+ function formatDate(dateString) {
1143
+ const options = { year: 'numeric', month: 'short', day: 'numeric' };
1144
+ return new Date(dateString).toLocaleDateString('en-US', options);
1145
+ }
1146
+
1147
+ // Close modal on outside click
1148
+ window.onclick = function(event) {
1149
+ if (event.target == modal) {
1150
+ closeModal();
1151
+ }
1152
+ }
1153
+
1154
+ cancelBtn.addEventListener('click', resetForm);
1155
+
1156
+ </script>
1157
+ </body>
1158
+ </html>