fix: reload table when apply discount
This commit is contained in:
parent
75f6a31c8c
commit
6bb758b88c
|
@ -57,7 +57,7 @@ const canProceed = ref();
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.params.id,
|
() => route.params.id,
|
||||||
() => tableRef.value.reload()
|
() => tableRef.value.reload(),
|
||||||
);
|
);
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
|
@ -133,7 +133,7 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: t('globals.amount'),
|
label: t('globals.amount'),
|
||||||
name: 'amount',
|
name: 'amount',
|
||||||
format: (row) => parseInt(row.amount * row.quantity),
|
format: (row) => toCurrency(getSaleTotal(row)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -200,7 +200,7 @@ const changeQuantity = async (sale) => {
|
||||||
await updateQuantity(sale);
|
await updateQuantity(sale);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const { quantity } = tableRef.value.CrudModelRef.originalData.find(
|
const { quantity } = tableRef.value.CrudModelRef.originalData.find(
|
||||||
(s) => s.id === sale.id
|
(s) => s.id === sale.id,
|
||||||
);
|
);
|
||||||
sale.quantity = quantity;
|
sale.quantity = quantity;
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -331,8 +331,7 @@ const updateDiscount = async (sales, newDiscount = null) => {
|
||||||
};
|
};
|
||||||
await axios.post(`Tickets/${route.params.id}/updateDiscount`, params);
|
await axios.post(`Tickets/${route.params.id}/updateDiscount`, params);
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
for (let sale of sales) sale.discount = _newDiscount;
|
tableRef.value.reload();
|
||||||
edit.value = { ...DEFAULT_EDIT };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getNewPrice = computed(() => {
|
const getNewPrice = computed(() => {
|
||||||
|
@ -505,7 +504,7 @@ async function isSalePrepared(item) {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
title: t('Item prepared'),
|
title: t('Item prepared'),
|
||||||
message: t(
|
message: t(
|
||||||
'This item is already prepared. Do you want to continue?'
|
'This item is already prepared. Do you want to continue?',
|
||||||
),
|
),
|
||||||
data: item,
|
data: item,
|
||||||
},
|
},
|
||||||
|
@ -527,7 +526,7 @@ watch(
|
||||||
if (newItemFk) {
|
if (newItemFk) {
|
||||||
updateItem(newRow.value);
|
updateItem(newRow.value);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -597,7 +596,7 @@ watch(
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('Continue anyway?'),
|
t('Continue anyway?'),
|
||||||
t('You are going to delete lines of the ticket'),
|
t('You are going to delete lines of the ticket'),
|
||||||
removeSales
|
removeSales,
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
@ -826,21 +825,24 @@ watch(
|
||||||
:mana-code="manaCode"
|
:mana-code="manaCode"
|
||||||
@save="changeDiscount(row)"
|
@save="changeDiscount(row)"
|
||||||
>
|
>
|
||||||
<VnInput
|
<template #default="{ popup }">
|
||||||
v-model.number="edit.discount"
|
<VnInput
|
||||||
:label="t('ticketSale.discount')"
|
autofocus
|
||||||
type="number"
|
@keyup.enter="
|
||||||
/>
|
() => {
|
||||||
<div v-if="usesMana" class="column q-gutter-y-sm q-mt-sm">
|
changeDiscount(row);
|
||||||
<VnUsesMana :mana-code="manaCode" />
|
popup.hide();
|
||||||
</div>
|
}
|
||||||
|
"
|
||||||
|
v-model.number="edit.discount"
|
||||||
|
:label="t('ticketSale.discount')"
|
||||||
|
type="number"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
</TicketEditManaProxy>
|
</TicketEditManaProxy>
|
||||||
</template>
|
</template>
|
||||||
<span v-else>{{ toPercentage(row.discount / 100) }}</span>
|
<span v-else>{{ toPercentage(row.discount / 100) }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #column-amount="{ row }">
|
|
||||||
{{ toCurrency(row.quantity * row.price) }}
|
|
||||||
</template>
|
|
||||||
</VnTable>
|
</VnTable>
|
||||||
|
|
||||||
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
||||||
|
|
Loading…
Reference in New Issue