-
Notifications
You must be signed in to change notification settings - Fork 5
/
admin_update_item.php
85 lines (72 loc) · 3.22 KB
/
admin_update_item.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
<?php
//Guard
require_once '_guards.php';
Guard::adminOnly();
$product = Guard::hasModel(Product::class);
$categories = Category::all();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Point of Sale System :: Update Product</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">
</head>
<body>
<?php require 'templates/admin_header.php' ?>
<div class="flex">
<?php require 'templates/admin_navbar.php' ?>
<main>
<div class="wrapper">
<div class="w-40p">
<div class="subtitle">Update Product</div>
<hr/>
<div class="card">
<div class="card-content">
<form method="POST" action="api/product_controller.php?action=update&id=<?= $product->id ?>">
<?php displayFlashMessage('update_product') ?>
<div class="form-control">
<label>Name</label>
<input
value="<?= $product->name ?>"
type="text"
name="name"
required=""
/>
</div>
<div class="form-control mt-16">
<label>Category</label>
<select name="category_id" required="">
<option value=""> -- Select Category --</option>
<?php foreach ($categories as $category) : ?>
<option
value="<?= $category->id ?>"
<?= $category->id === $product->category_id ? 'selected' : '' ?>
><?= $category->name ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="form-control mt-16">
<label>Price</label>
<input
value="<?= $product->price ?>"
required=""
type="number"
step=".25"
name="price"
/>
</div>
<div class="mt-16">
<button class="btn btn-primary w-full" type="submit">Update Product</button>
</div>
</form>
</div>
</div>
</div>
</div>
</main>
</div>
</body>
</html>