-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
138 lines (125 loc) · 6.13 KB
/
Copy pathsearch.php
File metadata and controls
138 lines (125 loc) · 6.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
include('header.php');
$term = $_GET['term'];
$sql = "SELECT * FROM product WHERE name LIKE '%$term%'";
$run = mysqli_query($conn,$sql);
if(mysqli_num_rows($run) > 0){
$product = mysqli_fetch_all($run,MYSQLI_ASSOC);
}else{
$none = 0;
}
?>
<style>
.w3-modal-content{
width: 30% !important;
border-radius: 10px;
}
.ex{
border-radius: 3px;
}
</style>
<link rel="stylesheet" href="assets/css/w3.css">
<div class="main-panel">
<div class="content-wrapper">
<div class="d-xl-flex justify-content-between align-items-start">
<div class="d-sm-flex justify-content-xl-between align-items-center mb-2">
<div class="dropdown ml-0 ml-md-4 mt-2 mt-lg-0">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="d-sm-flex justify-content-between align-items-center transaparent-tab-border ">
</div>
<div class="row">
<div class="col-md-12 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">Showing search results for: <span class="text-primary"><?php echo $term ?></span></h4>
<table class="table table-striped">
<thead>
<tr>
<th> ID </th>
<th> Product Name </th>
<th> Prodcut Category </th>
<th> Price </th>
<th>Upload Date</th>
<th> Check Expiry</th>
<th> Delete</th>
</tr>
</thead>
<tbody>
<?php
if(!isset($none)){
foreach($product as $prod){
$id = $prod['id'];
?>
<tr>
<td class="py-1">
<img src="product/<?php echo $prod['id']?>.jpg" alt="image" />
</td>
<td> <?php echo $prod['name']?> </td>
<td>
<!-- <div class="progress">
<div class="progress-bar bg-success" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div> -->
<b><?php echo $prod['category']?></b>
</td>
<td> ₦ <?php echo $prod['price']?> </td>
<td> <?php
$stamp = $prod['stamp'];
date_default_timezone_set('Africa/Lagos');
$day = date('F j, Y',$stamp);
echo $day;
?> </td>
<td>
<?php
$stamp = $prod['stamp'];
$now = time();
$days_gone = $now - $stamp;
date('d',$days_gone);
$days_int = intval(date('d',$days_gone));
$days = $days_int - 1;
?>
<div id="show<?php echo $id?>" class="w3-modal">
<div class="w3-modal-content w3-card-4 w3-animate-top">
<div class="w3-container text-center">
<span onclick="document.getElementById('show<?php echo $id?>').style.display='none'"
class="w3-button w3-display-topright">×</span>
<br><br>
<p>This product will expire in</p>
<h1 class="text-primary text-bold"><?php echo $exp= $prod['inv_days'] - $days?></h1>
<p>Days</p>
</div>
</div>
</div>
<?php if($exp > 1){?>
<a onclick="document.getElementById('show<?php echo $id?>').style.display='block'" class="btn btn-primary">Check</a>
<?php }else{?>
<label for="" class="bg-danger p-1 ex text-white">Expired</label>
<?php } ?>
</td>
<td>
<a href="delete.php?id=<?php echo $id ?>" class="btn bg-white text-danger">Delete</a>
</td>
</tr>
<?php }?>
<?php }else{?>
<tr>
<td colspan="7" class=" text-center">No Records Found</td>
<?php } ?>
</tr>
</tbody>
</table>
<br>
<a href="index.php" class="btn btn-primary">End Search</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
include('footer.php');
?>