Fix POS operator order creation step handling

This commit is contained in:
Jeppe B
2026-02-27 02:23:37 +01:00
parent 6c2b2b7d96
commit ad7ed052de
+11 -5
View File
@@ -60,6 +60,11 @@ export const setNextStepDelay = (delay) => {
/** Define the step functions */
export const nextStep = async (options = {isMobile: false, orderCreation: true}) => {
const normalizedOptions = {
isMobile: false,
orderCreation: true,
...options,
};
// Check if the delay has passed since the last step (To prevent double clicks)
if (nextStepDelay.value > 0) {
return;
@@ -70,11 +75,11 @@ export const nextStep = async (options = {isMobile: false, orderCreation: true})
clearErrors();
// If the current step is 1, create the order
if (step.value === 1) {
if (!options.orderCreation) {
if (normalizedOptions.orderCreation === false) {
step.value++;
return;
}
if (await createOrder(options)) {
if (await createOrder(normalizedOptions)) {
step.value++;
}
return;
@@ -174,12 +179,13 @@ watch([reg_1, reg_2, reg_3], () => {
});
/** Get the order details by order id */
export const getOrderDetails = async () => {
export const getOrderDetails = async (id = null) => {
const token = localStorage.getItem('token');
if (!token || !order_id.value) {
const targetOrderId = id ?? order_id.value;
if (!token || !targetOrderId) {
return null;
}
return axios.get(API_URL + '/order?id=' + order_id.value, {
return axios.get(API_URL + '/order?id=' + targetOrderId, {
headers: {
Authorization: `Bearer ${token}`
}