Repository navigation
Expand file tree
/
Copy pathadmin.html
More file actions
1009 lines (903 loc) · 58.4 KB
/
Copy pathadmin.html
File metadata and controls
1009 lines (903 loc) · 58.4 KB
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
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Dashboard | KumoFumi by Zeon</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preconnect" href="https://cdnjs.cloudflare.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<link rel="stylesheet" href="css/admin.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.31/jspdf.plugin.autotable.min.js"></script>
<script src="https://cdn.sheetjs.com/xlsx-0.20.1/package/dist/xlsx.full.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<link rel="stylesheet" href="css/dialogs.css">
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="js/dialogs.js"></script>
<script type="module" src="js/admin.js"></script>
<script src="js/dark-mode.js"></script>
</head>
<body>
<!-- Change Password Modal -->
<div id="changePasswordModal" class="modal-overlay">
<div class="modal-content" style="max-width: 400px;">
<div class="modal-header">
<h3>Change Password</h3>
<button id="closeChangePasswordBtn" class="icon-btn"><i class="fa-solid fa-xmark"></i></button>
</div>
<div class="modal-body">
<div class="form-group">
<label>New Password</label>
<input type="password" id="newPasswordInput" class="modal-input" placeholder="Enter new password (min 8 chars)" minlength="8">
</div>
<div class="form-group">
<label>Confirm Password</label>
<input type="password" id="confirmPasswordInput" class="modal-input" placeholder="Re-enter new password">
</div>
<p id="passwordError" style="color: var(--danger); font-size: 0.9rem; display: none; margin-bottom: 10px;"></p>
<div style="display: flex; gap: 10px; margin-top: 20px;">
<button id="submitPasswordBtn" class="btn btn-primary" style="flex: 1;">Update Password</button>
<button id="cancelPasswordBtn" class="btn btn-secondary" style="flex: 1;">Cancel</button>
</div>
</div>
</div>
</div>
<div class="admin-container">
<!-- Field Editor Sidebar -->
<aside class="sidebar">
<div class="sidebar-header">
<h2>Admin Panel</h2>
<button id="themeToggle"
style="background:none; border:none; cursor:pointer; color:var(--text-muted); font-size:1.2rem;">
<i class="fa-solid fa-moon"></i>
</button>
</div>
<nav class="sidebar-nav">
<ul class="nav-links">
<li class="nav-item active" data-tab="library">
<i class="fa-solid fa-folder-open"></i> My Forms
</li>
<li class="nav-item hidden" data-tab="builder">
<i class="fa-solid fa-pen-to-square"></i> Form Builder
</li>
<li class="nav-item hidden" data-tab="responses">
<i class="fa-solid fa-table"></i> Responses
</li>
<li class="nav-item superadmin-only" data-tab="team" style="display:none;">
<i class="fa-solid fa-users-gear"></i> Team
</li>
</ul>
<div style="padding: 0 15px; margin-top: 15px; display: flex; flex-direction: column; gap: 8px;">
<button id="changePasswordBtn" style="width: 100%; padding: 8px; border-radius: 6px; background: rgba(37,99,235,0.1); color: var(--primary); border: 1px solid rgba(37,99,235,0.2); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s; font-size: 0.85rem; font-weight: 500;">
<i class="fa-solid fa-key"></i> Change Password
</button>
<button id="logoutBtn" style="width: 100%; padding: 8px; border-radius: 6px; background: rgba(220,38,38,0.1); color: var(--danger); border: 1px solid rgba(220,38,38,0.2); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s; font-size: 0.85rem; font-weight: 500;">
<i class="fa-solid fa-arrow-right-from-bracket"></i> Logout
</button>
</div>
</nav>
<!-- Creator Showcase -->
<div class="sidebar-footer">
<div class="creator-label">Creator of KumoFumi</div>
<div class="creator-profile">
<img src="img/dp.jpg" alt="Creator" class="creator-avatar">
<div class="creator-info">
<strong>Zeon</strong>
<span class="creator-role">Developer</span>
</div>
</div>
<div class="social-links">
<a href="https://github.com/ZEON-07" class="social-link" title="GitHub"><i
class="fa-brands fa-github"></i></a>
<a href="https://linkedin.com/in/adithyan07" class="social-link" title="LinkedIn"><i
class="fa-brands fa-linkedin"></i></a>
<a href="https://instagram.com/zeon_ig" class="social-link" title="Instagram"><i
class="fa-brands fa-instagram"></i></a>
<a href="https://mail.google.com/mail/?view=cm&to=mr.adhi125@gmail.com" target="_blank"
class="social-link" title="Email">
<i class="fa-solid fa-envelope"></i>
</a>
</div>
</aside>
<!-- Main Content -->
<main class="main-content">
<div class="tab-content">
<!-- SECTION: MY FORMS (LIBRARY) -->
<section id="library" class="tab-pane active">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:20px;">
<h3 style="margin:0;"><i class="fa-solid fa-folder-open"></i> My Forms</h3>
<button id="addFormBtn" class="btn btn-primary">
<i class="fa-solid fa-plus"></i> Add Form
</button>
</div>
<div id="formsLibraryList"
style="display:grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap:20px; margin-top:20px;">
<!-- Dynamic Forms Cards -->
<div style="text-align:center; padding:40px; color:#999; grid-column: 1/-1;">
<i class="fa-regular fa-folder-open" style="font-size:2rem; margin-bottom:10px;"></i>
<p>No saved forms yet.</p>
</div>
</div>
</section>
<!-- SECTION: BUILDER -->
<section id="builder" class="tab-pane">
<div class="card">
<h3>Form Builder</h3>
<p class="hint">Add, edit, and reorder form fields. Drag to reorder.</p>
<div id="fieldBuilderList" class="builder-list"></div>
<div style="display: flex; gap: 10px; margin-top: 15px;">
<button id="openAddSidebarBtn" class="btn btn-primary" style="flex: 1;">
<i class="fa-solid fa-plus"></i> Add Field
</button>
<button id="addSectionBtn" class="btn" style="flex: 1; border: 1px dashed var(--primary); color: var(--primary); background: rgba(37,99,235,0.05); font-weight: 500;">
<i class="fa-solid fa-layer-group"></i> Add Section
</button>
</div>
</div>
<!-- Design & Theme Section -->
<div class="card" style="margin-top:20px;">
<h3 style="margin-bottom:15px; display:flex; align-items:center; gap:8px;"><i class="fa-solid fa-palette" style="color:var(--primary);"></i> Design & Theme</h3>
<p class="hint" style="margin-bottom:20px;">Customize the appearance and core settings of this form.</p>
<div style="display:grid; grid-template-columns:1fr 1fr; gap:20px; margin-bottom:20px;">
<div class="form-group" style="margin:0;">
<label>Form Title</label>
<input type="text" id="formTitleInput" placeholder="e.g., Workshop Registration 2025">
<p class="hint">The main heading displayed on the form page.</p>
</div>
<div class="form-group" style="margin:0;">
<label>Webpage Title</label>
<input type="text" id="webTitleInput" placeholder="e.g., Workshop | Register Now">
<p class="hint">The title as it appears in the browser tab.</p>
</div>
</div>
<div class="form-group">
<label>Form Description</label>
<textarea id="formDescInput" rows="2"
placeholder="e.g., Join us for an amazing workshop experience!"></textarea>
<p class="hint">Optional description shown below the title.</p>
</div>
<hr style="margin:20px 0; border:0; border-top:1px solid var(--border);">
<div style="display:grid; grid-template-columns:1fr 1fr; gap:20px; margin-bottom:20px; align-items:start;">
<div class="form-group" style="margin:0;">
<label>Response Limit (Optional)</label>
<input type="number" id="responseLimitInput" placeholder="e.g., 100" min="1">
<p class="hint">Automatically close after this many responses.</p>
</div>
<div class="form-group" style="margin:0;">
<label style="visibility:hidden; display:block; margin-bottom:8px;">Spacer</label>
<label style="display:flex; align-items:center; cursor:pointer; font-weight: 500; background:var(--bg-body); padding:10px 15px; border-radius:8px; border:1px solid var(--border); margin:0; height:45px;">
<input type="checkbox" id="allowMultipleResponsesInput" checked
style="width:20px; height:20px; margin-right:10px; margin-bottom:0;">
Allow multiple responses
</label>
<p class="hint" style="margin-top:8px;">Shows "Submit another" on success.</p>
</div>
</div>
<hr style="margin:20px 0; border:0; border-top:1px solid var(--border);">
<div style="display:grid; grid-template-columns:1fr 1fr; gap:20px; align-items:start;">
<div class="form-group" style="margin:0;">
<label>Theme Color</label>
<div class="color-picker-wrapper" style="position:relative; display:flex; align-items:center; width: 100%;">
<div id="themeColorSwatch" style="width:24px; height:24px; border-radius:50%; background:#db4437; position:absolute; left:12px; border:1px solid rgba(0,0,0,0.1); box-shadow:0 1px 3px rgba(0,0,0,0.1); overflow:hidden;">
<input type="color" id="themeColorPicker" value="#db4437" style="opacity:0; position:absolute; inset:0; width:100%; height:100%; cursor:pointer;">
</div>
<input type="text" id="colorValueInput" class="form-input" value="#db4437" placeholder="e.g. #db4437, rgb(255,0,0), hsl(0, 100%, 50%)" style="height:42px; padding-left:46px; font-family:monospace; font-size:0.9rem; box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);">
</div>
<p class="hint" style="margin-top:8px;">Updates accent color and custom cursor.</p>
</div>
<div class="form-group" style="margin:0;">
<label>Header Banner</label>
<div style="display:flex; gap:10px; align-items:center;">
<div class="custom-file-upload" style="flex:1;">
<input type="file" id="bannerUpload" accept="image/*" class="file-input-hidden">
<label for="bannerUpload" class="file-input-label" id="bannerUploadLabel">
<i class="fa-solid fa-image"></i>
<span class="file-name">Click to upload banner</span>
</label>
</div>
<button id="removeBanner" class="btn-icon-danger" style="height: 42px; width: 42px; margin:0; padding:0;"><i class="fa-solid fa-trash"></i></button>
</div>
</div>
</div>
<div class="form-group" style="margin-top:20px;">
<label style="display:block;">Club Logo</label>
<div style="display:flex; gap:10px; max-width: 50%;">
<button id="manageLogoBtn" class="btn btn-outline-primary" style="flex:1; margin:0; padding:10px 16px;">
<i class="fa-solid fa-image"></i> Manage Logos
</button>
<button id="removeLogosBtn" class="btn btn-outline-danger" style="flex:1; margin:0; padding:10px 16px;">
<i class="fa-solid fa-trash-can"></i> Remove Logos
</button>
</div>
<div id="logoUploadSection"
style="display:none; margin-top:10px; padding:15px; background:var(--bg-body); border:1px solid var(--border); border-radius:8px; max-width: 50%;">
<label style="font-size:0.85rem; display:block; margin-bottom:6px; font-weight: 600;">Light Mode Logo</label>
<div class="custom-file-upload">
<input type="file" id="logoLightUpload" accept="image/*" class="file-input-hidden">
<label for="logoLightUpload" class="file-input-label" id="logoLightUploadLabel">
<i class="fa-solid fa-image"></i>
<span class="file-name">Click to upload</span>
</label>
</div>
<p class="hint" style="margin-top: 6px; margin-bottom: 16px; font-size: 0.75rem; line-height: 1.4;">Upload a dark or colored logo that looks good on white/light backgrounds.</p>
<label style="font-size:0.85rem; display:block; margin-bottom:6px; font-weight: 600;">Dark Mode Logo</label>
<div class="custom-file-upload">
<input type="file" id="logoDarkUpload" accept="image/*" class="file-input-hidden">
<label for="logoDarkUpload" class="file-input-label" id="logoDarkUploadLabel">
<i class="fa-solid fa-image"></i>
<span class="file-name">Click to upload</span>
</label>
</div>
<p class="hint" style="margin-top: 6px; font-size: 0.75rem; line-height: 1.4;">Upload a white or bright logo that stands out on dark/black backgrounds.</p>
</div>
</div>
<hr style="margin:25px 0; border:0; border-top:1px solid var(--border);">
<!-- Cloudinary Config Block -->
<div class="config-card" style="border:1px solid rgba(59,130,246,0.3); background:rgba(59,130,246,0.04); padding:24px; border-radius:12px; position:relative; overflow:hidden;">
<div style="position:absolute; top:0; left:0; width:4px; height:100%; background:var(--primary);"></div>
<div class="config-title" style="display:flex; justify-content:space-between; align-items:center; margin-bottom:12px;">
<h4 style="margin:0; font-size:1.15rem; color:var(--primary); font-weight:600;"><i class="fa-solid fa-cloud-arrow-up"></i> Cloudinary Asset Storage</h4>
<button type="button" id="openCloudinaryHelp" class="help-badge" style="background:rgba(59,130,246,0.1); color:var(--primary); border:none; cursor:pointer; padding:4px 10px; border-radius:20px; font-size:0.8rem; text-decoration:none; display:flex; align-items:center; gap:4px; font-weight:500;">
<i class="fa-solid fa-circle-info"></i> How to connect?
</button>
</div>
<p class="hint" style="margin-bottom:20px; font-size: 0.9rem; color:var(--text-secondary);">Required for the <strong>"File Upload"</strong> field type. Assets will be uploaded directly to your Cloudinary storage.</p>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom:20px;">
<div>
<label style="font-size:0.9rem; font-weight:600; margin-bottom:8px; display:block;">Cloud Name</label>
<input type="text" id="cloudinaryCloudName" class="cloudinary-input"
placeholder="e.g., dxk7sh8w" style="background:var(--bg-card); border-color:rgba(59,130,246,0.2);">
</div>
<div>
<label style="font-size:0.9rem; font-weight:600; margin-bottom:8px; display:block;">Upload Preset</label>
<input type="text" id="cloudinaryPreset" class="cloudinary-input"
placeholder="e.g., ml_default" style="background:var(--bg-card); border-color:rgba(59,130,246,0.2);">
</div>
</div>
<div style="display:flex; justify-content:space-between; align-items:center; border-top:1px solid rgba(59,130,246,0.15); padding-top:15px;">
<p class="hint" style="margin:0; font-style: italic; color:var(--text-muted); font-size:0.85rem;">
<i class="fa-solid fa-key" style="margin-right: 4px;"></i>
Find in Dashboard > Settings > Upload
</p>
<button id="saveCloudinaryBtn" type="button" class="btn btn-primary btn-sm" style="display:flex; gap:6px; align-items:center; font-weight:600; padding:8px 16px;">
<i class="fa-solid fa-check"></i> Save Cloudinary Config
</button>
</div>
</div>
</div>
<!-- Save Button at Bottom -->
<button id="saveToLibraryBtn" class="btn btn-success"
style="margin: 30px auto 10px; font-size: 1.1rem; padding: 14px 30px; min-width: 300px; display: block; box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3); border-radius: 50px;">
<i class="fa-solid fa-floppy-disk"></i> Save Form to Library
</button>
</section>
<!-- SECTION: TEAM (Superadmin only) -->
<section id="team" class="tab-pane">
<div style="max-width:640px;">
<!-- Create new sub-admin -->
<div class="card" style="margin-bottom:24px;">
<h3 style="margin:0 0 6px;"><i class="fa-solid fa-user-plus"></i> Add Team Member</h3>
<p class="hint" style="margin-bottom:20px;">Create a username and password so others can access the admin panel.</p>
<div id="teamCreateError" style="display:none; background:rgba(220,38,38,0.1); color:var(--danger); padding:10px 14px; border-radius:var(--radius); border:1px solid rgba(220,38,38,0.2); margin-bottom:16px; font-size:0.875rem;"></div>
<div id="teamCreateSuccess" style="display:none; background:rgba(16,185,129,0.1); color:var(--success,#10b981); padding:10px 14px; border-radius:var(--radius); border:1px solid rgba(16,185,129,0.2); margin-bottom:16px; font-size:0.875rem;"></div>
<div style="display:grid; grid-template-columns:1fr 1fr; gap:15px; margin-bottom:15px;">
<div class="form-group" style="margin:0;">
<label>Username</label>
<input type="text" id="newAdminUsername" placeholder="e.g. john_doe" autocomplete="off" spellcheck="false" style="text-transform:lowercase;">
<p class="hint" style="margin-top:4px;">Letters, numbers, underscores only (3–32 chars)</p>
</div>
<div class="form-group" style="margin:0;">
<label>Password</label>
<input type="password" id="newAdminPassword" placeholder="Min. 8 characters" autocomplete="new-password">
<p class="hint" style="margin-top:4px;">Minimum 8 characters</p>
</div>
</div>
<button id="createAdminUserBtn" class="btn btn-primary" style="min-width:160px;">
<i class="fa-solid fa-user-plus"></i> Create User
</button>
</div>
<!-- Current team members -->
<div class="card">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:16px;">
<h3 style="margin:0;"><i class="fa-solid fa-users"></i> Team Members</h3>
<button id="refreshTeamBtn" class="btn btn-sm btn-outline-secondary" title="Refresh">
<i class="fa-solid fa-rotate"></i>
</button>
</div>
<div class="search-box" style="margin-bottom: 16px;">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="text" id="teamSearchInput" placeholder="Search team members...">
</div>
<div id="teamMembersList">
<p style="color:var(--text-muted); text-align:center; padding:20px 0;">Loading…</p>
</div>
</div>
</div>
</section>
<!-- SECTION: RESPONSES (Integrated Tab) -->
<section id="responses" class="tab-pane">
<div id="responsesPanel" class="responses-panel">
<div class="responses-header">
<h2>Responses</h2>
<div class="responses-header-actions">
<div class="export-dropdown">
<button id="exportDropdownBtn" class="btn btn-outline-primary btn-sm">
<i class="fa-solid fa-file-export"></i> Export <i
class="fa-solid fa-chevron-down"
style="font-size: 0.7rem; margin-left: 4px;"></i>
</button>
<div id="exportMenu" class="dropdown-menu">
<button class="dropdown-item" id="exportCsvBtn">
<i class="fa-solid fa-file-csv"></i> CSV
</button>
<button class="dropdown-item" id="exportExcelBtn">
<i class="fa-solid fa-file-excel"></i> Excel (XLSX)
</button>
<button class="dropdown-item" id="exportPdfBtn">
<i class="fa-solid fa-file-pdf"></i> PDF Report
</button>
</div>
</div>
<button id="clearResponsesBtn" class="btn btn-outline-danger btn-sm">
<i class="fa-solid fa-trash-can"></i> Clear All
</button>
<button onclick="closeResponses()" class="btn btn-outline-danger btn-sm">
<i class="fa-solid fa-xmark"></i> Close
</button>
</div>
</div>
<div class="responses-toolbar">
<div class="search-box">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="text" id="responseSearchInput" placeholder="Search responses...">
</div>
<div class="view-toggles">
<button id="viewTableBtn" class="btn btn-sm active">
<i class="fa-solid fa-table"></i> Table
</button>
<button id="viewStatsBtn" class="btn btn-sm">
<i class="fa-solid fa-chart-pie"></i> Stats
</button>
<button id="viewIndividualBtn" class="btn btn-sm">
<i class="fa-solid fa-user"></i> Individual
</button>
</div>
<button id="toggleFilterBtn" class="btn btn-outline-secondary btn-sm">
<i class="fa-solid fa-filter"></i> Filters
</button>
<div class="sort-box" style="display: flex; align-items: center; gap: 8px;">
<label
style="font-size: 0.8rem; color: var(--text-muted); font-weight: 500;">Sort:</label>
<select id="responseSortOrder" class="modal-input filter-select"
style="margin: 0; padding: 6px 30px 6px 12px; font-size: 0.85rem; min-width: 140px;">
<option value="desc">Newest First</option>
<option value="asc">Oldest First</option>
</select>
</div>
</div>
<div id="filterPanel" class="filter-panel">
<div class="filter-header">
<h4 class="filter-title">Active Filters</h4>
<button id="clearFiltersBtn" class="btn btn-link btn-sm"
style="color:var(--text-muted); padding:0; text-decoration:none;">Clear All</button>
</div>
<div id="filterList" class="filter-list">
<!-- Dynamic filters will go here -->
</div>
</div>
<div id="statsView" class="stats-view">
<div id="statsContent" class="stats-content">
<!-- Aggregated stats will go here -->
</div>
</div>
<div id="individualView" class="stats-view"
style="display:none; max-width:800px; margin:0 auto;">
<div class="filter-header"
style="margin-bottom:20px; background:var(--bg-secondary); padding:10px 15px; border-radius:var(--radius); border:1px solid var(--border);">
<div style="display:flex; align-items:center; gap:15px;">
<button id="prevEntryBtn" class="btn btn-sm btn-outline-secondary"><i
class="fa-solid fa-chevron-left"></i></button>
<span id="entryCounter"
style="font-size:0.9rem; font-weight:600; color:var(--text-main);">Entry 0 of
0</span>
<button id="nextEntryBtn" class="btn btn-sm btn-outline-secondary"><i
class="fa-solid fa-chevron-right"></i></button>
</div>
<div id="entryTimestamp" style="font-size:0.85rem; color:var(--text-muted);"></div>
</div>
<div id="individualEntryContent" class="card"
style="margin:0; padding:25px; border-radius:var(--radius);">
<!-- Single entry fields will go here -->
</div>
</div>
<div id="responsesMeta" class="responses-meta"></div>
<div id="responsesTable" class="responses-table-wrapper"></div>
</div>
</section>
</div>
<!-- Admin Footer -->
<div class="admin-footer">
<p>© <span id="currentYear">2026</span> KumoFumi Cloud Forms by Zeon. All rights reserved.</p>
</div>
<script>
document.getElementById('currentYear').textContent = new Date().getFullYear();
</script>
</main>
<!-- Mobile Menu Toggle -->
<button class="mobile-menu-toggle" id="mobileMenuToggle" aria-label="Toggle Menu">
<i class="fa-solid fa-bars"></i>
</button>
</div>
<!-- Field Editor Sidebar (Popup) -->
<div id="editorSidebar" class="editor-sidebar">
<div class="sidebar-content">
<div class="sidebar-header-panel">
<h3 id="sidebarTitle">Edit Field</h3>
<span class="close-sidebar">×</span>
</div>
<div class="sidebar-body">
<div class="form-group">
<label id="editLabelTitle">Field Label / Section Title</label>
<input type="text" id="editLabel" placeholder="e.g., T-Shirt Size">
</div>
<div class="form-group" id="editDescriptionContainer" style="display:none;">
<label>Section Description (Optional)</label>
<textarea id="editDescription" rows="3" placeholder="Add a description for this section..." style="width:100%; padding:8px; border:1px solid var(--border); border-radius:4px; font-family:inherit;"></textarea>
</div>
<div class="form-group">
<label style="margin-bottom:12px; display:block;">Select Field Type</label>
<select id="editType" style="display:none;">
<option value="text">Short Text</option>
<option value="textarea">Long Text</option>
<option value="email">Email</option>
<option value="tel">Phone Number</option>
<option value="radio">Single Choice (Radio)</option>
<option value="checkbox_group">Multiple Choice (Checkbox)</option>
<option value="select">Dropdown</option>
<option value="date">Date (Calendar Picker)</option>
<option value="checkbox">Confirmation (Single Checkbox)</option>
<option value="description">Description Text (No Input)</option>
<option value="success_link">Success Page Link (WhatsApp)</option>
<option value="image">Display Image (QR/Banner)</option>
<option value="file">File Upload (PDF/IMG)</option>
<option value="scale">Scale Rating</option>
<option value="section_break">Section Break</option>
</select>
<div id="fieldTypeGrid" style="display: flex; flex-direction: column; gap: 16px; margin-top: 5px;">
<div class="field-category">
<div class="category-title" style="font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;">Basic Inputs</div>
<div style="display:grid; grid-template-columns:1fr 1fr; gap:8px;">
<div class="type-btn" data-value="text"><i class="fa-solid fa-minus"></i> <span>Short Text</span></div>
<div class="type-btn" data-value="textarea"><i class="fa-solid fa-align-left"></i> <span>Long Text</span></div>
<div class="type-btn" data-value="email"><i class="fa-solid fa-at"></i> <span>Email</span></div>
<div class="type-btn" data-value="tel"><i class="fa-solid fa-phone"></i> <span>Phone</span></div>
</div>
</div>
<div class="field-category">
<div class="category-title" style="font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;">Choices</div>
<div style="display:grid; grid-template-columns:1fr 1fr; gap:8px;">
<div class="type-btn" data-value="radio"><i class="fa-regular fa-circle-dot"></i> <span>Single Choice</span></div>
<div class="type-btn" data-value="checkbox_group"><i class="fa-regular fa-square-check"></i> <span>Multiple Choice</span></div>
<div class="type-btn" data-value="select"><i class="fa-solid fa-caret-down"></i> <span>Dropdown</span></div>
<div class="type-btn" data-value="checkbox"><i class="fa-solid fa-check"></i> <span>Confirmation</span></div>
</div>
</div>
<div class="field-category">
<div class="category-title" style="font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;">Advanced</div>
<div style="display:grid; grid-template-columns:1fr 1fr; gap:8px;">
<div class="type-btn" data-value="date"><i class="fa-regular fa-calendar"></i> <span>Date Picker</span></div>
<div class="type-btn" data-value="file"><i class="fa-solid fa-cloud-arrow-up"></i> <span>File Upload</span></div>
<div class="type-btn" data-value="scale" style="grid-column: 1 / -1;"><i class="fa-solid fa-arrows-left-right-to-line"></i> <span>Scale Rating (Min to Max)</span></div>
</div>
</div>
<div class="field-category">
<div class="category-title" style="font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;">Layout & Media</div>
<div style="display:grid; grid-template-columns:1fr 1fr; gap:8px;">
<div class="type-btn" data-value="description"><i class="fa-solid fa-font"></i> <span>Text Block</span></div>
<div class="type-btn" data-value="image"><i class="fa-regular fa-image"></i> <span>Display Image</span></div>
<div class="type-btn" data-value="success_link"><i class="fa-brands fa-whatsapp"></i> <span>Action Link</span></div>
</div>
</div>
</div>
<style>
.type-btn {
border: 1px solid var(--border);
background: var(--bg-body);
padding: 8px 12px;
border-radius: 8px;
text-align: left;
cursor: pointer;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
font-size: 0.85rem;
font-weight: 500;
color: var(--text-main);
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
gap: 10px;
box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.type-btn:hover {
border-color: var(--primary);
background: rgba(37,99,235,0.04);
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(37,99,235,0.08);
}
.type-btn.active {
border-color: var(--primary);
background: rgba(37,99,235,0.1);
color: var(--primary);
box-shadow: inset 0 0 0 1px var(--primary);
}
.type-btn.active i {
color: var(--primary) !important;
opacity: 1;
}
.type-btn i {
font-size: 1.1rem;
width: 20px;
text-align: center;
opacity: 0.7;
color: var(--text-secondary);
transition: all 0.2s;
}
/* Sidebar Input Enhancements */
.editor-sidebar input[type="text"],
.editor-sidebar input[type="number"],
.editor-sidebar select,
.editor-sidebar textarea {
background: var(--bg-body);
border: 1px solid var(--border);
border-radius: 8px;
padding: 0 12px;
height: 40px;
font-size: 0.9rem;
transition: all 0.2s ease;
color: var(--text-main);
box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
box-sizing: border-box;
}
.editor-sidebar textarea {
height: auto;
padding: 10px 12px;
}
.editor-sidebar select {
padding-right: 24px;
text-overflow: ellipsis;
}
.editor-sidebar input:focus,
.editor-sidebar select:focus,
.editor-sidebar textarea:focus {
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
outline: none;
}
.editor-sidebar .form-group label {
font-weight: 600;
font-size: 0.9rem;
color: var(--text-main);
margin-bottom: 6px;
display: block;
}
.editor-sidebar .theme-hint-box {
background: rgba(37,99,235,0.02);
border: 1px solid rgba(37,99,235,0.1);
}
</style>
<script>
document.addEventListener('DOMContentLoaded', () => {
const selectEl = document.getElementById('editType');
const btns = document.querySelectorAll('.type-btn');
function updateVisualGrid(val) {
btns.forEach(btn => {
if(btn.dataset.value === val) btn.classList.add('active');
else btn.classList.remove('active');
});
}
// Handle click on grid
btns.forEach(btn => {
btn.addEventListener('click', () => {
const val = btn.dataset.value;
selectEl.value = val;
updateVisualGrid(val);
// Manually trigger change event for admin.js conditional logic
selectEl.dispatchEvent(new Event('change'));
});
});
// Intercept programmatic setting of the select value by admin.js
const originalDescriptor = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, 'value');
Object.defineProperty(selectEl, 'value', {
get: function() {
return originalDescriptor.get.call(this);
},
set: function(val) {
originalDescriptor.set.call(this, val);
updateVisualGrid(val);
}
});
updateVisualGrid(selectEl.value || 'text');
});
</script>
</div>
<div id="mediaUrlContainer" class="form-group theme-hint-box"
style="display:none; padding:15px; border-radius:8px;">
<label>Image Source URL</label>
<input type="text" id="editMediaUrl" placeholder="your image url"
style="margin-bottom: 10px;">
<div id="sidebarImagePreviewContainer"
style="margin-bottom: 15px; display: none; text-align: center; background: var(--bg-body); padding: 10px; border-radius: 6px; border: 1px solid var(--border);">
<img id="sidebarImagePreview" src=""
style="max-width: 100%; max-height: 150px; border-radius: 4px; display: block; margin: 0 auto;">
</div>
<label style="font-size: 0.8rem; opacity: 0.8;">Or Upload Image</label>
<input type="file" id="editImageUpload" accept="image/*" style="font-size: 0.8rem;">
<p id="imageUploadStatus" class="hint" style="margin-top: 5px; font-weight: 500;"></p>
</div>
<div id="linkUrlContainer" class="form-group theme-hint-box"
style="display:none; padding:15px; border-radius:8px;">
<label>App / Platform</label>
<select id="editLinkApp" style="margin-bottom: 10px;">
<option value="whatsapp">WhatsApp</option>
<option value="telegram">Telegram</option>
<option value="instagram">Instagram</option>
<option value="youtube">YouTube</option>
<option value="custom">Custom (Default Link)</option>
</select>
<label>Link URL (e.g., https://chat.whatsapp.com/...)</label>
<input type="text" id="editLinkUrl" placeholder="https://...">
</div>
<div id="scaleLimitContainer" class="form-group theme-hint-box"
style="display:none; padding:15px; border-radius:8px;">
<label>Scale Range (Min to Max)</label>
<div style="display:flex; gap:10px; margin-bottom: 5px;">
<input type="number" id="editScaleMin" placeholder="Min (e.g., 0)" value="0" style="flex:1;">
<span style="display:flex; align-items:center; font-weight:600;">to</span>
<input type="number" id="editScaleLimit" placeholder="Max (e.g., 10)" value="10" min="1" max="100" style="flex:1;">
</div>
<p class="hint">Users can select a value within this range.</p>
</div>
<div id="scaleBranchingContainer" class="form-group theme-hint-box"
style="display:none; padding:15px; border-radius:8px;">
<label>Scale Branching (Optional)</label>
<div id="scaleBranchingList" style="display:flex; flex-direction:column; gap:8px;"></div>
<p class="hint">Define where the user goes next based on their selected scale value.</p>
</div>
<div class="form-group checkbox-toggle">
<label style="display:flex; align-items:center; cursor:pointer;">
<input type="checkbox" id="editRequired" style="width:20px; height:20px; margin-right:10px;">
Make this field mandatory
</label>
</div>
<!-- Options Editor (for Radio/Checkbox/Select) -->
<div id="optionsContainer"
style="display:none; border-top:1px solid var(--border); padding-top:15px; margin-top:15px;">
<label>Options</label>
<div id="optionsList"></div>
<button id="addOptionBtn" class="btn" style="width: 100%; margin-top: 10px; background: transparent; border: 1px dashed var(--primary); color: var(--primary); padding: 10px; border-radius: 8px; font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s;">
<i class="fa-solid fa-plus"></i> Add Option
</button>
</div>
</div>
<div class="sidebar-footer-panel">
<button id="deleteFieldBtn" class="btn btn-outline-danger" style="margin-right:auto;">Delete</button>
<button id="saveFieldBtn" class="btn btn-primary" style="width:140px;">Save Field</button>
</div>
</div>
</div>
<div id="sidebarOverlay" class="sidebar-overlay"></div>
<!-- Custom Minimal Modal -->
<div id="customModal" class="modal-overlay">
<div class="modal-card">
<h3 id="modalTitle">Confirm Action</h3>
<p id="modalMessage">Are you sure?</p>
<input type="text" id="modalInput" class="modal-input" placeholder="Enter value...">
<div class="modal-actions">
<button id="modalCancel" class="btn btn-outline-secondary">Cancel</button>
<button id="modalConfirm" class="btn btn-primary">Confirm</button>
</div>
</div>
</div>
<!-- Cloudinary Help Modal -->
<div id="cloudinaryHelpModal" class="modal-overlay">
<div class="modal-card" style="max-width: 500px; text-align: left;">
<h3 style="margin-top:0; color:var(--primary); display:flex; align-items:center; gap:8px;">
<i class="fa-solid fa-cloud-arrow-up"></i> Cloudinary Setup Guide
</h3>
<div style="font-size: 0.95rem; line-height: 1.6; color: var(--text-main); margin-bottom: 20px;">
<ol style="padding-left: 20px; margin-bottom: 0;">
<li style="margin-bottom: 10px;">Sign up for a free account at <strong>cloudinary.com</strong>.</li>
<li style="margin-bottom: 10px;">In your Cloudinary Dashboard, find your <strong>Cloud Name</strong> at the top right or in your programmable media settings.</li>
<li style="margin-bottom: 10px;">Go to <strong>Settings > Upload</strong> (gear icon).</li>
<li style="margin-bottom: 10px;">Scroll down to <strong>Upload presets</strong> and click <strong>Add upload preset</strong>.</li>
<li style="margin-bottom: 10px;">Set "Signing Mode" to <strong>Unsigned</strong>. Save it and copy the Preset Name.</li>
<li>Paste your Cloud Name and Preset Name here in KumoFumi and click <strong>Save Config</strong>.</li>
</ol>
</div>
<div class="modal-actions" style="justify-content: flex-end;">
<button id="closeCloudinaryHelpModal" class="btn btn-primary">Got it!</button>
</div>
</div>
</div>
<!-- Edit Response Modal -->
<div id="editResponseModal" class="modal-overlay">
<div class="modal-card" style="max-width: 600px; max-height: 80vh; overflow-y: auto;">
<h3>Edit Response</h3>
<div id="editResponseFields" style="margin-top: 15px;">
<!-- Dynamic form fields for editing -->
</div>
<div class="modal-actions" style="margin-top: 20px;">
<button id="cancelEditResponse" class="btn btn-outline-secondary">Cancel</button>
<button id="saveEditResponse" class="btn btn-primary">Save Changes</button>
</div>
</div>
</div>
<!-- Cloudinary Help Modal -->
<div id="cloudinaryHelpModal" class="modal-overlay">
<div class="modal-card" style="max-width: 500px;">
<h3><i class="fa-solid fa-cloud"></i> Cloudinary Setup Guide</h3>
<div style="font-size: 0.95rem; line-height: 1.6; color: var(--text-main); margin-top: 15px;">
<p>To enable <strong>File Uploads</strong>, you need an unsigned upload preset:</p>
<ol style="padding-left: 20px; margin: 15px 0;">
<li>Log in to <a href="https://cloudinary.com/console" target="_blank"
style="color:var(--primary);">Cloudinary Console</a>.</li>
<li>Go to <strong>Settings</strong> (gear icon) > <strong>Upload</strong> tab.</li>
<li>Scroll to <strong>Upload presets</strong> and click <strong>Add upload preset</strong>.</li>
<li>Change "Signing Mode" to <strong>Unsigned</strong>.</li>
<li>Copy the generated <strong>Preset Name</strong> (e.g., <code>ml_default</code>).</li>
<li>Paste your <strong>Cloud Name</strong> and <strong>Preset Name</strong> in the builder.</li>
</ol>
<p class="hint"
style="background: var(--bg-body); padding: 10px; border-radius: 6px; border-left: 4px solid var(--primary);">
<i class="fa-solid fa-circle-info"></i> Unsigned presets allow direct uploads from users without
exposing your API credentials.
</p>
</div>
<div class="modal-actions" style="margin-top: 25px;">
<button id="closeCloudinaryHelp" class="btn btn-primary" style="width: 100%;">Got it!</button>
</div>
</div>
</div>
<style>
/* ===== DRAG & DROP FIELD REORDER ===== */
.field-item {
transition: opacity 0.15s, box-shadow 0.15s, transform 0.15s;
}
.field-item.dragging {
opacity: 0.4;
box-shadow: 0 8px 24px rgba(0,0,0,0.15);
transform: scale(0.99);
}
.field-item.drag-over {
border-top: 2px solid var(--primary, #2563eb) !important;
background: var(--bg-secondary, #f9fafb);
}
.drag-handle:hover {
color: var(--primary, #2563eb) !important;
background: var(--bg-secondary, #f3f4f6);
}
.drag-handle:active {
cursor: grabbing;
}
/* ===== RESPONSES PANEL ===== */
#responses {
width: 100%;
}
.responses-panel {
background: var(--bg-card);
padding: 20px;
border-radius: var(--radius);
}
.responses-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.responses-meta {
margin-bottom: 15px;
color: var(--text-secondary);
}
.responses-table-wrapper table {
width: 100%;
border-collapse: collapse;
}
.responses-table-wrapper th,
.responses-table-wrapper td {
border: 1px solid var(--border);
padding: 8px;
font-size: 0.9rem;
}
.responses-table-wrapper th {
background: var(--bg-secondary);
font-weight: 600;
}
/* Minimal Modal Styles */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.4);
backdrop-filter: blur(4px);
z-index: 4000;
display: none;
justify-content: center;
align-items: center;
opacity: 0;
transition: opacity 0.2s ease;
}
.modal-overlay.show {
display: flex;
opacity: 1;
}
.modal-card {
background: var(--bg-card);
padding: 25px;
border-radius: 12px;
width: 90%;
max-width: 400px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
transform: scale(0.95);
transition: transform 0.2s ease;
border: 1px solid var(--border);
}
.modal-overlay.show .modal-card {
transform: scale(1);
}
.modal-card h3 {
margin: 0 0 10px 0;
color: var(--text-main);
font-size: 1.25rem;
}
.modal-card p {
margin: 0 0 20px 0;
color: var(--text-secondary);
font-size: 0.95rem;
line-height: 1.5;
}
.modal-input {
width: 100%;
padding: 10px;
border: 1px solid var(--border);
border-radius: var(--radius);
margin-bottom: 20px;
font-family: inherit;
font-size: 1rem;
background: var(--bg-main);
color: var(--text-main);
}
.modal-actions {
display: flex;
justify-content: flex-end;
gap: 10px;
}
</style>
<!-- Image Preview Modal -->
<div id="imagePreviewModal" class="modal-overlay">
<div class="modal-card" style="max-width: 800px; padding: 15px;">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px;">
<h3 id="previewModalTitle" style="margin:0; font-size:1.1rem;">Image Preview</h3>
<span id="closeImagePreview"
style="cursor:pointer; font-size:1.5rem; line-height:1; color: var(--text-main);">×</span>
</div>
<div
style="text-align:center; background: var(--bg-body); border-radius: 8px; overflow: hidden; min-height: 200px; display: flex; align-items:center; justify-content:center; border: 1px solid var(--border);">
<img id="modalPreviewImage" src=""
style="max-width: 100%; max-height: 70vh; object-fit: contain; display: block;">
</div>
<div style="margin-top: 15px; display: flex; justify-content: flex-end; gap: 10px;">
<a id="downloadPreviewLink" href="" download class="btn btn-outline-primary btn-sm">
<i class="fa-solid fa-download"></i> Download