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 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(
@ -160,7 +170,7 @@ function setUserParams(watchedParams, watchedOrder) {
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
const filter =
typeof watchedParams?.filter == 'string'
? JSON.parse(watchedParams?.filter)
? JSON.parse(watchedParams?.filter ?? '{}')
: watchedParams?.filter;
const where = filter?.where;
const order = watchedOrder ?? filter?.order;
@ -615,14 +625,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">

View File

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

View File

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

View File

@ -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>

View File

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

View File

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

View File

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

View File

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