0
0
Fork 0

fix(customerDescription): fix action buttons

This commit is contained in:
Alex Moreno 2024-08-12 08:34:16 +02:00
parent b5ea6b70c5
commit 5e88004e79
3 changed files with 32 additions and 11 deletions

View File

@ -108,6 +108,8 @@ const CrudModelRef = ref({});
const showForm = ref(false); const showForm = ref(false);
const splittedColumns = ref({ columns: [] }); const splittedColumns = ref({ columns: [] });
const columnsVisibilitySkiped = ref(); const columnsVisibilitySkiped = ref();
const createForm = ref();
const tableModes = [ const tableModes = [
{ {
icon: 'view_column', icon: 'view_column',
@ -139,6 +141,14 @@ onMounted(() => {
.map((c) => c.name), .map((c) => c.name),
...['tableActions'], ...['tableActions'],
]; ];
createForm.value = $props.create;
if ($props.create && route?.query?.createForm) {
showForm.value = true;
createForm.value = {
...createForm.value,
...{ formInitialData: JSON.parse(route?.query?.createForm) },
};
}
}); });
watch( watch(
@ -158,7 +168,7 @@ function setUserParams(watchedParams) {
if (!watchedParams) return; if (!watchedParams) return;
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams); if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
const filter = JSON.parse(watchedParams?.filter); const filter = JSON.parse(watchedParams?.filter ?? '{}');
const where = filter?.where; const where = filter?.where;
const order = filter?.order; const order = filter?.order;
@ -598,14 +608,14 @@ defineExpose({
<QPageSticky v-if="create" :offset="[20, 20]" style="z-index: 2"> <QPageSticky v-if="create" :offset="[20, 20]" style="z-index: 2">
<QBtn @click="showForm = !showForm" color="primary" fab icon="add" /> <QBtn @click="showForm = !showForm" color="primary" fab icon="add" />
<QTooltip> <QTooltip>
{{ create.title }} {{ createForm.title }}
</QTooltip> </QTooltip>
</QPageSticky> </QPageSticky>
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale"> <QDialog v-model="showForm" transition-show="scale" transition-hide="scale">
<FormModelPopup <FormModelPopup
v-bind="create" v-bind="createForm"
:model="$attrs['data-key'] + 'Create'" :model="$attrs['data-key'] + 'Create'"
@on-data-saved="(_, res) => create.onDataSaved(res)" @on-data-saved="(_, res) => createForm.onDataSaved(res)"
> >
<template #form-inputs="{ data }"> <template #form-inputs="{ data }">
<div class="grid-create"> <div class="grid-create">

View File

@ -139,7 +139,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
<QBtn <QBtn
:to="{ :to="{
name: 'TicketList', name: 'TicketList',
query: { params: JSON.stringify({ clientFk: entity.id }) }, query: { table: JSON.stringify({ clientFk: entity.id }) },
}" }"
size="md" size="md"
icon="vn:ticket" icon="vn:ticket"
@ -150,7 +150,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
<QBtn <QBtn
:to="{ :to="{
name: 'InvoiceOutList', name: 'InvoiceOutList',
query: { params: JSON.stringify({ clientFk: entity.id }) }, query: { table: JSON.stringify({ clientFk: entity.id }) },
}" }"
size="md" size="md"
icon="vn:invoice-out" icon="vn:invoice-out"
@ -161,7 +161,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
<QBtn <QBtn
:to="{ :to="{
name: 'OrderCreate', name: 'OrderCreate',
query: { clientFk: entity.id }, query: { clientId: entity.id },
}" }"
size="md" size="md"
icon="vn:basketadd" icon="vn:basketadd"
@ -169,8 +169,19 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
> >
<QTooltip>{{ t('New order') }}</QTooltip> <QTooltip>{{ t('New order') }}</QTooltip>
</QBtn> </QBtn>
<QBtn size="md" icon="face" color="primary"> <QBtn
<!-- TODO:: Redirigir a la vista de usuario cuando exista --> :to="{
name: 'AccountList',
query: {
table: JSON.stringify({
filter: { where: { id: entity.id } },
}),
},
}"
size="md"
icon="face"
color="primary"
>
<QTooltip>{{ t('Go to user') }}</QTooltip> <QTooltip>{{ t('Go to user') }}</QTooltip>
</QBtn> </QBtn>
</QCardActions> </QCardActions>

View File

@ -64,7 +64,7 @@ const columns = computed(() => [
}, },
{ {
align: 'left', align: 'left',
name: 'clientSocialName', name: 'clientFk',
label: t('invoiceOutModule.customer'), label: t('invoiceOutModule.customer'),
cardVisible: true, cardVisible: true,
component: 'select', component: 'select',
@ -215,7 +215,7 @@ watchEffect(selectedRows);
selection: 'multiple', selection: 'multiple',
}" }"
> >
<template #column-clientSocialName="{ row }"> <template #column-clientFk="{ row }">
<span class="link" @click.stop> <span class="link" @click.stop>
{{ row.clientSocialName }} {{ row.clientSocialName }}
<CustomerDescriptorProxy :id="row.clientFk" /> <CustomerDescriptorProxy :id="row.clientFk" />