Merge pull request 'Change layout CustomerDescriptor Actions' (!931) from warmFix_customerDescriptorActions into dev
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
Reviewed-on: #931 Reviewed-by: Jorge Penadés <jorgep@verdnatura.es>
This commit is contained in:
commit
68994db6ff
|
@ -0,0 +1,8 @@
|
|||
import { openURL } from 'quasar';
|
||||
const defaultWindowFeatures = {
|
||||
noopener: true,
|
||||
noreferrer: true,
|
||||
};
|
||||
export default function (url, windowFeatures = defaultWindowFeatures, fn = undefined) {
|
||||
openURL(url, fn, windowFeatures);
|
||||
}
|
|
@ -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',
|
||||
|
|
|
@ -6,8 +6,8 @@ import axios from 'axios';
|
|||
import { useQuasar } from 'quasar';
|
||||
|
||||
import useNotify from 'src/composables/useNotify';
|
||||
|
||||
import VnSmsDialog from 'src/components/common/VnSmsDialog.vue';
|
||||
import useOpenURL from 'src/composables/useOpenURL';
|
||||
|
||||
const $props = defineProps({
|
||||
customer: {
|
||||
|
@ -15,7 +15,6 @@ const $props = defineProps({
|
|||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const { notify } = useNotify();
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
|
@ -40,9 +39,42 @@ const sendSms = async (payload) => {
|
|||
notify(error.message, 'positive');
|
||||
}
|
||||
};
|
||||
|
||||
const openCreateForm = (type) => {
|
||||
const query = {
|
||||
table: {
|
||||
clientFk: $props.customer.id,
|
||||
},
|
||||
createForm: {
|
||||
addressId: $props.customer.defaultAddressFk,
|
||||
},
|
||||
};
|
||||
const clientFk = {
|
||||
ticket: 'clientId',
|
||||
order: 'clientFk',
|
||||
};
|
||||
const key = clientFk[type];
|
||||
if (!key) return;
|
||||
query.createForm[key] = $props.customer.id;
|
||||
|
||||
const params = Object.entries(query)
|
||||
.map(([key, value]) => `${key}=${JSON.stringify(value)}`)
|
||||
.join('&');
|
||||
useOpenURL(`/#/${type}/list?${params}`);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QItem v-ripple clickable @click="openCreateForm('ticket')">
|
||||
<QItemSection>
|
||||
{{ t('globals.pageTitles.createTicket') }}
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable @click="openCreateForm('order')">
|
||||
<QItemSection>
|
||||
{{ t('globals.pageTitles.createOrder') }}
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection @click="showSmsDialog()">{{ t('Send SMS') }}</QItemSection>
|
||||
</QItem>
|
||||
|
|
|
@ -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 });
|
||||
|
|
Loading…
Reference in New Issue