-
Notifications
You must be signed in to change notification settings - Fork 1
/
showItems.php
801 lines (656 loc) · 27.8 KB
/
showItems.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
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
<?php
// session_start(); // Start the session
session_start();
// Check if the user is logged in
if (!isset($_SESSION['email'])) {
// If not logged in, redirect to login page
header("Location: pages-login.php");
exit();
}
include 'config/db.php'; // Include the database connection
$email = $_SESSION['email'];
//get user name and email from register table
$getAdminData = "SELECT * FROM register WHERE email = '$email'";
$resultData = mysqli_query($conn, $getAdminData);
if ($resultData->num_rows > 0) {
$row2 = $resultData->fetch_assoc();
$adminName = $row2['name'];
$adminEmail = $row2['email'];
}
// Initialize query condition
$searchQuery = "";
if (isset($_GET['query']) && !empty($_GET['query'])) {
$searchQuery = mysqli_real_escape_string($conn, $_GET['query']);
// Search query: match barcode exactly or item name partially
$sql = "SELECT * FROM box WHERE barcode = '%$searchQuery%'";
$result = $conn->query($sql);
} else {
// Default query if no search is performed
$sql = "SELECT * FROM item ORDER BY item_id DESC";
$result = $conn->query($sql);
}
$result = $conn->query($sql);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>items</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<!-- Favicons -->
<link href="assets/img/favicon.png" rel="icon">
<link href="assets/img/apple-touch-icon.png" rel="apple-touch-icon">
<!-- Google Fonts -->
<link href="https://fonts.gstatic.com" rel="preconnect">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Nunito:300,300i,400,400i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet">
<!-- Vendor CSS Files -->
<link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
<link href="assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
<link href="assets/vendor/quill/quill.snow.css" rel="stylesheet">
<link href="assets/vendor/quill/quill.bubble.css" rel="stylesheet">
<link href="assets/vendor/remixicon/remixicon.css" rel="stylesheet">
<link href="assets/vendor/simple-datatables/style.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/simple-datatables@latest/dist/style.css" rel="stylesheet" type="text/css">
<script src="https://cdn.jsdelivr.net/npm/simple-datatables@latest" type="text/javascript"></script>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Source+Serif+Pro:400,600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<link rel="stylesheet" href="fonts/icomoon/style.css">
<link rel="stylesheet" href="css/owl.carousel.min.css">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Style -->
<link rel="stylesheet" href="css/style.css">
<style>
/* Custom CSS to decrease font size of the table */
/* Basic styling for search bar */
input.btn.btn-success {
margin-left: 7px;
height: 41px;
padding: 2%;
padding-top: 3px;
padding-bottom: 3px;
text-align: center;
justify-items: center;
}
.search-container {
margin: 50px;
margin-left: 320px;
margin-bottom: 3px !important;
}
#main {
margin-top: 0 !important;
}
input[type="text"] {
padding: 8px;
font-size: 0.9rem;
width: 363px;
}
input[type="submit"] {
padding: 10px 20px;
font-size: 16px;
}
.card-body {
margin-left: 37px !important;
}
.pagetitle {
display: flex;
width: 989px;
flex-direction: column;
}
.row {
margin-left: 52px;
--bs-gutter-x: 1.5rem;
--bs-gutter-y: 0;
display: flex;
flex-wrap: wrap;
margin-top: calc(var(--bs-gutter-y)* -1);
margin-right: calc(var(--bs-gutter-x)* 1.5);
margin-left: calc(var(--bs-gutter-x)* 0.2);
}
.datatable-container {
border: none;
margin-left: 12px;
margin-top: 12px;
/* table-layout: fixed; */
}
/* Define the pulse animation */
.pagetitle {
display: flex;
width: 989px;
flex-direction: column;
}
#fixedButtonBranch {
position: relative;
top: 110px;
left: 1187px;
}
.row {
margin-left: 52px;
--bs-gutter-x: 1.5rem;
--bs-gutter-y: 0;
display: flex;
flex-wrap: wrap;
margin-top: calc(var(--bs-gutter-y)* -1);
margin-right: calc(var(--bs-gutter-x)* 1.5);
margin-left: calc(var(--bs-gutter-x)* 0.2);
}
.datatable-container {
border: none;
margin-left: 12px;
margin-top: 12px;
/* table-layout: fixed; */
}
/* Define the pulse animation */
@keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.1);
}
100% {
transform: scale(1);
}
}
/* Define the click animation */
@keyframes clickEffect {
0% {
transform: scale(1);
opacity: 1;
}
50% {
transform: scale(0.9);
opacity: 0.7;
}
100% {
transform: scale(1);
opacity: 1;
}
}
.company-name {
color: #000;
text-decoration: none;
display: inline-block;
transition: color 0.3s ease;
}
.mt-4 {
margin-top: 1.5rem !important;
margin-right: 214px;
}
.datatable-dropdown label {
font-size: 0.9rem;
}
.datatable-info {
display: none;
}
/* Card */
.cardBranch {
margin-bottom: 30px;
border: none;
border-radius: 5px;
box-shadow: 0px 0 30px rgba(1, 41, 112, 0.1);
background-color: white;
font-size: 0.8rem;
}
.company-name:active {
animation: clickEffect 0.s ease;
/* Apply the click effect animation on click */
color: #0056b3;
/* Darken color on click */
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.custom2 {
font-size: 0.8rem;
border-radius: 7px;
padding-top: 14px;
padding-bottom: 14px;
padding-right: 34px;
padding-left: 40px;
margin-left: 20px;
/* table-layout: fixed; */
/* overflow: hidden; */
/* text-overflow: ellipsis; */
/* white-space: nowrap; */
}
tbody,
td,
tr {
word-wrap: break-word;
max-width: 200px;
}
.datatable-table>tbody>tr>td,
.datatable-table>tbody>tr>th,
.datatable-table>tfoot>tr>td,
.datatable-table>tfoot>tr>th,
.datatable-table>thead>tr>td,
.datatable-table>thead>tr>th {
vertical-align: top;
padding: 8px 2px;
}
.image-circle {
display: flex;
justify-content: center;
/* Horizontally center */
align-items: center;
text-align: center;
}
.navbar-image {
width: 50px;
height: 50px;
margin-right: 7px;
}
.headerbox {
display: flex;
}
.datatable-table>thead>tr>th {
vertical-align: bottom;
text-align: left;
border-bottom: 0px solid #d9d9d9;
}
.pagetitleinside button {
width: 150px;
}
.datatable-pagination {
margin-left: 50px;
}
.datatable-top {
width: 942px;
}
.barcode {
height: 37px;
width: 167px;
position: relative;
left: -18px;
}
/* styles for card */
.card-body {
padding: 18px !important;
padding-left: 0 !important;
padding-top: 0 !important;
}
/*datatable top css*/
.datatable-top,
.datatable-bottom {
padding: 12px 10px;
margin-top: 4px;
display: flex !important;
}
.card-title {
padding: 5px 0 0px 0;
font-size: 23px;
font-weight: 500;
position: relative;
left: 11px;
color: #012970;
margin-top: 14px;
font-family: "Poppins", sans-serif;
/* font-family: "Poppins", sans-serif; */
width: 424px !important;
}
.datatable-input {
width: 240px;
height: 35px;
font-size: 0.8rem;
margin-left: 401px;
outline: none;
font-size: 17px;
border: 1px solid #ccc;
border-radius: 6px;
outline: none;
transition: all 0.3s ease;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
margin-bottom: -25px;
}
.datatable-search {
margin-left: 485px !important;
}
/* .custom-header-col-name{
margin-right: 1000px;
} */
</style>
<!-- Template Main CSS File -->
<link href="assets/css/style.css" rel="stylesheet">
<!-- =======================================================
* Template Name: NiceAdmin
* Template URL: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/
* Updated: Apr 20 2024 with Bootstrap v5.3.3
* Author: BootstrapMade.com
* License: https://bootstrapmade.com/license/
======================================================== -->
</head>
<body>
<!-- ======= Header ======= -->
<header id="header" class="header fixed-top d-flex align-items-center">
<div class="d-flex align-items-center justify-content-between">
<img class="navbar-image" src="assets/img/logo3.png" alt="">
<a href="index.php" class="logo d-flex align-items-center">
<span class="d-none d-lg-block">FingerLog</span>
</a>
<i class="bi bi-list toggle-sidebar-btn"></i>
</div><!-- End Logo -->
<div class="search-bar">
<form class="search-form d-flex align-items-center" method="POST" action="#">
<input type="text" name="query" placeholder="Search" title="Enter search keyword">
<button type="submit" title="Search"><i class="bi bi-search"></i></button>
</form>
</div><!-- End Search Bar -->
<nav class="header-nav ms-auto">
<ul class="d-flex align-items-center">
<li class="nav-item d-block d-lg-none">
<a class="nav-link nav-icon search-bar-toggle " href="#">
<i class="bi bi-search"></i>
</a>
</li><!-- End Search Icon-->
</li><!-- End Messages Nav -->
<li class="nav-item dropdown pe-3 mr-4">
<a class="nav-link nav-profile d-flex align-items-center pe-0" href="#" data-bs-toggle="dropdown">
<img src="image/admin-png.png" alt="Profile" class="rounded-circle">
<span class="d-none d-md-block dropdown-toggle ps-2"><?php echo $adminName ?></span>
</a><!-- End Profile Image Icon -->
<ul class="dropdown-menu dropdown-menu-end dropdown-menu-arrow profile">
<li class="dropdown-header">
<h6><?php echo $adminName ?></h6>
<span><?php echo $adminEmail ?></span>
</li>
<li>
<hr class="dropdown-divider">
</li>
</li>
<li>
<a class="dropdown-item d-flex align-items-center" href="logout.php">
<i class="bi bi-box-arrow-right"></i>
<span>Sign Out</span>
</a>
</li>
</ul><!-- End Profile Dropdown Items -->
</li><!-- End Profile Nav -->
</ul>
</nav><!-- End Icons Navigation -->
</header><!-- End Header -->
<?php
include "config/db.php";
$role = $_SESSION['role'];
?>
<!-- ======= Sidebar ======= -->
<aside id="sidebar" class="sidebar">
<ul class="sidebar-nav" id="sidebar-nav">
<!-- Dashboard Link (Visible to all users) -->
<li class="nav-item">
<a class="nav-link collapsed" href="index.php">
<i class="ri-home-8-line"></i>
<span>Dashboard</span>
</a>
</li><!-- End Dashboard Nav -->
<?php if ($_SESSION['role'] == 'admin') { ?>
<!-- Admin-only Links -->
<li class="nav-item">
<a class="nav-link collapsed" href="Companies.php">
<i class="ri-building-4-line"></i><span>Accounts</span><i class="bi bi-chevron ms-auto"></i>
</a>
</li><!-- End Companies Nav -->
<li class="nav-item">
<a class="nav-link collapsed" href="box.php">
<i class="ri-archive-stack-fill"></i><span>Containers</span><i class="bi bi-chevron ms-auto"></i>
</a>
</li><!-- End Boxes Nav -->
<li class="nav-item">
<a class="nav-link active" href="showItems.php">
<i class="ri-shopping-cart-line"></i><span>Items</span><i class="bi bi-chevron ms-auto"></i>
</a>
</li><!-- End Items Nav -->
<li class="nav-item">
<a class="nav-link collapsed" data-bs-toggle="collapse" data-bs-target="#forms-nav" href="#">
<i class="ri-list-ordered"></i><span>Work Order</span>
<i class="bi bi-chevron-down ms-auto"></i>
</a>
<ul id="forms-nav" class="nav-content collapse" data-bs-parent="#sidebar-nav">
<li>
<a class="nav-link" href="order.php">
<i class="bi bi-circle"></i><span>Delivery</span>
</a>
<a class="nav-link" href="pickup.php">
<i class="bi bi-circle"></i><span>Pickup</span>
</a>
<a class="nav-link" href="permout.php">
<i class="bi bi-circle"></i><span>Perm Out</span>
</a>
<a class="nav-link" href="destroy.php">
<i class="bi bi-circle"></i><span>Destroy</span>
</a>
<a class="nav-link" href="access.php">
<i class="bi bi-circle"></i><span>Access</span>
</a>
<a class="nav-link" href="supplies.php">
<i class="bi bi-circle"></i><span>Supplies</span>
</a>
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link collapsed" href="racks.php">
<i class="bi bi-box"></i><span>Racks</span><i class="bi bi-chevron ms-auto"></i>
</a>
</li><!-- End Racks Nav -->
<li class="nav-item">
<a class="nav-link collapsed" href="store.php">
<i class="bi bi-shop"></i><span>Store</span><i class="bi bi-chevron ms-auto"></i>
</a>
</li><!-- End Store Nav -->
<?php } else { ?>
<!-- User-only Links -->
<li class="nav-item">
<a class="nav-link collapsed" href="box.php">
<i class="ri-archive-stack-fill"></i><span>Containers</span><i class="bi bi-chevron ms-auto"></i>
</a>
</li><!-- End Boxes Nav -->
<li class="nav-item">
<a class="nav-link active" href="showItems.php">
<i class="ri-shopping-cart-line"></i><span>Items</span><i class="bi bi-chevron ms-auto"></i>
</a>
</li><!-- End Items Nav -->
<li class="nav-item">
<a class="nav-link collapsed" data-bs-toggle="collapse" data-bs-target="#forms-nav" href="#">
<i class="ri-list-ordered"></i><span>Work Order</span>
<i class="bi bi-chevron-down ms-auto"></i>
</a>
<ul id="forms-nav" class="nav-content collapse" data-bs-parent="#sidebar-nav">
<li>
<a class="nav-link" href="order.php">
<i class="bi bi-circle"></i><span>Delivery</span>
</a>
<a class="nav-link" href="pickup.php">
<i class="bi bi-circle"></i><span>Pickup</span>
</a>
<a class="nav-link" href="permout.php">
<i class="bi bi-circle"></i><span>Perm Out</span>
</a>
<a class="nav-link" href="destroy.php">
<i class="bi bi-circle"></i><span>Destroy</span>
</a>
<a class="nav-link" href="access.php">
<i class="bi bi-circle"></i><span>Access</span>
</a>
<a class="nav-link" href="supplies.php">
<i class="bi bi-circle"></i><span>Supplies</span>
</a>
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link collapsed" href="racks.php">
<i class="bi bi-box"></i><span>Racks</span><i class="bi bi-chevron ms-auto"></i>
</a>
</li><!-- End Racks Nav -->
<li class="nav-item">
<a class="nav-link collapsed" href="store.php">
<i class="bi bi-shop"></i><span>Store</span><i class="bi bi-chevron ms-auto"></i>
</a>
</li><!-- End Store Nav -->
<?php } ?>
<li class="nav-heading">Pages</li>
<li class="nav-item">
<a class="nav-link collapsed" href="pages-login.php">
<i class="bi bi-box-arrow-right"></i><span>Login</span>
</a>
</li><!-- End Login Nav -->
<li class="nav-item">
<a class="nav-link collapsed" href="logout.php">
<i class="bi bi-box-arrow-left"></i><span>Logout</span>
</a>
</li><!-- End Logout Nav -->
</ul>
</aside>
<!--------------- End sidebar ------------------>
<!--------------- End sidebar ------------------>
<!-- ---------------------------------------------------End Sidebar------------------------->
<!--new table design-->
<!-- Button to add new item -->
<button id="fixedButtonBranch" type="button" onclick="window.location.href = 'createitem.php'" class="btn btn-primary mb-3">Add Item</button>
<!-- Search bar -->
<div class="search-container">
<form id="searchForm" action="" method="GET">
<input type="text" id="searchInput" name="query" placeholder="Scan box barcode..." autofocus>
<input type="submit" value="Search" class="btn btn-success btn-success">
</form>
</div>
<!-- Main content -->
<main id="main" class="main">
<div class="col-12">
<div class="cardBranch recent-sales overflow-auto">
<div class="card-body">
<h5 class="card-title">List of Items</h5>
<?php
// Check if there are any results
if ($result->num_rows > 0) {
// Display table
echo '<table class="table datatable mt-4" style="table-layout: fixed;">
<thead>
<tr>
<th scope="col" style="width: 5%;">#</th>
<th scope="col" style="width: 15%;">Box barcode</th>
<th scope="col" style="width: 15%;">Item barcode</th>
<th scope="col" style="width: 20%;">Created at</th>
<th scope="col" style="width: 15%;">Status</th>';
// Show "Actions" column only if the user is an admin
if ($_SESSION['role'] == 'admin') {
echo '<th scope="col" style="width: 15%;">Actions</th>';
}
echo '</tr>
</thead>
<tbody style="table-layout: fixed;">';
// Counter variable
$counter = 1;
// Loop through results
while ($row = $result->fetch_assoc()) {
echo '<tr>';
echo '<td>' . $counter++ . '</td>';
// Get specific company id
$box_id = $row['box_id_fk'];
$sql3 = "SELECT * FROM box WHERE box_id= '$box_id'";
$result3 = $conn->query($sql3);
if ($result3->num_rows > 0) {
$row3 = $result3->fetch_assoc();
$box_barcode = $row3['barcode'];
}
echo '<td>' . $box_barcode . '</td>';
echo '<td> '. $row['barcode'] . '</a></td>';
echo '<td>' . ($row["creation_date"]) . '</td>';
echo '<td><i class="';
if ($row["status"] == 'In') {
echo 'fa-solid fa-right-to-bracket';
echo '" style="color: green; font-size: 1.5rem; </i>"';
} elseif ($row["status"] == 'Out') {
echo 'fa-solid fa-right-from-bracket';
echo '" style="color: red; font-size: 1.5rem; </i>"';
}
echo '"></i> ' . '</td>';
// echo '<td><img class="barcode" alt="' . ($row["item_id"]) . '" src="barcode.php?text=' . urlencode($row["item_id"]) . '&codetype=code128&orientation=horizontal&size=20&print=false"/></td>';
// Show "Actions" only if the user is an admin
if ($_SESSION['role'] == 'admin') {
echo '<td>
<div style="display: flex; gap: 10px;">
<a type="button" class="btn btn-danger btn-floating d-flex justify-content-center" style="width:25px; height:28px" data-mdb-ripple-init onclick="return confirm(\'Are you sure you want to delete this record?\');" href="itemDelete.php?id=' . $row['item_id'] . '"> <i style="width: 20px;" class="fa-solid fa-trash"></i></a>
</div>
</td>';
}
echo '</tr>';
}
echo '</tbody></table>';
} else {
// Display message if no results
echo '<p>No items found.</p>';
}
?>
</div>
</div>
</div>
</main>
<a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a>
<!-- Vendor JS Files -->
<script src="assets/vendor/apexcharts/apexcharts.min.js"></script>
<script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="assets/vendor/chart.js/chart.umd.js"></script>
<script src="assets/vendor/echarts/echarts.min.js"></script>
<script src="assets/vendor/quill/quill.js"></script>
<script src="assets/vendor/simple-datatables/simple-datatables.js"></script>
<script src="assets/vendor/tinymce/tinymce.min.js"></script>
<script src="assets/vendor/php-email-form/validate.js"></script>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
<!-- Template Main JS File -->
<script src="assets/js/main.js"></script>
<script>
// Listen for the Enter key press
document.getElementById("searchInput").addEventListener("keypress", function(event) {
if (event.key === "Enter") {
event.preventDefault(); // Prevent default form submission
document.getElementById("searchForm").submit(); // Manually submit the form
}
});
//click on the picture to update with ajax
$(document).on('click', 'img', function() {
$(this).next('input[type="file"]').click();
});
function uploadImage(comp_id) {
var fileInput = document.getElementById('file-' + comp_id);
var file = fileInput.files[0];
var formData = new FormData();
formData.append('image', file);
formData.append('comp_id', comp_id);
$.ajax({
url: 'update_image.php',
type: 'POST',
data: formData,
contentType: false,
processData: false,
success: function(response) {
// Update the image source with the new image path
$('#image-' + comp_id).attr('src', response);
},
error: function() {
alert('Image upload failed. Please try again.');
}
});
}
import {
Ripple,
initMDB
} from "mdb-ui-kit";
initMDB({
Ripple
});
</script>
</body>
</html>