-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.php
701 lines (673 loc) · 33.4 KB
/
admin.php
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
<?php
session_start();
// Redirect the user to login page if he is not logged in.
if(!isset($_SESSION['loggedIn']) || $_SESSION['usertype'] !== 'Admin'){
header('Location: index.php');
exit();
}
require_once('inc/config/constants.php');
require_once('inc/config/db.php');
require_once('inc/header.html');
?>
<body>
<?php
require 'inc/navigation.php';
?>
<!-- Page Content -->
<div class="container-fluid">
<div class="row">
<?php
require 'inc/navbar.php';
?>
<div class="col-lg-10">
<div class="tab-content" id="v-pills-tabContent">
<div class="tab-pane fade show" id="v-pills-item" role="tabpanel" aria-labelledby="v-pills-item-tab">
<div class="card card-outline-secondary my-4">
<div class="card-header">Item Details</div>
<div class="card-body">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#itemDetailsTab">Item</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#itemImageTab">Upload Image</a>
</li>
</ul>
<!-- Tab panes for item details and image sections -->
<div class="tab-content">
<div id="itemDetailsTab" class="container-fluid tab-pane active">
<br>
<!-- Div to show the ajax message from validations/db submission -->
<div id="itemDetailsMessage"></div>
<form>
<div class="form-row">
<div class="form-group col-md-3" style="display:inline-block">
<label for="itemDetailsItemNumber">Item Number<span class="requiredIcon">*</span></label>
<input type="text" class="form-control" name="itemDetailsItemNumber" id="itemDetailsItemNumber" autocomplete="off">
<div id="itemDetailsItemNumberSuggestionsDiv" class="customListDivWidth"></div>
</div>
<div class="form-group col-md-3">
<label for="itemDetailsProductID">Product ID</label>
<input class="form-control invTooltip" type="number" readonly id="itemDetailsProductID" name="itemDetailsProductID" title="This will be auto-generated when you add a new item">
</div>
<div class="form-group col-md-3">
<label for="itemDetailsProductID">Category</label>
<input class="form-control invTooltip" type="text" id="itemDetailsProductCategory" name="itemDetailsProductCategory">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="itemDetailsItemName">Item Name<span class="requiredIcon">*</span></label>
<input type="text" class="form-control" name="itemDetailsItemName" id="itemDetailsItemName" autocomplete="off">
<div id="itemDetailsItemNameSuggestionsDiv" class="customListDivWidth"></div>
</div>
<div class="form-group col-md-2">
<label for="itemDetailsStatus">Status</label>
<select id="itemDetailsStatus" name="itemDetailsStatus" class="form-control chosenSelect">
<?php include('inc/statusList.html'); ?>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6" style="display:inline-block">
<!-- <label for="itemDetailsDescription">Description</label> -->
<textarea rows="4" class="form-control" placeholder="Description" name="itemDetailsDescription" id="itemDetailsDescription"></textarea>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="itemDetailsDiscount">Discount %</label>
<input type="text" class="form-control" value="0" name="itemDetailsDiscount" id="itemDetailsDiscount">
</div>
<div class="form-group col-md-3">
<label for="itemDetailsQuantity">Quantity<span class="requiredIcon">*</span></label>
<input type="number" class="form-control" value="0" name="itemDetailsQuantity" id="itemDetailsQuantity">
</div>
<div class="form-group col-md-3">
<label for="itemDetailsUnitPrice">Unit Price<span class="requiredIcon">*</span></label>
<input type="text" class="form-control" value="0" name="itemDetailsUnitPrice" id="itemDetailsUnitPrice">
</div>
<div class="form-group col-md-3">
<label for="itemDetailsTotalStock">Total Stock</label>
<input type="text" class="form-control" name="itemDetailsTotalStock" id="itemDetailsTotalStock" readonly>
</div>
<div class="form-group col-md-3">
<div id="imageContainer"></div>
</div>
</div>
<button type="button" id="addItem" class="btn btn-success">Add Item</button>
<button type="button" id="updateItemDetailsButton" class="btn btn-primary">Update</button>
<button type="button" id="deleteItem" class="btn btn-danger">Delete</button>
<button type="reset" class="btn" id="itemClear">Clear</button>
</form>
</div>
<div id="itemImageTab" class="container-fluid tab-pane fade">
<br>
<div id="itemImageMessage"></div>
<p>You can upload an image for a particular item using this section.</p>
<p>Please make sure the item is already added to database before uploading the image.</p>
<br>
<form name="imageForm" id="imageForm" method="post">
<div class="form-row">
<div class="form-group col-md-3" style="display:inline-block">
<label for="itemImageItemNumber">Item Number<span class="requiredIcon">*</span></label>
<input type="text" class="form-control" name="itemImageItemNumber" id="itemImageItemNumber" autocomplete="off">
<div id="itemImageItemNumberSuggestionsDiv" class="customListDivWidth"></div>
</div>
<div class="form-group col-md-4">
<label for="itemImageItemName">Item Name</label>
<input type="text" class="form-control" name="itemImageItemName" id="itemImageItemName" readonly>
</div>
</div>
<br>
<div class="form-row">
<div class="form-group col-md-7">
<label for="itemImageFile">Select Image ( <span class="blueText">jpg</span>, <span class="blueText">jpeg</span>, <span class="blueText">gif</span>, <span class="blueText">png</span> only )</label>
<input type="file" class="form-control-file btn btn-dark" id="itemImageFile" name="itemImageFile">
</div>
</div>
<br>
<button type="button" id="updateImageButton" class="btn btn-primary">Upload Image</button>
<button type="button" id="deleteImageButton" class="btn btn-danger">Delete Image</button>
<button type="reset" class="btn">Clear</button>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="v-pills-purchase" role="tabpanel" aria-labelledby="v-pills-purchase-tab">
<div class="card card-outline-secondary my-4">
<div class="card-header">Restock Details</div>
<div class="card-body">
<div id="purchaseDetailsMessage"></div>
<form>
<div class="form-row">
<div class="form-group col-md-3">
<label for="purchaseDetailsItemNumber">Item Number<span class="requiredIcon">*</span></label>
<input type="text" class="form-control" id="purchaseDetailsItemNumber" name="purchaseDetailsItemNumber" autocomplete="off">
<div id="purchaseDetailsItemNumberSuggestionsDiv" class="customListDivWidth"></div>
</div>
<div class="form-group col-md-3">
<label for="purchaseDetailsPurchaseDate">Purchase Date<span class="requiredIcon">*</span></label>
<input type="text" class="form-control datepicker" id="purchaseDetailsPurchaseDate" name="purchaseDetailsPurchaseDate" readonly value="2024-11-06">
</div>
<div class="form-group col-md-2">
<label for="purchaseDetailsPurchaseID">Purchase ID</label>
<input type="text" class="form-control invTooltip" id="purchaseDetailsPurchaseID" name="purchaseDetailsPurchaseID" title="This will be auto-generated when you add a new record" autocomplete="off">
<div id="purchaseDetailsPurchaseIDSuggestionsDiv" class="customListDivWidth"></div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="purchaseDetailsItemName">Item Name<span class="requiredIcon">*</span></label>
<input type="text" class="form-control invTooltip" id="purchaseDetailsItemName" name="purchaseDetailsItemName" readonly title="This will be auto-filled when you enter the item number above">
</div>
<div class="form-group col-md-2">
<label for="purchaseDetailsCurrentStock">Current Stock</label>
<input type="text" class="form-control" id="purchaseDetailsCurrentStock" name="purchaseDetailsCurrentStock" readonly>
</div>
<div class="form-group col-md-4">
<label for="purchaseDetailsVendorName">Vendor Name<span class="requiredIcon">*</span></label>
<select id="purchaseDetailsVendorName" name="purchaseDetailsVendorName" class="form-control chosenSelect">
<?php
require('model/vendor/getVendorNames.php');
?>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-2">
<label for="purchaseDetailsQuantity">Quantity<span class="requiredIcon">*</span></label>
<input type="number" class="form-control" id="purchaseDetailsQuantity" name="purchaseDetailsQuantity" value="0">
</div>
<div class="form-group col-md-2">
<label for="purchaseDetailsUnitPrice">Unit Price<span class="requiredIcon">*</span></label>
<input type="text" class="form-control" id="purchaseDetailsUnitPrice" name="purchaseDetailsUnitPrice" value="0">
</div>
<div class="form-group col-md-2">
<label for="purchaseDetailsTotal">Total Cost</label>
<input type="text" class="form-control" id="purchaseDetailsTotal" name="purchaseDetailsTotal" readonly>
</div>
</div>
<button type="button" id="addPurchase" class="btn btn-success">Add Purchase</button>
<button type="button" id="updatePurchaseDetailsButton" class="btn btn-primary">Update</button>
<button type="reset" class="btn">Clear</button>
</form>
</div>
</div>
</div>
<div class="tab-pane fade" id="v-pills-vendor" role="tabpanel" aria-labelledby="v-pills-vendor-tab">
<div class="card card-outline-secondary my-4">
<div class="card-header">Supplier Details</div>
<div class="card-body">
<!-- Div to show the ajax message from validations/db submission -->
<div id="vendorDetailsMessage"></div>
<form>
<div class="form-row">
<div class="form-group col-md-6">
<label for="vendorDetailsVendorFullName">Full Name<span class="requiredIcon">*</span></label>
<input type="text" class="form-control" id="vendorDetailsVendorFullName" name="vendorDetailsVendorFullName" placeholder="">
</div>
<div class="form-group col-md-2">
<label for="vendorDetailsStatus">Status</label>
<select id="vendorDetailsStatus" name="vendorDetailsStatus" class="form-control chosenSelect">
<?php include('inc/statusList.html'); ?>
</select>
</div>
<div class="form-group col-md-3">
<label for="vendorDetailsVendorID">Supplier ID</label>
<input type="text" class="form-control invTooltip" id="vendorDetailsVendorID" name="vendorDetailsVendorID" title="This will be auto-generated when you add a new vendor" autocomplete="off">
<div id="vendorDetailsVendorIDSuggestionsDiv" class="customListDivWidth"></div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="vendorDetailsVendorMobile">Phone (mobile)<span class="requiredIcon">*</span></label>
<input type="text" class="form-control invTooltip" id="vendorDetailsVendorMobile" name="vendorDetailsVendorMobile" title="Do not enter leading 0">
</div>
<div class="form-group col-md-3">
<label for="vendorDetailsVendorPhone2">Phone 2</label>
<input type="text" class="form-control invTooltip" id="vendorDetailsVendorPhone2" name="vendorDetailsVendorPhone2" title="Do not enter leading 0">
</div>
<div class="form-group col-md-6">
<label for="vendorDetailsVendorEmail">Email</label>
<input type="email" class="form-control" id="vendorDetailsVendorEmail" name="vendorDetailsVendorEmail">
</div>
</div>
<div class="form-group">
<label for="vendorDetailsVendorAddress">Address<span class="requiredIcon">*</span></label>
<input type="text" class="form-control" id="vendorDetailsVendorAddress" name="vendorDetailsVendorAddress">
</div>
<div class="form-group">
<label for="vendorDetailsVendorAddress2">Address 2</label>
<input type="text" class="form-control" id="vendorDetailsVendorAddress2" name="vendorDetailsVendorAddress2">
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="vendorDetailsVendorCity">City</label>
<input type="text" class="form-control" id="vendorDetailsVendorCity" name="vendorDetailsVendorCity">
</div>
<div class="form-group col-md-4">
<label for="vendorDetailsVendorDistrict">District</label>
<select id="vendorDetailsVendorDistrict" name="vendorDetailsVendorDistrict" class="form-control chosenSelect">
<?php include('inc/districtList.html'); ?>
</select>
</div>
</div>
<button type="button" id="addVendor" name="addVendor" class="btn btn-success">Add</button>
<button type="button" id="updateVendorDetailsButton" class="btn btn-primary">Update</button>
<button type="button" id="deleteVendorButton" class="btn btn-danger">Delete</button>
<button type="reset" class="btn">Clear</button>
</form>
</div>
</div>
</div>
<div class="tab-pane fade" id="v-pills-sale" role="tabpanel" aria-labelledby="v-pills-sale-tab">
<div class="card card-outline-secondary my-4">
<div class="card-header">Order Details</div>
<div class="card-body">
<div id="saleDetailsMessage"></div>
<form>
<div class="form-row">
<div class="form-group col-md-3">
<label for="saleDetailsItemNumber">Item Number<span class="requiredIcon">*</span></label>
<input type="text" class="form-control" id="saleDetailsItemNumber" name="saleDetailsItemNumber" autocomplete="off">
<div id="saleDetailsItemNumberSuggestionsDiv" class="customListDivWidth"></div>
</div>
<div class="form-group col-md-3">
<label for="saleDetailsCustomerID">Customer ID<span class="requiredIcon">*</span></label>
<input type="text" class="form-control" id="saleDetailsCustomerID" name="saleDetailsCustomerID" autocomplete="off">
<div id="saleDetailsCustomerIDSuggestionsDiv" class="customListDivWidth"></div>
</div>
<div class="form-group col-md-4">
<label for="saleDetailsCustomerName">Customer Name</label>
<input type="text" class="form-control" id="saleDetailsCustomerName" name="saleDetailsCustomerName" readonly>
</div>
<div class="form-group col-md-2">
<label for="saleDetailsSaleID">Order ID</label>
<input type="text" class="form-control invTooltip" id="saleDetailsSaleID" name="saleDetailsSaleID" title="This will be auto-generated when you add a new record" autocomplete="off">
<div id="saleDetailsSaleIDSuggestionsDiv" class="customListDivWidth"></div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-5">
<label for="saleDetailsItemName">Item Name</label>
<!--<select id="saleDetailsItemNames" name="saleDetailsItemNames" class="form-control chosenSelect"> -->
<?php
//require('model/item/getItemDetails.php');
?>
<!-- </select> -->
<input type="text" class="form-control invTooltip" id="saleDetailsItemName" name="saleDetailsItemName" readonly title="This will be auto-filled when you enter the item number above">
</div>
<div class="form-group col-md-3">
<label for="saleDetailsSaleDate">Order Date<span class="requiredIcon">*</span></label>
<input type="text" class="form-control datepicker" id="saleDetailsSaleDate" value="2024-11-06" name="saleDetailsSaleDate" readonly>
</div>
<div class="form-group col-md-3">
<label for="saleDetailsItemStatus">Status</label>
<!--
<input type="text" class="form-control" id="saleDetailsItemStatus" name="saleDetailsItemStatus" autocomplete="off">
-->
<select class="form-control chosenSelect" name="saleDetailsItemStatus" id="saleDetailsItemStatus" autocomplete="off">
<option value="To Deliver">To Deliver</option>
<option value="Delivered">Delivered</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-2">
<label for="saleDetailsTotalStock">Total Stock</label>
<input type="text" class="form-control" name="saleDetailsTotalStock" id="saleDetailsTotalStock" readonly>
</div>
<div class="form-group col-md-2">
<label for="saleDetailsDiscount">Discount %</label>
<input type="text" class="form-control" id="saleDetailsDiscount" name="saleDetailsDiscount" value="0">
</div>
<div class="form-group col-md-2">
<label for="saleDetailsQuantity">Quantity<span class="requiredIcon">*</span></label>
<input type="number" class="form-control" id="saleDetailsQuantity" name="saleDetailsQuantity" value="0">
</div>
<div class="form-group col-md-2">
<label for="saleDetailsUnitPrice">Unit Price<span class="requiredIcon">*</span></label>
<input type="text" class="form-control" id="saleDetailsUnitPrice" name="saleDetailsUnitPrice" value="0">
</div>
<div class="form-group col-md-3">
<label for="saleDetailsTotal">Total</label>
<input type="text" class="form-control" id="saleDetailsTotal" name="saleDetailsTotal">
</div>
<div class="form-group col-md-3">
<label for="saleDetailsTotal">Cash</label>
<select class="form-control" name="saleDetailsCash" id="saleDetailsCash">
<option value="Cash Payment">Cash Payment</option>
<option value="Online Paymen">Onlne Payment</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<div id="saleDetailsImageContainer"></div>
</div>
</div>
<button type="button" id="addSaleButton" class="btn btn-success">Add Order</button>
<button type="button" id="updateSaleDetailsButton" class="btn btn-primary">Update</button>
<button type="reset" id="saleClear" class="btn">Clear</button>
</form>
</div>
</div>
</div>
<div class="tab-pane fade" id="v-pills-customer" role="tabpanel" aria-labelledby="v-pills-customer-tab">
<div class="card card-outline-secondary my-4">
<div class="card-header">Customer Details</div>
<div class="card-body">
<!-- Div to show the ajax message from validations/db submission -->
<div id="customerDetailsMessage"></div>
<form>
<div class="form-row">
<div class="form-group col-md-6">
<label for="customerDetailsCustomerFullName">Full Name<span class="requiredIcon">*</span></label>
<input type="text" class="form-control" id="customerDetailsCustomerFullName" name="customerDetailsCustomerFullName">
</div>
<div class="form-group col-md-2">
<label for="customerDetailsStatus">Status</label>
<select id="customerDetailsStatus" name="customerDetailsStatus" class="form-control chosenSelect">
<?php include('inc/statusList.html'); ?>
</select>
</div>
<div class="form-group col-md-3">
<label for="customerDetailsCustomerID">Customer ID</label>
<input type="text" class="form-control invTooltip" id="customerDetailsCustomerID" name="customerDetailsCustomerID" title="This will be auto-generated when you add a new customer" autocomplete="off">
<div id="customerDetailsCustomerIDSuggestionsDiv" class="customListDivWidth"></div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="customerDetailsCustomerMobile">Phone (mobile)<span class="requiredIcon">*</span></label>
<input type="text" class="form-control invTooltip" id="customerDetailsCustomerMobile" name="customerDetailsCustomerMobile" title="Do not enter leading 0">
</div>
<div class="form-group col-md-3">
<label for="customerDetailsCustomerPhone2">Phone 2</label>
<input type="text" class="form-control invTooltip" id="customerDetailsCustomerPhone2" name="customerDetailsCustomerPhone2" title="Do not enter leading 0">
</div>
<div class="form-group col-md-6">
<label for="customerDetailsCustomerEmail">Email</label>
<input type="email" class="form-control" id="customerDetailsCustomerEmail" name="customerDetailsCustomerEmail">
</div>
</div>
<div class="form-group">
<label for="customerDetailsCustomerAddress">Address<span class="requiredIcon">*</span></label>
<input type="text" class="form-control" id="customerDetailsCustomerAddress" name="customerDetailsCustomerAddress">
</div>
<div class="form-group">
<label for="customerDetailsCustomerAddress2">Address 2</label>
<input type="text" class="form-control" id="customerDetailsCustomerAddress2" name="customerDetailsCustomerAddress2">
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="customerDetailsCustomerCity">City</label>
<input type="text" class="form-control" id="customerDetailsCustomerCity" name="customerDetailsCustomerCity">
</div>
<div class="form-group col-md-4">
<label for="customerDetailsCustomerDistrict">District</label>
<select id="customerDetailsCustomerDistrict" name="customerDetailsCustomerDistrict" class="form-control chosenSelect">
<?php include('inc/districtList.html'); ?>
</select>
</div>
</div>
<button type="button" id="addCustomer" name="addCustomer" class="btn btn-success">Add Customer</button>
<button type="button" id="updateCustomerDetailsButton" class="btn btn-primary">Update</button>
<button type="button" id="deleteCustomerButton" class="btn btn-danger">Delete</button>
<button type="reset" class="btn">Clear</button>
</form>
</div>
</div>
</div>
<div class="tab-pane fade" id="v-pills-search" role="tabpanel" aria-labelledby="v-pills-search-tab">
<div class="card card-outline-secondary my-4">
<div class="card-header">Search Inventory<button id="searchTablesRefresh" name="searchTablesRefresh" class="btn btn-warning float-right btn-sm">Refresh</button></div>
<div class="card-body">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#itemSearchTab">Item</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#customerSearchTab">Customer</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#saleSearchTab">Order</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#purchaseSearchTab">Purchase</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#vendorSearchTab">Supplier</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#auditSearchTab">Audit</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#usersSearchTab">Accounts</a>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div id="itemSearchTab" class="container-fluid tab-pane active">
<br>
<p>Use the grid below to search all details of items</p>
<!-- <a href="#" class="itemDetailsHover" data-toggle="popover" id="10">wwwee</a> -->
<div class="table-responsive" id="itemDetailsTableDiv"></div>
</div>
<div id="customerSearchTab" class="container-fluid tab-pane fade">
<br>
<p>Use the grid below to search all details of customers</p>
<div class="table-responsive" id="customerDetailsTableDiv"></div>
</div>
<div id="saleSearchTab" class="container-fluid tab-pane fade">
<br>
<p>Use the grid below to search all sale details</p>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
<?php
$saleDetailsSearchSql = 'SELECT itemName, quantity FROM sale';
$saleDetailsSearchStatement = $conn->prepare($saleDetailsSearchSql);
$saleDetailsSearchStatement->execute();
$salesData = [];
while($row = $saleDetailsSearchStatement->fetch(PDO::FETCH_ASSOC)) {
$salesData[] = [$row['itemName'], (int)$row['quantity']];
}
// Convert PHP array to JSON
$jsonData = json_encode($salesData);
?>
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
var salesData = <?php echo $jsonData; ?>;
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Product Name', 'Product Sold'],
...salesData // Spread the array data
]);
var options = {
title: 'Most Purchased Products',
is3D: true,
legend: {
position: 'right',
textStyle: {color: 'black',
fontSize: 10}
}
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
</script>
<div style="width: 1000px">
<div id="piechart" style="min-width: 100%; height: 200px;"></div>
</div>
<div class="table-responsive" id="saleDetailsTableDiv"></div>
</div>
<div id="purchaseSearchTab" class="container-fluid tab-pane fade">
<br>
<p>Use the grid below to search purchase details</p>
<div class="table-responsive" id="purchaseDetailsTableDiv"></div>
</div>
<div id="vendorSearchTab" class="container-fluid tab-pane fade">
<br>
<p>Use the grid below to search user details</p>
<div class="table-responsive" id="vendorDetailsTableDiv"></div>
</div>
<div id="auditSearchTab" class="container-fluid tab-pane fade">
<br>
<p>Use the grid below to search Audit Logs details</p>
<div class="table-responsive" id="auditDetailsTableDiv"></div>
</div>
<div id="usersSearchTab" class="container-fluid tab-pane fade">
<br>
<p>Use the grid below to search Account's details</p>
<div class="table-responsive" id="usersDetailsTableDiv"></div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="v-pills-track" role="tabpanel" aria-labelledby="v-pills-search-tab">
<div class="card card-outline-secondary my-4">
<div class="card-header">Track Items<button id="searchTablesRefresh" name="searchTablesRefresh" class="btn btn-warning float-right btn-sm">Refresh</button></div>
<div class="card-body">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#itemSearchTab">Item</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#customerSearchTab">Customer</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#saleSearchTab">Order</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#purchaseSearchTab">Purchase</a>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div id="itemSearchTab" class="container-fluid tab-pane active">
<br>
<p>Use the grid below to search all details of items</p>
<!-- <a href="#" class="itemDetailsHover" data-toggle="popover" id="10">wwwee</a> -->
<div class="table-responsive" id="itemDetailsTableDiv"></div>
</div>
<div id="customerSearchTab" class="container-fluid tab-pane fade">
<br>
<p>Use the grid below to search all details of customers</p>
<div class="table-responsive" id="customerDetailsTableDiv"></div>
</div>
<div id="saleSearchTab" class="container-fluid tab-pane fade">
<br>
<p>Use the grid below to search sale details</p>
<div class="table-responsive" id="saleDetailsTableDiv"></div>
</div>
<div id="purchaseSearchTab" class="container-fluid tab-pane fade">
<br>
<p>Use the grid below to search purchase details</p>
<div class="table-responsive" id="purchaseDetailsTableDiv"></div>
</div>
<div id="vendorSearchTab" class="container-fluid tab-pane fade">
<br>
<p>Use the grid below to search vendor details</p>
<div class="table-responsive" id="vendorDetailsTableDiv"></div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="v-pills-reports" role="tabpanel" aria-labelledby="v-pills-reports-tab">
<div class="card card-outline-secondary my-4">
<div class="card-header">Reports<button id="reportsTablesRefresh" name="reportsTablesRefresh" class="btn btn-warning float-right btn-sm">Refresh</button></div>
<div class="card-body">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#itemReportsTab">Item</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#customerReportsTab">Customer</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#saleReportsTab">Order</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#purchaseReportsTab">Purchase</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#vendorReportsTab">Supplier</a>
</li>
</ul>
<!-- Tab panes for reports sections -->
<div class="tab-content">
<div id="itemReportsTab" class="container-fluid tab-pane active">
<br>
<p>Use the grid below to get reports for items</p>
<div class="table-responsive" id="itemReportsTableDiv"></div>
</div>
<div id="customerReportsTab" class="container-fluid tab-pane fade">
<br>
<p>Use the grid below to get reports for customers</p>
<div class="table-responsive" id="customerReportsTableDiv"></div>
</div>
<div id="saleReportsTab" class="container-fluid tab-pane fade">
<br>
<!-- <p>Use the grid below to get reports for sales</p> -->
<form>
<div class="form-row">
<div class="form-group col-md-3">
<label for="saleReportStartDate">Start Date</label>
<input type="text" class="form-control datepicker" id="saleReportStartDate" value="2024-11-06" name="saleReportStartDate" readonly>
</div>
<div class="form-group col-md-3">
<label for="saleReportEndDate">End Date</label>
<input type="text" class="form-control datepicker" id="saleReportEndDate" value="2024-11-06" name="saleReportEndDate" readonly>
</div>
</div>
<button type="button" id="showSaleReport" class="btn btn-dark">Show Report</button>
<button type="reset" id="saleFilterClear" class="btn">Clear</button>
</form>
<br><br>
<div class="table-responsive" id="saleReportsTableDiv"></div>
</div>
<div id="purchaseReportsTab" class="container-fluid tab-pane fade">
<br>
<!-- <p>Use the grid below to get reports for purchases</p> -->
<form>
<div class="form-row">
<div class="form-group col-md-3">
<label for="purchaseReportStartDate">Start Date</label>
<input type="text" class="form-control datepicker" id="purchaseReportStartDate" value="2024-11-06" name="purchaseReportStartDate" readonly>
</div>
<div class="form-group col-md-3">
<label for="purchaseReportEndDate">End Date</label>
<input type="text" class="form-control datepicker" id="purchaseReportEndDate" value="2024-11-06" name="purchaseReportEndDate" readonly>
</div>
</div>
<button type="button" id="showPurchaseReport" class="btn btn-dark">Show Report</button>
<button type="reset" id="purchaseFilterClear" class="btn">Clear</button>
</form>
<br><br>
<div class="table-responsive" id="purchaseReportsTableDiv"></div>
</div>
<div id="vendorReportsTab" class="container-fluid tab-pane fade">
<br>
<p>Use the grid below to get reports for users</p>
<div class="table-responsive" id="vendorReportsTableDiv"></div>
</div>
</div>
</div>
</div>
</div>
<?php
require 'inc/profile.php';
?>
</div>
</div>
</div>
<?php
require 'inc/footer.php';
?>
</body>
</html>