more OOP and restructure utils
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
</div>
|
||||
<div class="">
|
||||
<span>Total Categories</span>
|
||||
<h2 class="fw-bold mb-0">6</h2>
|
||||
<h2 class="fw-bold mb-0" id="total_category">6</h2>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -52,7 +52,7 @@
|
||||
</div>
|
||||
<div class="">
|
||||
<span>Active</span>
|
||||
<h2 class="fw-bold mb-0">5</h2>
|
||||
<h2 class="fw-bold mb-0" id="active_category">5</h2>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -71,7 +71,7 @@
|
||||
</div>
|
||||
<div class="">
|
||||
<span>Inactive</span>
|
||||
<h2 class="fw-bold mb-0">1</h2>
|
||||
<h2 class="fw-bold mb-0" id="inactive_category">1</h2>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -90,7 +90,7 @@
|
||||
</div>
|
||||
<div class="">
|
||||
<span>Total Products</span>
|
||||
<h2 class="fw-bold mb-0">356</h2>
|
||||
<h2 class="fw-bold mb-0" id="total_product">356</h2>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -194,6 +194,7 @@
|
||||
<th>SKU</th>
|
||||
<th>Current Stock</th>
|
||||
<th>Min Stock</th>
|
||||
<th>Reorder Point</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@@ -217,6 +218,29 @@
|
||||
<?php require "../include_ending.php";?>
|
||||
|
||||
<script>
|
||||
function retrieve_stats() {
|
||||
|
||||
return ajax_request({
|
||||
url: "<?php echo $server_url?>inventory/api/engine/product_stats.php",
|
||||
autoPrepare: true,
|
||||
checkRequired: 0,
|
||||
action: 'read',
|
||||
debugMode: 0,
|
||||
onSuccess: function(res) {
|
||||
|
||||
$("#total_category").text(res.total_category);
|
||||
$("#active_category").text(res.active_category);
|
||||
$("#inactive_category").text(res.inactive_category);
|
||||
$("#total_product").text(res.total_product);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function retrieve_category() {
|
||||
|
||||
return ajax_request({
|
||||
@@ -224,6 +248,7 @@
|
||||
autoPrepare: true,
|
||||
checkRequired: 0,
|
||||
action: 'read',
|
||||
debugMode: 0,
|
||||
onSuccess: function(res) {
|
||||
|
||||
// Register the array as a table name
|
||||
@@ -271,6 +296,7 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
function change_page_category(page_num) {
|
||||
|
||||
var offset = (page_num - 1) * prop_limit;
|
||||
@@ -283,9 +309,9 @@
|
||||
<td class="py-3">${item['category']}</td>
|
||||
<td class="py-3">${item['slug']}</td>
|
||||
<td class="py-3">${item['description']}</td>
|
||||
<td class="py-3">${item['status']}</td>
|
||||
<td class="py-3">${item['product_count']}</td>
|
||||
<td class="py-3">
|
||||
${(item['status'])?'<span class="badge bg-success">Active</span>':'<span class="badge bg-secondary">Inactive</span>'}
|
||||
${(item['status']==1)?'<span class="badge bg-success">Active</span>':'<span class="badge bg-secondary">Inactive</span>'}
|
||||
</td>
|
||||
<td class="py-3">
|
||||
<a href="<?php echo $server_url?>inventory/manage_category.php?id=${item['id']}" class=""><i class="ti ti-eye fs-5"></i></a>
|
||||
@@ -332,6 +358,7 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
function change_page_product(page_num) {
|
||||
|
||||
var offset = (page_num - 1) * prop_limit;
|
||||
@@ -343,10 +370,11 @@
|
||||
body += `<tr>
|
||||
<td class="py-3">${item['product_name']}</td>
|
||||
<td class="py-3">${item['sku']}</td>
|
||||
<td class="py-3">${item['description']}</td>
|
||||
<td class="py-3" style='text-align: right;'>${format_number(item['product_balance'],4)}</td>
|
||||
<td class="py-3" style='text-align: right;'>${format_number(item['min_stock'],2)}</td>
|
||||
<td class="py-3" style='text-align: right;'>${format_number(item['reorder_point'],2)}</td>
|
||||
<td class="py-3">
|
||||
${(item['status'])?'<span class="badge bg-success">Active</span>':'<span class="badge bg-secondary">Inactive</span>'}
|
||||
${(item['status']==1)?'<span class="badge bg-success">Active</span>':'<span class="badge bg-secondary">Inactive</span>'}
|
||||
</td>
|
||||
<td class="py-3">
|
||||
<a href="<?php echo $server_url?>inventory/manage_product.php?id=${item['id']}" class=""><i class="ti ti-eye fs-5"></i></a>
|
||||
@@ -361,6 +389,7 @@
|
||||
|
||||
$(async function() {
|
||||
try {
|
||||
await retrieve_stats();
|
||||
await retrieve_category();
|
||||
await retrieve_product();
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user