Merge branch 'Dev2' of https://git.pstw.com.my/catalyx/PSTW_CentralizeSystem into Dev2
This commit is contained in:
commit
e5e1414826
@ -118,7 +118,8 @@
|
||||
<h2>Item Movement List</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-bordered table-hover table-striped no-wrap" id="itemDatatable" style=" width:100%;border-style: solid; border-width: 1px"></table>
|
||||
<table class="table table-bordered table-hover table-striped no-wrap" id="itemDatatable"
|
||||
style=" width:100%;border-style: solid; border-width: 1px"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -131,7 +132,9 @@
|
||||
</div>
|
||||
<div v-for="(group, itemId) in filteredItems" :key="itemId" class="row card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h2>Item : {{ group.uniqueID }}</h2>
|
||||
@* <h2>Item : {{ group.uniqueID }}</h2> *@
|
||||
<h2 v-if="group.uniqueID">Item : {{ group.uniqueID }}</h2>
|
||||
<h2 v-else>Item : No Item Tracked</h2>
|
||||
<button class="btn btn-light" v-on:click="toggleCategory(itemId)">
|
||||
<i :class="categoryVisible[itemId] ? 'fas fa-chevron-up' : 'fas fa-chevron-down'"></i> Show Details
|
||||
</button>
|
||||
@ -250,7 +253,10 @@
|
||||
'text-weird': movement.action === 'Register'}"
|
||||
class="flex-shrink-0 text-nowrap" style="max-width:140px; min-width:90px;">
|
||||
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' : ( movement.toStation !== null ? 'Change' : ( movement.toOther == 'Faulty' || movement.toOther == 'Calibration' || movement.toOther == 'Repair' ? movement.toOther : ( movement.action == 'Register' ? 'Register' : 'Assign')))) }}
|
||||
{{ movement.toOther === 'Return' ? 'Return' : (movement.toOther === 'On Delivery' ? 'Receive' :
|
||||
( movement.toStation !== null ? 'Change' :
|
||||
( movement.toOther == 'Faulty' || movement.toOther == 'Calibration' || movement.toOther == 'Repair' ? movement.toOther :
|
||||
( movement.action == 'Register' ? 'Register' : 'Assign')))) }}
|
||||
</h3>
|
||||
|
||||
<!-- Send Date -->
|
||||
@ -283,9 +289,13 @@
|
||||
</button>
|
||||
|
||||
<!-- Completion Status -->
|
||||
<h4 :class="movement.action == 'Register' ? 'text-success' : movement.movementComplete == 1 && movement.latestStatus !== 'Ready To Deploy' ? 'text-success' : movement.toOther === 'Repair' || movement.toOther === 'Calibration' && movement.latestStatus === 'Ready To Deploy' ? 'text-success' :'text-danger'"
|
||||
<h4 :class="movement.action == 'Register' ? 'text-success' : movement.movementComplete == 1 && movement.latestStatus !== 'Ready To Deploy' ? 'text-success' :
|
||||
movement.toOther === 'Repair' || movement.toOther === 'Calibration' && movement.latestStatus === 'Ready To Deploy' ? 'text-success' :'text-danger'"
|
||||
class="text-nowrap ms-3">
|
||||
{{ movement.action == 'Register' ? 'Complete' : (movement.movementComplete == 1 && movement.latestStatus !== 'Ready To Deploy' ? 'Complete' : ( movement.toOther === 'Repair' || movement.toOther === 'Calibration' && movement.latestStatus === 'Ready To Deploy' ? 'Complete' : (movement.latestStatus === 'Ready To Deploy' ? 'Canceled' : 'Incomplete'))) }}
|
||||
{{ movement.action == 'Register' ? 'Complete' :
|
||||
(movement.movementComplete == 1 && movement.latestStatus !== 'Ready To Deploy' ? 'Complete' :
|
||||
( movement.toOther === 'Repair' || movement.toOther === 'Calibration' && movement.latestStatus === 'Ready To Deploy' ? 'Complete' :
|
||||
(movement.latestStatus === 'Ready To Deploy' ? 'Canceled' : 'Incomplete'))) }}
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
@ -341,7 +351,8 @@
|
||||
|
||||
<!--------------------------------------------STATION CATEGORY---------------------------------------------------------------------->
|
||||
<div v-if="sortBy === 'station'">
|
||||
<div v-for="(items, station) in filteredStation" :key="stationName" :class="{'bg-light-gray': station === 'Unassign Station', 'bg-white': station !== 'Unassign Station'}" class="station-category card mt-3">
|
||||
<div v-for="(items, station) in filteredStation" :key="stationName"
|
||||
:class="{'bg-light-gray': station === 'Unassign Station', 'bg-white': station !== 'Unassign Station'}" class="station-category card mt-3">
|
||||
<!-- Station Header -->
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h3>{{ station }}</h3>
|
||||
@ -355,7 +366,9 @@
|
||||
<div v-for="(group, itemId) in items" :key="itemId" class="row card">
|
||||
<!-- Item Header -->
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h2>Item : {{ group.uniqueID }}</h2>
|
||||
@* <h2>Item : {{ group.uniqueID }}</h2> *@
|
||||
<h2 v-if="group.uniqueID">Item : {{ group.uniqueID }}</h2>
|
||||
<h2 v-else>Item : No Item Tracked</h2>
|
||||
<button class="btn btn-light" v-on:click="toggleCategory(itemId)">
|
||||
<i :class="categoryVisible[itemId] ? 'fas fa-chevron-up' : 'fas fa-chevron-down'"></i> Show Details
|
||||
</button>
|
||||
@ -664,26 +677,13 @@
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
console.log(grouped);
|
||||
|
||||
// Sort items from newest to oldest & filter them
|
||||
for (let itemId in grouped) {
|
||||
let movements = grouped[itemId].movements
|
||||
.sort((a, b) => b.id - a.id); // Newest to oldest
|
||||
|
||||
// console.log(movements);
|
||||
// let stopIndex = movements.findIndex(m =>
|
||||
// m.toOther === 'Return' && m.movementComplete == 1
|
||||
// );
|
||||
|
||||
// if (stopIndex !== -1) {
|
||||
// movements = movements.slice(0, stopIndex + 1);
|
||||
// }
|
||||
|
||||
// Ensure at least 3 movements before stopping
|
||||
let stopIndex = movements.slice(3).findIndex(m =>
|
||||
m.toOther === 'Return' && m.movementComplete == 1
|
||||
);
|
||||
let stopIndex = movements.slice(3).findIndex(m => m.toOther === 'Return' && m.movementComplete == 1);
|
||||
|
||||
if (stopIndex !== -1) {
|
||||
stopIndex += 3; // Adjust index since we sliced after the first 3
|
||||
@ -692,7 +692,6 @@
|
||||
|
||||
grouped[itemId].movements = movements;
|
||||
}
|
||||
|
||||
return grouped;
|
||||
},
|
||||
|
||||
@ -716,9 +715,7 @@
|
||||
.sort((a, b) => b.id - a.id); // Newest → Oldest
|
||||
|
||||
// Ensure at least 3 movements before stopping
|
||||
let stopIndex = movements.slice(3).findIndex(m =>
|
||||
m.toOther === 'Return' && m.movementComplete == 1
|
||||
);
|
||||
let stopIndex = movements.slice(3).findIndex(m => m.toOther === 'Return' && m.movementComplete == 1);
|
||||
|
||||
// Remove older movements
|
||||
if (stopIndex !== -1) {
|
||||
@ -730,9 +727,7 @@
|
||||
let latestMovement = movements[0];
|
||||
let station = latestMovement.lastStationName || latestMovement.toStationName || "Not Assigned";
|
||||
|
||||
if (!groupedByStation[station]) {
|
||||
groupedByStation[station] = {};
|
||||
}
|
||||
if (!groupedByStation[station]) { groupedByStation[station] = {}; }
|
||||
|
||||
groupedByStation[station][itemId] = { uniqueID: itemId, movements };
|
||||
}
|
||||
@ -752,8 +747,6 @@
|
||||
|
||||
return sortedGrouped;
|
||||
|
||||
|
||||
|
||||
},
|
||||
filteredItems() {
|
||||
if (!this.searchQuery.trim()) {
|
||||
@ -766,7 +759,7 @@
|
||||
)
|
||||
);
|
||||
|
||||
},
|
||||
},
|
||||
filteredStation() {
|
||||
if (!this.searchStation) {
|
||||
return this.groupedByStation;
|
||||
@ -781,10 +774,8 @@
|
||||
filtered[station] = grouped[station];
|
||||
}
|
||||
});
|
||||
|
||||
return filtered;
|
||||
|
||||
},
|
||||
return filtered;
|
||||
},
|
||||
|
||||
},
|
||||
methods: {
|
||||
@ -914,8 +905,6 @@
|
||||
}
|
||||
if(this.currentRole == "Super Admin"){
|
||||
this.items = await response.json();
|
||||
|
||||
console.log(this.items);
|
||||
this.initAllTables();
|
||||
|
||||
} else {
|
||||
@ -929,10 +918,6 @@
|
||||
|
||||
this.initAllTables();
|
||||
|
||||
|
||||
// console.log(this.items);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (this.itemDatatable) {
|
||||
@ -982,16 +967,10 @@
|
||||
this.renderTables();
|
||||
},
|
||||
renderTables() {
|
||||
// if (this.sortBy === "logs") {
|
||||
// // this.initAllTables();
|
||||
// this.initiateTable();
|
||||
// } else
|
||||
// if (this.sortBy === "all") {
|
||||
// this.initAllTables();
|
||||
// // this.initiateTable();
|
||||
// }
|
||||
|
||||
this.initAllTables();
|
||||
this.initAllTables();
|
||||
this.initiateTable();
|
||||
|
||||
},
|
||||
initAllTables() {
|
||||
if (this.itemMovementNotCompleteDatatable) {
|
||||
|
||||
@ -591,16 +591,18 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
.Include(i => i.NextUser)
|
||||
.ToListAsync();
|
||||
|
||||
int itemrow = 0;
|
||||
var itemMovementListWithQR = itemMovementList.Select(item => new
|
||||
{
|
||||
id = itemrow++,
|
||||
item, // Includes all properties of the original item
|
||||
QRString = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/I/{item.ItemId}", // Generate QR String
|
||||
ProductName = item.Item?.Product?.ProductName,
|
||||
toUserName = item.NextUser?.FullName,
|
||||
lastUserName = item.FromUser?.FullName
|
||||
}).ToList();
|
||||
// if use qr, need to use this. else do simple return json. datatable qr will read dom and replace element with id=qr{qrstring} with qr image.
|
||||
// then need dynamic numbering for qr even if item movement is repeated by the same item
|
||||
//int itemrow = 0;
|
||||
//var itemMovementListWithQR = itemMovementList.Select(item => new
|
||||
//{
|
||||
// id = itemrow++,
|
||||
// item, // Includes all properties of the original item
|
||||
// QRString = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/I/{item.ItemId}", // Generate QR String
|
||||
// ProductName = item.Item?.Product?.ProductName,
|
||||
// toUserName = item.NextUser?.FullName,
|
||||
// lastUserName = item.FromUser?.FullName
|
||||
//}).ToList();
|
||||
//Console.WriteLine(Json(itemMovementListWithQR));
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user