From 26aaff2d2b2d1b9a2b69ea10bbe86f46c6b4af10 Mon Sep 17 00:00:00 2001 From: ameerulrasyid Date: Tue, 4 Mar 2025 14:37:23 +0800 Subject: [PATCH] update item movement master --- .../Views/InventoryMaster/ItemMovement.cshtml | 75 ++++--- .../Views/InventoryMaster/QrMaster.cshtml | 53 +++-- Controllers/API/Inventory/InvMainAPI.cs | 4 +- Views/Shared/_Layout.cshtml | 197 +++++++++--------- 4 files changed, 186 insertions(+), 143 deletions(-) diff --git a/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml b/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml index 75a019a..86d4f90 100644 --- a/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml +++ b/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml @@ -42,6 +42,11 @@

Pending Item Movement

+
+
+ Loading... +
+
@@ -51,12 +56,22 @@

Complete Item Movement

+
+
+ Loading... +
+
+
+
+ Loading... +
+

Item Movement List

@@ -68,6 +83,11 @@
+
+
+ Loading... +
+

Item : {{ group.uniqueID }}

@@ -432,6 +452,8 @@ initiateTable() { + this.loading = true; + self = this; this.itemDatatable = $('#itemDatatable').DataTable({ "data": this.items, @@ -518,34 +540,35 @@ self.deleteItem(itemId); }); - $('#itemDatatable tbody').on('click', '.print-btn', function () { - const $button = $(this); // The clicked button - const $row = $button.closest('tr'); // The parent row of the button - const itemId = $button.data('id'); // Get the item ID from the button's data attribute + // $('#itemDatatable tbody').on('click', '.print-btn', function () { + // const $button = $(this); The clicked button + // const $row = $button.closest('tr'); The parent row of the button + // const itemId = $button.data('id'); Get the item ID from the button's data attribute - let imageSrc; + // let imageSrc; - // Check if the table is collapsed - if ($row.hasClass('child')) { - // For collapsed view: Look for the closest `.dtr-data` that contains the img - imageSrc = $row.prev('tr').find('td:nth-child(1) img').attr('src'); - } else { - // For expanded view: Find the img in the first column of the current row - imageSrc = $row.find('td:nth-child(1) img').attr('src'); - } + // Check if the table is collapsed + // if ($row.hasClass('child')) { + // For collapsed view: Look for the closest `.dtr-data` that contains the img + // imageSrc = $row.prev('tr').find('td:nth-child(1) img').attr('src'); + // } else { + // For expanded view: Find the img in the first column of the current row + // imageSrc = $row.find('td:nth-child(1) img').attr('src'); + // } - if (imageSrc) { - self.printItem(itemId, imageSrc); // Call the print function with the itemId and imageSrc - } else { - console.error("Image source not found."); - } - }); + // if (imageSrc) { + // self.printItem(itemId, imageSrc); Call the print function with the itemId and imageSrc + // } else { + // console.error("Image source not found."); + // } + // }); this.loading = false; }, async fetchItem() { - await this.fetchUser(); + this.loading = true; + await this.fetchUser(); try { // const token = localStorage.getItem('token'); // Get the token from localStorage const response = await fetch('/InvMainAPI/ItemMovementList', { @@ -561,6 +584,8 @@ } if(this.currentRole == "Super Admin"){ this.items = await response.json(); + + } else { const data = await response.json(); this.items = data.filter(item => @@ -586,14 +611,9 @@ catch (error) { console.error('Error fetching item:', error); } - }, - - - - - - + this.loading = false; + }, // FRONT END FUNCTIONS //----------------------// @@ -706,6 +726,7 @@ if (roles.includes("SuperAdmin")) { this.currentRole = "Super Admin"; + this.sortBy = 'logs'; } else if (roles.includes("Inventory Master")) { this.currentRole = "Inventory Master"; this.sortBy = "item"; diff --git a/Areas/Inventory/Views/InventoryMaster/QrMaster.cshtml b/Areas/Inventory/Views/InventoryMaster/QrMaster.cshtml index f1a1a7a..b137bb6 100644 --- a/Areas/Inventory/Views/InventoryMaster/QrMaster.cshtml +++ b/Areas/Inventory/Views/InventoryMaster/QrMaster.cshtml @@ -36,6 +36,7 @@

Scan QR Code Here:

+ + + +

{{ error }}

- + +

Scan Time: {{ scanTime }} ms

@@ -150,6 +155,13 @@
+
+ +
+ +
+
+