Merge pull request 'HOTfix: handle multiple changes' (!1458) from hotfix_ticketSale_quantity into master
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
Reviewed-on: #1458 Reviewed-by: Jon Elias <jon@verdnatura.es>
This commit is contained in:
commit
98660c4e50
|
@ -174,17 +174,21 @@ const getSaleTotal = (sale) => {
|
||||||
return price - discount;
|
return price - discount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getRowUpdateInputEvents = (sale) => ({
|
||||||
|
'keyup.enter': () => {
|
||||||
|
changeQuantity(sale);
|
||||||
|
},
|
||||||
|
blur: () => {
|
||||||
|
changeQuantity(sale);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const resetChanges = async () => {
|
const resetChanges = async () => {
|
||||||
arrayData.fetch({ append: false });
|
arrayData.fetch({ append: false });
|
||||||
tableRef.value.reload();
|
tableRef.value.reload();
|
||||||
};
|
};
|
||||||
const rowToUpdate = ref(null);
|
|
||||||
const changeQuantity = async (sale) => {
|
const changeQuantity = async (sale) => {
|
||||||
if (
|
if (!sale.itemFk || sale.quantity == null || sale?.originalQuantity === sale.quantity)
|
||||||
!sale.itemFk ||
|
|
||||||
sale.quantity == null ||
|
|
||||||
edit.value?.oldQuantity === sale.quantity
|
|
||||||
)
|
|
||||||
return;
|
return;
|
||||||
if (!sale.id) return addSale(sale);
|
if (!sale.id) return addSale(sale);
|
||||||
|
|
||||||
|
@ -196,11 +200,8 @@ const changeQuantity = async (sale) => {
|
||||||
const updateQuantity = async (sale) => {
|
const updateQuantity = async (sale) => {
|
||||||
try {
|
try {
|
||||||
let { quantity, id } = sale;
|
let { quantity, id } = sale;
|
||||||
if (!rowToUpdate.value) return;
|
|
||||||
rowToUpdate.value = null;
|
|
||||||
sale.isNew = false;
|
sale.isNew = false;
|
||||||
const params = { quantity: quantity };
|
await axios.post(`Sales/${id}/updateQuantity`, { quantity });
|
||||||
await axios.post(`Sales/${id}/updateQuantity`, params);
|
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
tableRef.value.reload();
|
tableRef.value.reload();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -816,9 +817,7 @@ watch(
|
||||||
v-if="row.isNew || isTicketEditable"
|
v-if="row.isNew || isTicketEditable"
|
||||||
type="number"
|
type="number"
|
||||||
v-model.number="row.quantity"
|
v-model.number="row.quantity"
|
||||||
@blur="changeQuantity(row)"
|
v-on="getRowUpdateInputEvents(row)"
|
||||||
@keyup.enter.stop="changeQuantity(row)"
|
|
||||||
@update:model-value="() => (rowToUpdate = row)"
|
|
||||||
@focus="edit.oldQuantity = row.quantity"
|
@focus="edit.oldQuantity = row.quantity"
|
||||||
/>
|
/>
|
||||||
<span v-else>{{ row.quantity }}</span>
|
<span v-else>{{ row.quantity }}</span>
|
||||||
|
|
|
@ -50,6 +50,7 @@ const { dialog } = useQuasar();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const acl = useAcl();
|
const acl = useAcl();
|
||||||
const btnDropdownRef = ref(null);
|
const btnDropdownRef = ref(null);
|
||||||
|
const editManaProxyRef = ref(null);
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
|
||||||
const newDiscount = ref(null);
|
const newDiscount = ref(null);
|
||||||
|
@ -131,13 +132,13 @@ const createClaim = () => {
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('Claim out of time'),
|
t('Claim out of time'),
|
||||||
t('Do you want to continue?'),
|
t('Do you want to continue?'),
|
||||||
onCreateClaimAccepted
|
onCreateClaimAccepted,
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('Do you want to create a claim?'),
|
t('Do you want to create a claim?'),
|
||||||
false,
|
false,
|
||||||
onCreateClaimAccepted
|
onCreateClaimAccepted,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -216,8 +217,15 @@ const createRefund = async (withWarehouse) => {
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Update discount') }}</QItemLabel>
|
<QItemLabel>{{ t('Update discount') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<TicketEditManaProxy :mana="props.mana" @save="changeMultipleDiscount()">
|
<TicketEditManaProxy
|
||||||
|
ref="editManaProxyRef"
|
||||||
|
:sale="row"
|
||||||
|
:mana="props.mana"
|
||||||
|
@save="changeMultipleDiscount"
|
||||||
|
>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
autofocus
|
||||||
|
@keyup.enter.stop="() => editManaProxyRef.save(row)"
|
||||||
v-model.number="newDiscount"
|
v-model.number="newDiscount"
|
||||||
:label="t('ticketSale.discount')"
|
:label="t('ticketSale.discount')"
|
||||||
type="number"
|
type="number"
|
||||||
|
|
Loading…
Reference in New Issue