File size: 52,552 Bytes
2d01b01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vendor Work Order System</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://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
    <style>
        .tab-content {
            display: none;
        }
        .tab-content.active {
            display: block;
            animation: fadeIn 0.3s ease-in-out;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .nav-tab {
            transition: all 0.3s ease;
        }
        .nav-tab:hover:not(.active) {
            background-color: #f3f4f6;
        }
        .nav-tab.active {
            border-bottom: 3px solid #3b82f6;
        }
        .signature-pad {
            border: 1px dashed #ccc;
            background-color: #f9fafb;
        }
        #workOrderPreview {
            background-color: white;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        .search-highlight {
            background-color: #fef08a;
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen">
    <div class="container mx-auto px-4 py-8 max-w-6xl">
        <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
            <div class="p-6">
                <div class="flex justify-between items-center mb-6">
                    <h1 class="text-3xl font-bold text-gray-800">
                        <i class="fas fa-file-invoice mr-3 text-blue-500"></i>Vendor Work Order System
                    </h1>
                    <div class="flex items-center space-x-2">
                        <span class="px-3 py-1 bg-blue-100 text-blue-800 rounded-full text-sm font-medium">
                            <i class="fas fa-user-shield mr-1"></i> Admin
                        </span>
                    </div>
                </div>

                <!-- Tabs Navigation -->
                <div class="border-b border-gray-200 mb-6">
                    <nav class="flex space-x-8">
                        <button class="nav-tab py-4 px-1 font-medium text-sm flex items-center" data-tab="initiate">
                            <i class="fas fa-pen-to-square mr-2"></i> Initiate Work Order
                        </button>
                        <button class="nav-tab py-4 px-1 font-medium text-sm flex items-center" data-tab="approval">
                            <i class="fas fa-check-double mr-2"></i> Approval
                        </button>
                        <button class="nav-tab py-4 px-1 font-medium text-sm flex items-center" data-tab="manage">
                            <i class="fas fa-database mr-2"></i> Manage Work Orders
                        </button>
                        <button class="nav-tab py-4 px-1 font-medium text-sm flex items-center" data-tab="print">
                            <i class="fas fa-print mr-2"></i> Print/Export
                        </button>
                    </nav>
                </div>

                <!-- Tab Contents -->
                <div class="tab-content-container">
                    <!-- Initiate Form Tab -->
                    <div id="initiate" class="tab-content active">
                        <form id="workOrderForm" class="space-y-6">
                            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                                <div>
                                    <label for="woNumber" class="block text-sm font-medium text-gray-700 mb-1">Work Order #</label>
                                    <input type="text" id="woNumber" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" value="WO-2023-001" readonly>
                                </div>
                                <div>
                                    <label for="woDate" class="block text-sm font-medium text-gray-700 mb-1">Date</label>
                                    <input type="date" id="woDate" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" required>
                                </div>
                            </div>

                            <div>
                                <label for="vendorSelect" class="block text-sm font-medium text-gray-700 mb-1">Vendor</label>
                                <select id="vendorSelect" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" required>
                                    <option value="">Select a vendor</option>
                                    <option value="1">ABC Construction Co.</option>
                                    <option value="2">XYZ Maintenance Services</option>
                                    <option value="3">Global Tech Solutions</option>
                                    <option value="4">Premium Cleaning Services</option>
                                </select>
                            </div>

                            <div>
                                <label for="projectName" class="block text-sm font-medium text-gray-700 mb-1">Project Name</label>
                                <input type="text" id="projectName" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" placeholder="Enter project name" required>
                            </div>

                            <div>
                                <label for="workDescription" class="block text-sm font-medium text-gray-700 mb-1">Work Description</label>
                                <textarea id="workDescription" rows="4" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" placeholder="Detailed description of the work to be performed..." required></textarea>
                            </div>

                            <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                                <div>
                                    <label for="startDate" class="block text-sm font-medium text-gray-700 mb-1">Start Date</label>
                                    <input type="date" id="startDate" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" required>
                                </div>
                                <div>
                                    <label for="endDate" class="block text-sm font-medium text-gray-700 mb-1">End Date</label>
                                    <input type="date" id="endDate" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" required>
                                </div>
                                <div>
                                    <label for="estimatedCost" class="block text-sm font-medium text-gray-700 mb-1">Estimated Cost ($)</label>
                                    <input type="number" id="estimatedCost" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" placeholder="0.00" step="0.01" required>
                                </div>
                            </div>

                            <div>
                                <label for="attachments" class="block text-sm font-medium text-gray-700 mb-1">Attachments</label>
                                <div class="mt-1 flex justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-md">
                                    <div class="space-y-1 text-center">
                                        <div class="flex text-sm text-gray-600">
                                            <label for="file-upload" class="relative cursor-pointer bg-white rounded-md font-medium text-blue-600 hover:text-blue-500 focus-within:outline-none">
                                                <span>Upload files</span>
                                                <input id="file-upload" name="file-upload" type="file" class="sr-only" multiple>
                                            </label>
                                            <p class="pl-1">or drag and drop</p>
                                        </div>
                                        <p class="text-xs text-gray-500">PDF, DOC, JPG, PNG up to 10MB</p>
                                    </div>
                                </div>
                            </div>

                            <div class="flex justify-end space-x-4 pt-4">
                                <button type="reset" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
                                    <i class="fas fa-eraser mr-2"></i> Clear Form
                                </button>
                                <button type="submit" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
                                    <i class="fas fa-paper-plane mr-2"></i> Submit for Approval
                                </button>
                            </div>
                        </form>
                    </div>

                    <!-- Approval Tab -->
                    <div id="approval" class="tab-content">
                        <div class="bg-blue-50 border-l-4 border-blue-400 p-4 mb-6">
                            <div class="flex">
                                <div class="flex-shrink-0">
                                    <i class="fas fa-info-circle text-blue-400"></i>
                                </div>
                                <div class="ml-3">
                                    <p class="text-sm text-blue-700">
                                        Work orders pending your approval are listed below. Please review carefully before approving or rejecting.
                                    </p>
                                </div>
                            </div>
                        </div>

                        <div class="overflow-x-auto">
                            <table class="min-w-full divide-y divide-gray-200">
                                <thead class="bg-gray-50">
                                    <tr>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">WO #</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Vendor</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Project</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Est. Cost</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
                                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
                                    </tr>
                                </thead>
                                <tbody class="bg-white divide-y divide-gray-200">
                                    <tr>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">WO-2023-015</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">ABC Construction Co.</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Office Renovation</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$12,500.00</td>
                                        <td class="px-6 py-4 whitespace-nowrap">
                                            <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">
                                                Pending Approval
                                            </span>
                                        </td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                                            <button class="text-blue-600 hover:text-blue-900 mr-3 approve-btn" data-id="15"><i class="fas fa-check mr-1"></i> Approve</button>
                                            <button class="text-red-600 hover:text-red-900 reject-btn" data-id="15"><i class="fas fa-times mr-1"></i> Reject</button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">WO-2023-014</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Global Tech Solutions</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Network Upgrade</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$8,200.00</td>
                                        <td class="px-6 py-4 whitespace-nowrap">
                                            <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">
                                                Pending Approval
                                            </span>
                                        </td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                                            <button class="text-blue-600 hover:text-blue-900 mr-3 approve-btn" data-id="14"><i class="fas fa-check mr-1"></i> Approve</button>
                                            <button class="text-red-600 hover:text-red-900 reject-btn" data-id="14"><i class="fas fa-times mr-1"></i> Reject</button>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>

                        <div class="mt-8 border-t border-gray-200 pt-6">
                            <h3 class="text-lg font-medium text-gray-900 mb-4">Approved Work Orders</h3>
                            <div class="overflow-x-auto">
                                <table class="min-w-full divide-y divide-gray-200">
                                    <thead class="bg-gray-50">
                                        <tr>
                                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">WO #</th>
                                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Vendor</th>
                                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Project</th>
                                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Approved Date</th>
                                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
                                        </tr>
                                    </thead>
                                    <tbody class="bg-white divide-y divide-gray-200">
                                        <tr>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">WO-2023-013</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Premium Cleaning Services</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Quarterly Deep Cleaning</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-06-15</td>
                                            <td class="px-6 py-4 whitespace-nowrap">
                                                <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
                                                    Approved
                                                </span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">WO-2023-012</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">XYZ Maintenance Services</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">HVAC Maintenance</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-06-10</td>
                                            <td class="px-6 py-4 whitespace-nowrap">
                                                <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
                                                    Approved
                                                </span>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>

                    <!-- Manage Work Orders Tab -->
                    <div id="manage" class="tab-content">
                        <div class="bg-white shadow rounded-lg p-6 mb-6">
                            <div class="flex flex-col md:flex-row md:items-center md:justify-between mb-6">
                                <h2 class="text-xl font-semibold text-gray-800">Work Order Management</h2>
                                <div class="mt-4 md:mt-0">
                                    <div class="relative">
                                        <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                                            <i class="fas fa-search text-gray-400"></i>
                                        </div>
                                        <input type="text" id="searchWorkOrders" class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md leading-5 bg-white placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm" placeholder="Search work orders...">
                                    </div>
                                </div>
                            </div>

                            <div class="flex flex-wrap gap-3 mb-6">
                                <div class="w-full sm:w-auto">
                                    <label for="filterStatus" class="block text-sm font-medium text-gray-700 mb-1">Status</label>
                                    <select id="filterStatus" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500">
                                        <option value="">All Statuses</option>
                                        <option value="approved">Approved</option>
                                        <option value="completed">Completed</option>
                                        <option value="archived">Archived</option>
                                    </select>
                                </div>
                                <div class="w-full sm:w-auto">
                                    <label for="filterVendor" class="block text-sm font-medium text-gray-700 mb-1">Vendor</label>
                                    <select id="filterVendor" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500">
                                        <option value="">All Vendors</option>
                                        <option value="1">ABC Construction Co.</option>
                                        <option value="2">XYZ Maintenance Services</option>
                                        <option value="3">Global Tech Solutions</option>
                                        <option value="4">Premium Cleaning Services</option>
                                    </select>
                                </div>
                                <div class="w-full sm:w-auto">
                                    <label for="filterDateFrom" class="block text-sm font-medium text-gray-700 mb-1">From Date</label>
                                    <input type="date" id="filterDateFrom" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500">
                                </div>
                                <div class="w-full sm:w-auto">
                                    <label for="filterDateTo" class="block text-sm font-medium text-gray-700 mb-1">To Date</label>
                                    <input type="date" id="filterDateTo" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500">
                                </div>
                                <div class="w-full sm:w-auto flex items-end">
                                    <button id="applyFilters" class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500">
                                        Apply Filters
                                    </button>
                                </div>
                            </div>

                            <div class="overflow-x-auto">
                                <table class="min-w-full divide-y divide-gray-200" id="workOrdersTable">
                                    <thead class="bg-gray-50">
                                        <tr>
                                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">WO #</th>
                                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Vendor</th>
                                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Project</th>
                                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
                                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
                                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
                                        </tr>
                                    </thead>
                                    <tbody class="bg-white divide-y divide-gray-200" id="workOrdersBody">
                                        <!-- Work orders will be loaded here -->
                                    </tbody>
                                </table>
                            </div>

                            <div class="mt-4 flex items-center justify-between">
                                <div class="text-sm text-gray-500">
                                    Showing <span id="showingFrom">1</span> to <span id="showingTo">10</span> of <span id="totalItems">50</span> work orders
                                </div>
                                <div class="flex space-x-2">
                                    <button id="prevPage" class="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 disabled:opacity-50" disabled>
                                        Previous
                                    </button>
                                    <button id="nextPage" class="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">
                                        Next
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Print/Export Tab -->
                    <div id="print" class="tab-content">
                        <div class="flex flex-col md:flex-row gap-6">
                            <div class="md:w-1/3 space-y-6">
                                <div class="bg-white p-4 rounded-lg shadow">
                                    <h3 class="font-medium text-lg mb-4">Export Options</h3>
                                    <div class="space-y-4">
                                        <div>
                                            <label class="flex items-center">
                                                <input type="radio" name="exportFormat" value="pdf" class="h-4 w-4 text-blue-600 focus:ring-blue-500" checked>
                                                <span class="ml-2 block text-sm text-gray-700">PDF Document</span>
                                            </label>
                                        </div>
                                        <div>
                                            <label class="flex items-center">
                                                <input type="radio" name="exportFormat" value="doc" class="h-4 w-4 text-blue-600 focus:ring-blue-500">
                                                <span class="ml-2 block text-sm text-gray-700">Word Document</span>
                                            </label>
                                        </div>
                                        <div>
                                            <label class="flex items-center">
                                                <input type="radio" name="exportFormat" value="print" class="h-4 w-4 text-blue-600 focus:ring-blue-500">
                                                <span class="ml-2 block text-sm text-gray-700">Print Directly</span>
                                            </label>
                                        </div>
                                    </div>
                                </div>

                                <div class="bg-white p-4 rounded-lg shadow">
                                    <h3 class="font-medium text-lg mb-4">Select Work Order</h3>
                                    <select id="woSelect" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500">
                                        <option value="">Select a work order</option>
                                        <option value="WO-2023-013">WO-2023-013 - Premium Cleaning Services</option>
                                        <option value="WO-2023-012">WO-2023-012 - XYZ Maintenance Services</option>
                                        <option value="WO-2023-011">WO-2023-011 - ABC Construction Co.</option>
                                    </select>
                                </div>

                                <div class="bg-white p-4 rounded-lg shadow">
                                    <h3 class="font-medium text-lg mb-4">Delivery Options</h3>
                                    <div class="space-y-4">
                                        <div>
                                            <label class="flex items-center">
                                                <input type="checkbox" class="h-4 w-4 text-blue-600 focus:ring-blue-500">
                                                <span class="ml-2 block text-sm text-gray-700">Email to Vendor</span>
                                            </label>
                                        </div>
                                        <div>
                                            <label class="flex items-center">
                                                <input type="checkbox" class="h-4 w-4 text-blue-600 focus:ring-blue-500">
                                                <span class="ml-2 block text-sm text-gray-700">Save to Documents</span>
                                            </label>
                                        </div>
                                        <div>
                                            <label class="flex items-center">
                                                <input type="checkbox" class="h-4 w-4 text-blue-600 focus:ring-blue-500" checked>
                                                <span class="ml-2 block text-sm text-gray-700">Download File</span>
                                            </label>
                                        </div>
                                    </div>
                                </div>

                                <div class="flex space-x-3">
                                    <button id="generateBtn" class="flex-1 bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-md flex items-center justify-center">
                                        <i class="fas fa-file-export mr-2"></i> Generate
                                    </button>
                                    <button id="printBtn" class="flex-1 bg-gray-600 hover:bg-gray-700 text-white py-2 px-4 rounded-md flex items-center justify-center">
                                        <i class="fas fa-print mr-2"></i> Print
                                    </button>
                                </div>
                            </div>

                            <div class="md:w-2/3">
                                <div class="bg-white p-6 rounded-lg shadow">
                                    <h3 class="font-medium text-lg mb-4">Preview</h3>
                                    <div id="workOrderPreview" class="p-6">
                                        <div class="text-center mb-8">
                                            <h2 class="text-2xl font-bold">WORK ORDER</h2>
                                            <div class="flex justify-between mt-4">
                                                <div class="text-left">
                                                    <p><strong>WO #:</strong> <span id="previewWoNumber">WO-2023-013</span></p>
                                                    <p><strong>Date:</strong> <span id="previewDate">June 15, 2023</span></p>
                                                </div>
                                                <div class="text-right">
                                                    <p><strong>Status:</strong> <span class="text-green-600">Approved</span></p>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
                                            <div>
                                                <h3 class="font-bold border-b pb-1 mb-2">Vendor Information</h3>
                                                <p><strong>Name:</strong> Premium Cleaning Services</p>
                                                <p><strong>Contact:</strong> John Smith</p>
                                                <p><strong>Phone:</strong> (555) 123-4567</p>
                                                <p><strong>Email:</strong> john@premiumclean.com</p>
                                            </div>
                                            <div>
                                                <h3 class="font-bold border-b pb-1 mb-2">Project Details</h3>
                                                <p><strong>Project:</strong> Quarterly Deep Cleaning</p>
                                                <p><strong>Location:</strong> Main Office Building</p>
                                                <p><strong>Start Date:</strong> June 20, 2023</p>
                                                <p><strong>End Date:</strong> June 22, 2023</p>
                                            </div>
                                        </div>

                                        <div class="mb-6">
                                            <h3 class="font-bold border-b pb-1 mb-2">Work Description</h3>
                                            <p>Complete deep cleaning of all office spaces including carpets, windows, restrooms, and kitchen areas. Special attention to high-touch surfaces and disinfecting all areas.</p>
                                        </div>

                                        <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
                                            <div>
                                                <h3 class="font-bold border-b pb-1 mb-2">Financial Details</h3>
                                                <p><strong>Estimated Cost:</strong> $3,500.00</p>
                                                <p><strong>Payment Terms:</strong> Net 30 days</p>
                                            </div>
                                            <div>
                                                <h3 class="font-bold border-b pb-1 mb-2">Approval</h3>
                                                <p><strong>Approved By:</strong> Sarah Johnson</p>
                                                <p><strong>Approval Date:</strong> June 15, 2023</p>
                                            </div>
                                        </div>

                                        <div class="mt-8">
                                            <div class="flex justify-between">
                                                <div class="w-1/2 pr-4">
                                                    <p class="border-t pt-2 text-center">Vendor Signature</p>
                                                    <div class="signature-pad h-20 mt-2"></div>
                                                </div>
                                                <div class="w-1/2 pl-4">
                                                    <p class="border-t pt-2 text-center">Company Representative</p>
                                                    <div class="signature-pad h-20 mt-2"></div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Approval Modal -->
    <div id="approvalModal" class="fixed inset-0 z-50 hidden overflow-y-auto">
        <div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
            <div class="fixed inset-0 transition-opacity" aria-hidden="true">
                <div class="absolute inset-0 bg-gray-500 opacity-75"></div>
            </div>
            <span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
            <div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
                <div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
                    <div class="sm:flex sm:items-start">
                        <div class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10">
                            <i class="fas fa-check text-blue-600"></i>
                        </div>
                        <div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
                            <h3 class="text-lg leading-6 font-medium text-gray-900" id="modalTitle">Approve Work Order</h3>
                            <div class="mt-2">
                                <p class="text-sm text-gray-500">Are you sure you want to approve this work order?</p>
                                <div class="mt-4">
                                    <label for="approvalNotes" class="block text-sm font-medium text-gray-700">Approval Notes (Optional)</label>
                                    <textarea id="approvalNotes" rows="3" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
                    <button type="button" id="confirmApprove" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-green-600 text-base font-medium text-white hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 sm:ml-3 sm:w-auto sm:text-sm">
                        Confirm Approval
                    </button>
                    <button type="button" id="cancelApprove" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
                        Cancel
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- Rejection Modal -->
    <div id="rejectionModal" class="fixed inset-0 z-50 hidden overflow-y-auto">
        <div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
            <div class="fixed inset-0 transition-opacity" aria-hidden="true">
                <div class="absolute inset-0 bg-gray-500 opacity-75"></div>
            </div>
            <span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
            <div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
                <div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
                    <div class="sm:flex sm:items-start">
                        <div class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10">
                            <i class="fas fa-times text-red-600"></i>
                        </div>
                        <div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
                            <h3 class="text-lg leading-6 font-medium text-gray-900" id="modalTitle">Reject Work Order</h3>
                            <div class="mt-2">
                                <p class="text-sm text-gray-500">Are you sure you want to reject this work order?</p>
                                <div class="mt-4">
                                    <label for="rejectionReason" class="block text-sm font-medium text-gray-700">Reason for Rejection (Required)</label>
                                    <textarea id="rejectionReason" rows="3" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm" required></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
                    <button type="button" id="confirmReject" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm">
                        Confirm Rejection
                    </button>
                    <button type="button" id="cancelReject" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
                        Cancel
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- Edit Work Order Modal -->
    <div id="editModal" class="fixed inset-0 z-50 hidden overflow-y-auto">
        <div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
            <div class="fixed inset-0 transition-opacity" aria-hidden="true">
                <div class="absolute inset-0 bg-gray-500 opacity-75"></div>
            </div>
            <span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
            <div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-4xl sm:w-full">
                <div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
                    <div class="sm:flex sm:items-start">
                        <div class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10">
                            <i class="fas fa-edit text-blue-600"></i>
                        </div>
                        <div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left w-full">
                            <h3 class="text-lg leading-6 font-medium text-gray-900">Edit Work Order</h3>
                            <div class="mt-2">
                                <form id="editWorkOrderForm" class="space-y-4">
                                    <input type="hidden" id="editWoId">
                                    <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                                        <div>
                                            <label for="editWoNumber" class="block text-sm font-medium text-gray-700">Work Order #</label>
                                            <input type="text" id="editWoNumber" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm" readonly>
                                        </div>
                                        <div>
                                            <label for="editWoDate" class="block text-sm font-medium text-gray-700">Date</label>
                                            <input type="date" id="editWoDate" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
                                        </div>
                                    </div>
                                    <div>
                                        <label for="editVendor" class="block text-sm font-medium text-gray-700">Vendor</label>
                                        <select id="editVendor" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
                                            <option value="1">ABC Construction Co.</option>
                                            <option value="2">XYZ Maintenance Services</option>
                                            <option value="3">Global Tech Solutions</option>
                                            <option value="4">Premium Cleaning Services</option>
                                        </select>
                                    </div>
                                    <div>
                                        <label for="editProject" class="block text-sm font-medium text-gray-700">Project Name</label>
                                        <input type="text" id="editProject" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
                                    </div>
                                    <div>
                                        <label for="editDescription" class="block text-sm font-medium text-gray-700">Work Description</label>
                                        <textarea id="editDescription" rows="3" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm"></textarea>
                                    </div>
                                    <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                                        <div>
                                            <label for="editStartDate" class="block text-sm font-medium text-gray-700">Start Date</label>
                                            <input type="date" id="editStartDate" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
                                        </div>
                                        <div>
                                            <label for="editEndDate" class="block text-sm font-medium text-gray-700">End Date</label>
                                            <input type="date" id="editEndDate" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
                                        </div>
                                        <div>
                                            <label for="editCost" class="block text-sm font-medium text-gray-700">Estimated Cost ($)</label>
                                            <input type="number" id="editCost" step="0.01" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
                                        </div>
                                    </div>
                                    <div>
                                        <label for="editStatus" class="block text-sm font-medium text-gray-700">Status</label>
                                        <select id="editStatus" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
                                            <option value="approved">Approved</option>
                                            <option value="completed">Completed</option>
                                            <option value="archived">Archived</option>
                                        </select>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
                    <button type="button" id="confirmEdit" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
                        Save Changes
                    </button>
                    <button type="button" id="cancelEdit" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
                        Cancel
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- Delete Confirmation Modal -->
    <div id="deleteModal" class="fixed inset-0 z-50 hidden overflow-y-auto">
        <div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
            <div class="fixed inset-0 transition-opacity" aria-hidden="true">
                <div class="absolute inset-0 bg-gray-500 opacity-75"></div>
            </div>
            <span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
            <div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
                <div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
                    <div class="sm:flex sm:items-start">
                        <div class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10">
                            <i class="fas fa-exclamation-triangle text-red-600"></i>
                        </div>
                        <div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
                            <h3 class="text-lg leading-6 font-medium text-gray-900">Delete Work Order</h3>
                            <div class="mt-2">
                                <p class="text-sm text-gray-500">Are you sure you want to delete this work order? This action cannot be undone.</p>
                                <div class="mt-4">
                                    <label for="deleteReason" class="block text-sm font-medium text-gray-700">Reason for Deletion (Optional)</label>
                                    <textarea id="deleteReason" rows="3" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
                    <button type="button" id="confirmDelete" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm">
                        Delete
                    </button>
                    <button type="button" id="cancelDelete" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
                        Cancel
                    </button>
                </div>
            </div>
        </div>
    </div>

    <script>
        // Work Order Data Storage
        const workOrders = [
            {
                id: 1,
                woNumber: 'WO-2023-013',
                date: '2023-06-15',
                vendor: 'Premium Cleaning Services',

</html>