Refactor POS Mobile error popup and action button logic

- Removed unused icon container in `PosDepartmentStepMobilePopupError.vue`.
- Added reusable `actionButtons` object in `PosDepartmentStepMobileFlow.vue` for consistency.
- Imported `Swal` for future popup enhancements.
This commit is contained in:
Jeppe Bundgaard
2025-09-18 12:36:45 +02:00
parent 4ca1090b8e
commit 319e3ee9b3
3 changed files with 9 additions and 6 deletions
@@ -5,7 +5,7 @@ import { errors } from "@/components/request/HandleGlobalError.vue";
import { SessionUser } from "@/components/session/token/SessionUser.vue";
import GenericButton from "@/components/viewport/page/templates/generic/graphics/GenericButton.vue";
import ContinueArrow from "@/components/viewport/elements/icons/ContinueArrow.vue";
import { vehicles, metadata, getCustomerId, popups, resetPos } from "../objects/PosDepartmentStepMobileFlow.vue";
import { vehicles, metadata, getCustomerId, popups, resetPos, actionButtons } from "../objects/PosDepartmentStepMobileFlow.vue";
const selectCustomerString = `${SessionUser.objects.global.language.select} ${SessionUser.objects.global.language.customer.toLowerCase()}`;
const props = defineProps({
@@ -10,11 +10,6 @@ const emit = defineEmits<{
<template>
<!-- Icon -->
<div class="custom-container has-text-centered">
<div class="flex flex-col items-center">
<div class="custom-icon-container">
<SuccessCheck/>
</div>
</div>
<div>
<!-- Text: Error -->
<p class="custom-title">{{popups.get()?.title || 'Error message'}}</p>
@@ -9,6 +9,7 @@ import type {Addon} from "@/components/displays/department/pos/steps/mobile/obje
import type { PosLocation } from './PosLocation.vue';
import type { PosSoundEffect } from './PosSoundEffect.vue';
import type { PosActionButton } from './PosActionButton.vue';
import Swal from 'sweetalert2';
/** Views */
// Step 1
@@ -150,6 +151,10 @@ const defaultActionButtons = ref<{ [key: string]: PosActionButton }>({
color: 'primary'
},
});
// Call action buttons object for use in other components
const actionButtons = {
default: defaultActionButtons,
};
/** Popups */
const popup = ref<PosPopup | null>(null);
// Function to check if a popup is currently set
@@ -1482,6 +1487,9 @@ export {
clearSearchVehicles,
getSearchVehicles,
resetSearchVehicles,
// Action buttons
actionButtons,
};
// Non-breaking alias exports (clearer names while keeping originals)