diff --git a/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml b/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml
index a53292f..bada624 100644
--- a/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml
+++ b/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml
@@ -1044,44 +1044,43 @@
this.loading = true;
await this.fetchUser();
try {
- // const token = localStorage.getItem('token'); // Get the token from localStorage
const response = await fetch('/InvMainAPI/ItemMovementList', {
- method: 'POST', // Specify the HTTP method
- headers: {
- 'Content-Type': 'application/json', // Set content type
- // 'Authorization': `Bearer ${token}` // Include the token in the headers
- }
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' }
});
- if (!response.ok) {
- throw new Error('Failed to fetch item');
- }
+ if (!response.ok) throw new Error('Failed to fetch item');
+
+ const data = await response.json();
+
if(this.currentRole == "Super Admin"){
- this.items = await response.json();
- this.initAllTables();
-
+ this.items = data;
} else {
- const data = await response.json();
+
+ const myStationIds = this.stations
+ .filter(s => s.stationPicID === this.currentUser.id)
+ .map(s => s.stationId);
+
this.items = data.filter(item =>
- item.lastUser === this.currentUser.id ||
- item.toUser === this.currentUser.id ||
- item.lastStore === this.currentUser.store ||
- item.toStore === this.currentUser.store
+ item.lastUser === this.currentUser.id ||
+ item.toUser === this.currentUser.id ||
+ (item.lastStation && myStationIds.includes(item.lastStation)) ||
+ (item.toStation && myStationIds.includes(item.toStation)) ||
+ item.lastStore === this.currentUser.store ||
+ item.toStore === this.currentUser.store
);
-
- this.initAllTables();
-
}
+ this.initAllTables();
+
if (this.itemDatatable) {
this.itemDatatable.clear().destroy();
}
this.initiateTable();
- }
+ }
catch (error) {
console.error('Error fetching item:', error);
}
-
this.loading = false;
},
async fetchUser() {
@@ -1164,10 +1163,10 @@
{ title: "Action", data: "action" },
{ title: "Send Date", data: "sendDate" , render: this.formatDate.bind(this)},
{ title: "From User", data: "lastUserName" },
- { title: "Last User", data: "toUserName" },
{ title: "From Station", data: "lastStationName" },
- { title: "Last Station", data: "toStationName" },
{ title: "From Store", data: "lastStoreName" },
+ { title: "Last User", data: "toUserName" },
+ { title: "Last Station", data: "toStationName" },
{ title: "Last Store", data: "toStoreName" },
{ title: "Start Status", data: "toOther" },
{ title: "Product Category", data: "productCategory" },
@@ -1189,10 +1188,10 @@
{ title: "Receive Date", data: "receiveDate", render: this.formatDate.bind(this) },
{ title: "Action", data: "action" },
{ title: "From User", data: "lastUserName" },
- { title: "Last User", data: "toUserName" },
{ title: "From Station", data: "lastStationName" },
- { title: "Last Station", data: "toStationName" },
{ title: "From Store", data: "lastStoreName" },
+ { title: "Last User", data: "toUserName" },
+ { title: "Last Station", data: "toStationName" },
{ title: "Last Store", data: "toStoreName" },
{ title: "Start Status", data: "toOther" },
{ title: "Latest Status", data: "latestStatus" },
@@ -1205,12 +1204,16 @@
});
this.assignStationDatatable = $("#assignStationDatatable").DataTable({
- data: this.items.filter((m) => m.action === "Assign" ),
+ data: this.items.filter((m) =>
+ m.action === "Assign" ||
+ m.action === "Change" ||
+ m.toStation !== null
+ ),
columns: [
{ title: "Unique Id", data: "id" },
{ title: "Product Name", data: "productName", render: (data, type, full) => { return `${data}
${renderFile(full.productImage)}`; } },
{ title: "Product Code", data: "uniqueID" },
- { title: "Assign Date", data: "sendDate", render: this.formatDate.bind(this) },
+ { title: "Assign Date", data: "sendDate", render: this.formatDate.bind(this) },
{ title: "Action", data: "action" },
{ title: "Station User PIC", data: "lastUserName" },
{ title: "From Station", data: "lastStationName" },
diff --git a/Areas/Inventory/Views/InventoryMaster/ItemRequestMaster.cshtml b/Areas/Inventory/Views/InventoryMaster/ItemRequestMaster.cshtml
index bd7362f..92e899b 100644
--- a/Areas/Inventory/Views/InventoryMaster/ItemRequestMaster.cshtml
+++ b/Areas/Inventory/Views/InventoryMaster/ItemRequestMaster.cshtml
@@ -337,7 +337,7 @@