diff --git a/src/components/common/TableVisibleColumns.vue b/src/components/common/TableVisibleColumns.vue index 7aa696a07..a4e4afafe 100644 --- a/src/components/common/TableVisibleColumns.vue +++ b/src/components/common/TableVisibleColumns.vue @@ -52,7 +52,7 @@ const toggleMarkAll = (val) => { const getConfig = async (url, filter) => { const response = await axios.get(url, { - params: { filter: filter }, + params: { filter: JSON.stringify(filter) }, }); return response.data && response.data.length > 0 ? response.data[0] : null; }; @@ -60,7 +60,7 @@ const getConfig = async (url, filter) => { const fetchViewConfigData = async () => { try { const userConfigFilter = { - where: { tableCode: $props.tableCode, userFk: user.id }, + where: { tableCode: $props.tableCode, userFk: user.value.id }, }; const userConfig = await getConfig('UserConfigViews', userConfigFilter); @@ -74,8 +74,14 @@ const fetchViewConfigData = async () => { const defaultConfig = await getConfig('DefaultViewConfigs', defaultConfigFilter); if (defaultConfig) { + // Si el backend devuelve una configuración por defecto la usamos setUserConfigViewData(defaultConfig.columns); return; + } else { + // Si no hay configuración por defecto mostramos todas las columnas + const defaultColumns = {}; + $props.allColumns.forEach((col) => (defaultColumns[col] = true)); + setUserConfigViewData(defaultColumns); } } catch (err) { console.err('Error fetching config view data', err); diff --git a/src/components/common/VnCard.vue b/src/components/common/VnCard.vue index c81bcd8e2..17fa74317 100644 --- a/src/components/common/VnCard.vue +++ b/src/components/common/VnCard.vue @@ -39,7 +39,7 @@ const arrayData = useArrayData(props.dataKey, { onBeforeMount(async () => { if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id }; - await arrayData.fetch({ append: false }); + await arrayData.fetch({ append: false, updateRouter: false }); }); if (props.baseUrl) { diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 8111bcae4..0fcbbbb48 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -85,8 +85,12 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } Object.assign(filter, store.userFilter, exprFilter); - Object.assign(store.filter, filter); - const params = { filter: store.filter }; + let where; + if (filter?.where || store.filter?.where) + where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {}); + Object.assign(filter, store.filter); + filter.where = where; + const params = { filter }; Object.assign(params, userParams); params.filter.skip = store.skip; @@ -148,7 +152,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } async function addFilter({ filter, params }) { - if (filter) store.userFilter = Object.assign(store.userFilter, filter); + if (filter) store.filter = filter; let userParams = { ...store.userParams, ...params }; userParams = sanitizerParams(userParams, store?.exprBuilder); @@ -161,7 +165,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } async function addFilterWhere(where) { - const storedFilter = { ...store.userFilter }; + const storedFilter = { ...store.filter }; if (!storedFilter?.where) storedFilter.where = {}; where = { ...storedFilter.where, ...where }; await addFilter({ filter: { where } }); diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 3a1d619c0..6a66754f4 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -550,6 +550,7 @@ ticket: observation: Notes ticketAdvance: Advance tickets futureTickets: Future tickets + expedition: Expedition purchaseRequest: Purchase request weeklyTickets: Weekly tickets services: Service diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 42b887c21..a0af73641 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -548,6 +548,7 @@ ticket: observation: Notas ticketAdvance: Adelantar tickets futureTickets: Tickets a futuro + expedition: Expedición purchaseRequest: Petición de compra weeklyTickets: Tickets programados services: Servicios diff --git a/src/pages/Customer/CustomerList.vue b/src/pages/Customer/CustomerList.vue index 58aaf2bf0..394c472c2 100644 --- a/src/pages/Customer/CustomerList.vue +++ b/src/pages/Customer/CustomerList.vue @@ -408,7 +408,6 @@ function handleLocation(data, location) { default-mode="table" redirect="customer" auto-load - :disable-option="{ card: true }" >