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;
|
||||
};
|
||||
|
||||
const getRowUpdateInputEvents = (sale) => ({
|
||||
'keyup.enter': () => {
|
||||
changeQuantity(sale);
|
||||
},
|
||||
blur: () => {
|
||||
changeQuantity(sale);
|
||||
},
|
||||
});
|
||||
|
||||
const resetChanges = async () => {
|
||||
arrayData.fetch({ append: false });
|
||||
tableRef.value.reload();
|
||||
};
|
||||
const rowToUpdate = ref(null);
|
||||
const changeQuantity = async (sale) => {
|
||||
if (
|
||||
!sale.itemFk ||
|
||||
sale.quantity == null ||
|
||||
edit.value?.oldQuantity === sale.quantity
|
||||
)
|
||||
if (!sale.itemFk || sale.quantity == null || sale?.originalQuantity === sale.quantity)
|
||||
return;
|
||||
if (!sale.id) return addSale(sale);
|
||||
|
||||
|
@ -196,11 +200,8 @@ const changeQuantity = async (sale) => {
|
|||
const updateQuantity = async (sale) => {
|
||||
try {
|
||||
let { quantity, id } = sale;
|
||||
if (!rowToUpdate.value) return;
|
||||
rowToUpdate.value = null;
|
||||
sale.isNew = false;
|
||||
const params = { quantity: quantity };
|
||||
await axios.post(`Sales/${id}/updateQuantity`, params);
|
||||
await axios.post(`Sales/${id}/updateQuantity`, { quantity });
|
||||
notify('globals.dataSaved', 'positive');
|
||||
tableRef.value.reload();
|
||||
} catch (e) {
|
||||
|
@ -816,9 +817,7 @@ watch(
|
|||
v-if="row.isNew || isTicketEditable"
|
||||
type="number"
|
||||
v-model.number="row.quantity"
|
||||
@blur="changeQuantity(row)"
|
||||
@keyup.enter.stop="changeQuantity(row)"
|
||||
@update:model-value="() => (rowToUpdate = row)"
|
||||
v-on="getRowUpdateInputEvents(row)"
|
||||
@focus="edit.oldQuantity = row.quantity"
|
||||
/>
|
||||
<span v-else>{{ row.quantity }}</span>
|
||||
|
|
|
@ -50,6 +50,7 @@ const { dialog } = useQuasar();
|
|||
const { notify } = useNotify();
|
||||
const acl = useAcl();
|
||||
const btnDropdownRef = ref(null);
|
||||
const editManaProxyRef = ref(null);
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
|
||||
const newDiscount = ref(null);
|
||||
|
@ -131,13 +132,13 @@ const createClaim = () => {
|
|||
openConfirmationModal(
|
||||
t('Claim out of time'),
|
||||
t('Do you want to continue?'),
|
||||
onCreateClaimAccepted
|
||||
onCreateClaimAccepted,
|
||||
);
|
||||
else
|
||||
openConfirmationModal(
|
||||
t('Do you want to create a claim?'),
|
||||
false,
|
||||
onCreateClaimAccepted
|
||||
onCreateClaimAccepted,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -216,8 +217,15 @@ const createRefund = async (withWarehouse) => {
|
|||
<QItemSection>
|
||||
<QItemLabel>{{ t('Update discount') }}</QItemLabel>
|
||||
</QItemSection>
|
||||
<TicketEditManaProxy :mana="props.mana" @save="changeMultipleDiscount()">
|
||||
<TicketEditManaProxy
|
||||
ref="editManaProxyRef"
|
||||
:sale="row"
|
||||
:mana="props.mana"
|
||||
@save="changeMultipleDiscount"
|
||||
>
|
||||
<VnInput
|
||||
autofocus
|
||||
@keyup.enter.stop="() => editManaProxyRef.save(row)"
|
||||
v-model.number="newDiscount"
|
||||
:label="t('ticketSale.discount')"
|
||||
type="number"
|
||||
|
|
Loading…
Reference in New Issue