feat: move buttons to DescriptorMenu
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-11-14 12:06:12 +01:00
parent e57a253c6f
commit ecf131ba78
3 changed files with 51 additions and 39 deletions

View File

@ -174,23 +174,6 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
>
<QTooltip>{{ t('Customer ticket list') }}</QTooltip>
</QBtn>
<QBtn
:to="{
name: 'TicketList',
query: {
table: JSON.stringify({
clientFk: entity.id,
}),
createForm: JSON.stringify({ clientId: entity.id }),
},
}"
size="md"
color="primary"
target="_blank"
icon="vn:ticketAdd"
>
<QTooltip>{{ t('New ticket') }}</QTooltip>
</QBtn>
<QBtn
:to="{
name: 'InvoiceOutList',
@ -202,23 +185,6 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
>
<QTooltip>{{ t('Customer invoice out list') }}</QTooltip>
</QBtn>
<QBtn
:to="{
name: 'OrderList',
query: {
table: JSON.stringify({
clientFk: entity.id,
}),
createForm: JSON.stringify({ clientFk: entity.id }),
},
}"
size="md"
target="_blank"
icon="vn:basketadd"
color="primary"
>
<QTooltip>{{ t('New order') }}</QTooltip>
</QBtn>
<QBtn
:to="{
name: 'AccountSummary',

View File

@ -40,9 +40,53 @@ const sendSms = async (payload) => {
notify(error.message, 'positive');
}
};
const openTicketCreateForm = () => {
const query = {
table: {
clientFk: $props.customer.id,
},
createForm: {
clientId: $props.customer.id,
addressId: $props.customer.defaultAddressFk,
},
};
openWindow('ticket', query);
};
const openOrderCreateForm = () => {
const query = {
table: {
clientFk: $props.customer.id,
},
createForm: {
clientFk: $props.customer.id,
addressId: $props.customer.defaultAddressFk,
},
};
openWindow('order', query);
};
const openWindow = (type, { createForm, table }) => {
window.open(
`/#/${type}/list?createForm=${JSON.stringify(createForm)}&table=${JSON.stringify(
table
)}`,
'_blank'
);
};
</script>
<template>
<QItem v-ripple clickable @click="openTicketCreateForm()">
<QItemSection>
{{ t('globals.pageTitles.createTicket') }}
</QItemSection>
</QItem>
<QItem v-ripple clickable @click="openOrderCreateForm()">
<QItemSection>
{{ t('globals.pageTitles.createOrder') }}
</QItemSection>
</QItem>
<QItem v-ripple clickable>
<QItemSection @click="showSmsDialog()">{{ t('Send SMS') }}</QItemSection>
</QItem>

View File

@ -45,6 +45,13 @@ const userParams = {
from: null,
to: null,
};
onMounted(() => {
initializeFromQuery();
stateStore.rightDrawer = true;
if (!route.query.createForm) return;
onClientSelected(JSON.parse(route.query.createForm));
});
// Método para inicializar las variables desde la query string
const initializeFromQuery = () => {
const query = route.query.table ? JSON.parse(route.query.table) : {};
@ -301,11 +308,6 @@ const getDateColor = (date) => {
if (comparation < 0) return 'bg-success';
};
onMounted(() => {
initializeFromQuery();
stateStore.rightDrawer = true;
});
async function makeInvoice(ticket) {
const ticketsIds = ticket.map((item) => item.id);
const { data } = await axios.post(`Tickets/invoiceTicketsAndPdf`, { ticketsIds });