8315-devToTest #1094
|
@ -75,17 +75,6 @@ watch(
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
// const onItemSaved = (updatedItem) => {
|
|
||||||
// console.error(stateStore);
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const scrollToItem = async (id) => {
|
|
||||||
// const element = itemRefs.value[id]?.$el;
|
|
||||||
// if (element) {
|
|
||||||
// element.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// provide('onItemSaved', onItemSaved);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -22,7 +22,6 @@ const state = useState();
|
||||||
|
|
||||||
const total = computed(() => state.get('orderTotal'));
|
const total = computed(() => state.get('orderTotal'));
|
||||||
|
|
||||||
// const onItemSaved = inject('onItemSaved');
|
|
||||||
const prices = ref((props.item.prices || []).map((item) => ({ ...item, quantity: 0 })));
|
const prices = ref((props.item.prices || []).map((item) => ({ ...item, quantity: 0 })));
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
const calculateTotals = (items) => {
|
const calculateTotals = (items) => {
|
||||||
|
@ -36,14 +35,6 @@ const calculateTotals = (items) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// const totalSum = (items) =>
|
|
||||||
// items.reduce((acc, item) => {
|
|
||||||
// return acc + item.quantity * item.price;
|
|
||||||
// }, 0);
|
|
||||||
// const totalQuantity = (items) =>
|
|
||||||
// items.reduce((acc, item) => {
|
|
||||||
// return acc + item.quantity;
|
|
||||||
// }, 0);
|
|
||||||
const addToOrder = async () => {
|
const addToOrder = async () => {
|
||||||
if (isLoading.value) return;
|
if (isLoading.value) return;
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
|
@ -57,7 +48,6 @@ const addToOrder = async () => {
|
||||||
|
|
||||||
state.set('orderTotal', total.value + totalSum);
|
state.set('orderTotal', total.value + totalSum);
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
// onItemSaved({ ...props, items, saved: true });
|
|
||||||
emit('added', -totalQuantity);
|
emit('added', -totalQuantity);
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
};
|
};
|
||||||
|
|
|
@ -63,15 +63,15 @@ const setData = (entity) => {
|
||||||
if (!entity) return;
|
if (!entity) return;
|
||||||
getTotalRef.value && getTotalRef.value.fetch();
|
getTotalRef.value && getTotalRef.value.fetch();
|
||||||
data.value = useCardDescription(entity?.client?.name, entity?.id);
|
data.value = useCardDescription(entity?.client?.name, entity?.id);
|
||||||
state.set('orderTotal', _total);
|
state.set('orderTotal', total);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getConfirmationValue = (isConfirmed) => {
|
const getConfirmationValue = (isConfirmed) => {
|
||||||
return t(isConfirmed ? 'globals.confirmed' : 'order.summary.notConfirmed');
|
return t(isConfirmed ? 'globals.confirmed' : 'order.summary.notConfirmed');
|
||||||
};
|
};
|
||||||
|
|
||||||
const total = computed(() => state.get('orderTotal') ?? 0);
|
const orderTotal = computed(() => state.get('orderTotal') ?? 0);
|
||||||
const _total = ref(0);
|
const total = ref(0);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -80,7 +80,7 @@ const _total = ref(0);
|
||||||
:url="`Orders/${entityId}/getTotal`"
|
:url="`Orders/${entityId}/getTotal`"
|
||||||
@on-fetch="
|
@on-fetch="
|
||||||
(response) => {
|
(response) => {
|
||||||
_total = response;
|
total = response;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
@ -117,7 +117,7 @@ const _total = ref(0);
|
||||||
:label="t('order.summary.items')"
|
:label="t('order.summary.items')"
|
||||||
:value="(entity?.rows?.length || DEFAULT_ITEMS).toString()"
|
:value="(entity?.rows?.length || DEFAULT_ITEMS).toString()"
|
||||||
/>
|
/>
|
||||||
<VnLv :label="t('order.summary.total')" :value="toCurrency(total)" />
|
<VnLv :label="t('order.summary.total')" :value="toCurrency(orderTotal)" />
|
||||||
</template>
|
</template>
|
||||||
<template #actions="{ entity }">
|
<template #actions="{ entity }">
|
||||||
<QCardActions>
|
<QCardActions>
|
||||||
|
|
Loading…
Reference in New Issue