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

View File

@ -8,9 +8,6 @@ import { useQuasar } from 'quasar';
import useNotify from 'src/composables/useNotify';
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({
customer: {
@ -44,13 +41,38 @@ const sendSms = async (payload) => {
}
};
const ticketCreateFormDialog = ref(null);
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 = () => {
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>
@ -58,17 +80,11 @@ const openOrderCreateForm = () => {
<QItem v-ripple clickable @click="openTicketCreateForm()">
<QItemSection>
{{ t('globals.pageTitles.createTicket') }}
<QDialog ref="ticketCreateFormDialog">
<TicketCreateDialog />
</QDialog>
</QItemSection>
</QItem>
<QItem v-ripple clickable @click="openOrderCreateForm()">
<QItemSection>
{{ t('globals.pageTitles.createOrder') }}
<QDialog ref="orderCreateFormDialog">
<OrderCreateDialog :client-fk="customer.id" />
</QDialog>
</QItemSection>
</QItem>
<QItem v-ripple clickable>