-
Notifications
You must be signed in to change notification settings - Fork 5
/
admin_home.php
73 lines (62 loc) · 2.46 KB
/
admin_home.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
<?php
//Guard
require_once '_guards.php';
Guard::adminOnly();
$products = Product::all();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Point of Sale System :: Home</title>
<link rel="stylesheet" type="text/css" href="./css/main.css">
<link rel="stylesheet" type="text/css" href="./css/admin.css">
<link rel="stylesheet" type="text/css" href="./css/util.css">
<!-- Datatables Library -->
<link rel="stylesheet" type="text/css" href="./css/datatable.css">
<script src="./js/datatable.js"></script>
<script src="./js/main.js"></script>
</head>
<body>
<?php require 'templates/admin_header.php' ?>
<div class="flex">
<?php require 'templates/admin_navbar.php' ?>
<main>
<div class="wrapper w-60p">
<span class="subtitle">Product List</span>
<hr/>
<?php displayFlashMessage('delete_product') ?>
<?php displayFlashMessage('add_stock') ?>
<table id="productsTable">
<thead>
<tr>
<th>Name</th>
<th>Category</th>
<th>Stocks</th>
<th>Price</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($products as $product) : ?>
<tr>
<td><?= $product->name ?></td>
<td><?= $product->category->name ?></td>
<td><?= $product->quantity ?></td>
<td><?= $product->price ?></td>
<td>
<a href="#" onclick="addStock(<?= $product->id ?>)" class="text-green-300">Add Stock</a>
<a href="admin_update_item.php?id=<?= $product->id ?>" class="text-primary ml-16">Update</a>
<a href="api/product_controller.php?action=delete&id=<?= $product->id ?>" class="text-red-500 ml-16">Delete</a>
</td>
<?php endforeach; ?>
</tbody>
</table>
</div>
</main>
</div>
<script type="text/javascript">
var dataTable = new simpleDatatables.DataTable("#productsTable")
</script>
</body>
</html>