small fix
This commit is contained in:
parent
58f3fc4c48
commit
2c10b89147
@ -118,7 +118,8 @@
|
|||||||
<h2>Item Movement List</h2>
|
<h2>Item Movement List</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -131,7 +132,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-for="(group, itemId) in filteredItems" :key="itemId" class="row card">
|
<div v-for="(group, itemId) in filteredItems" :key="itemId" class="row card">
|
||||||
<div class="card-header d-flex justify-content-between align-items-center">
|
<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)">
|
<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
|
<i :class="categoryVisible[itemId] ? 'fas fa-chevron-up' : 'fas fa-chevron-down'"></i> Show Details
|
||||||
</button>
|
</button>
|
||||||
@ -250,7 +253,10 @@
|
|||||||
'text-weird': movement.action === 'Register'}"
|
'text-weird': movement.action === 'Register'}"
|
||||||
class="flex-shrink-0 text-nowrap" style="max-width:140px; min-width:90px;">
|
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>
|
</h3>
|
||||||
|
|
||||||
<!-- Send Date -->
|
<!-- Send Date -->
|
||||||
@ -283,9 +289,13 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- Completion Status -->
|
<!-- 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">
|
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>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -341,7 +351,8 @@
|
|||||||
|
|
||||||
<!--------------------------------------------STATION CATEGORY---------------------------------------------------------------------->
|
<!--------------------------------------------STATION CATEGORY---------------------------------------------------------------------->
|
||||||
<div v-if="sortBy === 'station'">
|
<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 -->
|
<!-- Station Header -->
|
||||||
<div class="card-header d-flex justify-content-between align-items-center">
|
<div class="card-header d-flex justify-content-between align-items-center">
|
||||||
<h3>{{ station }}</h3>
|
<h3>{{ station }}</h3>
|
||||||
@ -355,7 +366,9 @@
|
|||||||
<div v-for="(group, itemId) in items" :key="itemId" class="row card">
|
<div v-for="(group, itemId) in items" :key="itemId" class="row card">
|
||||||
<!-- Item Header -->
|
<!-- Item Header -->
|
||||||
<div class="card-header d-flex justify-content-between align-items-center">
|
<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)">
|
<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
|
<i :class="categoryVisible[itemId] ? 'fas fa-chevron-up' : 'fas fa-chevron-down'"></i> Show Details
|
||||||
</button>
|
</button>
|
||||||
@ -664,26 +677,13 @@
|
|||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
console.log(grouped);
|
|
||||||
|
|
||||||
// Sort items from newest to oldest & filter them
|
// Sort items from newest to oldest & filter them
|
||||||
for (let itemId in grouped) {
|
for (let itemId in grouped) {
|
||||||
let movements = grouped[itemId].movements
|
let movements = grouped[itemId].movements
|
||||||
.sort((a, b) => b.id - a.id); // Newest to oldest
|
.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
|
// Ensure at least 3 movements before stopping
|
||||||
let stopIndex = movements.slice(3).findIndex(m =>
|
let stopIndex = movements.slice(3).findIndex(m => m.toOther === 'Return' && m.movementComplete == 1);
|
||||||
m.toOther === 'Return' && m.movementComplete == 1
|
|
||||||
);
|
|
||||||
|
|
||||||
if (stopIndex !== -1) {
|
if (stopIndex !== -1) {
|
||||||
stopIndex += 3; // Adjust index since we sliced after the first 3
|
stopIndex += 3; // Adjust index since we sliced after the first 3
|
||||||
@ -692,7 +692,6 @@
|
|||||||
|
|
||||||
grouped[itemId].movements = movements;
|
grouped[itemId].movements = movements;
|
||||||
}
|
}
|
||||||
|
|
||||||
return grouped;
|
return grouped;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -716,9 +715,7 @@
|
|||||||
.sort((a, b) => b.id - a.id); // Newest → Oldest
|
.sort((a, b) => b.id - a.id); // Newest → Oldest
|
||||||
|
|
||||||
// Ensure at least 3 movements before stopping
|
// Ensure at least 3 movements before stopping
|
||||||
let stopIndex = movements.slice(3).findIndex(m =>
|
let stopIndex = movements.slice(3).findIndex(m => m.toOther === 'Return' && m.movementComplete == 1);
|
||||||
m.toOther === 'Return' && m.movementComplete == 1
|
|
||||||
);
|
|
||||||
|
|
||||||
// Remove older movements
|
// Remove older movements
|
||||||
if (stopIndex !== -1) {
|
if (stopIndex !== -1) {
|
||||||
@ -730,9 +727,7 @@
|
|||||||
let latestMovement = movements[0];
|
let latestMovement = movements[0];
|
||||||
let station = latestMovement.lastStationName || latestMovement.toStationName || "Not Assigned";
|
let station = latestMovement.lastStationName || latestMovement.toStationName || "Not Assigned";
|
||||||
|
|
||||||
if (!groupedByStation[station]) {
|
if (!groupedByStation[station]) { groupedByStation[station] = {}; }
|
||||||
groupedByStation[station] = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
groupedByStation[station][itemId] = { uniqueID: itemId, movements };
|
groupedByStation[station][itemId] = { uniqueID: itemId, movements };
|
||||||
}
|
}
|
||||||
@ -752,8 +747,6 @@
|
|||||||
|
|
||||||
return sortedGrouped;
|
return sortedGrouped;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
filteredItems() {
|
filteredItems() {
|
||||||
if (!this.searchQuery.trim()) {
|
if (!this.searchQuery.trim()) {
|
||||||
@ -766,7 +759,7 @@
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
},
|
},
|
||||||
filteredStation() {
|
filteredStation() {
|
||||||
if (!this.searchStation) {
|
if (!this.searchStation) {
|
||||||
return this.groupedByStation;
|
return this.groupedByStation;
|
||||||
@ -781,10 +774,8 @@
|
|||||||
filtered[station] = grouped[station];
|
filtered[station] = grouped[station];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return filtered;
|
||||||
return filtered;
|
},
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -914,8 +905,6 @@
|
|||||||
}
|
}
|
||||||
if(this.currentRole == "Super Admin"){
|
if(this.currentRole == "Super Admin"){
|
||||||
this.items = await response.json();
|
this.items = await response.json();
|
||||||
|
|
||||||
console.log(this.items);
|
|
||||||
this.initAllTables();
|
this.initAllTables();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -929,10 +918,6 @@
|
|||||||
|
|
||||||
this.initAllTables();
|
this.initAllTables();
|
||||||
|
|
||||||
|
|
||||||
// console.log(this.items);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.itemDatatable) {
|
if (this.itemDatatable) {
|
||||||
@ -982,16 +967,10 @@
|
|||||||
this.renderTables();
|
this.renderTables();
|
||||||
},
|
},
|
||||||
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() {
|
initAllTables() {
|
||||||
if (this.itemMovementNotCompleteDatatable) {
|
if (this.itemMovementNotCompleteDatatable) {
|
||||||
|
|||||||
@ -591,16 +591,18 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
.Include(i => i.NextUser)
|
.Include(i => i.NextUser)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
int itemrow = 0;
|
// 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.
|
||||||
var itemMovementListWithQR = itemMovementList.Select(item => new
|
// then need dynamic numbering for qr even if item movement is repeated by the same item
|
||||||
{
|
//int itemrow = 0;
|
||||||
id = itemrow++,
|
//var itemMovementListWithQR = itemMovementList.Select(item => new
|
||||||
item, // Includes all properties of the original item
|
//{
|
||||||
QRString = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/I/{item.ItemId}", // Generate QR String
|
// id = itemrow++,
|
||||||
ProductName = item.Item?.Product?.ProductName,
|
// item, // Includes all properties of the original item
|
||||||
toUserName = item.NextUser?.FullName,
|
// QRString = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/I/{item.ItemId}", // Generate QR String
|
||||||
lastUserName = item.FromUser?.FullName
|
// ProductName = item.Item?.Product?.ProductName,
|
||||||
}).ToList();
|
// toUserName = item.NextUser?.FullName,
|
||||||
|
// lastUserName = item.FromUser?.FullName
|
||||||
|
//}).ToList();
|
||||||
//Console.WriteLine(Json(itemMovementListWithQR));
|
//Console.WriteLine(Json(itemMovementListWithQR));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user