diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 8cd7bb628..16d4dd160 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -108,6 +108,8 @@ const CrudModelRef = ref({}); const showForm = ref(false); const splittedColumns = ref({ columns: [] }); const columnsVisibilitySkiped = ref(); +const createForm = ref(); + const tableModes = [ { icon: 'view_column', @@ -139,6 +141,14 @@ onMounted(() => { .map((c) => c.name), ...['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( @@ -158,7 +168,7 @@ function setUserParams(watchedParams) { if (!watchedParams) return; 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 order = filter?.order; @@ -598,14 +608,14 @@ defineExpose({ <QPageSticky v-if="create" :offset="[20, 20]" style="z-index: 2"> <QBtn @click="showForm = !showForm" color="primary" fab icon="add" /> <QTooltip> - {{ create.title }} + {{ createForm.title }} </QTooltip> </QPageSticky> <QDialog v-model="showForm" transition-show="scale" transition-hide="scale"> <FormModelPopup - v-bind="create" + v-bind="createForm" :model="$attrs['data-key'] + 'Create'" - @on-data-saved="(_, res) => create.onDataSaved(res)" + @on-data-saved="(_, res) => createForm.onDataSaved(res)" > <template #form-inputs="{ data }"> <div class="grid-create"> diff --git a/src/pages/Customer/Card/CustomerDescriptor.vue b/src/pages/Customer/Card/CustomerDescriptor.vue index 938d90ab1..0e76bcfed 100644 --- a/src/pages/Customer/Card/CustomerDescriptor.vue +++ b/src/pages/Customer/Card/CustomerDescriptor.vue @@ -139,7 +139,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit <QBtn :to="{ name: 'TicketList', - query: { params: JSON.stringify({ clientFk: entity.id }) }, + query: { table: JSON.stringify({ clientFk: entity.id }) }, }" size="md" icon="vn:ticket" @@ -150,7 +150,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit <QBtn :to="{ name: 'InvoiceOutList', - query: { params: JSON.stringify({ clientFk: entity.id }) }, + query: { table: JSON.stringify({ clientFk: entity.id }) }, }" size="md" icon="vn:invoice-out" @@ -161,7 +161,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit <QBtn :to="{ name: 'OrderCreate', - query: { clientFk: entity.id }, + query: { clientId: entity.id }, }" size="md" icon="vn:basketadd" @@ -169,8 +169,19 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit > <QTooltip>{{ t('New order') }}</QTooltip> </QBtn> - <QBtn size="md" icon="face" color="primary"> - <!-- TODO:: Redirigir a la vista de usuario cuando exista --> + <QBtn + :to="{ + name: 'AccountList', + query: { + table: JSON.stringify({ + filter: { where: { id: entity.id } }, + }), + }, + }" + size="md" + icon="face" + color="primary" + > <QTooltip>{{ t('Go to user') }}</QTooltip> </QBtn> </QCardActions> diff --git a/src/pages/InvoiceOut/InvoiceOutList.vue b/src/pages/InvoiceOut/InvoiceOutList.vue index 7e4622560..528cdf234 100644 --- a/src/pages/InvoiceOut/InvoiceOutList.vue +++ b/src/pages/InvoiceOut/InvoiceOutList.vue @@ -64,7 +64,7 @@ const columns = computed(() => [ }, { align: 'left', - name: 'clientSocialName', + name: 'clientFk', label: t('invoiceOutModule.customer'), cardVisible: true, component: 'select', @@ -215,7 +215,7 @@ watchEffect(selectedRows); selection: 'multiple', }" > - <template #column-clientSocialName="{ row }"> + <template #column-clientFk="{ row }"> <span class="link" @click.stop> {{ row.clientSocialName }} <CustomerDescriptorProxy :id="row.clientFk" />