Laukan commited on
Commit
7db9184
·
verified ·
1 Parent(s): a0aa058

Buatkan agar lebih responsif untuk bagian grafik agar ketika di versi mobile air temperature akan berpindah ke bawah sehingga tampilan oke

Browse files
Files changed (2) hide show
  1. README.md +9 -5
  2. index.html +1261 -19
README.md CHANGED
@@ -1,10 +1,14 @@
1
  ---
2
- title: Undefined
3
- emoji: 🔥
4
- colorFrom: indigo
5
- colorTo: green
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: undefined
3
+ colorFrom: red
4
+ colorTo: gray
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://deepsite.hf.co).
14
+
index.html CHANGED
@@ -1,19 +1,1261 @@
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>Bioflok-IoT</title>
7
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
10
+ <style>
11
+ :root {
12
+ --navy-blue: #0a2463;
13
+ --teal: #3e92cc;
14
+ --aqua: #7bdff2;
15
+ --light-blue: #d6f8ff;
16
+ --white: #ffffff;
17
+ --coral: #ff6b6b;
18
+ --sea-green: #4ecdc4;
19
+ --sun-yellow: #ffe66d;
20
+ }
21
+
22
+ body {
23
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
24
+ background: linear-gradient(to bottom, var(--navy-blue), var(--teal));
25
+ color: var(--navy-blue);
26
+ margin: 0;
27
+ padding: 0;
28
+ min-height: 100vh;
29
+ }
30
+
31
+ .header {
32
+ background-color: rgba(10, 36, 99, 0.8);
33
+ backdrop-filter: blur(5px);
34
+ height: 70px;
35
+ display: flex;
36
+ align-items: center;
37
+ padding: 0 30px;
38
+ position: fixed;
39
+ width: 100%;
40
+ top: 0;
41
+ z-index: 1000;
42
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
43
+ }
44
+
45
+ .logo {
46
+ display: flex;
47
+ align-items: center;
48
+ gap: 10px;
49
+ }
50
+
51
+ .logo-icon {
52
+ font-size: 24px;
53
+ color: var(--aqua);
54
+ animation: wave 3s infinite ease-in-out;
55
+ }
56
+
57
+ .logo-text {
58
+ color: white;
59
+ font-size: 22px;
60
+ font-weight: 600;
61
+ letter-spacing: 1px;
62
+ }
63
+
64
+ .sidebar {
65
+ width: 80px;
66
+ background-color: rgba(10, 36, 99, 0.9);
67
+ height: calc(100vh - 70px);
68
+ position: fixed;
69
+ top: 70px;
70
+ left: 0;
71
+ transition: width 0.3s ease;
72
+ overflow: hidden;
73
+ z-index: 900;
74
+ }
75
+
76
+ .sidebar:hover {
77
+ width: 220px;
78
+ }
79
+
80
+ .menu-item {
81
+ display: flex;
82
+ align-items: center;
83
+ padding: 15px 20px;
84
+ color: white;
85
+ cursor: pointer;
86
+ transition: all 0.3s ease;
87
+ position: relative;
88
+ overflow: hidden;
89
+ }
90
+
91
+ .menu-item:hover {
92
+ background-color: rgba(126, 217, 247, 0.2);
93
+ }
94
+
95
+ .menu-item:hover::before {
96
+ content: '';
97
+ position: absolute;
98
+ top: 0;
99
+ left: 0;
100
+ width: 100%;
101
+ height: 100%;
102
+ background: linear-gradient(90deg, transparent, rgba(126, 217, 247, 0.4), transparent);
103
+ animation: waveHover 1.5s infinite;
104
+ }
105
+
106
+ .menu-icon {
107
+ font-size: 20px;
108
+ min-width: 40px;
109
+ text-align: center;
110
+ }
111
+
112
+ .menu-text {
113
+ white-space: nowrap;
114
+ opacity: 0;
115
+ transition: opacity 0.3s ease;
116
+ }
117
+
118
+ .sidebar:hover .menu-text,
119
+ .sidebar.mobile-active .menu-text {
120
+ opacity: 1;
121
+ }
122
+
123
+ .main-content {
124
+ margin-left: 80px;
125
+ margin-top: 70px;
126
+ padding: 30px;
127
+ transition: margin-left 0.3s ease;
128
+ }
129
+
130
+ .sidebar:hover ~ .main-content {
131
+ margin-left: 220px;
132
+ }
133
+
134
+ .card {
135
+ background-color: white;
136
+ border-radius: 16px;
137
+ padding: 20px;
138
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
139
+ position: relative;
140
+ overflow: hidden;
141
+ }
142
+
143
+ .card::after {
144
+ content: '';
145
+ position: absolute;
146
+ top: 10px;
147
+ right: 10px;
148
+ width: 40px;
149
+ height: 40px;
150
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237bdff2'%3E%3Cpath d='M12,20A6,6 0 0,1 6,14C6,10 12,3.25 12,3.25C12,3.25 18,10 18,14A6,6 0 0,1 12,20Z' /%3E%3C/svg%3E");
151
+ background-size: contain;
152
+ background-repeat: no-repeat;
153
+ opacity: 0.3;
154
+ }
155
+
156
+ .parameter-grid {
157
+ display: grid;
158
+ grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
159
+ gap: 20px;
160
+ margin-bottom: 30px;
161
+ }
162
+
163
+ .parameter-title {
164
+ font-size: 14px;
165
+ color: var(--navy-blue);
166
+ margin-bottom: 10px;
167
+ display: flex;
168
+ align-items: center;
169
+ gap: 8px;
170
+ }
171
+
172
+ .parameter-value {
173
+ font-size: 32px;
174
+ font-weight: 600;
175
+ color: var(--navy-blue);
176
+ margin: 10px 0;
177
+ }
178
+
179
+ .parameter-unit {
180
+ font-size: 16px;
181
+ color: var(--teal);
182
+ margin-left: 5px;
183
+ }
184
+
185
+ .progress-bar {
186
+ height: 8px;
187
+ background-color: #e0e0e0;
188
+ border-radius: 4px;
189
+ overflow: hidden;
190
+ margin-top: 15px;
191
+ }
192
+
193
+ .progress-fill {
194
+ height: 100%;
195
+ background: linear-gradient(90deg, var(--aqua), var(--teal));
196
+ border-radius: 4px;
197
+ width: 0%;
198
+ transition: width 1s ease;
199
+ }
200
+
201
+ .slider-container {
202
+ margin: 20px 0;
203
+ }
204
+
205
+ .slider-label {
206
+ display: flex;
207
+ justify-content: space-between;
208
+ margin-bottom: 10px;
209
+ }
210
+
211
+ .range-slider {
212
+ -webkit-appearance: none;
213
+ width: 100%;
214
+ height: 10px;
215
+ border-radius: 5px;
216
+ background: linear-gradient(90deg, var(--light-blue), var(--aqua));
217
+ outline: none;
218
+ }
219
+
220
+ .range-slider::-webkit-slider-thumb {
221
+ -webkit-appearance: none;
222
+ appearance: none;
223
+ width: 24px;
224
+ height: 24px;
225
+ border-radius: 50%;
226
+ background: white;
227
+ cursor: pointer;
228
+ border: 2px solid var(--teal);
229
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
230
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%233e92cc'%3E%3Cpath d='M12,20A6,6 0 0,1 6,14C6,10 12,3.25 12,3.25C12,3.25 18,10 18,14A6,6 0 0,1 12,20Z' /%3E%3C/svg%3E");
231
+ background-size: 60%;
232
+ background-position: center;
233
+ background-repeat: no-repeat;
234
+ }
235
+
236
+ .chart-container {
237
+ position: relative;
238
+ height: 300px;
239
+ width: 100%;
240
+ margin: 30px 0;
241
+ }
242
+
243
+ .notification {
244
+ position: fixed;
245
+ bottom: 20px;
246
+ right: 20px;
247
+ background-color: white;
248
+ border-radius: 10px;
249
+ padding: 15px;
250
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
251
+ display: flex;
252
+ align-items: center;
253
+ gap: 15px;
254
+ transform: translateX(150%);
255
+ transition: transform 0.5s ease;
256
+ z-index: 1000;
257
+ max-width: 300px;
258
+ }
259
+
260
+ .notification.show {
261
+ transform: translateX(0);
262
+ }
263
+
264
+ .notification-icon {
265
+ font-size: 20px;
266
+ min-width: 30px;
267
+ text-align: center;
268
+ }
269
+
270
+ .notification.warning {
271
+ border-left: 5px solid var(--sun-yellow);
272
+ }
273
+
274
+ .notification.critical {
275
+ border-left: 5px solid var(--coral);
276
+ }
277
+
278
+ .notification.safe {
279
+ border-left: 5px solid var(--sea-green);
280
+ }
281
+
282
+ .footer {
283
+ background-color: rgba(255, 255, 255, 0.9);
284
+ padding: 20px;
285
+ text-align: center;
286
+ margin-top: 40px;
287
+ border-radius: 16px 16px 0 0;
288
+ }
289
+
290
+ .copyright {
291
+ color: var(--teal);
292
+ font-size: 14px;
293
+ }
294
+
295
+ @keyframes waveHover {
296
+ 0% { transform: translateX(-100%); }
297
+ 100% { transform: translateX(100%); }
298
+ }
299
+
300
+ @keyframes wavePulse {
301
+ 0% { transform: scale(1); opacity: 1; }
302
+ 100% { transform: scale(1.2); opacity: 0; }
303
+ }
304
+
305
+ /* Responsive adjustments */
306
+ @media (max-width: 768px) {
307
+ .sidebar {
308
+ width: 0;
309
+ left: -100%;
310
+ transition: left 0.3s ease;
311
+ }
312
+ .sidebar.mobile-active {
313
+ left: 0;
314
+ width: 220px;
315
+ }
316
+ .sidebar.mobile-active .menu-text {
317
+ opacity: 1;
318
+ }
319
+ .main-content {
320
+ margin-left: 0;
321
+ }
322
+ .main-content.mobile-active {
323
+ margin-left: 220px;
324
+ }
325
+ .parameter-grid {
326
+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
327
+ }
328
+ .mobile-menu-toggle {
329
+ display: block;
330
+ position: fixed;
331
+ top: 23px;
332
+ left: 20px;
333
+ z-index: 1100;
334
+ color: white;
335
+ font-size: 24px;
336
+ cursor: pointer;
337
+ }
338
+ .header {
339
+ padding-left: 70px;
340
+ justify-content: flex-start;
341
+ gap: 10px;
342
+ }
343
+ .logo {
344
+ margin-left: 10px;
345
+ }
346
+ }
347
+ @media (min-width: 769px) {
348
+ .mobile-menu-toggle {
349
+ display: none;
350
+ }
351
+ }
352
+
353
+ @media (max-width: 480px) {
354
+ .header {
355
+ padding: 0 15px 0 70px;
356
+ }
357
+ .logo-text {
358
+ font-size: 18px;
359
+ }
360
+ .main-content {
361
+ padding: 20px 15px;
362
+ }
363
+ .parameter-grid {
364
+ grid-template-columns: 1fr;
365
+ }
366
+ .mobile-menu-toggle {
367
+ left: 15px;
368
+ }
369
+ }
370
+
371
+ /* MQTT Status Indicator */
372
+ .mqtt-status {
373
+ position: fixed;
374
+ top: 80px;
375
+ right: 20px;
376
+ z-index: 1000;
377
+ display: flex;
378
+ align-items: center;
379
+ gap: 8px;
380
+ background: rgba(0,0,0,0.7);
381
+ padding: 8px 12px;
382
+ border-radius: 20px;
383
+ color: white;
384
+ font-size: 12px;
385
+ }
386
+ .status-indicator {
387
+ width: 10px;
388
+ height: 10px;
389
+ border-radius: 50%;
390
+ display: inline-block;
391
+ }
392
+ .status-connected {
393
+ background: #00ff00;
394
+ box-shadow: 0 0 8px #00ff00;
395
+ }
396
+ .status-disconnected {
397
+ background: #ff0000;
398
+ box-shadow: 0 0 8px #ff0000;
399
+ }
400
+
401
+ /* New styles for the overhauled sections */
402
+ .section-title {
403
+ font-size: 1.5rem;
404
+ font-weight: 600;
405
+ color: white;
406
+ margin-bottom: 1rem;
407
+ padding-bottom: 0.5rem;
408
+ border-bottom: 2px solid rgba(255, 255, 255, 0.2);
409
+ }
410
+
411
+ .sungkup-container {
412
+ display: grid;
413
+ grid-template-columns: 1fr 1fr;
414
+ gap: 20px;
415
+ margin-bottom: 30px;
416
+ }
417
+
418
+ .sungkup-section {
419
+ background: rgba(255, 255, 255, 0.1);
420
+ border-radius: 16px;
421
+ padding: 20px;
422
+ }
423
+
424
+ .sungkup-header {
425
+ color: white;
426
+ font-size: 1.25rem;
427
+ font-weight: 600;
428
+ margin-bottom: 15px;
429
+ display: flex;
430
+ align-items: center;
431
+ gap: 10px;
432
+ }
433
+
434
+ .sungkup-cards {
435
+ display: grid;
436
+ grid-template-columns: repeat(3, 1fr);
437
+ gap: 15px;
438
+ margin-bottom: 20px;
439
+ }
440
+ .sungkup-charts {
441
+ display: grid;
442
+ grid-template-columns: 1fr;
443
+ gap: 15px;
444
+ }
445
+
446
+ @media (min-width: 768px) {
447
+ .sungkup-charts {
448
+ grid-template-columns: 1fr 1fr;
449
+ }
450
+ }
451
+ .irrigation-section {
452
+ background: rgba(255, 255, 255, 0.1);
453
+ border-radius: 16px;
454
+ padding: 20px;
455
+ margin-top: 30px;
456
+ }
457
+
458
+ .irrigation-controls {
459
+ display: grid;
460
+ grid-template-columns: 1fr 1fr;
461
+ gap: 20px;
462
+ margin-bottom: 20px;
463
+ }
464
+
465
+ .irrigation-schedule {
466
+ margin-top: 20px;
467
+ }
468
+
469
+ .schedule-inputs {
470
+ display: grid;
471
+ grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
472
+ gap: 10px;
473
+ margin-top: 10px;
474
+ }
475
+
476
+ .time-input {
477
+ padding: 8px;
478
+ border-radius: 8px;
479
+ border: 1px solid #ddd;
480
+ text-align: center;
481
+ }
482
+
483
+ .current-time {
484
+ font-size: 1.1rem;
485
+ color: white;
486
+ text-align: center;
487
+ margin-top: 10px;
488
+ padding: 10px;
489
+ background: rgba(255, 255, 255, 0.1);
490
+ border-radius: 8px;
491
+ }
492
+ </style>
493
+ </head>
494
+ <body>
495
+ <!-- MQTT Status Indicator -->
496
+ <div class="mqtt-status">
497
+ <span class="status-indicator status-disconnected" id="mqtt-status-indicator"></span>
498
+ <span id="mqtt-status-text">MQTT: Disconnected</span>
499
+ </div>
500
+
501
+ <!-- Header -->
502
+ <header class="header">
503
+ <div class="logo">
504
+ <div class="logo-icon">
505
+ <img src="logo_ikan.png" alt="AquaDrum" class="h-16 w-16 object-contain aspect-square">
506
+ </div>
507
+ <div class="logo-text">Monitoring Kualitas Air Kolam Bioflok Berbasis IoT</div>
508
+ </div>
509
+ </header>
510
+
511
+ <!-- Sidebar Navigation -->
512
+ <nav class="sidebar">
513
+ <a href="#dashboard" class="menu-item">
514
+ <div class="menu-icon">
515
+ <i class="fas fa-home"></i>
516
+ </div>
517
+ <div class="menu-text">Dashboard</div>
518
+ </a>
519
+ <a href="#irrigation" class="menu-item">
520
+ <div class="menu-icon">
521
+ <i class="fas fa-tint"></i>
522
+ </div>
523
+ <div class="menu-text">Irrigation Nozzle</div>
524
+ </a>
525
+ <a href="#notifikasi" class="menu-item">
526
+ <div class="menu-icon">
527
+ <i class="fas fa-bell"></i>
528
+ </div>
529
+ <div class="menu-text">Notifikasi</div>
530
+ </a>
531
+ </nav>
532
+
533
+ <!-- Mobile Sidebar Toggle -->
534
+ <div class="mobile-menu-toggle" onclick="toggleSidebar()">
535
+ <i class="fas fa-bars"></i>
536
+ </div>
537
+
538
+ <!-- Main Content -->
539
+ <main class="main-content">
540
+ <!-- Dashboard Section -->
541
+ <section id="dashboard">
542
+ <h2 class="text-2xl font-semibold text-white mb-6">Dashboard</h2>
543
+
544
+ <!-- Sungkup 1 Section -->
545
+ <div class="sungkup-container">
546
+ <div class="sungkup-section">
547
+ <div class="sungkup-header">
548
+ <i class="fas fa-seedling"></i>
549
+ <span>Sungkup 1</span>
550
+ </div>
551
+
552
+ <div class="sungkup-cards">
553
+ <!-- Soil Moisture 1 -->
554
+ <div class="card">
555
+ <div class="parameter-title">
556
+ <i class="fas fa-tint"></i>
557
+ <span>Soil Moisture 1</span>
558
+ </div>
559
+ <div class="parameter-value">
560
+ <span id="soil-moisture-1">0</span><span class="parameter-unit">%</span>
561
+ </div>
562
+ <div class="progress-bar">
563
+ <div class="progress-fill" id="soil-moisture-1-progress" style="width: 0%"></div>
564
+ </div>
565
+ </div>
566
+
567
+ <!-- Soil Moisture 2 -->
568
+ <div class="card">
569
+ <div class="parameter-title">
570
+ <i class="fas fa-tint"></i>
571
+ <span>Soil Moisture 2</span>
572
+ </div>
573
+ <div class="parameter-value">
574
+ <span id="soil-moisture-2">0</span><span class="parameter-unit">%</span>
575
+ </div>
576
+ <div class="progress-bar">
577
+ <div class="progress-fill" id="soil-moisture-2-progress" style="width: 0%"></div>
578
+ </div>
579
+ </div>
580
+
581
+ <!-- Soil Moisture 3 -->
582
+ <div class="card">
583
+ <div class="parameter-title">
584
+ <i class="fas fa-tint"></i>
585
+ <span>Soil Moisture 3</span>
586
+ </div>
587
+ <div class="parameter-value">
588
+ <span id="soil-moisture-3">0</span><span class="parameter-unit">%</span>
589
+ </div>
590
+ <div class="progress-bar">
591
+ <div class="progress-fill" id="soil-moisture-3-progress" style="width: 0%"></div>
592
+ </div>
593
+ </div>
594
+ </div>
595
+ <div class="sungkup-charts grid grid-cols-1 md:grid-cols-2 gap-4">
596
+ <!-- Average Moisture Chart -->
597
+ <div class="card order-1">
598
+ <div class="parameter-title">
599
+ <i class="fas fa-chart-bar"></i>
600
+ <span>Average Moisture</span>
601
+ </div>
602
+ <div class="chart-container">
603
+ <canvas id="avg-moisture-chart-1"></canvas>
604
+ </div>
605
+ </div>
606
+
607
+ <!-- Air Temperature Chart -->
608
+ <div class="card order-3 md:order-2">
609
+ <div class="parameter-title">
610
+ <i class="fas fa-thermometer-half"></i>
611
+ <span>Air Temperature</span>
612
+ </div>
613
+ <div class="chart-container">
614
+ <canvas id="air-temp-chart-1"></canvas>
615
+ </div>
616
+ </div>
617
+ </div>
618
+ </div>
619
+
620
+ <!-- Sungkup 2 Section -->
621
+ <div class="sungkup-section">
622
+ <div class="sungkup-header">
623
+ <i class="fas fa-seedling"></i>
624
+ <span>Sungkup 2</span>
625
+ </div>
626
+
627
+ <div class="sungkup-cards">
628
+ <!-- Soil Moisture 1 -->
629
+ <div class="card">
630
+ <div class="parameter-title">
631
+ <i class="fas fa-tint"></i>
632
+ <span>Soil Moisture 1</span>
633
+ </div>
634
+ <div class="parameter-value">
635
+ <span id="soil-moisture-21">0</span><span class="parameter-unit">%</span>
636
+ </div>
637
+ <div class="progress-bar">
638
+ <div class="progress-fill" id="soil-moisture-21-progress" style="width: 0%"></div>
639
+ </div>
640
+ </div>
641
+
642
+ <!-- Soil Moisture 2 -->
643
+ <div class="card">
644
+ <div class="parameter-title">
645
+ <i class="fas fa-tint"></i>
646
+ <span>Soil Moisture 2</span>
647
+ </div>
648
+ <div class="parameter-value">
649
+ <span id="soil-moisture-22">0</span><span class="parameter-unit">%</span>
650
+ </div>
651
+ <div class="progress-bar">
652
+ <div class="progress-fill" id="soil-moisture-22-progress" style="width: 0%"></div>
653
+ </div>
654
+ </div>
655
+
656
+ <!-- Soil Moisture 3 -->
657
+ <div class="card">
658
+ <div class="parameter-title">
659
+ <i class="fas fa-tint"></i>
660
+ <span>Soil Moisture 3</span>
661
+ </div>
662
+ <div class="parameter-value">
663
+ <span id="soil-moisture-23">0</span><span class="parameter-unit">%</span>
664
+ </div>
665
+ <div class="progress-bar">
666
+ <div class="progress-fill" id="soil-moisture-23-progress" style="width: 0%"></div>
667
+ </div>
668
+ </div>
669
+ </div>
670
+ <div class="sungkup-charts grid grid-cols-1 md:grid-cols-2 gap-4">
671
+ <!-- Average Moisture Chart -->
672
+ <div class="card order-1">
673
+ <div class="parameter-title">
674
+ <i class="fas fa-chart-bar"></i>
675
+ <span>Average Moisture</span>
676
+ </div>
677
+ <div class="chart-container">
678
+ <canvas id="avg-moisture-chart-2"></canvas>
679
+ </div>
680
+ </div>
681
+
682
+ <!-- Air Temperature Chart -->
683
+ <div class="card order-3 md:order-2">
684
+ <div class="parameter-title">
685
+ <i class="fas fa-thermometer-half"></i>
686
+ <span>Air Temperature</span>
687
+ </div>
688
+ <div class="chart-container">
689
+ <canvas id="air-temp-chart-2"></canvas>
690
+ </div>
691
+ </div>
692
+ </div>
693
+ </div>
694
+ </div>
695
+ </section>
696
+
697
+ <!-- Irrigation Nozzle Section -->
698
+ <section id="irrigation" class="irrigation-section">
699
+ <h2 class="text-2xl font-semibold text-white mb-6">Irrigation Nozzle</h2>
700
+
701
+ <div class="irrigation-controls">
702
+ <!-- Watering Frequency -->
703
+ <div class="card">
704
+ <div class="slider-container">
705
+ <div class="slider-label">
706
+ <span>Number of Waterings</span>
707
+ <span id="watering-frequency-value">0x</span>
708
+ </div>
709
+ <input type="range" min="0" max="5" value="0" class="range-slider" id="watering-frequency" oninput="updateWateringFrequency()">
710
+ </div>
711
+ </div>
712
+
713
+ <!-- Watering Duration -->
714
+ <div class="card">
715
+ <div class="slider-container">
716
+ <div class="slider-label">
717
+ <span>Watering Duration</span>
718
+ <span id="watering-duration-value">0 min</span>
719
+ </div>
720
+ <input type="range" min="0" max="60" value="0" class="range-slider" id="watering-duration" oninput="updateWateringDuration()">
721
+ </div>
722
+ </div>
723
+ </div>
724
+
725
+ <!-- Current Time Display -->
726
+ <div class="current-time">
727
+ <i class="fas fa-clock"></i>
728
+ <span id="current-time">Loading...</span>
729
+ <span>(WIB - West Indonesia Time)</span>
730
+ </div>
731
+
732
+ <!-- Watering Schedule -->
733
+ <div class="irrigation-schedule">
734
+ <div class="card">
735
+ <div class="parameter-title">
736
+ <i class="fas fa-calendar-alt"></i>
737
+ <span>Watering Schedule</span>
738
+ </div>
739
+ <div class="schedule-inputs" id="schedule-inputs-container">
740
+ <!-- Schedule inputs will be dynamically generated here -->
741
+ </div>
742
+ </div>
743
+ </div>
744
+ </section>
745
+
746
+ <!-- Notification Section -->
747
+ <section id="notifikasi" class="mt-10">
748
+ <h2 class="text-2xl font-semibold text-white mb-6">Notifikasi</h2>
749
+ <div class="card">
750
+ <div id="notification-list">
751
+ <!-- Notifications will be displayed here -->
752
+ </div>
753
+ </div>
754
+ </section>
755
+
756
+ <!-- MQTT Library -->
757
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/mqtt/5.6.1/mqtt.min.js"></script>
758
+
759
+ <script>
760
+ // ========== MQTT CONFIGURATION ==========
761
+ // IMPORTANT: use WSS when hosting on HTTPS (GitHub Pages)
762
+ const brokerUrl = 'wss://broker.emqx.io:8084/mqtt';
763
+
764
+ // Sungkup 1 topics
765
+ const topicSoilMoisture1 = "tes/34235/topic/kelembaban1";
766
+ const topicSoilMoisture2 = "tes/34235/topic/kelembaban2";
767
+ const topicSoilMoisture3 = "tes/34235/topic/kelembaban3";
768
+ const topicAvgMoisture1 = "tes/34235/topic/kelembabanAVG";
769
+ const topicAirTemp1 = "tes/34235/topic/suhu1";
770
+
771
+ // Sungkup 2 topics
772
+ const topicSoilMoisture21 = "tes/34235/topic/kelembaban21";
773
+ const topicSoilMoisture22 = "tes/34235/topic/kelembaban22";
774
+ const topicSoilMoisture23 = "tes/34235/topic/kelembaban23";
775
+ const topicAvgMoisture2 = "tes/34235/topic/kelembabanAVG2";
776
+ const topicAirTemp2 = "tes/34235/topic/suhu2";
777
+
778
+ // Irrigation topics
779
+ const topicWateringFrequency = "tes/34235/topic/sumsiram";
780
+ const topicWateringDuration = "tes/34235/topic/dursiram";
781
+ const topicSchedule1 = "tes/34235/topic/jadwal1";
782
+ const topicSchedule2 = "tes/34235/topic/jadwal2";
783
+ const topicSchedule3 = "tes/34235/topic/jadwal3";
784
+ const topicSchedule4 = "tes/34235/topic/jadwal4";
785
+ const topicSchedule5 = "tes/34235/topic/jadwal5";
786
+
787
+ const publishOptions = { qos: 1, retain: true };
788
+
789
+ // MQTT Client - add a lightweight clientId to help broker
790
+ const clientId = 'webclient-' + Math.random().toString(16).substr(2, 8);
791
+ const client = mqtt.connect(brokerUrl, { reconnectPeriod: 2000, clientId: clientId, connectTimeout: 30_000 });
792
+
793
+ client.on('connect', () => {
794
+ console.log('MQTT connected to Bioflok System');
795
+
796
+ // Subscribe to all topics
797
+ const topics = [
798
+ topicSoilMoisture1, topicSoilMoisture2, topicSoilMoisture3,
799
+ topicAvgMoisture1, topicAirTemp1,
800
+ topicSoilMoisture21, topicSoilMoisture22, topicSoilMoisture23,
801
+ topicAvgMoisture2, topicAirTemp2,
802
+ topicWateringFrequency, topicWateringDuration,
803
+ topicSchedule1, topicSchedule2, topicSchedule3, topicSchedule4, topicSchedule5
804
+ ];
805
+
806
+ client.subscribe(topics, { qos: 0 }, (err) => {
807
+ if (err) console.warn('Subscribe error', err);
808
+ });
809
+
810
+ // Update MQTT status
811
+ document.getElementById('mqtt-status-indicator').className = 'status-indicator status-connected';
812
+ document.getElementById('mqtt-status-text').textContent = 'MQTT: Connected';
813
+
814
+ showNotification('safe', 'MQTT Connected', 'Terhubung ke broker MQTT');
815
+ });
816
+
817
+ client.on('message', (topic, message) => {
818
+ const msg = message.toString();
819
+ console.log(`Received from ${topic}: ${msg}`);
820
+
821
+ try {
822
+ const value = parseFloat(msg);
823
+ if (isNaN(value)) {
824
+ console.error(`Invalid number received: ${msg}`);
825
+ return;
826
+ }
827
+
828
+ // Sungkup 1
829
+ if (topic === topicSoilMoisture1) {
830
+ document.getElementById('soil-moisture-1').textContent = value.toFixed(1);
831
+ updateProgressBar('soil-moisture-1', value);
832
+ } else if (topic === topicSoilMoisture2) {
833
+ document.getElementById('soil-moisture-2').textContent = value.toFixed(1);
834
+ updateProgressBar('soil-moisture-2', value);
835
+ } else if (topic === topicSoilMoisture3) {
836
+ document.getElementById('soil-moisture-3').textContent = value.toFixed(1);
837
+ updateProgressBar('soil-moisture-3', value);
838
+ } else if (topic === topicAvgMoisture1) {
839
+ updateChartData(avgMoistureChart1, value);
840
+ } else if (topic === topicAirTemp1) {
841
+ updateChartData(airTempChart1, value);
842
+ }
843
+
844
+ // Sungkup 2
845
+ else if (topic === topicSoilMoisture21) {
846
+ document.getElementById('soil-moisture-21').textContent = value.toFixed(1);
847
+ updateProgressBar('soil-moisture-21', value);
848
+ } else if (topic === topicSoilMoisture22) {
849
+ document.getElementById('soil-moisture-22').textContent = value.toFixed(1);
850
+ updateProgressBar('soil-moisture-22', value);
851
+ } else if (topic === topicSoilMoisture23) {
852
+ document.getElementById('soil-moisture-23').textContent = value.toFixed(1);
853
+ updateProgressBar('soil-moisture-23', value);
854
+ } else if (topic === topicAvgMoisture2) {
855
+ updateChartData(avgMoistureChart2, value);
856
+ } else if (topic === topicAirTemp2) {
857
+ updateChartData(airTempChart2, value);
858
+ }
859
+
860
+ // Irrigation
861
+ else if (topic === topicWateringFrequency) {
862
+ document.getElementById('watering-frequency').value = value;
863
+ document.getElementById('watering-frequency-value').textContent = `${value}x`;
864
+ updateScheduleInputs(value);
865
+ } else if (topic === topicWateringDuration) {
866
+ document.getElementById('watering-duration').value = value;
867
+ document.getElementById('watering-duration-value').textContent = `${value} min`;
868
+ }
869
+
870
+ // Schedule topics (handle as strings)
871
+ else if (topic.startsWith('tes/34235/topic/jadwal')) {
872
+ const scheduleIndex = topic.slice(-1);
873
+ const inputElement = document.getElementById(`schedule-${scheduleIndex}`);
874
+ if (inputElement) {
875
+ inputElement.value = msg;
876
+ }
877
+ }
878
+
879
+ } catch (error) {
880
+ console.error('Error processing MQTT message:', error);
881
+ }
882
+ });
883
+
884
+ client.on('error', (error) => {
885
+ console.error('MQTT error:', error);
886
+ document.getElementById('mqtt-status-indicator').className = 'status-indicator status-disconnected';
887
+ document.getElementById('mqtt-status-text').textContent = 'MQTT: Error';
888
+ showNotification('critical', 'MQTT Error', 'Koneksi MQTT bermasalah');
889
+ });
890
+
891
+ client.on('reconnect', () => {
892
+ document.getElementById('mqtt-status-indicator').className = 'status-indicator status-disconnected';
893
+ document.getElementById('mqtt-status-text').textContent = 'MQTT: Reconnecting';
894
+ });
895
+
896
+ client.on('close', () => {
897
+ document.getElementById('mqtt-status-indicator').className = 'status-indicator status-disconnected';
898
+ document.getElementById('mqtt-status-text').textContent = 'MQTT: Disconnected';
899
+ });
900
+
901
+ // Helper function to publish MQTT messages
902
+ function publish(topic, payload) {
903
+ if (client.connected) {
904
+ client.publish(topic, String(payload), publishOptions, (err) => {
905
+ if (err) console.error('Publish error', err);
906
+ });
907
+ console.log(`Published to ${topic}: ${payload}`);
908
+ } else {
909
+ console.warn('Cannot publish, MQTT client not connected');
910
+ }
911
+ }
912
+
913
+ // Update progress bars based on sensor values
914
+ function updateProgressBar(parameter, value) {
915
+ let progressBar;
916
+
917
+ switch(parameter) {
918
+ case 'soil-moisture-1':
919
+ progressBar = document.getElementById('soil-moisture-1-progress');
920
+ break;
921
+ case 'soil-moisture-2':
922
+ progressBar = document.getElementById('soil-moisture-2-progress');
923
+ break;
924
+ case 'soil-moisture-3':
925
+ progressBar = document.getElementById('soil-moisture-3-progress');
926
+ break;
927
+ case 'soil-moisture-21':
928
+ progressBar = document.getElementById('soil-moisture-21-progress');
929
+ break;
930
+ case 'soil-moisture-22':
931
+ progressBar = document.getElementById('soil-moisture-22-progress');
932
+ break;
933
+ case 'soil-moisture-23':
934
+ progressBar = document.getElementById('soil-moisture-23-progress');
935
+ break;
936
+ default:
937
+ return;
938
+ }
939
+
940
+ if (progressBar) {
941
+ progressBar.style.width = `${Math.max(0, Math.min(100, value))}%`;
942
+ }
943
+ }
944
+
945
+ // Initialize charts
946
+ let avgMoistureChart1, avgMoistureChart2, airTempChart1, airTempChart2;
947
+
948
+ function initializeCharts() {
949
+ // Sungkup 1 - Average Moisture Chart
950
+ const avgMoistureCtx1 = document.getElementById('avg-moisture-chart-1').getContext('2d');
951
+ avgMoistureChart1 = new Chart(avgMoistureCtx1, {
952
+ type: 'line',
953
+ data: {
954
+ labels: [],
955
+ datasets: [{
956
+ label: 'Average Moisture (%)',
957
+ data: [],
958
+ borderColor: '#3e92cc',
959
+ backgroundColor: 'rgba(62, 146, 204, 0.1)',
960
+ tension: 0.1,
961
+ fill: true,
962
+ borderWidth: 2,
963
+ pointRadius: 0,
964
+ pointHoverRadius: 4
965
+ }]
966
+ },
967
+ options: {
968
+ responsive: true,
969
+ maintainAspectRatio: false,
970
+ scales: {
971
+ x: {
972
+ display: false
973
+ },
974
+ y: {
975
+ beginAtZero: true,
976
+ max: 100,
977
+ grid: {
978
+ color: 'rgba(0, 0, 0, 0.05)'
979
+ }
980
+ }
981
+ },
982
+ plugins: {
983
+ legend: {
984
+ display: false
985
+ }
986
+ }
987
+ }
988
+ });
989
+
990
+ // Sungkup 1 - Air Temperature Chart
991
+ const airTempCtx1 = document.getElementById('air-temp-chart-1').getContext('2d');
992
+ airTempChart1 = new Chart(airTempCtx1, {
993
+ type: 'line',
994
+ data: {
995
+ labels: [],
996
+ datasets: [{
997
+ label: 'Air Temperature (°C)',
998
+ data: [],
999
+ borderColor: '#ff6b6b',
1000
+ backgroundColor: 'rgba(255, 107, 107, 0.1)',
1001
+ tension: 0.1,
1002
+ fill: true,
1003
+ borderWidth: 2,
1004
+ pointRadius: 0,
1005
+ pointHoverRadius: 4
1006
+ }]
1007
+ },
1008
+ options: {
1009
+ responsive: true,
1010
+ maintainAspectRatio: false,
1011
+ scales: {
1012
+ x: {
1013
+ display: false
1014
+ },
1015
+ y: {
1016
+ beginAtZero: false,
1017
+ grid: {
1018
+ color: 'rgba(0, 0, 0, 0.05)'
1019
+ }
1020
+ }
1021
+ },
1022
+ plugins: {
1023
+ legend: {
1024
+ display: false
1025
+ }
1026
+ }
1027
+ }
1028
+ });
1029
+
1030
+ // Sungkup 2 - Average Moisture Chart
1031
+ const avgMoistureCtx2 = document.getElementById('avg-moisture-chart-2').getContext('2d');
1032
+ avgMoistureChart2 = new Chart(avgMoistureCtx2, {
1033
+ type: 'line',
1034
+ data: {
1035
+ labels: [],
1036
+ datasets: [{
1037
+ label: 'Average Moisture (%)',
1038
+ data: [],
1039
+ borderColor: '#4ecdc4',
1040
+ backgroundColor: 'rgba(78, 205, 196, 0.1)',
1041
+ tension: 0.1,
1042
+ fill: true,
1043
+ borderWidth: 2,
1044
+ pointRadius: 0,
1045
+ pointHoverRadius: 4
1046
+ }]
1047
+ },
1048
+ options: {
1049
+ responsive: true,
1050
+ maintainAspectRatio: false,
1051
+ scales: {
1052
+ x: {
1053
+ display: false
1054
+ },
1055
+ y: {
1056
+ beginAtZero: true,
1057
+ max: 100,
1058
+ grid: {
1059
+ color: 'rgba(0, 0, 0, 0.05)'
1060
+ }
1061
+ }
1062
+ },
1063
+ plugins: {
1064
+ legend: {
1065
+ display: false
1066
+ }
1067
+ }
1068
+ }
1069
+ });
1070
+
1071
+ // Sungkup 2 - Air Temperature Chart
1072
+ const airTempCtx2 = document.getElementById('air-temp-chart-2').getContext('2d');
1073
+ airTempChart2 = new Chart(airTempCtx2, {
1074
+ type: 'line',
1075
+ data: {
1076
+ labels: [],
1077
+ datasets: [{
1078
+ label: 'Air Temperature (°C)',
1079
+ data: [],
1080
+ borderColor: '#ffe66d',
1081
+ backgroundColor: 'rgba(255, 230, 109, 0.1)',
1082
+ tension: 0.1,
1083
+ fill: true,
1084
+ borderWidth: 2,
1085
+ pointRadius: 0,
1086
+ pointHoverRadius: 4
1087
+ }]
1088
+ },
1089
+ options: {
1090
+ responsive: true,
1091
+ maintainAspectRatio: false,
1092
+ scales: {
1093
+ x: {
1094
+ display: false
1095
+ },
1096
+ y: {
1097
+ beginAtZero: false,
1098
+ grid: {
1099
+ color: 'rgba(0, 0, 0, 0.05)'
1100
+ }
1101
+ }
1102
+ },
1103
+ plugins: {
1104
+ legend: {
1105
+ display: false
1106
+ }
1107
+ }
1108
+ }
1109
+ });
1110
+ }
1111
+
1112
+ // Update chart data
1113
+ function updateChartData(chart, value) {
1114
+ const now = new Date();
1115
+ const timeLabel = now.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
1116
+
1117
+ chart.data.labels.push(timeLabel);
1118
+ chart.data.datasets[0].data.push(value);
1119
+
1120
+ if (chart.data.labels.length > 10) {
1121
+ chart.data.labels.shift();
1122
+ chart.data.datasets[0].data.shift();
1123
+ }
1124
+
1125
+ chart.update({ duration: 0 });
1126
+ }
1127
+
1128
+ // Irrigation functions
1129
+ function updateWateringFrequency() {
1130
+ const value = document.getElementById('watering-frequency').value;
1131
+ document.getElementById('watering-frequency-value').textContent = `${value}x`;
1132
+ publish(topicWateringFrequency, value);
1133
+ updateScheduleInputs(value);
1134
+ }
1135
+
1136
+ function updateWateringDuration() {
1137
+ const value = document.getElementById('watering-duration').value;
1138
+ document.getElementById('watering-duration-value').textContent = `${value} min`;
1139
+ publish(topicWateringDuration, value);
1140
+ }
1141
+
1142
+ function updateScheduleInputs(count) {
1143
+ const container = document.getElementById('schedule-inputs-container');
1144
+ container.innerHTML = '';
1145
+
1146
+ const scheduleTopics = [topicSchedule1, topicSchedule2, topicSchedule3, topicSchedule4, topicSchedule5];
1147
+
1148
+ for (let i = 1; i <= count; i++) {
1149
+ const input = document.createElement('input');
1150
+ input.type = 'time';
1151
+ input.className = 'time-input';
1152
+ input.id = `schedule-${i}`;
1153
+ input.placeholder = 'HH:MM';
1154
+ input.addEventListener('change', function() {
1155
+ publish(scheduleTopics[i-1], this.value);
1156
+ });
1157
+
1158
+ const label = document.createElement('div');
1159
+ label.className = 'text-sm text-white mb-1';
1160
+ label.textContent = `Schedule ${i}`;
1161
+
1162
+ const wrapper = document.createElement('div');
1163
+ wrapper.appendChild(label);
1164
+ wrapper.appendChild(input);
1165
+ container.appendChild(wrapper);
1166
+ }
1167
+ }
1168
+
1169
+ // Update current time
1170
+ function updateCurrentTime() {
1171
+ const now = new Date();
1172
+ // Convert to WIB timezone (UTC+7)
1173
+ const wibTime = new Date(now.getTime() + (7 * 60 * 60 * 1000));
1174
+ const timeString = wibTime.toISOString().substr(11, 8);
1175
+ document.getElementById('current-time').textContent = timeString;
1176
+ }
1177
+
1178
+ // Initialize current time and update every second
1179
+ updateCurrentTime();
1180
+ setInterval(updateCurrentTime, 1000);
1181
+
1182
+ // Initialize schedule inputs
1183
+ updateScheduleInputs(0);
1184
+
1185
+ // ========== EXISTING APPLICATION LOGIC ==========
1186
+
1187
+ // Initialize charts when DOM is loaded
1188
+ document.addEventListener('DOMContentLoaded', function() {
1189
+ initializeCharts();
1190
+ });
1191
+
1192
+ function toggleSidebar() {
1193
+ const sidebar = document.querySelector('.sidebar');
1194
+ const mainContent = document.querySelector('.main-content');
1195
+ sidebar.classList.toggle('mobile-active');
1196
+ mainContent.classList.toggle('mobile-active');
1197
+ }
1198
+
1199
+ document.querySelectorAll('.menu-item').forEach(item => {
1200
+ item.addEventListener('click', function(e) {
1201
+ if (this.getAttribute('href').startsWith('#')) {
1202
+ e.preventDefault();
1203
+ const targetId = this.getAttribute('href');
1204
+ const targetSection = document.querySelector(targetId);
1205
+ if (targetSection) {
1206
+ targetSection.scrollIntoView({
1207
+ behavior: 'smooth'
1208
+ });
1209
+ }
1210
+ }
1211
+ });
1212
+ });
1213
+
1214
+ function showNotification(type, title, message) {
1215
+ const notificationList = document.getElementById('notification-list');
1216
+ const notificationItem = document.createElement('div');
1217
+ notificationItem.className = `notification-item p-4 mb-2 rounded-md border-l-4 ${
1218
+ type === 'critical' ? 'border-red-500 bg-red-50' :
1219
+ type === 'warning' ? 'border-yellow-500 bg-yellow-50' :
1220
+ 'border-green-500 bg-green-50'
1221
+ }`;
1222
+ notificationItem.innerHTML = `
1223
+ <div class="flex items-start">
1224
+ <div class="mr-3 text-lg ${
1225
+ type === 'critical' ? 'text-red-500' :
1226
+ type === 'warning' ? 'text-yellow-500' :
1227
+ 'text-green-500'
1228
+ }">
1229
+ <i class="fas fa-${type === 'critical' ? 'exclamation-triangle' : 'exclamation-circle'}"></i>
1230
+ </div>
1231
+ <div>
1232
+ <div class="font-semibold">${title}</div>
1233
+ <div class="text-sm text-gray-600">${message}</div>
1234
+ <div class="text-xs text-gray-400 mt-1">${new Date().toLocaleTimeString()}</div>
1235
+ </div>
1236
+ </div>
1237
+ `;
1238
+ if (notificationList) {
1239
+ notificationList.prepend(notificationItem);
1240
+ }
1241
+
1242
+ const notification = document.createElement('div');
1243
+ notification.className = `notification ${type} show`;
1244
+ notification.innerHTML = `
1245
+ <div class="notification-icon">
1246
+ <i class="fas fa-${type === 'critical' ? 'exclamation-triangle' : 'exclamation-circle'}"></i>
1247
+ </div>
1248
+ <div>
1249
+ <div class="font-semibold">${title}</div>
1250
+ <div class="text-sm">${message}</div>
1251
+ </div>
1252
+ `;
1253
+ document.body.appendChild(notification);
1254
+
1255
+ setTimeout(() => {
1256
+ notification.remove();
1257
+ }, 5000);
1258
+ }
1259
+ </script>
1260
+ </body>
1261
+ </html>