Merge pull request '5926-refactor_docuware' (!1613) from 5926-refactor_docuware into dev
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #1613
Reviewed-by: Javier Segarra <jsegarra@verdnatura.es>
This commit is contained in:
Alex Moreno 2025-03-18 13:59:04 +00:00
commit 30d287bbf6
2 changed files with 22 additions and 28 deletions

View File

@ -32,7 +32,7 @@ onMounted(() => {
watch( watch(
() => props.ticket, () => props.ticket,
() => restoreTicket () => restoreTicket,
); );
const { push, currentRoute } = useRouter(); const { push, currentRoute } = useRouter();
@ -58,7 +58,7 @@ const hasDocuwareFile = ref();
const quasar = useQuasar(); const quasar = useQuasar();
const canRestoreTicket = ref(false); const canRestoreTicket = ref(false);
const onClientSelected = async(clientId) =>{ const onClientSelected = async (clientId) => {
client.value = clientId; client.value = clientId;
await fetchClient(); await fetchClient();
await fetchAddresses(); await fetchAddresses();
@ -66,10 +66,10 @@ const onClientSelected = async(clientId) =>{
const onAddressSelected = (addressId) => { const onAddressSelected = (addressId) => {
address.value = addressId; address.value = addressId;
} };
const fetchClient = async () => { const fetchClient = async () => {
const response = await getClient(client.value) const response = await getClient(client.value);
if (!response) return; if (!response) return;
const [retrievedClient] = response.data; const [retrievedClient] = response.data;
selectedClient.value = retrievedClient; selectedClient.value = retrievedClient;
@ -151,7 +151,7 @@ function openDeliveryNote(type = 'deliveryNote', documentType = 'pdf') {
recipientId: ticket.value.clientFk, recipientId: ticket.value.clientFk,
type: type, type: type,
}, },
'_blank' '_blank',
); );
} }
@ -297,8 +297,8 @@ async function transferClient() {
clientFk: client.value, clientFk: client.value,
addressFk: address.value, addressFk: address.value,
}; };
await axios.patch( `Tickets/${ticketId.value}/transferClient`, params ); await axios.patch(`Tickets/${ticketId.value}/transferClient`, params);
window.location.reload(); window.location.reload();
} }
@ -339,7 +339,7 @@ async function changeShippedHour(time) {
const { data } = await axios.post( const { data } = await axios.post(
`Tickets/${ticketId.value}/updateEditableTicket`, `Tickets/${ticketId.value}/updateEditableTicket`,
params params,
); );
if (data) window.location.reload(); if (data) window.location.reload();
@ -405,8 +405,7 @@ async function uploadDocuware(force) {
uploadDocuware(true); uploadDocuware(true);
}); });
const { data } = await axios.post(`Docuwares/upload`, { const { data } = await axios.post(`Docuwares/upload-delivery-note`, {
fileCabinet: 'deliveryNote',
ticketIds: [parseInt(ticketId.value)], ticketIds: [parseInt(ticketId.value)],
}); });
@ -500,7 +499,7 @@ async function ticketToRestore() {
</QItem> </QItem>
</template> </template>
</VnSelect> </VnSelect>
<VnSelect <VnSelect
:disable="!client" :disable="!client"
:options="addressesOptions" :options="addressesOptions"
:fields="['id', 'nickname']" :fields="['id', 'nickname']"
@ -815,7 +814,7 @@ async function ticketToRestore() {
en: en:
addTurn: Add turn addTurn: Add turn
invoiceIds: "Invoices have been generated with the following ids: {invoiceIds}" invoiceIds: "Invoices have been generated with the following ids: {invoiceIds}"
es: es:
Show Delivery Note...: Ver albarán... Show Delivery Note...: Ver albarán...
Send Delivery Note...: Enviar albarán... Send Delivery Note...: Enviar albarán...

View File

@ -340,25 +340,20 @@ async function makeInvoice(ticket) {
}); });
} }
async function sendDocuware(ticket) { async function sendDocuware(tickets) {
try { let ticketIds = tickets.map((item) => item.id);
let ticketIds = ticket.map((item) => item.id);
const { data } = await axios.post(`Docuwares/upload`, { const { data } = await axios.post(`Docuwares/upload-delivery-note`, {
fileCabinet: 'deliveryNote', ticketIds,
ticketIds, });
});
for (let ticket of ticketIds) { for (let ticket of tickets) {
ticket.stateFk = data.id; ticket.stateFk = data.id;
ticket.state = data.name; ticket.state = data.name;
ticket.alertLevel = data.alertLevel; ticket.alertLevel = data.alertLevel;
ticket.alertLevelCode = data.code; ticket.alertLevelCode = data.code;
}
notify('globals.dataSaved', 'positive');
} catch (err) {
console.err('err: ', err);
} }
notify('globals.dataSaved', 'positive');
} }
function openBalanceDialog(ticket) { function openBalanceDialog(ticket) {