0
0
Fork 0
This commit is contained in:
Alex Moreno 2024-08-12 11:46:09 +02:00
commit 65a80e006b
8 changed files with 49 additions and 26 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(
@ -160,7 +170,7 @@ function setUserParams(watchedParams, watchedOrder) {
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams); if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
const filter = const filter =
typeof watchedParams?.filter == 'string' typeof watchedParams?.filter == 'string'
? JSON.parse(watchedParams?.filter) ? JSON.parse(watchedParams?.filter ?? '{}')
: watchedParams?.filter; : watchedParams?.filter;
const where = filter?.where; const where = filter?.where;
const order = watchedOrder ?? filter?.order; const order = watchedOrder ?? filter?.order;
@ -615,14 +625,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

@ -65,7 +65,7 @@ async function fetchViewConfigData() {
const userConfig = await getConfig('UserConfigViews', { const userConfig = await getConfig('UserConfigViews', {
where: { where: {
...defaultFilter.where, ...defaultFilter.where,
...{ userFk: user.id }, ...{ userFk: user.value.id },
}, },
}); });

View File

@ -214,7 +214,7 @@ function getLogTree(data) {
} }
nLogs++; nLogs++;
modelLog.logs.push(log); modelLog.logs.push(log);
modelLog.summaryId = modelLog.logs[0].summaryId;
// Changes // Changes
const notDelete = log.action != 'delete'; const notDelete = log.action != 'delete';
const olds = (notDelete ? log.oldInstance : null) || {}; const olds = (notDelete ? log.oldInstance : null) || {};
@ -472,12 +472,17 @@ watch(
> >
{{ t(modelLog.modelI18n) }} {{ t(modelLog.modelI18n) }}
</QChip> </QChip>
<span class="model-id" v-if="modelLog.summaryId"
>#{{ modelLog.summaryId }}</span <span
> class="model-id q-mr-xs"
<span class="model-value" :title="modelLog.showValue"> v-if="modelLog.summaryId"
{{ modelLog.showValue }} v-text="`#${modelLog.summaryId}`"
</span> />
<span
class="model-value"
:title="modelLog.showValue"
v-text="modelLog.showValue"
/>
<QBtn <QBtn
flat flat
round round

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" />

View File

@ -119,6 +119,7 @@ const emit = defineEmits(['search']);
sort-by="numberPlate ASC" sort-by="numberPlate ASC"
option-value="id" option-value="id"
option-label="numberPlate" option-label="numberPlate"
option-filter-value="numberPlate"
dense dense
outlined outlined
rounded rounded

View File

@ -142,11 +142,6 @@ const onSave = (data, response) => {
<QInput <QInput
v-model.number="data.kmEnd" v-model.number="data.kmEnd"
:label="t('Km End')" :label="t('Km End')"
:rules="[
(val) =>
val < maxDistance ||
t('Distance must be lesser than', { maxDistance }),
]"
clearable clearable
type="number" type="number"
/> />
@ -194,7 +189,7 @@ es:
Description: Descripción Description: Descripción
Is served: Se ha servido Is served: Se ha servido
Created: Creado Created: Creado
Distance must be lesser than: La distancia debe ser inferior a {maxDistance} The km can not exceed: La distancia debe ser inferior a {maxDistance}
en: en:
Distance must be lesser than: Distance must be lesser than {maxDistance} The km can not exceed: Distance must be lesser than {maxDistance}
</i18n> </i18n>

View File

@ -99,6 +99,7 @@ const columns = computed(() => [
url: 'vehicles', url: 'vehicles',
fields: ['id', 'numberPlate'], fields: ['id', 'numberPlate'],
optionLabel: 'numberPlate', optionLabel: 'numberPlate',
optionFilterValue: 'numberPlate',
find: { find: {
value: 'vehicleFk', value: 'vehicleFk',
label: 'vehiclePlateNumber', label: 'vehiclePlateNumber',