commit
26009d809e
src/pages/Ticket/Card
|
@ -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"
|
||||
|
|
|
@ -45,6 +45,15 @@ const descriptorData = useArrayData('ticketData');
|
|||
onMounted(async () => {
|
||||
ticketUrl.value = (await getUrl('ticket/')) + entityId.value + '/';
|
||||
});
|
||||
const formattedAddress = computed(() => {
|
||||
if (!ticket.value) return '';
|
||||
|
||||
const address = ticket.value.address;
|
||||
const postcode = address.postalCode;
|
||||
const province = address.province ? `(${address.province.name})` : '';
|
||||
|
||||
return `${address.street} - ${postcode} - ${address.city} ${province}`;
|
||||
});
|
||||
|
||||
function isEditable() {
|
||||
try {
|
||||
|
@ -237,7 +246,7 @@ onMounted(async () => {
|
|||
/>
|
||||
<VnLv
|
||||
:label="t('ticket.summary.consigneeStreet')"
|
||||
:value="entity.address?.street"
|
||||
:value="formattedAddress"
|
||||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-one" v-if="entity.notes.length">
|
||||
|
|
Loading…
Reference in New Issue