update item movement master
This commit is contained in:
parent
4afac02583
commit
26aaff2d2b
@ -42,6 +42,11 @@
|
||||
<h2>Pending Item Movement</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div v-if="loading">
|
||||
<div class="spinner-border text-info" role="status">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-bordered table-hover table-striped no-wrap" id="itemMovementNotCompleteDatatable" style="width:100%;border-style: solid; border-width: 1px"></table>
|
||||
</div>
|
||||
</div>
|
||||
@ -51,12 +56,22 @@
|
||||
<h2>Complete Item Movement</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div v-if="loading">
|
||||
<div class="spinner-border text-info" role="status">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-bordered table-hover table-striped no-wrap" id="itemMovementCompleteDatatable" style="width:100%;border-style: solid; border-width: 1px"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="sortBy === 'logs'">
|
||||
<div v-if="loading">
|
||||
<div class="spinner-border text-info" role="status">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row card">
|
||||
<div class="card-header">
|
||||
<h2>Item Movement List</h2>
|
||||
@ -68,6 +83,11 @@
|
||||
</div>
|
||||
|
||||
<div v-if="sortBy === 'item'">
|
||||
<div v-if="loading">
|
||||
<div class="spinner-border text-info" role="status">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
</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>
|
||||
@ -432,6 +452,8 @@
|
||||
|
||||
|
||||
initiateTable() {
|
||||
this.loading = true;
|
||||
|
||||
self = this;
|
||||
this.itemDatatable = $('#itemDatatable').DataTable({
|
||||
"data": this.items,
|
||||
@ -518,33 +540,34 @@
|
||||
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')) {
|
||||
// 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 {
|
||||
// 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');
|
||||
}
|
||||
// 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() {
|
||||
this.loading = true;
|
||||
await this.fetchUser();
|
||||
try {
|
||||
// const token = localStorage.getItem('token'); // Get the token from localStorage
|
||||
@ -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,15 +611,10 @@
|
||||
catch (error) {
|
||||
console.error('Error fetching item:', error);
|
||||
}
|
||||
|
||||
this.loading = false;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// FRONT END FUNCTIONS
|
||||
//----------------------//
|
||||
//Calculate Total Price
|
||||
@ -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";
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
|
||||
<div id="registerItemMovement" v-if="!thisItem" data-aos="fade-right">
|
||||
<p style="text-align:center; padding:10px;">Scan QR Code Here:</p>
|
||||
|
||||
<qrcode-stream :constraints="selectedConstraints"
|
||||
:formats="['qr_code']"
|
||||
:track="trackFunctionSelected.value"
|
||||
@ -44,9 +45,13 @@
|
||||
v-on:error="onError">
|
||||
</qrcode-stream>
|
||||
|
||||
<!-- Debugging: Show Processed Video -->
|
||||
<canvas ref="sharpenedCanvas" style="display:none;"></canvas>
|
||||
<video ref="preview" autoplay style="width: 100%;"></video>
|
||||
<p class="error">{{ error }}</p>
|
||||
</div>
|
||||
|
||||
<p v-if="scanTime">Scan Time: {{ scanTime }} ms</p>
|
||||
<div v-if="thisItem" style="display: flex; justify-content: center; align-items: center;">
|
||||
<div class="col-lg-7 col-11 border rounded p-3 shadow-sm">
|
||||
|
||||
@ -150,6 +155,13 @@
|
||||
<form v-on:submit.prevent="receiveItemMovement" data-aos="fade-right">
|
||||
<div class="row register-form">
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">Remark:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" id="remark" name="remark" v-model="remark" class="form-control" required />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; justify-content: center; margin-top: 20px;">
|
||||
<button type="submit" class="btn btn-primary" style="width: 200px; padding: 10px; font-size: 16px;">
|
||||
Cancel Item Movement
|
||||
@ -324,7 +336,7 @@
|
||||
<label class="col-sm-4 col-form-label">To Station:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="dropdown">
|
||||
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedStation" v-on:change="handleSelection" required style="width: 100%;">
|
||||
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedStation" required style="width: 100%;">
|
||||
<option class="btn-light" value="" disabled selected>Select Station</option>
|
||||
<option class="btn-light" v-for="(station, index) in stationlist" :key="index" :value="station.stationId">{{station.stationName}}</option>
|
||||
</select>
|
||||
@ -339,7 +351,7 @@
|
||||
<label class="col-sm-4 col-form-label">To PIC:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="dropdown">
|
||||
<input type="text" id="selectedStationPIC" name="selectedStationPIC" v-model="selectedStationPIC" class="form-control" readonly />
|
||||
<input type="text" id="selectedStationPIC" name="selectedStationPIC" :value="selectedStationPicName" class="form-control" readonly />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -584,7 +596,7 @@
|
||||
supplierlist: null,
|
||||
selectedUser: "",
|
||||
selectedStation: "",
|
||||
selectedStationPIC: "",
|
||||
selectedStationPIC: null,
|
||||
selectedStore: "",
|
||||
selectedAction: "",
|
||||
assigndate: null,
|
||||
@ -626,6 +638,8 @@
|
||||
],
|
||||
videoInputDevices: [],
|
||||
selectedCameraId: null,
|
||||
scanStartTime: null,
|
||||
scanTime: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -638,15 +652,19 @@
|
||||
},
|
||||
watch: {
|
||||
selectedStation(newStationId) {
|
||||
console.log(newStationId);
|
||||
console.log(this.selectedStation);
|
||||
|
||||
// Find the station object that matches the selectedStation id
|
||||
const selectedStationObj = this.stationlist.find(station => station.stationId === newStationId);
|
||||
// Set the selectedPIC based on the stationPIC
|
||||
this.selectedStationPIC = selectedStationObj ? selectedStationObj.stationPicID : "";
|
||||
// this.selectedStationPIC = selectedStationObj ? selectedStationObj : null;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
selectedStationPicName() {
|
||||
const selectedStationObj = this.stationlist.find(station => station.stationId === this.selectedStation);
|
||||
return selectedStationObj ? selectedStationObj.stationPic.fullName : "";
|
||||
},
|
||||
filteredDepartments() {
|
||||
if (!this.selectedCompany) {
|
||||
return []; // No company selected, return empty list
|
||||
@ -667,17 +685,11 @@
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
// handleSelection(event) {
|
||||
// console.log("Event Target Value:", event.target.value); Debugging
|
||||
// const selectedstationid = event.target.value;
|
||||
// console.log(this.stationlist);
|
||||
// const selectedStationObj = this.stationlist.find(station => station.stationId == selectedstationid);
|
||||
// Set the selectedPIC based on the stationPIC
|
||||
// this.selectedStationPIC = selectedStationObj ? selectedStationObj.stationPicID : "";
|
||||
// },
|
||||
// Split Url dapatkan unique ID Je
|
||||
onDecode(detectedCodes) {
|
||||
// const endTime = performance.now();
|
||||
// this.scanTime = Math.round(endTime - this.scanStartTime); Calculate scan time
|
||||
|
||||
if (detectedCodes.length > 0) {
|
||||
this.qrCodeResult = detectedCodes[0].rawValue; // Ambil URL dari rawValue
|
||||
this.UniqueID = this.qrCodeResult.split('/').pop(); // Ambil UniqueID dari URL
|
||||
@ -702,6 +714,9 @@
|
||||
|
||||
//Setting Camera
|
||||
async onCameraReady() {
|
||||
// this.scanStartTime = performance.now(); Start timing
|
||||
// this.scanTime = null; Reset previous scan time
|
||||
|
||||
try {
|
||||
const devices = await navigator.mediaDevices.enumerateDevices();
|
||||
this.videoInputDevices = devices.filter(device => device.kind === 'videoinput');
|
||||
@ -771,7 +786,7 @@
|
||||
const formData = {
|
||||
|
||||
...(this.selectedAction === 'user' ? { toUser: this.currentUser.id, toOther: 'On Delivery', SendDate: this.assigndate, lastUser: this.selectedUser, MovementComplete: false, Remark: this.remark, ConsignmentNote: this.document} : {}),
|
||||
...(this.selectedAction === 'station' ? { toStation: this.selectedStation, toUser: this.currentUser.id, toOther: 'On Delivery', SendDate: this.assigndate, lastUser: this.selectedUser, MovementComplete: false, Remark: this.remark, ConsignmentNote: this.document} : {}),
|
||||
...(this.selectedAction === 'station' ? { toUser: this.currentUser.id, toOther: 'On Delivery', SendDate: this.assigndate, lastStation: this.selectedStation, lastUser: this.selectedStationPIC, MovementComplete: false, Remark: this.remark, ConsignmentNote: this.document} : {}),
|
||||
...(this.selectedAction === 'store' ? { toUser: this.currentUser.id, toOther: 'On Delivery', SendDate: this.assigndate, lastUser: this.selectedStore, MovementComplete: false, Remark: this.remark, ConsignmentNote: this.document} : {}),
|
||||
...(this.selectedAction === 'supplier' ? { toUser: this.currentUser.id, toOther: this.selectedOther, SendDate: this.assigndate, Remark: this.remark + '. Item sent to ' + this.selectedSupplier + ' for ' + this.selectedOther, ConsignmentNote: this.document, lastUser: this.currentUser.id, MovementComplete: false, } : {}),
|
||||
...(this.selectedAction === 'faulty' ? { toUser: this.currentUser.id,toOther: 'Faulty', Date: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(), Remark: this.remark, ConsignmentNote: this.document, MovementComplete: true, } : {}),
|
||||
@ -834,6 +849,7 @@
|
||||
|
||||
Id: this.thisItem.movementId,
|
||||
ReceiveDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
Remark: this.thisItem.toOther === "On Delivery" ? this.thisItem.remark + ". Inventory Master cancelled delivery with remark: " + this.remark : this.thisItem.remark,
|
||||
LatestStatus: this.thisItem.toOther === "Return" ? "Faulty" : (this.thisItem.toOther === "Calibration" || this.thisItem.toOther === "Repair" || this.thisItem.toOther === "On Delivery" ) ? "Ready To Deploy" : ""
|
||||
};
|
||||
|
||||
@ -884,6 +900,7 @@
|
||||
this.thisItem = await response.json();
|
||||
this.itemlateststatus = this.thisItem.latestStatus ? this.thisItem.latestStatus : this.thisItem.toOther;
|
||||
this.itemassignedtouser = this.thisItem.toUser == this.currentUser.id || this.thisItem.lastUser == this.currentUser.id ? true : false;
|
||||
console.log(this.thisItem);
|
||||
|
||||
|
||||
// if ((this.thisItem.toOther === "Repair" || this.thisItem.toOther === "Calibration" || this.thisItem.toOther === "Return" ) && this.thisItem.lastUser === this.currentUser.id && this.thisItem.movementComplete === false) {
|
||||
@ -927,6 +944,8 @@
|
||||
this.assigndate = "";
|
||||
this.selectedStore = "";
|
||||
this.selectedOther = "";
|
||||
this.selectedStation = "";
|
||||
this.selectedStationPIC = "";
|
||||
|
||||
|
||||
|
||||
|
||||
@ -538,6 +538,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
item.Movement?.LatestStatus,
|
||||
item.Movement?.LastUser,
|
||||
item.Movement?.MovementComplete,
|
||||
remark = item.Movement?.Remark,
|
||||
QRString = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/I/{item.UniqueID}" // Generate QR String
|
||||
};
|
||||
return Json(singleItem);
|
||||
@ -753,6 +754,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
|
||||
updatedList.LatestStatus = receiveMovement.LatestStatus;
|
||||
updatedList.receiveDate = receiveMovement.receiveDate;
|
||||
updatedList.Remark = receiveMovement.Remark;
|
||||
updatedList.MovementComplete = true;
|
||||
|
||||
_centralDbContext.ItemMovements.Update(updatedList);
|
||||
@ -1121,7 +1123,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpPost("StationList")]
|
||||
public async Task<IActionResult> StationList()
|
||||
{
|
||||
var stationList = await _centralDbContext.Stations.ToListAsync();
|
||||
var stationList = await _centralDbContext.Stations.Include(i => i.StationPic).ToListAsync();
|
||||
return Json(stationList);
|
||||
}
|
||||
|
||||
|
||||
@ -453,8 +453,8 @@
|
||||
<i class="mdi mdi-view-dashboard"></i><span class="hide-menu">Admin Dashboard</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
<li class="sidebar-item">
|
||||
<a class="sidebar-link waves-effect waves-dark sidebar-link"
|
||||
asp-area="Inventory" asp-controller="ItemMovement" asp-action="UserDashboard"
|
||||
@ -462,6 +462,7 @@
|
||||
<i class="mdi mdi-view-dashboard"></i><span class="hide-menu">User Dashboard</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
<li class="sidebar-item">
|
||||
<a class="sidebar-link waves-effect waves-dark sidebar-link"
|
||||
asp-area="Inventory" asp-controller="InventoryMaster" asp-action="ProductRegistration"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user