rafactor: refs #6951 actions descriptor & update changelog
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
c911dc5cc4
commit
2bb95fa568
|
@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Added
|
||||
|
||||
- (Tickets) => Se añade la opción de clonar ticket. #6951
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
|
|
@ -24,7 +24,42 @@ const { openReport, sendEmail } = usePrintService();
|
|||
|
||||
const ticket = ref(props.ticket);
|
||||
const ticketId = currentRoute.value.params.id;
|
||||
const actions = { remove: remove, clone: clone };
|
||||
const actions = {
|
||||
clone: async () => {
|
||||
const opts = { message: t('Ticket cloned'), type: 'positive' };
|
||||
let clonedTicketId;
|
||||
|
||||
try {
|
||||
const { data } = await axios.post(`Tickets/${ticketId}/clone`, {
|
||||
shipped: ticket.value.shipped,
|
||||
});
|
||||
clonedTicketId = data;
|
||||
} catch (e) {
|
||||
opts.message = t('It was not able to clone the ticket');
|
||||
opts.type = 'negative';
|
||||
} finally {
|
||||
notify(opts);
|
||||
|
||||
if (clonedTicketId)
|
||||
push({ name: 'TicketSummary', params: { id: clonedTicketId } });
|
||||
}
|
||||
},
|
||||
remove: async () => {
|
||||
try {
|
||||
await axios.post(`Tickets/${ticketId}/setDeleted`);
|
||||
|
||||
notify({ message: t('Ticket deleted'), type: 'positive' });
|
||||
notify({
|
||||
message: t('You can undo this action within the first hour'),
|
||||
icon: 'info',
|
||||
});
|
||||
|
||||
push({ name: 'TicketList' });
|
||||
} catch (e) {
|
||||
notify({ message: e.message, type: 'negative' });
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
function openDeliveryNote(type = 'deliveryNote', documentType = 'pdf') {
|
||||
const path = `Tickets/${ticket.value.id}/delivery-note-${documentType}`;
|
||||
|
@ -118,42 +153,6 @@ function openConfirmDialog(callback) {
|
|||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function clone() {
|
||||
const opts = { message: t('Ticket cloned'), type: 'positive' };
|
||||
let clonedTicketId;
|
||||
|
||||
try {
|
||||
const { data } = await axios.post(`Tickets/${ticketId}/clone`, {
|
||||
shipped: ticket.value.shipped,
|
||||
});
|
||||
clonedTicketId = data;
|
||||
} catch (e) {
|
||||
opts.message = t('It was not able to clone the ticket');
|
||||
opts.type = 'negative';
|
||||
} finally {
|
||||
notify(opts);
|
||||
|
||||
if (clonedTicketId)
|
||||
push({ name: 'TicketSummary', params: { id: clonedTicketId } });
|
||||
}
|
||||
}
|
||||
|
||||
async function remove() {
|
||||
try {
|
||||
await axios.post(`Tickets/${ticketId}/setDeleted`);
|
||||
|
||||
notify({ message: t('Ticket deleted'), type: 'positive' });
|
||||
notify({
|
||||
message: t('You can undo this action within the first hour'),
|
||||
icon: 'info',
|
||||
});
|
||||
|
||||
push({ name: 'TicketList' });
|
||||
} catch (e) {
|
||||
notify({ message: e.message, type: 'negative' });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<QItem v-ripple clickable>
|
||||
|
|
Loading…
Reference in New Issue