File size: 64,773 Bytes
b8a6467
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cb15347
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19bce99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
 
 
 
 
 
cb15347
 
 
 
19bce99
 
 
 
 
b8a6467
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19bce99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cb15347
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19bce99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
19bce99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
 
19bce99
 
 
b8a6467
 
 
19bce99
 
b8a6467
19bce99
 
 
 
 
 
 
b8a6467
 
19bce99
b8a6467
19bce99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
 
19bce99
b8a6467
19bce99
 
b8a6467
 
19bce99
 
b8a6467
19bce99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
19bce99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
19bce99
 
 
 
 
 
 
 
 
b8a6467
19bce99
 
b8a6467
19bce99
 
 
 
 
 
 
 
 
 
 
 
b8a6467
19bce99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
19bce99
 
 
 
 
 
 
 
cb15347
19bce99
cb15347
19bce99
 
 
 
 
 
 
 
 
 
 
 
cb15347
19bce99
cb15347
19bce99
 
 
 
cb15347
19bce99
 
 
cb15347
19bce99
 
 
 
 
cb15347
19bce99
cb15347
19bce99
 
 
b8a6467
19bce99
 
b8a6467
19bce99
 
 
 
b8a6467
 
19bce99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
 
19bce99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
19bce99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
19bce99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
19bce99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
19bce99
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
19bce99
 
 
 
 
 
 
 
 
 
 
 
 
b8a6467
19bce99
 
b8a6467
 
 
 
19bce99
b8a6467
 
 
 
19bce99
 
b8a6467
 
19bce99
b8a6467
 
 
19bce99
 
 
 
 
 
 
 
 
 
 
b8a6467
19bce99
 
 
 
 
 
 
 
b8a6467
19bce99
 
 
 
 
 
b8a6467
19bce99
 
 
 
 
 
 
 
 
 
b8a6467
19bce99
 
b8a6467
 
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
<!DOCTYPE html>
<html lang="pt-BR" class="dark">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Pedidos de Compra</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <style>
        .status-em-elaboracao {
            background-color: rgba(59, 130, 246, 0.2);
            color: rgb(59, 130, 246);
        }
        .status-aguardando-aprovacao {
            background-color: rgba(234, 179, 8, 0.2);
            color: rgb(234, 179, 8);
        }
        .status-aprovado {
            background-color: rgba(34, 197, 94, 0.2);
            color: rgb(34, 197, 94);
        }
        .status-enviado {
            background-color: rgba(168, 85, 247, 0.2);
            color: rgb(168, 85, 247);
        }
        .status-recebido-parcial {
            background-color: rgba(249, 115, 22, 0.2);
            color: rgb(249, 115, 22);
        }
        .status-recebido-total {
            background-color: rgba(16, 185, 129, 0.2);
            color: rgb(16, 185, 129);
        }
        .status-cancelado {
            background-color: rgba(239, 68, 68, 0.2);
            color: rgb(239, 68, 68);
        }
        
        .item-status-pendente {
            background-color: rgba(239, 68, 68, 0.2);
            color: rgb(239, 68, 68);
        }
        .item-status-recebido {
            background-color: rgba(16, 185, 129, 0.2);
            color: rgb(16, 185, 129);
        }
        .item-status-parcial {
            background-color: rgba(249, 115, 22, 0.2);
            color: rgb(249, 115, 22);
        }
        
        .dark .modal-content {
            background-color: #1f2937;
        }
        
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.7);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }
        
        .modal-content {
            background-color: white;
            border-radius: 0.5rem;
            width: 90%;
            max-width: 1200px;
            max-height: 90vh;
            overflow-y: auto;
            padding: 1.5rem;
        }
        
        .offcanvas {
            position: fixed;
            top: 0;
            right: 0;
            width: 50%;
            height: 100vh;
            background-color: white;
            box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
            transform: translateX(100%);
            transition: transform 0.3s ease;
            z-index: 1050;
            overflow-y: auto;
        }
        
        .offcanvas.show {
            transform: translateX(0);
        }
        
        .offcanvas-header {
            padding: 1rem;
            border-bottom: 1px solid #e5e7eb;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .offcanvas-body {
            padding: 1rem;
        }
        
        .dark .offcanvas {
            background-color: #1f2937;
            color: white;
        }
        
        .dark .offcanvas-header {
            border-bottom-color: #374151;
        }
        
        /* Notification Dropdown Styles */
        .notification-container {
            position: relative;
            display: inline-block;
        }
        
        .notification-badge {
            position: absolute;
            top: -5px;
            right: -5px;
            background-color: #ef4444;
            color: white;
            border-radius: 50%;
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: bold;
        }
        
        .notification-dropdown {
            position: absolute;
            right: 0;
            top: 100%;
            width: 350px;
            max-height: 400px;
            overflow-y: auto;
            background-color: white;
            border-radius: 0.5rem;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            z-index: 1100;
            display: none;
        }
        
        .dark .notification-dropdown {
            background-color: #1f2937;
            border: 1px solid #374151;
        }
        
        .notification-dropdown.show {
            display: block;
        }
        
        .notification-header {
            padding: 1rem;
            border-bottom: 1px solid #e5e7eb;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .dark .notification-header {
            border-bottom-color: #374151;
        }
        
        .notification-item {
            padding: 1rem;
            border-bottom: 1px solid #e5e7eb;
            cursor: pointer;
            transition: background-color 0.2s;
        }
        
        .dark .notification-item {
            border-bottom-color: #374151;
        }
        
        .notification-item:hover {
            background-color: #f3f4f6;
        }
        
        .dark .notification-item:hover {
            background-color: #374151;
        }
        
        .notification-item.unread {
            background-color: #f0f9ff;
        }
        
        .dark .notification-item.unread {
            background-color: #1e3a8a;
        }
        
        .notification-time {
            font-size: 0.75rem;
            color: #6b7280;
            margin-top: 0.25rem;
        }
        
        .dark .notification-time {
            color: #9ca3af;
        }
        
        .notification-footer {
            padding: 0.75rem;
            text-align: center;
            border-top: 1px solid #e5e7eb;
        }
        
        .dark .notification-footer {
            border-top-color: #374151;
        }
        
        @media (max-width: 768px) {
            .responsive-table {
                display: block;
                overflow-x: auto;
                white-space: nowrap;
            }
            
            .offcanvas {
                width: 90%;
            }
            
            .notification-dropdown {
                width: 280px;
                right: -50px;
            }
        }
    </style>
</head>
<body class="dark:bg-gray-900 dark:text-gray-100 min-h-screen transition-colors duration-300">
    <div class="container mx-auto px-4 py-8">
        <!-- Header -->
        <div class="flex flex-col md:flex-row justify-between items-start md:items-center mb-8 gap-4">
            <div>
                <h1 class="text-3xl font-bold">Pedidos de Compra</h1>
                <p class="text-gray-500 dark:text-gray-400">Gerencie todos os pedidos de compra da sua empresa</p>
            </div>
            <div class="flex items-center gap-4">
                <button id="theme-toggle" class="p-2 rounded-full bg-gray-200 dark:bg-gray-700">
                    <i class="fas fa-moon dark:hidden"></i>
                    <i class="fas fa-sun hidden dark:inline"></i>
                </button>
                
                <!-- Notification Bell -->
                <div class="notification-container">
                    <button id="notification-btn" class="p-2 rounded-full bg-gray-200 dark:bg-gray-700 relative">
                        <i class="fas fa-bell"></i>
                        <span class="notification-badge">6</span>
                    </button>
                    <div id="notification-dropdown" class="notification-dropdown">
                        <div class="notification-header">
                            <h3 class="font-semibold">Notificações</h3>
                            <button id="mark-all-read" class="text-blue-600 dark:text-blue-400 text-sm">Marcar todas como lidas</button>
                        </div>
                        <div class="overflow-y-auto max-h-80">
                            <div class="notification-item unread">
                                <div class="font-medium">Novo pedido aprovado</div>
                                <p class="text-sm">Pedido PC-2023-010 foi aprovado pelo gestor</p>
                                <div class="notification-time">Há 5 minutos</div>
                            </div>
                            <div class="notification-item unread">
                                <div class="font-medium">Recebimento parcial</div>
                                <p class="text-sm">3 itens do pedido PC-2023-008 foram recebidos</p>
                                <div class="notification-time">Há 1 hora</div>
                            </div>
                            <div class="notification-item unread">
                                <div class="font-medium">Pedido enviado</div>
                                <p class="text-sm">Pedido PC-2023-009 foi enviado ao fornecedor</p>
                                <div class="notification-time">Hoje, 09:30</div>
                            </div>
                            <div class="notification-item">
                                <div class="font-medium">Aprovação pendente</div>
                                <p class="text-sm">Pedido PC-2023-011 aguarda sua aprovação</p>
                                <div class="notification-time">Ontem, 16:45</div>
                            </div>
                            <div class="notification-item">
                                <div class="font-medium">Fornecedor atualizado</div>
                                <p class="text-sm">Fornecedor A atualizou seus dados cadastrais</p>
                                <div class="notification-time">Ontem, 14:20</div>
                            </div>
                            <div class="notification-item">
                                <div class="font-medium">Novo comentário</div>
                                <p class="text-sm">João Silva comentou no pedido PC-2023-007</p>
                                <div class="notification-time">Ontem, 11:10</div>
                            </div>
                        </div>
                        <div class="notification-footer">
                            <a href="#" class="text-blue-600 dark:text-blue-400 text-sm">Ver todas as notificações</a>
                        </div>
                    </div>
                </div>
                
                <button id="new-order-btn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center gap-2">
                    <i class="fas fa-plus"></i> Novo Pedido de Compra
                </button>
            </div>
        </div>
        
        <!-- Filters -->
        <div class="bg-gray-100 dark:bg-gray-800 p-4 rounded-lg mb-6">
            <h2 class="text-lg font-semibold mb-4">Filtros</h2>
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
                <div>
                    <label for="supplier-filter" class="block text-sm font-medium mb-1">Fornecedor</label>
                    <select id="supplier-filter" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600">
                        <option value="">Todos</option>
                        <option value="1">Fornecedor A</option>
                        <option value="2">Fornecedor B</option>
                        <option value="3">Fornecedor C</option>
                    </select>
                </div>
                <div>
                    <label for="status-filter" class="block text-sm font-medium mb-1">Status</label>
                    <select id="status-filter" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600">
                        <option value="">Todos</option>
                        <option value="Em Elaboração">Em Elaboração</option>
                        <option value="Aguardando Aprovação">Aguardando Aprovação</option>
                        <option value="Aprovado">Aprovado</option>
                        <option value="Enviado">Enviado</option>
                        <option value="Recebido Parcial">Recebido Parcial</option>
                        <option value="Recebido Total">Recebido Total</option>
                        <option value="Cancelado">Cancelado</option>
                    </select>
                </div>
                <div>
                    <label for="responsible-filter" class="block text-sm font-medium mb-1">Responsável</label>
                    <select id="responsible-filter" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600">
                        <option value="">Todos</option>
                        <option value="1">João Silva</option>
                        <option value="2">Maria Souza</option>
                        <option value="3">Carlos Oliveira</option>
                    </select>
                </div>
                <div>
                    <label for="date-filter" class="block text-sm font-medium mb-1">Período</label>
                    <input type="date" id="date-filter" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600">
                </div>
            </div>
            <div class="flex justify-end mt-4">
                <button id="apply-filters" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg mr-2">
                    Aplicar Filtros
                </button>
                <button id="clear-filters" class="bg-gray-300 hover:bg-gray-400 dark:bg-gray-600 dark:hover:bg-gray-700 text-gray-800 dark:text-gray-200 px-4 py-2 rounded-lg">
                    Limpar
                </button>
            </div>
        </div>
        
        <!-- Orders Table -->
        <div class="bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden">
            <div class="responsive-table">
                <table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
                    <thead class="bg-gray-50 dark:bg-gray-700">
                        <tr>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Número</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Fornecedor</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Responsável</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Emissão</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Previsão Entrega</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Status</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Valor Total</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Ações</th>
                        </tr>
                    </thead>
                    <tbody class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700">
                        <!-- Sample Data -->
                        <tr>
                            <td class="px-6 py-4 whitespace-nowrap">PC-2023-001</td>
                            <td class="px-6 py-4 whitespace-nowrap">Fornecedor A</td>
                            <td class="px-6 py-4 whitespace-nowrap">João Silva</td>
                            <td class="px-6 py-4 whitespace-nowrap">10/05/2023</td>
                            <td class="px-6 py-4 whitespace-nowrap">25/05/2023</td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <span class="px-2 py-1 rounded-full text-xs font-semibold status-em-elaboracao">Em Elaboração</span>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">R$ 1.250,00</td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <button class="view-btn text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 mr-2" data-id="1">
                                    <i class="fas fa-eye"></i>
                                </button>
                                <button class="edit-btn text-yellow-600 hover:text-yellow-800 dark:text-yellow-400 dark:hover:text-yellow-300 mr-2" data-id="1">
                                    <i class="fas fa-edit"></i>
                                </button>
                                <button class="cancel-btn text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300 mr-2" data-id="1">
                                    <i class="fas fa-times-circle"></i>
                                </button>
                                <button class="print-btn text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-300" data-id="1">
                                    <i class="fas fa-print"></i>
                                </button>
                            </td>
                        </tr>
                        <tr>
                            <td class="px-6 py-4 whitespace-nowrap">PC-2023-002</td>
                            <td class="px-6 py-4 whitespace-nowrap">Fornecedor B</td>
                            <td class="px-6 py-4 whitespace-nowrap">Maria Souza</td>
                            <td class="px-6 py-4 whitespace-nowrap">12/05/2023</td>
                            <td class="px-6 py-4 whitespace-nowrap">30/05/2023</td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <span class="px-2 py-1 rounded-full text-xs font-semibold status-aguardando-aprovacao">Aguardando Aprovação</span>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">R$ 3.420,00</td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <button class="view-btn text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 mr-2" data-id="2">
                                    <i class="fas fa-eye"></i>
                                </button>
                                <button class="edit-btn text-yellow-600 hover:text-yellow-800 dark:text-yellow-400 dark:hover:text-yellow-300 mr-2" data-id="2">
                                    <i class="fas fa-edit"></i>
                                </button>
                                <button class="cancel-btn text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300 mr-2" data-id="2">
                                    <i class="fas fa-times-circle"></i>
                                </button>
                                <button class="print-btn text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-300" data-id="2">
                                    <i class="fas fa-print"></i>
                                </button>
                            </td>
                        </tr>
                        <tr>
                            <td class="px-6 py-4 whitespace-nowrap">PC-2023-003</td>
                            <td class="px-6 py-4 whitespace-nowrap">Fornecedor C</td>
                            <td class="px-6 py-4 whitespace-nowrap">Carlos Oliveira</td>
                            <td class="px-6 py-4 whitespace-nowrap">15/05/2023</td>
                            <td class="px-6 py-4 whitespace-nowrap">05/06/2023</td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <span class="px-2 py-1 rounded-full text-xs font-semibold status-aprovado">Aprovado</span>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">R$ 2.150,00</td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <button class="view-btn text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 mr-2" data-id="3">
                                    <i class="fas fa-eye"></i>
                                </button>
                                <button class="edit-btn text-yellow-600 hover:text-yellow-800 dark:text-yellow-400 dark:hover:text-yellow-300 mr-2" data-id="3">
                                    <i class="fas fa-edit"></i>
                                </button>
                                <button class="cancel-btn text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300 mr-2" data-id="3">
                                    <i class="fas fa-times-circle"></i>
                                </button>
                                <button class="print-btn text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-300" data-id="3">
                                    <i class="fas fa-print"></i>
                                </button>
                            </td>
                        </tr>
                        <tr>
                            <td class="px-6 py-4 whitespace-nowrap">PC-2023-004</td>
                            <td class="px-6 py-4 whitespace-nowrap">Fornecedor A</td>
                            <td class="px-6 py-4 whitespace-nowrap">João Silva</td>
                            <td class="px-6 py-4 whitespace-nowrap">18/05/2023</td>
                            <td class="px-6 py-4 whitespace-nowrap">10/06/2023</td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <span class="px-2 py-1 rounded-full text-xs font-semibold status-enviado">Enviado</span>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">R$ 4.750,00</td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <button class="view-btn text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 mr-2" data-id="4">
                                    <i class="fas fa-eye"></i>
                                </button>
                                <button class="edit-btn text-yellow-600 hover:text-yellow-800 dark:text-yellow-400 dark:hover:text-yellow-300 mr-2" data-id="4">
                                    <i class="fas fa-edit"></i>
                                </button>
                                <button class="cancel-btn text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300 mr-2" data-id="4">
                                    <i class="fas fa-times-circle"></i>
                                </button>
                                <button class="print-btn text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-300" data-id="4">
                                    <i class="fas fa-print"></i>
                                </button>
                            </td>
                        </tr>
                        <tr>
                            <td class="px-6 py-4 whitespace-nowrap">PC-2023-005</td>
                            <td class="px-6 py-4 whitespace-nowrap">Fornecedor B</td>
                            <td class="px-6 py-4 whitespace-nowrap">Maria Souza</td>
                            <td class="px-6 py-4 whitespace-nowrap">20/05/2023</td>
                            <td class="px-6 py-4 whitespace-nowrap">15/06/2023</td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <span class="px-2 py-1 rounded-full text-xs font-semibold status-recebido-parcial">Recebido Parcial</span>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">R$ 5.300,00</td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <button class="view-btn text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 mr-2" data-id="5">
                                    <i class="fas fa-eye"></i>
                                </button>
                                <button class="edit-btn text-yellow-600 hover:text-yellow-800 dark:text-yellow-400 dark:hover:text-yellow-300 mr-2" data-id="5">
                                    <i class="fas fa-edit"></i>
                                </button>
                                <button class="cancel-btn text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300 mr-2" data-id="5">
                                    <i class="fas fa-times-circle"></i>
                                </button>
                                <button class="print-btn text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-300" data-id="5">
                                    <i class="fas fa-print"></i>
                                </button>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        
        <!-- Pagination -->
        <div class="flex justify-between items-center mt-6">
            <div class="text-sm text-gray-500 dark:text-gray-400">
                Mostrando 1 a 5 de 15 registros
            </div>
            <div class="flex gap-1">
                <button class="px-3 py-1 rounded-lg bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300">
                    <i class="fas fa-angle-left"></i>
                </button>
                <button class="px-3 py-1 rounded-lg bg-blue-600 text-white">1</button>
                <button class="px-3 py-1 rounded-lg bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600">2</button>
                <button class="px-3 py-1 rounded-lg bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600">3</button>
                <button class="px-3 py-1 rounded-lg bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300">
                    <i class="fas fa-angle-right"></i>
                </button>
            </div>
        </div>
    </div>
    
    <!-- New Order Offcanvas -->
    <div id="new-order-offcanvas" class="offcanvas">
        <div class="offcanvas-header">
            <h2 class="text-xl font-bold">Novo Pedido de Compra</h2>
            <button id="close-new-order" class="text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200">
                <i class="fas fa-times text-xl"></i>
            </button>
        </div>
        <div class="offcanvas-body">
            <form id="new-order-form" class="space-y-4">
                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                    <div>
                        <label for="supplier-select" class="block text-sm font-medium mb-1">Fornecedor</label>
                        <select id="supplier-select" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600" required>
                            <option value="">Selecione um fornecedor</option>
                            <option value="1">Fornecedor A</option>
                            <option value="2">Fornecedor B</option>
                            <option value="3">Fornecedor C</option>
                        </select>
                    </div>
                    
                    <div>
                        <label for="responsible-select" class="block text-sm font-medium mb-1">Responsável</label>
                        <select id="responsible-select" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600" required>
                            <option value="">Selecione o responsável</option>
                            <option value="1">João Silva</option>
                            <option value="2">Maria Souza</option>
                            <option value="3">Carlos Oliveira</option>
                        </select>
                    </div>
                    
                    <div>
                        <label for="payment-terms" class="block text-sm font-medium mb-1">Condição de Pagamento</label>
                        <select id="payment-terms" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600" required>
                            <option value="">Selecione a condição</option>
                            <option value="30">30 dias</option>
                            <option value="60">60 dias</option>
                            <option value="90">90 dias</option>
                            <option value="30/60/90">30/60/90 dias</option>
                        </select>
                    </div>
                    
                    <div>
                        <label for="delivery-date" class="block text-sm font-medium mb-1">Previsão de Entrega</label>
                        <input type="date" id="delivery-date" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600" required>
                    </div>
                </div>
                
                <div>
                    <label for="order-notes" class="block text-sm font-medium mb-1">Observações</label>
                    <textarea id="order-notes" rows="3" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600"></textarea>
                </div>
                
                <div class="mt-6">
                    <h3 class="text-lg font-semibold mb-4">Itens do Pedido</h3>
                    
                    <div class="responsive-table mb-4">
                        <table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
                            <thead class="bg-gray-50 dark:bg-gray-700">
                                <tr>
                                    <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Produto</th>
                                    <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Quantidade</th>
                                    <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Valor Unitário</th>
                                    <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Ações</th>
                                </tr>
                            </thead>
                            <tbody id="order-items-list" class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700">
                                <!-- Items will be added here dynamically -->
                            </tbody>
                        </table>
                    </div>
                    
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-4">
                        <div>
                            <label for="product-select" class="block text-sm font-medium mb-1">Produto</label>
                            <select id="product-select" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600">
                                <option value="">Selecione um produto</option>
                                <option value="1">Produto X</option>
                                <option value="2">Produto Y</option>
                                <option value="3">Produto Z</option>
                            </select>
                        </div>
                        
                        <div>
                            <label for="item-quantity" class="block text-sm font-medium mb-1">Quantidade</label>
                            <input type="number" id="item-quantity" min="1" value="1" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600">
                        </div>
                        
                        <div>
                            <label for="item-unit-price" class="block text-sm font-medium mb-1">Valor Unitário</label>
                            <input type="text" id="item-unit-price" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600 money">
                        </div>
                    </div>
                    
                    <button type="button" id="add-item-to-order" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm flex items-center gap-1">
                        <i class="fas fa-plus"></i> Adicionar Item
                    </button>
                </div>
                
                <div class="flex justify-end gap-3 pt-6 border-t border-gray-200 dark:border-gray-700">
                    <button type="button" id="cancel-new-order" class="bg-gray-300 hover:bg-gray-400 dark:bg-gray-600 dark:hover:bg-gray-700 text-gray-800 dark:text-gray-200 px-4 py-2 rounded-lg">
                        Cancelar
                    </button>
                    <button type="submit" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2">
                        <i class="fas fa-save"></i> Salvar Pedido
                    </button>
                </div>
            </form>
        </div>
    </div>
    
    <!-- Order Detail Modal -->
    <div id="order-detail-modal" class="modal-overlay hidden">
        <div class="modal-content">
            <div class="flex justify-between items-center mb-6">
                <h2 class="text-2xl font-bold">Detalhes do Pedido de Compra</h2>
                <button id="close-modal" class="text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200">
                    <i class="fas fa-times text-2xl"></i>
                </button>
            </div>
            
            <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
                <div class="bg-gray-100 dark:bg-gray-700 p-4 rounded-lg">
                    <h3 class="text-lg font-semibold mb-4">Dados do Pedido</h3>
                    <div class="space-y-3">
                        <div>
                            <p class="text-sm text-gray-500 dark:text-gray-400">Número do Pedido</p>
                            <p class="font-medium" id="order-number">PC-2023-001</p>
                        </div>
                        <div>
                            <p class="text-sm text-gray-500 dark:text-gray-400">Status</p>
                            <p class="font-medium"><span class="px-2 py-1 rounded-full text-xs font-semibold status-em-elaboracao" id="order-status">Em Elaboração</span></p>
                        </div>
                        <div>
                            <p class="text-sm text-gray-500 dark:text-gray-400">Data de Emissão</p>
                            <p class="font-medium" id="order-date">10/05/2023</p>
                        </div>
                        <div>
                            <p class="text-sm text-gray-500 dark:text-gray-400">Previsão de Entrega</p>
                            <p class="font-medium" id="order-delivery-date">25/05/2023</p>
                        </div>
                    </div>
                </div>
                
                <div class="bg-gray-100 dark:bg-gray-700 p-4 rounded-lg">
                    <h3 class="text-lg font-semibold mb-4">Dados do Fornecedor</h3>
                    <div class="space-y-3">
                        <div>
                            <p class="text-sm text-gray-500 dark:text-gray-400">Fornecedor</p>
                            <p class="font-medium" id="supplier-name">Fornecedor A</p>
                        </div>
                        <div>
                            <p class="text-sm text-gray-500 dark:text-gray-400">CNPJ</p>
                            <p class="font-medium" id="supplier-cnpj">12.345.678/0001-90</p>
                        </div>
                        <div>
                            <p class="text-sm text-gray-500 dark:text-gray-400">Contato</p>
                            <p class="font-medium" id="supplier-contact">[email protected]</p>
                        </div>
                    </div>
                </div>
                
                <div class="bg-gray-100 dark:bg-gray-700 p-4 rounded-lg">
                    <h3 class="text-lg font-semibold mb-4">Dados da Compra</h3>
                    <div class="space-y-3">
                        <div>
                            <p class="text-sm text-gray-500 dark:text-gray-400">Responsável</p>
                            <p class="font-medium" id="responsible-name">João Silva</p>
                        </div>
                        <div>
                            <p class="text-sm text-gray-500 dark:text-gray-400">Condição de Pagamento</p>
            <p class="font-medium" id="payment-terms">30/60/90 dias</p>
        </div>
        <div>
            <p class="text-sm text-gray-500 dark:text-gray-400">Valor Total</p>
            <p class="font-medium" id="order-total">R$ 1.250,00</p>
        </div>
    </div>
</div>

<div class="bg-gray-100 dark:bg-gray-700 p-4 rounded-lg">
    <h3 class="text-lg font-semibold mb-4">Observações</h3>
    <p class="text-sm" id="order-notes">Pedido com prioridade máxima. Favor confirmar disponibilidade antes do envio.</p>
</div>
</div>

<!-- Items Table -->
<div class="mb-8">
    <div class="flex justify-between items-center mb-4">
        <h3 class="text-lg font-semibold">Itens do Pedido</h3>
        <button id="add-item-btn" class="bg-blue-600 hover:bg-blue-700 text-white px-3 py-1 rounded-lg text-sm flex items-center gap-1">
            <i class="fas fa-plus"></i> Adicionar Item
        </button>
    </div>
    
    <div class="responsive-table">
        <table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
            <thead class="bg-gray-50 dark:bg-gray-700">
                <tr>
                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Produto</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Categoria</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Quantidade</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Valor Unitário</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Valor Total</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Recebido</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Status</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Ações</th>
                </tr>
            </thead>
            <tbody class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700">
                <tr>
                    <td class="px-6 py-4 whitespace-nowrap">Produto X</td>
                    <td class="px-6 py-4 whitespace-nowrap">Eletrônicos</td>
                    <td class="px-6 py-4 whitespace-nowrap">5</td>
                    <td class="px-6 py-4 whitespace-nowrap">R$ 150,00</td>
                    <td class="px-6 py-4 whitespace-nowrap">R$ 750,00</td>
                    <td class="px-6 py-4 whitespace-nowrap">0</td>
                    <td class="px-6 py-4 whitespace-nowrap">
                        <span class="px-2 py-1 rounded-full text-xs font-semibold item-status-pendente">Pendente</span>
                    </td>
                    <td class="px-6 py-4 whitespace-nowrap">
                        <button class="edit-item-btn text-yellow-600 hover:text-yellow-800 dark:text-yellow-400 dark:hover:text-yellow-300 mr-2">
                            <i class="fas fa-edit"></i>
                        </button>
                        <button class="receive-item-btn text-green-600 hover:text-green-800 dark:text-green-400 dark:hover:text-green-300 mr-2">
                            <i class="fas fa-check-circle"></i>
                        </button>
                        <button class="remove-item-btn text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300">
                            <i class="fas fa-trash"></i>
                        </button>
                    </td>
                </tr>
                <tr>
                    <td class="px-6 py-4 whitespace-nowrap">Produto Y</td>
                    <td class="px-6 py-4 whitespace-nowrap">Móveis</td>
                    <td class="px-6 py-4 whitespace-nowrap">2</td>
                    <td class="px-6 py-4 whitespace-nowrap">R$ 250,00</td>
                    <td class="px-6 py-4 whitespace-nowrap">R$ 500,00</td>
                    <td class="px-6 py-4 whitespace-nowrap">0</td>
                    <td class="px-6 py-4 whitespace-nowrap">
                        <span class="px-2 py-1 rounded-full text-xs font-semibold item-status-pendente">Pendente</span>
                    </td>
                    <td class="px-6 py-4 whitespace-nowrap">
                        <button class="edit-item-btn text-yellow-600 hover:text-yellow-800 dark:text-yellow-400 dark:hover:text-yellow-300 mr-2">
                            <i class="fas fa-edit"></i>
                        </button>
                        <button class="receive-item-btn text-green-600 hover:text-green-800 dark:text-green-400 dark:hover:text-green-300 mr-2">
                            <i class="fas fa-check-circle"></i>
                        </button>
                        <button class="remove-item-btn text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300">
                            <i class="fas fa-trash"></i>
                        </button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>

<!-- Order Actions -->
<div class="flex flex-wrap gap-3 mb-8">
    <button id="send-approval-btn" class="bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded-lg flex items-center gap-2">
        <i class="fas fa-paper-plane"></i> Enviar para Aprovação
    </button>
    <button id="register-receipt-btn" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2">
        <i class="fas fa-check-double"></i> Registrar Recebimento
    </button>
    <button id="cancel-order-btn" class="bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg flex items-center gap-2">
        <i class="fas fa-times"></i> Cancelar Pedido
    </button>
    <button id="print-order-btn" class="bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg flex items-center gap-2">
        <i class="fas fa-print"></i> Imprimir Pedido
    </button>
</div>

<!-- History -->
<div>
    <h3 class="text-lg font-semibold mb-4">Histórico do Pedido</h3>
    <div class="space-y-4">
        <div class="border-l-4 border-blue-500 pl-4 py-2">
            <div class="flex justify-between">
                <p class="font-medium">Pedido criado</p>
                <p class="text-sm text-gray-500 dark:text-gray-400">10/05/2023 09:15</p>
            </div>
            <p class="text-sm">Por: João Silva</p>
        </div>
        <div class="border-l-4 border-blue-500 pl-4 py-2">
            <div class="flex justify-between">
                <p class="font-medium">Item adicionado</p>
                <p class="text-sm text-gray-500 dark:text-gray-400">10/05/2023 09:20</p>
            </div>
            <p class="text-sm">Produto X - Quantidade: 5 - Valor: R$ 750,00</p>
            <p class="text-sm">Por: João Silva</p>
        </div>
        <div class="border-l-4 border-blue-500 pl-4 py-2">
            <div class="flex justify-between">
                <p class="font-medium">Item adicionado</p>
                <p class="text-sm text-gray-500 dark:text-gray-400">10/05/2023 09:25</p>
            </div>
            <p class="text-sm">Produto Y - Quantidade: 2 - Valor: R$ 500,00</p>
            <p class="text-sm">Por: João Silva</p>
        </div>
    </div>
</div>
</div>
</div>

<!-- Add Item Modal -->
<div id="add-item-modal" class="modal-overlay hidden">
    <div class="modal-content max-w-md">
        <div class="flex justify-between items-center mb-6">
            <h2 class="text-2xl font-bold">Adicionar Item</h2>
            <button id="close-add-item-modal" class="text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200">
                <i class="fas fa-times text-2xl"></i>
            </button>
        </div>
        
        <form id="add-item-form" class="space-y-4">
            <div>
                <label for="product-select" class="block text-sm font-medium mb-1">Produto</label>
                <select id="product-select" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600" required>
                    <option value="">Selecione um produto</option>
                    <option value="1">Produto X</option>
                    <option value="2">Produto Y</option>
                    <option value="3">Produto Z</option>
                </select>
            </div>
            
            <div>
                <label for="item-quantity" class="block text-sm font-medium mb-1">Quantidade</label>
                <input type="number" id="item-quantity" min="1" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600" required>
            </div>
            
            <div>
                <label for="item-unit-price" class="block text-sm font-medium mb-1">Valor Unitário</label>
                <input type="text" id="item-unit-price" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600 money" required>
            </div>
            
            <div class="flex justify-end gap-3 pt-4">
                <button type="button" id="cancel-add-item" class="bg-gray-300 hover:bg-gray-400 dark:bg-gray-600 dark:hover:bg-gray-700 text-gray-800 dark:text-gray-200 px-4 py-2 rounded-lg">
                    Cancelar
                </button>
                <button type="submit" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg">
                    Adicionar Item
                </button>
            </div>
        </form>
    </div>
</div>

<!-- Receive Item Modal -->
<div id="receive-item-modal" class="modal-overlay hidden">
    <div class="modal-content max-w-md">
        <div class="flex justify-between items-center mb-6">
            <h2 class="text-2xl font-bold">Registrar Recebimento</h2>
            <button id="close-receive-item-modal" class="text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200">
                <i class="fas fa-times text-2xl"></i>
            </button>
        </div>
        
        <form id="receive-item-form" class="space-y-4">
            <div>
                <p class="text-sm font-medium mb-1">Produto</p>
                <p class="font-medium" id="receive-product-name">Produto X</p>
            </div>
            
            <div class="grid grid-cols-2 gap-4">
                <div>
                    <p class="text-sm font-medium mb-1">Quantidade Solicitada</p>
                    <p class="font-medium" id="receive-requested-quantity">5</p>
                </div>
                <div>
                    <p class="text-sm font-medium mb-1">Quantidade Pendente</p>
                    <p class="font-medium" id="receive-pending-quantity">5</p>
                </div>
            </div>
            
            <div>
                <label for="received-quantity" class="block text-sm font-medium mb-1">Quantidade Recebida</label>
                <input type="number" id="received-quantity" min="1" max="5" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600" required>
            </div>
            
            <div>
                <label for="receipt-date" class="block text-sm font-medium mb-1">Data do Recebimento</label>
                <input type="date" id="receipt-date" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600" required>
            </div>
            
            <div>
                <label for="receipt-notes" class="block text-sm font-medium mb-1">Observações</label>
                <textarea id="receipt-notes" rows="3" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600"></textarea>
            </div>
            
            <div class="flex justify-end gap-3 pt-4">
                <button type="button" id="cancel-receive-item" class="bg-gray-300 hover:bg-gray-400 dark:bg-gray-600 dark:hover:bg-gray-700 text-gray-800 dark:text-gray-200 px-4 py-2 rounded-lg">
                    Cancelar
                </button>
                <button type="submit" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg">
                    Registrar Recebimento
                </button>
            </div>
        </form>
    </div>
</div>

<script>
    // Theme Toggle
    document.getElementById('theme-toggle').addEventListener('click', function() {
        document.documentElement.classList.toggle('dark');
        localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light');
    });
    
    // Check for saved theme preference
    if (localStorage.getItem('theme') === 'light') {
        document.documentElement.classList.remove('dark');
    }
    
    // Notification Dropdown Toggle
    const notificationBtn = document.getElementById('notification-btn');
    const notificationDropdown = document.getElementById('notification-dropdown');
    const markAllReadBtn = document.getElementById('mark-all-read');
    const notificationBadge = document.querySelector('.notification-badge');
    
    notificationBtn.addEventListener('click', function(e) {
        e.stopPropagation();
        notificationDropdown.classList.toggle('show');
    });
    
    markAllReadBtn.addEventListener('click', function() {
        const unreadItems = document.querySelectorAll('.notification-item.unread');
        unreadItems.forEach(item => {
            item.classList.remove('unread');
        });
        notificationBadge.textContent = '0';
        notificationBadge.style.display = 'none';
        
        Swal.fire({
            title: 'Notificações marcadas como lidas',
            icon: 'success',
            timer: 1500,
            showConfirmButton: false
        });
    });
    
    // Close dropdown when clicking outside
    document.addEventListener('click', function(e) {
        if (!notificationDropdown.contains(e.target) && e.target !== notificationBtn) {
            notificationDropdown.classList.remove('show');
        }
    });
    
    // New Order Offcanvas
    const newOrderBtn = document.getElementById('new-order-btn');
    const newOrderOffcanvas = document.getElementById('new-order-offcanvas');
    const closeNewOrder = document.getElementById('close-new-order');
    const cancelNewOrder = document.getElementById('cancel-new-order');
    
    newOrderBtn.addEventListener('click', function() {
        newOrderOffcanvas.classList.add('show');
        document.body.style.overflow = 'hidden';
    });
    
    closeNewOrder.addEventListener('click', function() {
        newOrderOffcanvas.classList.remove('show');
        document.body.style.overflow = 'auto';
    });
    
    cancelNewOrder.addEventListener('click', function() {
        newOrderOffcanvas.classList.remove('show');
        document.body.style.overflow = 'auto';
    });
    
    // Add items to new order
    const addItemToOrderBtn = document.getElementById('add-item-to-order');
    const orderItemsList = document.getElementById('order-items-list');
    
    addItemToOrderBtn.addEventListener('click', function() {
        const productSelect = document.getElementById('product-select');
        const productName = productSelect.options[productSelect.selectedIndex].text;
        const quantity = document.getElementById('item-quantity').value;
        const unitPrice = document.getElementById('item-unit-price').value;
        
        if (productSelect.value === '' || quantity === '' || unitPrice === '') {
            Swal.fire({
                title: 'Campos obrigatórios',
                text: 'Por favor, preencha todos os campos do item.',
                icon: 'warning'
            });
            return;
        }
        
        const totalValue = (parseFloat(quantity) * parseFloat(unitPrice.replace('R$ ', '').replace('.', '').replace(',', '.'))).toFixed(2);
        
        const newRow = document.createElement('tr');
        newRow.className = 'bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700';
        newRow.innerHTML = `
            <td class="px-4 py-2 whitespace-nowrap">${productName}</td>
            <td class="px-4 py-2 whitespace-nowrap">${quantity}</td>
            <td class="px-4 py-2 whitespace-nowrap">${unitPrice}</td>
            <td class="px-4 py-2 whitespace-nowrap">
                <button class="remove-item-row text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300">
                    <i class="fas fa-trash"></i>
                </button>
            </td>
        `;
        
        orderItemsList.appendChild(newRow);
        
        // Clear form
        productSelect.value = '';
        document.getElementById('item-quantity').value = '1';
        document.getElementById('item-unit-price').value = '';
        
        // Add event listener to remove button
        newRow.querySelector('.remove-item-row').addEventListener('click', function() {
            newRow.remove();
        });
    });
    
    // Submit new order form
    document.getElementById('new-order-form').addEventListener('submit', function(e) {
        e.preventDefault();
        
        if (orderItemsList.children.length === 0) {
            Swal.fire({
                title: 'Itens obrigatórios',
                text: 'Por favor, adicione pelo menos um item ao pedido.',
                icon: 'warning'
            });
            return;
        }
        
        Swal.fire({
            title: 'Pedido criado!',
            text: 'O novo pedido de compra foi criado com sucesso.',
            icon: 'success'
        });
        
        newOrderOffcanvas.classList.remove('show');
        document.body.style.overflow = 'auto';
        this.reset();
        orderItemsList.innerHTML = '';
    });
    
    // Order Detail Modal
    const viewButtons = document.querySelectorAll('.view-btn');
    const orderDetailModal = document.getElementById('order-detail-modal');
    const closeModal = document.getElementById('close-modal');
    
    viewButtons.forEach(button => {
        button.addEventListener('click', function() {
            const orderId = this.getAttribute('data-id');
            // In a real app, we would fetch order details based on orderId
            orderDetailModal.classList.remove('hidden');
            document.body.style.overflow = 'hidden';
        });
    });
    
    closeModal.addEventListener('click', function() {
        orderDetailModal.classList.add('hidden');
        document.body.style.overflow = 'auto';
    });
    
    // Add Item Modal
    const addItemBtn = document.getElementById('add-item-btn');
    const addItemModal = document.getElementById('add-item-modal');
    const closeAddItemModal = document.getElementById('close-add-item-modal');
    const cancelAddItem = document.getElementById('cancel-add-item');
    
    addItemBtn.addEventListener('click', function() {
        addItemModal.classList.remove('hidden');
        document.body.style.overflow = 'hidden';
    });
    
    closeAddItemModal.addEventListener('click', function() {
        addItemModal.classList.add('hidden');
        document.body.style.overflow = 'auto';
    });
    
    cancelAddItem.addEventListener('click', function() {
        addItemModal.classList.add('hidden');
        document.body.style.overflow = 'auto';
    });
    
    // Receive Item Modal
    const receiveItemBtns = document.querySelectorAll('.receive-item-btn');
    const receiveItemModal = document.getElementById('receive-item-modal');
    const closeReceiveItemModal = document.getElementById('close-receive-item-modal');
    const cancelReceiveItem = document.getElementById('cancel-receive-item');
    
    receiveItemBtns.forEach(button => {
        button.addEventListener('click', function() {
            receiveItemModal.classList.remove('hidden');
            document.body.style.overflow = 'hidden';
        });
    });
    
    closeReceiveItemModal.addEventListener('click', function() {
        receiveItemModal.classList.add('hidden');
        document.body.style.overflow = 'auto';
    });
    
    cancelReceiveItem.addEventListener('click', function() {
        receiveItemModal.classList.add('hidden');
        document.body.style.overflow = 'auto';
    });
    
    // Cancel Order Confirmation
    const cancelOrderBtn = document.getElementById('cancel-order-btn');
    const cancelButtons = document.querySelectorAll('.cancel-btn');
    
    function showCancelConfirmation() {
        Swal.fire({
            title: 'Cancelar Pedido',
            text: 'Tem certeza que deseja cancelar este pedido? Esta ação não pode ser desfeita.',
            icon: 'warning',
            showCancelButton: true,
            confirmButtonColor: '#d33',
            cancelButtonColor: '#3085d6',
            confirmButtonText: 'Sim, cancelar!',
            cancelButtonText: 'Não, manter'
        }).then((result) => {
            if (result.isConfirmed) {
                Swal.fire(
                    'Cancelado!',
                    'O pedido foi cancelado com sucesso.',
                    'success'
                );
                // In a real app, we would update the order status to "Cancelado"
            }
        });
    }
    
    cancelOrderBtn.addEventListener('click', showCancelConfirmation);
    
    cancelButtons.forEach(button => {
        button.addEventListener('click', showCancelConfirmation);
    });
    
    // Send for Approval
    const sendApprovalBtn = document.getElementById('send-approval-btn');
    
    sendApprovalBtn.addEventListener('click', function() {
        Swal.fire({
            title: 'Enviar para Aprovação',
            text: 'Deseja enviar este pedido para aprovação?',
            icon: 'question',
            showCancelButton: true,
            confirmButtonColor: '#3085d6',
            cancelButtonColor: '#d33',
            confirmButtonText: 'Sim, enviar!',
            cancelButtonText: 'Cancelar'
        }).then((result) => {
            if (result.isConfirmed) {
                Swal.fire(
                    'Enviado!',
                    'O pedido foi enviado para aprovação com sucesso.',
                    'success'
                );
                // In a real app, we would update the order status to "Aguardando Aprovação"
            }
        });
    });
    
    // Register Receipt
    const registerReceiptBtn = document.getElementById('register-receipt-btn');
    
    registerReceiptBtn.addEventListener('click', function() {
        Swal.fire({
            title: 'Registrar Recebimento',
            text: 'Deseja registrar o recebimento deste pedido?',
            icon: 'question',
            showCancelButton: true,
            confirmButtonColor: '#3085d6',
            cancelButtonColor: '#d33',
            confirmButtonText: 'Sim, registrar!',
            cancelButtonText: 'Cancelar'
        }).then((result) => {
            if (result.isConfirmed) {
                Swal.fire(
                    'Registrado!',
                    'O recebimento do pedido foi registrado com sucesso.',
                    'success'
                );
                // In a real app, we would update the order status to "Recebido Parcial" or "Recebido Total"
            }
        });
    });
    
    // Print Order
    const printOrderBtn = document.getElementById('print-order-btn');
    const printButtons = document.querySelectorAll('.print-btn');
    
    function showPrintConfirmation() {
        Swal.fire({
            title: 'Imprimir Pedido',
            text: 'Preparando o pedido para impressão...',
            icon: 'info',
            timer: 1500,
            showConfirmButton: false
        });
    }
    
    printOrderBtn.addEventListener('click', showPrintConfirmation);
    
    printButtons.forEach(button => {
        button.addEventListener('click', showPrintConfirmation);
    });
    
    // Remove Item Confirmation
    const removeItemBtns = document.querySelectorAll('.remove-item-btn');
    
    removeItemBtns.forEach(button => {
        button.addEventListener('click', function() {
            Swal.fire({
                title: 'Remover Item',
                text: 'Tem certeza que deseja remover este item do pedido?',
                icon: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#d33',
                cancelButtonColor: '#3085d6',
                confirmButtonText: 'Sim, remover!',
                cancelButtonText: 'Cancelar'
            }).then((result) => {
                if (result.isConfirmed) {
                    Swal.fire(
                        'Removido!',
                        'O item foi removido do pedido com sucesso.',
                        'success'
                    );
                    // In a real app, we would remove the item from the order
                }
            });
        });
    });
    
    // Apply Filters
    document.getElementById('apply-filters').addEventListener('click', function() {
        // In a real app, we would filter the orders based on the selected filters
        Swal.fire({
            title: 'Filtros Aplicados',
            text: 'Os filtros foram aplicados com sucesso.',
            icon: 'success',
            timer: 1500,
            showConfirmButton: false
        });
    });
    
    // Clear Filters
    document.getElementById('clear-filters').addEventListener('click', function() {
        document.getElementById('supplier-filter').value = '';
        document.getElementById('status-filter').value = '';
        document.getElementById('responsible-filter').value = '';
        document.getElementById('date-filter').value = '';
        
        Swal.fire({
            title: 'Filtros Limpos',
            text: 'Todos os filtros foram resetados.',
            icon: 'info',
            timer: 1500,
            showConfirmButton: false
        });
    });
    
    // Money format input
    document.querySelectorAll('.money').forEach(input => {
        input.addEventListener('input', function() {
            let value = this.value.replace(/\D/g, '');
            value = (value / 100).toFixed(2) + '';
            value = value.replace(".", ",");
            value = value.replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1.');
            this.value = 'R$ ' + value;
        });
    });
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=gallabs/tom-system-pedido-compra" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>