This commit is contained in:
parent
b3170108e0
commit
b18de7df4e
|
@ -75,17 +75,6 @@ watch(
|
|||
},
|
||||
{ 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>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -22,7 +22,6 @@ const state = useState();
|
|||
|
||||
const total = computed(() => state.get('orderTotal'));
|
||||
|
||||
// const onItemSaved = inject('onItemSaved');
|
||||
const prices = ref((props.item.prices || []).map((item) => ({ ...item, quantity: 0 })));
|
||||
const isLoading = ref(false);
|
||||
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 () => {
|
||||
if (isLoading.value) return;
|
||||
isLoading.value = true;
|
||||
|
@ -57,7 +48,6 @@ const addToOrder = async () => {
|
|||
|
||||
state.set('orderTotal', total.value + totalSum);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
// onItemSaved({ ...props, items, saved: true });
|
||||
emit('added', -totalQuantity);
|
||||
isLoading.value = false;
|
||||
};
|
||||
|
|
|
@ -63,15 +63,15 @@ const setData = (entity) => {
|
|||
if (!entity) return;
|
||||
getTotalRef.value && getTotalRef.value.fetch();
|
||||
data.value = useCardDescription(entity?.client?.name, entity?.id);
|
||||
state.set('orderTotal', _total);
|
||||
state.set('orderTotal', total);
|
||||
};
|
||||
|
||||
const getConfirmationValue = (isConfirmed) => {
|
||||
return t(isConfirmed ? 'globals.confirmed' : 'order.summary.notConfirmed');
|
||||
};
|
||||
|
||||
const total = computed(() => state.get('orderTotal') ?? 0);
|
||||
const _total = ref(0);
|
||||
const orderTotal = computed(() => state.get('orderTotal') ?? 0);
|
||||
const total = ref(0);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -80,7 +80,7 @@ const _total = ref(0);
|
|||
:url="`Orders/${entityId}/getTotal`"
|
||||
@on-fetch="
|
||||
(response) => {
|
||||
_total = response;
|
||||
total = response;
|
||||
}
|
||||
"
|
||||
/>
|
||||
|
@ -117,7 +117,7 @@ const _total = ref(0);
|
|||
:label="t('order.summary.items')"
|
||||
: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 #actions="{ entity }">
|
||||
<QCardActions>
|
||||
|
|
Loading…
Reference in New Issue