Qr & Movement Display
This commit is contained in:
parent
4afac02583
commit
eab78d321f
@ -36,27 +36,37 @@
|
||||
.ms-auto {
|
||||
margin-left: auto !important; /* Push Complete/Incomplete to right */
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartialUser.cshtml")
|
||||
|
||||
<div id="ItemMovement" class="row">
|
||||
<div class="row mb-3">
|
||||
<h2 for="sortSelect" class="col-sm-1 col-form-h2" style="min-width:140px;">Sort by:</h2>
|
||||
<h2 for="sortSelect" class="col-sm-1 col-form-h2" style="min-width:150px;">Sort by:</h2>
|
||||
<div class="col-sm-4">
|
||||
<select id="sortSelect" class="form-control" v-model="sortBy" v-on:change="handleSorting">
|
||||
<option value="all">All</option>
|
||||
<option value="item">Item</option>
|
||||
<option value="station">Station</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3" v-if="sortBy === 'item'">
|
||||
<h4 class="col-sm-1 col-form-h2" style="min-width:140px;">Search Item:</h4>
|
||||
<h4 class="col-sm-1 col-form-h2" style="min-width:150px;">Search Item:</h4>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" v-model="searchQuery" placeholder="Search by item code...">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3" v-if="sortBy === 'station'">
|
||||
<h4 class="col-sm-1 col-form-h2" style="min-width:150px;">Search Station:</h4>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" v-model="searchStation" placeholder="Search by station name...">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="sortBy === 'all'">
|
||||
<div class="row card">
|
||||
<div class="card-header">
|
||||
@ -77,6 +87,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--------------------------------------------ITEM CATEGORY---------------------------------------------------------------------->
|
||||
<div v-if="sortBy === 'item'">
|
||||
<div v-for="(group, itemId) in filteredItems" :key="itemId" class="row card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
@ -94,11 +105,16 @@
|
||||
<strong>Latest Movement</strong>
|
||||
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
||||
<!-- Movement Type -->
|
||||
<h3 :class="movement.toOther === 'On Delivery' ? 'text-primary' : 'text-warning'"
|
||||
class="flex-shrink-0 text-nowrap" style="max-width:90px; min-width:90px;">
|
||||
{{ movement.toOther === 'On Delivery' ? 'Receive' : 'Return' }}
|
||||
<h3 :class="{'text-primary': movement.toOther === 'On Delivery', 'text-warning': movement.toOther !== 'On Delivery' && movement.action !== 'Assign',
|
||||
'text-info': movement.action === 'Assign'}"
|
||||
class="flex-shrink-0 text-nowrap"
|
||||
style="max-width:90px; min-width:90px;">
|
||||
|
||||
{{ movement.action === 'Assign' ? 'Assign' : (movement.toOther === 'On Delivery' ? 'Receive' : 'Return') }}
|
||||
|
||||
</h3>
|
||||
|
||||
|
||||
<!-- Send Date -->
|
||||
<div class="d-flex flex-wrap align-items-center gap-2 flex-grow-1">
|
||||
<h4 class="fixed-label m-0 text-nowrap">Send Date:</h4>
|
||||
@ -143,33 +159,34 @@
|
||||
<i v-if="movement.toOther !== 'On Delivery'" class="fas fa-user fa-2x"></i>
|
||||
<i v-else class="fas fa-warehouse fa-2x"></i>
|
||||
<p><strong>Start</strong></p>
|
||||
<p><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<p></p>
|
||||
<i class="fas fa-arrow-right fa-2x"></i>
|
||||
<p>{{ movement.latestStatus || movement.toOther }}</p>
|
||||
<p>
|
||||
<button class="btn btn-info btn-sm ms-auto" v-on:click="remark(movement.remark)" v-if="movement.toOther !== 'On Delivery'">
|
||||
<button class="btn btn-info btn-sm ms-auto" v-on:click="remark(movement.remark)">
|
||||
Remark
|
||||
</button>
|
||||
</p>
|
||||
<p>
|
||||
<button class="btn btn-info btn-sm ms-auto" v-on:click="consignmentNote(movement.consignmentNote)" v-if="movement.toOther !== 'On Delivery'">
|
||||
<button class="btn btn-info btn-sm ms-auto" v-on:click="consignmentNote(movement.consignmentNote)">
|
||||
Consignment Note
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<!-- Conditionally render End Icon -->
|
||||
<i v-if="movement.toOther !== 'On Delivery'" class="fas fa-warehouse fa-2x"></i>
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-warehouse fa-2x"></i>
|
||||
<i v-else class="fas fa-user fa-2x"></i>
|
||||
<p><strong>End</strong></p>
|
||||
<p><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -186,9 +203,13 @@
|
||||
<div v-for="(movement, i) in group.movements.slice(1)" :key="i" class="row mt-2">
|
||||
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
||||
<!-- Movement Type -->
|
||||
<h3 :class="movement.toOther === 'On Delivery' ? 'text-primary' : 'text-warning'"
|
||||
class="flex-shrink-0 text-nowrap" style="max-width:90px; min-width:90px;">
|
||||
{{ movement.toOther === 'On Delivery' ? 'Receive' : 'Return' }}
|
||||
<h3 :class="{'text-primary': movement.toOther === 'On Delivery', 'text-warning': movement.toOther !== 'On Delivery' && movement.action !== 'Assign',
|
||||
'text-info': movement.action === 'Assign'}"
|
||||
class="flex-shrink-0 text-nowrap"
|
||||
style="max-width:90px; min-width:90px;">
|
||||
|
||||
{{ movement.action === 'Assign' ? 'Assign' : (movement.toOther === 'On Delivery' ? 'Receive' : 'Return') }}
|
||||
|
||||
</h3>
|
||||
|
||||
<!-- Send Date -->
|
||||
@ -236,33 +257,34 @@
|
||||
<i v-if="movement.toOther !== 'On Delivery'" class="fas fa-user fa-2x"></i>
|
||||
<i v-else class="fas fa-warehouse fa-2x"></i>
|
||||
<p><strong>Start</strong></p>
|
||||
<p><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<p></p>
|
||||
<i class="fas fa-arrow-right fa-2x"></i>
|
||||
<p>{{ movement.latestStatus || movement.toOther }}</p>
|
||||
<p>
|
||||
<button class="btn btn-info btn-sm ms-auto" v-on:click="remark(movement.remark)" v-if="movement.toOther !== 'On Delivery'">
|
||||
<button class="btn btn-info btn-sm ms-auto" v-on:click="remark(movement.remark)">
|
||||
Remark
|
||||
</button>
|
||||
</p>
|
||||
<p>
|
||||
<button class="btn btn-info btn-sm ms-auto" v-on:click="consignmentNote(movement.consignmentNote)" v-if="movement.toOther !== 'On Delivery'">
|
||||
<button class="btn btn-info btn-sm ms-auto" v-on:click="consignmentNote(movement.consignmentNote)">
|
||||
Consignment Note
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<!-- Conditionally render End Icon -->
|
||||
<i v-if="movement.toOther !== 'On Delivery'" class="fas fa-warehouse fa-2x"></i>
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-warehouse fa-2x"></i>
|
||||
<i v-else class="fas fa-user fa-2x"></i>
|
||||
<p><strong>End</strong></p>
|
||||
<p><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -272,41 +294,245 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="remarkModal" tabindex="-1" aria-labelledby="remarkModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="remarkModalLabel">Remark</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body" id="remarkContent">
|
||||
<!-- Remark Content Here -->
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="consignmentModal" tabindex="-1" aria-labelledby="consignmentModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="consignmentModalLabel">Consignment Note</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body text-center">
|
||||
<img v-if="/\.(jpeg|jpg|png|gif)$/i.test(consignmentNoteUrl)" :src="consignmentNoteUrl" class="img-fluid" alt="Consignment Note Image">
|
||||
<iframe v-else-if="/\.pdf$/i.test(consignmentNoteUrl)" :src="consignmentNoteUrl" style="width:100%; height: 80vh;"></iframe>
|
||||
<a v-else class="btn btn-primary">There's no Folder or Picture</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--------------------------------------------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">
|
||||
<!-- 📌 Station Header -->
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h3>{{ station }}</h3>
|
||||
<button class="btn btn-light" v-on:click="toggleCategory(station)">
|
||||
<i :class="categoryVisible[station] ? 'fas fa-chevron-up' : 'fas fa-chevron-down'"></i> Show Items
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 📌 Show Items Under Each Station -->
|
||||
<div v-show="categoryVisible[station]" class="card-body">
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<!-- 📌 Show Movements for Each Item -->
|
||||
<div v-show="categoryVisible[itemId]" class="card-body">
|
||||
<div v-for="(movement, index) in group.movements.sort((a, b) => a.id - b.id).reverse()" :key="movement.id" class="movement-row">
|
||||
<div v-if="index === 0" class="row">
|
||||
<strong>Latest Movement</strong>
|
||||
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
||||
<h3 :class="{'text-primary': movement.toOther === 'On Delivery', 'text-warning': movement.toOther !== 'On Delivery' && movement.action !== 'Assign',
|
||||
'text-info': movement.action === 'Assign'}"
|
||||
class="flex-shrink-0 text-nowrap"
|
||||
style="max-width:90px; min-width:90px;">
|
||||
|
||||
{{ movement.action === 'Assign' ? 'Assign' : (movement.toOther === 'On Delivery' ? 'Receive' : 'Return') }}
|
||||
|
||||
</h3>
|
||||
|
||||
<div class="d-flex flex-wrap align-items-center gap-2 flex-grow-1">
|
||||
<h4 class="fixed-label m-0 text-nowrap">Send Date:</h4>
|
||||
<span class="fixed-value">{{ movement.sendDate }}</span>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-wrap align-items-center gap-2 flex-grow-1">
|
||||
<h4 class="fixed-label m-0 text-nowrap">Receive Date:</h4>
|
||||
<span class="fixed-value">{{ movement.receiveDate || 'Not arrive' }}</span>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-wrap align-items-center gap-2 flex-grow-1">
|
||||
<h4 class="fixed-labelStatus m-0 text-nowrap">Action:</h4>
|
||||
<span class="fixed-value">{{ movement.action }}</span>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-wrap align-items-center gap-2 flex-grow-1">
|
||||
<h4 class="fixed-labelStatus m-0 text-nowrap">Status:</h4>
|
||||
<span class="fixed-value">{{ movement.latestStatus || movement.toOther }}</span>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-info btn-sm ms-auto" v-on:click="toggleDetails(movement.id)">
|
||||
More Details
|
||||
</button>
|
||||
|
||||
<h4 :class="movement.movementComplete == 1 && movement.latestStatus !== 'Ready To Deploy' ? 'text-success' : 'text-danger'" class="text-nowrap ms-3">
|
||||
{{ movement.movementComplete == 1 && movement.latestStatus !== 'Ready To Deploy' ? 'Complete' : (movement.latestStatus === 'Ready To Deploy' ? 'Canceled' : 'Incomplete') }}
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div v-show="detailsVisible[movement.id]" class="col-md-12 mt-2">
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-center">
|
||||
<i v-if="movement.toOther !== 'On Delivery'" class="fas fa-user fa-2x"></i>
|
||||
<i v-else class="fas fa-warehouse fa-2x"></i>
|
||||
<p><strong>Start</strong></p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<i class="fas fa-arrow-right fa-2x"></i>
|
||||
<p>{{ movement.latestStatus || movement.toOther }}</p>
|
||||
<p>
|
||||
<button class="btn btn-info btn-sm ms-auto" v-on:click="remark(movement.remark)">
|
||||
Remark
|
||||
</button>
|
||||
</p>
|
||||
<p>
|
||||
<button class="btn btn-info btn-sm ms-auto" v-on:click="consignmentNote(movement.consignmentNote)">
|
||||
Consignment Note
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-warehouse fa-2x"></i>
|
||||
<i v-else class="fas fa-user fa-2x"></i>
|
||||
<p><strong>End</strong></p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 📌 Single View History Button -->
|
||||
<button class="btn btn-light w-100 text-left" v-on:click="toggleHistory(itemId)">
|
||||
<i :class="historyVisible[itemId] ? 'fas fa-chevron-up' : 'fas fa-chevron-down'"></i> View History
|
||||
</button>
|
||||
|
||||
<div v-show="historyVisible[itemId]" class="history-row">
|
||||
<div v-for="(movement, i) in group.movements.slice(1)" :key="i" class="row mt-2">
|
||||
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
||||
<!-- Movement Type -->
|
||||
<h3 :class="{'text-primary': movement.toOther === 'On Delivery', 'text-warning': movement.toOther !== 'On Delivery' && movement.action !== 'Assign',
|
||||
'text-info': movement.action === 'Assign'}" class="flex-shrink-0 text-nowrap" style="max-width:90px; min-width:90px;">
|
||||
{{ movement.action === 'Assign' ? 'Assign' : (movement.toOther === 'On Delivery' ? 'Receive' : 'Return') }}
|
||||
</h3>
|
||||
|
||||
<!-- Send Date -->
|
||||
<div class="d-flex flex-wrap align-items-center gap-2 flex-grow-1" style="max-width:285px; min-width:285px;">
|
||||
<h4 class="fixed-label m-0 text-nowrap">Send Date:</h4>
|
||||
<span class="fixed-value text-truncate">{{ movement.sendDate }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Receive Date -->
|
||||
<div class="d-flex flex-wrap align-items-center gap-2 flex-grow-1" style="max-width:290px; min-width:290px;">
|
||||
<h4 class="fixed-label m-0 text-nowrap">Receive Date:</h4>
|
||||
<span class="fixed-value text-truncate" style="max-width:160px;">{{ movement.receiveDate || 'Not arrive' }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Action -->
|
||||
<div class="d-flex flex-wrap align-items-center gap-2 flex-grow-1" style="max-width:150px; min-width:150px;">
|
||||
<h4 class="fixed-labelStatus m-0 text-nowrap">Action:</h4>
|
||||
<span class="fixed-value text-truncate">{{ movement.action }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Status -->
|
||||
<div class="d-flex flex-wrap align-items-center gap-2 flex-grow-1" style="max-width:160px; min-width:160px;">
|
||||
<h4 class="fixed-labelStatus m-0 text-nowrap">Status:</h4>
|
||||
<span class="fixed-value text-truncate" style="max-width:90px;">{{ movement.latestStatus || movement.toOther }}</span>
|
||||
</div>
|
||||
|
||||
<!-- More Details Button -->
|
||||
<button class="btn btn-info btn-sm ms-auto" v-on:click="toggleDetails(movement.id)">
|
||||
More Details
|
||||
</button>
|
||||
|
||||
<!-- Completion Status -->
|
||||
<h4 :class="movement.movementComplete == 1 && movement.latestStatus !== 'Ready To Deploy' ? 'text-success' : 'text-danger'"
|
||||
class="text-nowrap ms-3">
|
||||
{{ movement.movementComplete == 1 && movement.latestStatus !== 'Ready To Deploy' ? 'Complete' : (movement.latestStatus === 'Ready To Deploy' ? 'Canceled' : 'Incomplete') }}
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 📌 Details Section (Hidden by Default) -->
|
||||
<div v-show="detailsVisible[movement.id]" class="col-md-12 mt-2">
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-center">
|
||||
<!-- Conditionally render Start Icon -->
|
||||
<i v-if="movement.toOther !== 'On Delivery'" class="fas fa-user fa-2x"></i>
|
||||
<i v-else class="fas fa-warehouse fa-2x"></i>
|
||||
<p><strong>Start</strong></p>
|
||||
<p v-if="movement.toUser !== null"><strong>User:</strong> {{ movement.toUserName }}</p>
|
||||
<p v-if="movement.toStation !== null"><strong>Station:</strong> {{ movement.toStationName }}</p>
|
||||
<p v-if="movement.toStore !== null"><strong>Store:</strong> {{ movement.toStoreName }}</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<p></p>
|
||||
<i class="fas fa-arrow-right fa-2x"></i>
|
||||
<p>{{ movement.latestStatus || movement.toOther }}</p>
|
||||
<p>
|
||||
<button class="btn btn-info btn-sm ms-auto" v-on:click="remark(movement.remark)">
|
||||
Remark
|
||||
</button>
|
||||
</p>
|
||||
<p>
|
||||
<button class="btn btn-info btn-sm ms-auto" v-on:click="consignmentNote(movement.consignmentNote)">
|
||||
Consignment Note
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<!-- Conditionally render End Icon -->
|
||||
<i v-if="movement.lastStation" class="fas fa-map-marker-alt"></i>
|
||||
<i v-else-if="movement.toOther !== 'On Delivery'" class="fas fa-warehouse fa-2x"></i>
|
||||
<i v-else class="fas fa-user fa-2x"></i>
|
||||
<p><strong>End</strong></p>
|
||||
<p v-if="movement.lastUser !== null"><strong>User:</strong> {{ movement.lastUserName }}</p>
|
||||
<p v-if="movement.lastStation !== null"><strong>Station:</strong> {{ movement.lastStationName }}</p>
|
||||
<p v-if="movement.lastStore !== null"><strong>Store:</strong> {{ movement.lastStoreName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--------------------------------------------REMARK & CONSIGNMENT NOTE CATEGORY---------------------------------------------------------------------->
|
||||
<div class="modal fade" id="remarkModal" tabindex="-1" aria-labelledby="remarkModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="remarkModalLabel">Remark</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body" id="remarkContent">
|
||||
<!-- Remark Content Here -->
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="consignmentModal" tabindex="-1" aria-labelledby="consignmentModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="consignmentModalLabel">Consignment Note</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body text-center">
|
||||
<img v-if="/\.(jpeg|jpg|png|gif)$/i.test(consignmentNoteUrl)" :src="consignmentNoteUrl" class="img-fluid" alt="Consignment Note Image">
|
||||
<iframe v-else-if="/\.pdf$/i.test(consignmentNoteUrl)" :src="consignmentNoteUrl" style="width:100%; height: 80vh;"></iframe>
|
||||
<a v-else class="btn btn-primary">There's no Folder or Picture</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@ -324,11 +550,13 @@
|
||||
itemMovementCompleteDatatable: null,
|
||||
itemMovementNotCompleteDatatable: null,
|
||||
searchQuery: "",
|
||||
searchStation: "",
|
||||
sortBy: "all",
|
||||
historyVisible: {},
|
||||
detailsVisible: {},
|
||||
categoryVisible: {},
|
||||
consignmentNoteUrl: "",
|
||||
stationName: "",
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -344,6 +572,37 @@
|
||||
return acc;
|
||||
}, {});
|
||||
},
|
||||
groupedByStation() {
|
||||
let grouped = {};
|
||||
this.itemMovements.forEach((movement) => {
|
||||
let station = movement.toStationName || movement.lastStationName || "Unassign Station";
|
||||
let itemId = movement.uniqueID;
|
||||
|
||||
if (!grouped[station]) {
|
||||
grouped[station] = {};
|
||||
}
|
||||
|
||||
if (!grouped[station][itemId]) {
|
||||
grouped[station][itemId] = { uniqueID: itemId, movements: [] };
|
||||
}
|
||||
|
||||
grouped[station][itemId].movements.push(movement);
|
||||
});
|
||||
|
||||
// Sort stations and move "Unassign Station" to the last position
|
||||
let sortedKeys = Object.keys(grouped).sort((a, b) => {
|
||||
if (a === "Unassign Station") return 1; // Move Unassign Station to the end
|
||||
if (b === "Unassign Station") return -1;
|
||||
return a.localeCompare(b); // Normal sorting for other stations
|
||||
});
|
||||
|
||||
let sortedGrouped = {};
|
||||
sortedKeys.forEach((key) => {
|
||||
sortedGrouped[key] = grouped[key];
|
||||
});
|
||||
|
||||
return sortedGrouped;
|
||||
},
|
||||
filteredItems() {
|
||||
if (!this.searchQuery.trim()) {
|
||||
return this.groupedItems;
|
||||
@ -355,6 +614,23 @@
|
||||
)
|
||||
);
|
||||
},
|
||||
filteredStation() {
|
||||
if (!this.searchStation) {
|
||||
return this.groupedByStation;
|
||||
}
|
||||
|
||||
let searchQuery = this.searchStation.toLowerCase();
|
||||
let grouped = this.groupedByStation;
|
||||
let filtered = {};
|
||||
|
||||
Object.keys(grouped).forEach(station => {
|
||||
if (station.toLowerCase().includes(searchQuery)) {
|
||||
filtered[station] = grouped[station];
|
||||
}
|
||||
});
|
||||
|
||||
return filtered;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.fetchItemMovement();
|
||||
@ -382,7 +658,6 @@
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
async fetchItemMovement() {
|
||||
try {
|
||||
const response = await fetch("/InvMainAPI/ItemMovementUser", {
|
||||
|
||||
@ -125,6 +125,7 @@
|
||||
<div class="dropdown">
|
||||
<select class="btn btn-primary dropdown-toggle col-md-12" data-toggle="dropdown" aria-expanded="false" v-model="stationId" required>
|
||||
<option class="btn-light" value="" disabled selected>Select Station</option>
|
||||
<option v-if="stations.length === 0" class="btn-light" disabled>No Station Assigned to You</option>
|
||||
<option class="btn-light" v-for="(item, index) in stations" :key="index" :value="item.stationId">
|
||||
{{ item.stationName }}
|
||||
</option>
|
||||
@ -218,9 +219,9 @@
|
||||
},
|
||||
async mounted() {
|
||||
this.fetchProducts();
|
||||
this.fetchStation();
|
||||
await this.fetchUser();
|
||||
await Promise.all([
|
||||
this.fetchStation(),
|
||||
this.fetchRequest(),
|
||||
]);
|
||||
},
|
||||
@ -574,7 +575,9 @@
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch suppliers');
|
||||
}
|
||||
this.stations = await response.json(); // Get the full response object
|
||||
|
||||
const data = await response.json();
|
||||
this.stations = data.filter(station => station.stationPicID === this.userId);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error fetching suppliers:', error);
|
||||
|
||||
@ -154,7 +154,7 @@
|
||||
<div class="card shadow-sm border-0">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title mb-4 text-primary">
|
||||
<i class="fas fa-info-circle me-2"></i>Receiver Information
|
||||
<i class="fas fa-info-circle me-2"></i>Sender Information
|
||||
</h5>
|
||||
<ul class="list-group list-group-flush">
|
||||
<!-- User -->
|
||||
@ -164,7 +164,7 @@
|
||||
<i class="fas fa-user me-2 text-secondary"></i>User:
|
||||
</span>
|
||||
<span class="text-muted text-end" style="max-width: 70%; word-wrap: break-word;">
|
||||
{{ thisItem.toUserName }}
|
||||
{{ thisItem.currentUser }}
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
@ -191,8 +191,8 @@
|
||||
|
||||
@* Submit and Reset Buttons *@
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-8 offset-sm-3">
|
||||
<button type="button" v-on:click="ReturnMessage" class="btn btn-secondary m-1">Return Item</button>
|
||||
<div class="col-sm-8 offset-sm-5">
|
||||
<button type="button" v-on:click="receiveReturnMessage" class="btn btn-secondary m-1">Return Item</button>
|
||||
<button type="submit" class="btn btn-primary m-1">Receive Item</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -217,7 +217,7 @@
|
||||
<br><br>
|
||||
@* Submit and Reset Buttons *@
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-8 offset-sm-3">
|
||||
<div class="col-sm-8 offset-sm-5">
|
||||
<button type="submit" v-on:click="ReturnMessage" class="btn btn-primary m-1">Return Item</button>
|
||||
<button type="submit" v-on:click="StationMessage" class="btn btn-primary m-1" v-if="thisItem.currentStationId == null">Deploy Station</button>
|
||||
</div>
|
||||
@ -248,6 +248,7 @@
|
||||
<div class="col-sm-8">
|
||||
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedStation">
|
||||
<option class="btn-light" value="" disabled selected>Select Station</option>
|
||||
<option v-if="stationList.length === 0" class="btn-light" disabled>No Station Assigned to You</option>
|
||||
<option class="btn-light" v-for="(station, index) in stationList" :key="index" :value="station.stationId">{{ station.stationName}}</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -371,6 +372,7 @@
|
||||
consignmentNote: null,
|
||||
receiveReturn: null,
|
||||
UniqueID: null,
|
||||
InventoryMasterId: null,
|
||||
|
||||
//QR VARIABLE
|
||||
qrCodeResult: null,
|
||||
@ -399,10 +401,12 @@
|
||||
selectedCameraId: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
async mounted() {
|
||||
this.trackFunctionSelected.value = this.paintOutline;
|
||||
this.fetchStation();
|
||||
this.fetchUser();
|
||||
await this.fetchUser();
|
||||
await Promise.all([
|
||||
this.fetchStation(),
|
||||
]);
|
||||
},
|
||||
methods: {
|
||||
|
||||
@ -435,7 +439,7 @@
|
||||
const formData = {
|
||||
ItemId: this.thisItem.itemID,
|
||||
ToStation: this.thisItem.currentStationId,
|
||||
ToStore: this.thisItem.currentStoreId,
|
||||
ToStore: this.thisItem.toStore,
|
||||
ToUser: this.currentUserId,
|
||||
ToOther: "Delivered",
|
||||
SendDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
@ -461,10 +465,11 @@
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
this.thisItem = await response.json();
|
||||
this.fetchItem(this.thisItem.uniqueID);
|
||||
alert('Success! Item assign to the Station.');
|
||||
$('#stationMessage').modal('hide');
|
||||
this.displayStatus = "return";
|
||||
this.thisItem = await response.json();
|
||||
} else {
|
||||
throw new Error('Failed to submit form.');
|
||||
}
|
||||
@ -488,7 +493,7 @@
|
||||
Id : this.thisItem.id,
|
||||
LatestStatus: "Delivered",
|
||||
ReceiveDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
MovementComplete: true
|
||||
MovementComplete: true,
|
||||
};
|
||||
|
||||
const response = await fetch('/InvMainAPI/UpdateItemMovementUser', {
|
||||
@ -520,14 +525,14 @@
|
||||
|
||||
async returnItemMovement() {
|
||||
|
||||
const requiredFields = ['remark', 'consignmentNote'];
|
||||
// const requiredFields = ['remark', 'consignmentNote'];
|
||||
|
||||
for (let field of requiredFields) {
|
||||
if (!this[field]) {
|
||||
alert(`Request Error: Please fill in required field ${field}.`, 'warning');
|
||||
return;
|
||||
}
|
||||
}
|
||||
// for (let field of requiredFields) {
|
||||
// if (!this[field]) {
|
||||
// alert(`Request Error: Please fill in required field ${field}.`, 'warning');
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (!confirm("Are you sure you want to return this item?")) {
|
||||
return false;
|
||||
@ -547,7 +552,7 @@
|
||||
Remark: this.remark,
|
||||
ConsignmentNote: this.consignmentNote,
|
||||
Date: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(),
|
||||
LastUser: this.thisItem.toUser,
|
||||
LastUser: this.InventoryMasterId,
|
||||
LastStore: this.thisItem.toStore,
|
||||
LastStation: this.thisItem.toStation,
|
||||
LatestStatus: null,
|
||||
@ -567,6 +572,7 @@
|
||||
alert('Success! Item is on the delivery to return to Inventory Master.');
|
||||
this.thisItem = await response.json();
|
||||
$('#returnModal').modal('hide');
|
||||
$('#returnMessage').modal('hide');
|
||||
this.displayStatus = "requestAgain";
|
||||
this.resetForm();
|
||||
} else {
|
||||
@ -585,7 +591,9 @@
|
||||
);
|
||||
|
||||
if (response.ok) {
|
||||
|
||||
this.thisItem = await response.json();
|
||||
this.fetchStore(this.thisItem.toStore);
|
||||
|
||||
if (this.thisItem.movementId != null && this.thisItem.toOther === "On Delivery" && this.thisItem.latestStatus == null && this.thisItem.currentUserId == this.currentUserId && this.thisItem.movementComplete == 0) {
|
||||
this.displayStatus = "arrived";
|
||||
@ -616,7 +624,28 @@
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch suppliers');
|
||||
}
|
||||
this.stationList = await response.json(); // Get the full response object
|
||||
|
||||
const data = await response.json();
|
||||
this.stationList = data.filter(station => station.stationPicID === this.currentUserId);
|
||||
} catch (error) {
|
||||
console.error('Error fetching suppliers:', error);
|
||||
}
|
||||
},
|
||||
|
||||
async fetchStore(storeId) {
|
||||
try {
|
||||
const response = await fetch('/InvMainAPI/StoreSpecificMaster/' + storeId, {
|
||||
method: 'POST', // Specify the HTTP method
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch Store');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
this.InventoryMasterId = data.userId;
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error fetching suppliers:', error);
|
||||
|
||||
@ -1171,6 +1171,12 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
return Json(storeList);
|
||||
}
|
||||
|
||||
[HttpPost("StoreSpecificMaster/{storeId}")]
|
||||
public async Task<IActionResult> StoreSpecificMaster(int storeId)
|
||||
{
|
||||
var storeList = await _centralDbContext.InventoryMasters.Where(i => i.StoreId == storeId).FirstOrDefaultAsync();
|
||||
return Json(storeList);
|
||||
}
|
||||
|
||||
#endregion Store
|
||||
|
||||
@ -1280,10 +1286,20 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
returnItems.ItemStatus = 2;
|
||||
_centralDbContext.Items.Update(returnItems);
|
||||
|
||||
await _centralDbContext.SaveChangesAsync(); // Simpan perubahan
|
||||
}
|
||||
}
|
||||
|
||||
//4. Update Assign Row (Untuk ToStore = Ada value , kepada , ToStore = null)
|
||||
var updateToStoreAssignStation = await _centralDbContext.ItemMovements.Where(i => i.Action == "Assign").ToListAsync();
|
||||
|
||||
foreach (var item in updateToStoreAssignStation)
|
||||
{
|
||||
item.ToStore = null; // Set ToStore to null for each matching row
|
||||
_centralDbContext.ItemMovements.Update(item);
|
||||
}
|
||||
|
||||
await _centralDbContext.SaveChangesAsync(); // Simpan perubahan
|
||||
|
||||
return Json(new
|
||||
{
|
||||
updateItemIdMovement.Id,
|
||||
@ -1353,7 +1369,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
await _centralDbContext.SaveChangesAsync();
|
||||
|
||||
// 2. Cari item movement yang ada ItemId & MovementComplete = false
|
||||
var updateItemIdMovement = await _centralDbContext.ItemMovements
|
||||
var updateItemIdMovement = await _centralDbContext.ItemMovements.Include(i => i.Item)
|
||||
.FirstOrDefaultAsync(m => m.Id == stationMovement.Id);
|
||||
|
||||
|
||||
@ -1366,9 +1382,9 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
{
|
||||
returnItems.MovementId = updateItemIdMovement.Id;
|
||||
returnItems.ItemStatus = 3;
|
||||
_centralDbContext.Items.Update(returnItems);
|
||||
|
||||
await _centralDbContext.SaveChangesAsync(); // Simpan perubahan
|
||||
_centralDbContext.Items.Update(returnItems); // Simpan perubahan
|
||||
await _centralDbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1376,6 +1392,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
{
|
||||
updateItemIdMovement.Id,
|
||||
updateItemIdMovement.ItemId,
|
||||
updateItemIdMovement.Item?.UniqueID,
|
||||
updateItemIdMovement.ToStation,
|
||||
updateItemIdMovement.ToStore,
|
||||
updateItemIdMovement.ToUser,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user