"Refactor MyWashStart.vue and ordersTable.vue: enhance wash timer display, add lane labeling, and improve department access validation logic in navigation."
This commit is contained in:
@@ -57,9 +57,14 @@ import WhiteBoxCard from "@/components/displays/boxes/WhiteBoxCard.vue";
|
||||
|
||||
|
||||
const redirectDepartmentOrderPage = (orderId, departmentId, newTab = true) => {
|
||||
// Send the user to the order page (In a new tab)
|
||||
// `/admin/${departmentId}/modules/pos/orders/${orderId}`
|
||||
window.open(`/admin/${departmentId}/modules/pos/orders/${orderId}`, newTab ? '_blank' : '_self');
|
||||
// Check if the user has access to the department
|
||||
if (!SessionUser.canAccessDepartment(departmentId)) {
|
||||
window.open('/user/orders/' + orderId, newTab ? '_blank' : '_self');
|
||||
} else {
|
||||
// Send the user to the order page (In a new tab)
|
||||
// `/admin/${departmentId}/modules/pos/orders/${orderId}`
|
||||
window.open(`/admin/${departmentId}/modules/pos/orders/${orderId}`, newTab ? '_blank' : '_self');
|
||||
}
|
||||
};
|
||||
|
||||
const redirectSuperUserInvoiceCollectionPage = (invoiceCollectionId) => {
|
||||
|
||||
@@ -119,6 +119,27 @@ const timeSinceWashStart = computed(() => {
|
||||
return 0;
|
||||
});
|
||||
|
||||
// Helpers for a cleaner in-progress display
|
||||
const pad2 = (n: number) => n.toString().padStart(2, '0');
|
||||
const formattedElapsed = computed(() => {
|
||||
const totalSeconds = Math.floor(timeSinceWashStart.value / 1000);
|
||||
const minutes = Math.floor(totalSeconds / 60);
|
||||
const seconds = totalSeconds % 60;
|
||||
return `${pad2(minutes)}:${pad2(seconds)}`;
|
||||
});
|
||||
const humanElapsed = computed(() => {
|
||||
const totalSeconds = Math.floor(timeSinceWashStart.value / 1000);
|
||||
const minutes = Math.floor(totalSeconds / 60);
|
||||
const seconds = totalSeconds % 60;
|
||||
return `${minutes} minutter og ${seconds} sekunder`;
|
||||
});
|
||||
|
||||
// Current lane (for nicer labeling than just ID)
|
||||
const currentLane = computed(() => {
|
||||
const lanes = nearestDepartment.value?.lanes || [];
|
||||
return lanes.find((l: any) => l.id === washLaneId.value) || null;
|
||||
});
|
||||
|
||||
const onStartWash = (laneId, licensePlate, customerNumber) => {
|
||||
if (!nearestDepartment.value) {
|
||||
alert('Ingen afdeling valgt.');
|
||||
@@ -454,24 +475,13 @@ watch(() => nearestDepartment.value, (newValue) => {
|
||||
<!-- Wash -->
|
||||
<b-step-item label="Vask" iconPack="fas" icon="soap" :step="steps.WASH_IN_PROGRESS" :clickable="clickableSteps[steps.WASH_IN_PROGRESS]()">
|
||||
<h1 class="title has-text-centered">Vask i gang</h1>
|
||||
<h3 class="subtitle has-text-centered">
|
||||
<strong>{{ Math.floor(timeSinceWashStart / 60000) }} minutter og {{ Math.floor((timeSinceWashStart % 60000) / 1000) }} sekunder</strong>.
|
||||
</h3>
|
||||
<h2 class="subtitle has-text-centered">
|
||||
<strong>{{ formattedElapsed }}</strong>
|
||||
</h2>
|
||||
<p class="has-text-centered">
|
||||
Vasken er startet på bane {{ (currentLane && currentLane.name) ? currentLane.name : washLaneId }}.
|
||||
Når vasken er færdig, skal du trykke på knappen "Færdig" nedenfor for at afslutte processen.
|
||||
</p>
|
||||
<b-message type="is-info" aria-close-label="Luk besked" v-if="washInProgress">
|
||||
<b-icon icon="info-circle" pack="fas" class="mr-2"/>
|
||||
<b>Vasken er startet på bane {{ washLaneId }}. Følg venligst instruktionerne på stedet for at fuldføre vasken.</b>
|
||||
<br/>
|
||||
<b-button
|
||||
type="is-danger is-light"
|
||||
icon-pack="fas"
|
||||
icon-left="stop"
|
||||
class="mt-2"
|
||||
@click="() => onStopWash(washLaneId)"
|
||||
>Stop vask</b-button>
|
||||
</b-message>
|
||||
</b-step-item>
|
||||
<!-- Completed -->
|
||||
<b-step-item label="Færdig" iconPack="fas" icon="check-circle" :step="steps.COMPLETED">
|
||||
|
||||
Reference in New Issue
Block a user