-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathproduction_stat.php
87 lines (83 loc) · 2.8 KB
/
production_stat.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
+<?php include 'includes/header.php'; ?>
<?php
require_once "includes/classes/admin-class.php";
$admins = new Admins($dbh);
?>
<div class="dashboard">
<div class="col-md-12 col-sm-12">
<h2 class="col-md-3">Products Stock</h2>
<br><br>
<div class="col-md-3 pull-right">
<form class="form-inline pull-right">
<div class="form-group">
<label class="sr-only" for="search">Search for</label>
<div class="input-group">
<div class="input-group-addon"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></div>
<input type="text" class="form-control" id="search" placeholder="Type a name">
<div class="input-group-addon"></div>
</div>
</div>
<!-- <button type="submit" class="btn btn-info">Search</button> -->
</form>
</div>
<hr>
<div class="col-md-12 col-sm-12">
<table class="table center table-striped table-bordered" id="grid-basic">
<thead class="thead-inverse">
<tr class="info">
<th>Product ID</th>
<th>Product Name</th>
<th>Category</th>
<th>Details</th>
<th>Quantity</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$products = $admins->fetchProductionStats();
if (isset($products) && sizeof($products) > 0){
foreach ($products as $product) {
$proID = $product->product_id;
$proName = $admins->getAProduct($proID);
$product_name = $proName->pro_name;
$product_details = $proName->pro_details;
$product_category = $proName->pro_category;
?>
<tr>
<td><?=$product->product_id?></td>
<td class="search"><?php echo $product_name; ?></td>
<td class="search"><?php echo $product_category; ?></td>
<td><?php echo $product_details; ?></td>
<td><?=$product->quantity?></td>
<td><button type="submit" class="btn btn-info">LEDGER</button></td>
</tr>
<?php }} ?>
</tbody>
</table>
</div>
</div>
<?php include 'includes/footer.php'; ?>
<script type="text/javascript">
document.getElementById('date').valueAsDate = new Date();
</script>
<script type="text/javascript">
$(function() {
grid = $('#grid-basic');
// handle search fields of members key up event
$('#search').keyup(function(e) {
text = $(this).val(); // grab search term
if(text.length > 1) {
grid.find('tr:has(td)').hide(); // hide data rows, leave header row showing
// iterate through all grid rows
grid.find('tr').each(function(i) {
// check to see if search term matches Name column
if($(this).find('.search').text().toUpperCase().match(text.toUpperCase()))
$(this).show(); // show matching row
});
}
else
grid.find('tr').show(); // if no matching name is found, show all rows
});
});
</script>