This repository has been archived by the owner on Aug 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinventory.php
235 lines (223 loc) · 13.3 KB
/
inventory.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>Inventory - Point of Sale and Inventory Management System</title>
<meta name="description" content="Inventory & Point of Sale System">
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i&display=swap">
<link rel="stylesheet" href="assets/fonts/fontawesome-all.min.css">
<link rel="stylesheet" href="assets/css/Pricing-Centered-badges.css">
<link rel="stylesheet" href="assets/css/Pricing-Centered-icons.css">
</head>
<body id="page-top">
<div id="wrapper">
<?php
include_once 'functions/authentication.php';
include_once 'functions/sidebar.php';
?>
<div class="d-flex flex-column" id="content-wrapper">
<div id="content">
<nav class="navbar navbar-light navbar-expand bg-white shadow mb-4 topbar static-top">
<div class="container-fluid"><span>KYLE SHOE'S SHOP POINT OF SALE AND INVENTORY MANAGEMENT SYSTEM</span></div>
</nav>
<div class="container-fluid">
<h3 class="text-dark mb-4">Inventory Management</h3>
<div class="row">
<div class="col-md-6 col-xl-4 mb-4">
<div class="card shadow border-start-warning py-2">
<div class="card-body">
<div class="row align-items-center no-gutters">
<?php
// Connect to the database.
$db = new PDO('mysql:host=localhost;dbname=db_hash', 'root', '');
// Get the total number of users.
$sql = "SELECT COUNT(*) FROM products";
$stmt = $db->prepare($sql);
$stmt->execute();
$row = $stmt->fetch();
$total_products = $row['COUNT(*)'];
// Display the total number of users.
echo "<div class=\"col me-2\">
<div class=\"text-uppercase text-info fw-bold text-xs mb-1\"><span>total product</span></div>
<div class=\"text-dark fw-bold h5 mb-0\"><span>$total_products</span></div>
</div>";
?>
<div class="col-auto"><i class="fas fa-table fa-2x text-gray-300"></i></div>
</div>
</div>
</div>
</div>
</div>
<div class="card shadow">
<div class="card-header py-3">
<p class="text-primary m-0 fw-bold">Product List</p><button class="btn btn-primary btn-icon-split" type="button" data-bs-target="#add-product" data-bs-toggle="modal"><span class="text-white-50 icon"><i class="fas fa-download"></i></span><span class="text-white text">Add Product</span></button>
</div>
<div class="card-body">
<div class="table-responsive table mt-2" id="dataTable" role="grid" aria-describedby="dataTable_info">
<table class="table table-hover table-bordered my-0" id="dataTable">
<thead>
<tr>
<th>Product Code</th>
<th>Product Name</th>
<th>Size</th>
<th>Qty</th>
<th>Price</th>
<th>Product Created</th>
<th>Product Options (Stock In, Stock Out, Update and Remove)</th>
</tr>
</thead>
<tbody>
<?php include_once 'functions/view-products.php'; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<footer class="bg-white sticky-footer">
<div class="container my-auto">
<div class="text-center my-auto copyright"><span>Copyright © Inventory & Point of Sale System 2023</span></div>
</div>
</footer>
</div><a class="border rounded d-inline scroll-to-top" href="#page-top"><i class="fas fa-angle-up"></i></a>
</div>
<div class="modal fade" role="dialog" tabindex="-1" id="add-product">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Add Product</h4><button class="btn-close" type="button" aria-label="Close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<p>Product Information</p>
<form class="text-center" action="functions/add-product.php" method="post">
<div class="mb-3"><input class="form-control" type="text" pattern="^(?!\s).*$" name="product_name" placeholder="Product Name" required=""></div>
<div class="mb-3"><input class="form-control" type="number" name="size" placeholder="Size" required=""></div>
<div class="mb-3"><input class="form-control" type="number" name="qty" placeholder="Quantity"></div>
<div class="mb-3"><input class="form-control" type="number" name="price" placeholder="Price" required=""></div>
<div class="mb-3"><button class="btn btn-primary d-block w-100" type="submit">Add Product</button></div>
</form>
</div>
<div class="modal-footer"><button class="btn btn-light" type="button" data-bs-dismiss="modal">Close</button></div>
</div>
</div>
</div>
<div class="modal fade" role="dialog" tabindex="-1" id="update-product">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Update Product</h4><button class="btn-close" type="button" aria-label="Close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<p>Product Information</p>
<form class="text-center" action="functions/update-product.php" method="post">
<input type="hidden" name="product_id">
<div class="mb-3"><input class="form-control" type="text" pattern="^(?!\s).*$" name="product_name" placeholder="Product Name" required=""></div>
<div class="mb-3"><input class="form-control" type="number" name="size" placeholder="Size" required=""></div>
<div class="mb-3"><input class="form-control" type="number" name="qty" placeholder="Quantity"></div>
<div class="mb-3"><input class="form-control" type="number" name="price" placeholder="Price" required=""></div>
<div class="mb-3"><button class="btn btn-primary d-block w-100" type="submit">Update Product</button></div>
</form>
</div>
<div class="modal-footer"><button class="btn btn-light" type="button" data-bs-dismiss="modal">Close</button></div>
</div>
</div>
</div>
<div class="modal fade" role="dialog" tabindex="-1" id="stock-in">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Stock-In</h4><button class="btn-close" type="button" aria-label="Close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<p>Product Information</p>
<form class="text-center" action="functions/stock-in.php" method="post">
<input type="hidden" name="product_id">
<div class="mb-3"><input class="form-control" type="text" name="qty" placeholder="Quantity" required></div>
<div class="mb-3"><button class="btn btn-primary d-block w-100" type="submit">Stock In</button></div>
</form>
</div>
<div class="modal-footer"><button class="btn btn-light" type="button" data-bs-dismiss="modal">Close</button></div>
</div>
</div>
</div>
<div class="modal fade" role="dialog" tabindex="-1" id="stock-out">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Stock-out</h4><button class="btn-close" type="button" aria-label="Close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<p>Product Information</p>
<form class="text-center" action="functions/stock-out.php" method="post">
<input type="hidden" name="product_id">
<div class="mb-3"><input class="form-control" type="text" name="qty" placeholder="Quantity" required></div>
<div class="mb-3"><button class="btn btn-primary d-block w-100" type="submit">Stock out</button></div>
</form>
</div>
<div class="modal-footer"><button class="btn btn-light" type="button" data-bs-dismiss="modal">Close</button></div>
</div>
</div>
</div>
<div class="modal fade" role="dialog" tabindex="-1" id="confirmation">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Confirmation</h4><button class="btn-close" type="button" aria-label="Close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<p>Are you sure you want to remove this product?</p>
</div>
<form action="functions/remove-product.php" method="post">
<input type="hidden" name="product_id">
<div class="modal-footer"><button class="btn btn-light" type="button" data-bs-dismiss="modal">Close</button><button class="btn btn-danger" type="submit">Remove</button></div>
</form>
</div>
</div>
</div>
<script src="assets/js/jquery.min.js"></script>
<script>
$('button[data-bs-target="#stock-in"]').on('click', function() {
// Get the user ID from the data attribute.
var product_id = $(this).data('product-id');
console.log(product_id);
// Set the value of all input fields with the name "userid" to the user ID.
$('input[name="product_id"]').each(function() {
$(this).val(product_id);
});
});
$('button[data-bs-target="#stock-out"]').on('click', function() {
// Get the user ID from the data attribute.
var product_id = $(this).data('product-id');
console.log(product_id);
// Set the value of all input fields with the name "userid" to the user ID.
$('input[name="product_id"]').each(function() {
$(this).val(product_id);
});
});
$('button[data-bs-target="#update-product"]').on('click', function() {
// Get the user ID from the data attribute.
var product_id = $(this).data('product-id');
console.log(product_id);
// Set the value of all input fields with the name "userid" to the user ID.
$('input[name="product_id"]').each(function() {
$(this).val(product_id);
});
});
$('button[data-bs-target="#confirmation"]').on('click', function() {
// Get the user ID from the data attribute.
var product_id = $(this).data('product-id');
console.log(product_id);
// Set the value of all input fields with the name "userid" to the user ID.
$('input[name="product_id"]').each(function() {
$(this).val(product_id);
});
});
</script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/js/bs-init.js"></script>
<script src="assets/js/theme.js"></script>
</body>
</html>