"Enhance various components with improved sorting, formatting, and layout updates: add time formatting logic for midnight in NewBookingStep5.vue, introduce compact mode for vehicle suggestions layout in TimeBookingsElementVehicleSuggestions.vue, and implement priority-based addon sorting in PosDepartmentStepMobile2Addons.vue. Remove unused customer slot logic in MyBookingsBook.vue for cleanup."

This commit is contained in:
Jeppe Bundgaard
2025-11-13 13:21:10 +01:00
parent 40127ac64a
commit 017437fecf
4 changed files with 13 additions and 9 deletions
@@ -96,13 +96,21 @@ const onAddProduct = (addon: Addon) => {
emit('update:addons', [...props.addons])
}
const sortAddonsByProductOrderPriority = (addons: Addon[]) => {
return addons.sort((a, b) => {
const priorityA = a.product.order_priority || 0;
const priorityB = b.product.order_priority || 0;
return priorityA - priorityB;
});
}
</script>
<template>
<template v-if="addons.length > 0"> <!-- If there are add-ons available -->
<p class="custom-label">{{ props.label }}</p>
<div>
<template v-for="addon in props.addons" :key="addon.id">
<template v-for="addon in sortAddonsByProductOrderPriority(props.addons)" :key="addon.id">
<PosDepartmentStepMobile2CategoryProduct
:compact="props.compact"
:price="addon.price"
@@ -10,6 +10,7 @@ const props = defineProps<{
label: string | null | undefined;
input: string;
availableVehicleTypes: PosProduct[] | null;
compact?: boolean;
}>();
const emits = defineEmits([
'onSelectVehicle',
@@ -76,7 +77,7 @@ watch(results, (newVal) => {
<!-- Results -->
<div v-show="results.length > 0"
class="column is-one-third"
class="column" :class="{'is-12': compact, 'is-one-third': !compact}"
v-for="vehicle in (results.length > 0 ? results : input.length > 0 ? [] : customerVehicles)"
:key="vehicle.id"
@click="onSelectVehicle(vehicle)"
@@ -52,7 +52,6 @@ import PosDepartmentStepMobile2Addons
from "@/components/displays/department/pos/steps/mobile/elements/PosDepartmentStepMobile2Addons.vue";
import {getProductsCategory, setDepartment, setProductsCategory} from "@/components/shop/POSDepartmentProcess.vue";
import Swal from "sweetalert2";
import { getProducts } from "@/components/shop/Products.vue";
const customerNumber = ref<number | null>(SessionUser?.user?.customer_number.value ? parseInt(SessionUser.user.customer_number.value) : null);
const department = ref<any>(null);
@@ -468,12 +467,6 @@ const right_tabs = [
icon: "fas fa-shopping-basket",
hidden: false,
},
{
name: "Kunde",
slot: "customer",
icon: "fas fa-user",
hidden: false,
}
];
const addItemToBasket = (product: PosProduct, options = {quantity: 1}) => {
@@ -28,6 +28,8 @@ const formattedDateTime = computed(() => {
const d = props.dateTime;
const date = d.toLocaleDateString('da-DK', { year: 'numeric', month: 'long', day: 'numeric' });
const time = d.toLocaleTimeString('da-DK', { hour: '2-digit', minute: '2-digit' });
// Check if the time is 00:00 and return only the date if so
if (time === '00:00') return date;
return `${date} kl. ${time}`;
});