0
0
Fork 0

feat: #6943 CustomerDescriptor actions

This commit is contained in:
Javier Segarra 2024-11-15 11:36:20 +01:00
parent 0a239e8c43
commit 2891e1363a
2 changed files with 38 additions and 14 deletions

View File

@ -37,6 +37,9 @@ const entityId = computed(() => {
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = (entity) => (data.value = useCardDescription(entity?.name, entity?.id)); const setData = (entity) => (data.value = useCardDescription(entity?.name, entity?.id));
const debtWarning = computed(() => {
return customer.value?.debt > customer.value.credit ? 'negative' : 'primary';
});
</script> </script>
<template> <template>
@ -107,11 +110,12 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
> >
<QTooltip>{{ t('customer.card.webAccountInactive') }}</QTooltip> <QTooltip>{{ t('customer.card.webAccountInactive') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="customer.debt > customer.credit" v-if="customer.debt > customer.credit"
name="vn:risk" name="vn:risk"
size="xs" size="xs"
color="primary" :color="debtWarning"
> >
<QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip> <QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip>
</QIcon> </QIcon>
@ -168,6 +172,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
> >
<QTooltip>{{ t('Customer ticket list') }}</QTooltip> <QTooltip>{{ t('Customer ticket list') }}</QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
:to="{ :to="{
name: 'InvoiceOutList', name: 'InvoiceOutList',
@ -179,6 +184,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
> >
<QTooltip>{{ t('Customer invoice out list') }}</QTooltip> <QTooltip>{{ t('Customer invoice out list') }}</QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
:to="{ :to="{
name: 'AccountSummary', name: 'AccountSummary',
@ -215,6 +221,8 @@ es:
Go to module index: Ir al índice del módulo Go to module index: Ir al índice del módulo
Customer ticket list: Listado de tickets del cliente Customer ticket list: Listado de tickets del cliente
Customer invoice out list: Listado de facturas del cliente Customer invoice out list: Listado de facturas del cliente
New order: Nuevo pedido
New ticket: Nuevo ticket
Go to user: Ir al usuario Go to user: Ir al usuario
Go to supplier: Ir al proveedor Go to supplier: Ir al proveedor
Customer unpaid: Cliente impago Customer unpaid: Cliente impago

View File

@ -8,9 +8,6 @@ import { useQuasar } from 'quasar';
import useNotify from 'src/composables/useNotify'; import useNotify from 'src/composables/useNotify';
import VnSmsDialog from 'src/components/common/VnSmsDialog.vue'; import VnSmsDialog from 'src/components/common/VnSmsDialog.vue';
import TicketCreateDialog from 'src/pages/Ticket/TicketCreateDialog.vue';
import OrderCreateDialog from 'src/pages/Order/Card/OrderCreateDialog.vue';
import { ref } from 'vue';
const $props = defineProps({ const $props = defineProps({
customer: { customer: {
@ -44,13 +41,38 @@ const sendSms = async (payload) => {
} }
}; };
const ticketCreateFormDialog = ref(null);
const openTicketCreateForm = () => { const openTicketCreateForm = () => {
ticketCreateFormDialog.value.show(); const query = {
table: {
clientFk: $props.customer.id,
},
createForm: {
clientId: $props.customer.id,
addressId: $props.customer.defaultAddressFk,
},
};
openWindow('ticket', query);
}; };
const orderCreateFormDialog = ref(null);
const openOrderCreateForm = () => { const openOrderCreateForm = () => {
orderCreateFormDialog.value.show(); 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> </script>
@ -58,17 +80,11 @@ const openOrderCreateForm = () => {
<QItem v-ripple clickable @click="openTicketCreateForm()"> <QItem v-ripple clickable @click="openTicketCreateForm()">
<QItemSection> <QItemSection>
{{ t('globals.pageTitles.createTicket') }} {{ t('globals.pageTitles.createTicket') }}
<QDialog ref="ticketCreateFormDialog">
<TicketCreateDialog />
</QDialog>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem v-ripple clickable @click="openOrderCreateForm()"> <QItem v-ripple clickable @click="openOrderCreateForm()">
<QItemSection> <QItemSection>
{{ t('globals.pageTitles.createOrder') }} {{ t('globals.pageTitles.createOrder') }}
<QDialog ref="orderCreateFormDialog">
<OrderCreateDialog :client-fk="customer.id" />
</QDialog>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem v-ripple clickable> <QItem v-ripple clickable>