diff --git a/src/components/VnTable/VnFilter.vue b/src/components/VnTable/VnFilter.vue index 0eb2e2a19..d572b8be0 100644 --- a/src/components/VnTable/VnFilter.vue +++ b/src/components/VnTable/VnFilter.vue @@ -106,7 +106,7 @@ async function addFilter(value) { let params = { [field]: value }; if (columnFilter.value?.inWhere) { if (columnFilter.value.alias) field = columnFilter.value.alias + '.' + field; - params = { filter: { where: { [field]: value } } }; + return await arrayData.addFilterWhere(params); } await arrayData.addFilter({ params }); } diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index ba6f62810..81a2bf01a 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -150,6 +150,13 @@ export function useArrayData(key, userOptions) { return { filter, params }; } + async function addFilterWhere(where) { + const storedFilter = { ...store.userFilter }; + if (!storedFilter?.where) storedFilter.where = {}; + where = { ...storedFilter.where, ...where }; + await addFilter({ filter: { where } }); + } + function sanitizerParams(params, exprBuilder) { for (const param in params) { if (params[param] === '' || params[param] === null) { @@ -188,7 +195,12 @@ export function useArrayData(key, userOptions) { if (store.limit) query.limit = store.limit; if (store.skip) query.skip = store.skip; if (store.userParams && Object.keys(store.userParams).length !== 0) - query.params = JSON.stringify(store.userParams); + query.params = store.userParams; + if (store.userFilter && Object.keys(store.userFilter).length !== 0) { + if (!query.params) query.params = {}; + query.params.filter = store.userFilter; + } + if (query.params) query.params = JSON.stringify(query.params); router.replace({ path: route.path, @@ -203,6 +215,7 @@ export function useArrayData(key, userOptions) { fetch, applyFilter, addFilter, + addFilterWhere, refresh, destroy, loadMore, diff --git a/src/pages/Customer/ExtendedList/CustomerExtendedList.vue b/src/pages/Customer/ExtendedList/CustomerExtendedList.vue index 3edb680fa..3a026763d 100644 --- a/src/pages/Customer/ExtendedList/CustomerExtendedList.vue +++ b/src/pages/Customer/ExtendedList/CustomerExtendedList.vue @@ -198,16 +198,44 @@ const columns = computed(() => [ align: 'left', label: t('customer.extendedList.tableVisibleColumns.payMethodFk'), name: 'payMethodFk', + columnFilter: { + component: 'select', + attrs: { + url: 'PayMethods', + }, + inWhere: true, + }, + format: (row, dashIfEmpty) => dashIfEmpty(row.payMethod), }, { align: 'left', label: t('customer.extendedList.tableVisibleColumns.sageTaxTypeFk'), name: 'sageTaxTypeFk', + columnFilter: { + component: 'select', + attrs: { + optionLabel: 'vat', + url: 'SageTaxTypes', + }, + alias: 'sti', + inWhere: true, + }, + format: (row, dashIfEmpty) => dashIfEmpty(row.sageTaxType), }, { align: 'left', label: t('customer.extendedList.tableVisibleColumns.sageTransactionTypeFk'), name: 'sageTransactionTypeFk', + columnFilter: { + component: 'select', + attrs: { + optionLabel: 'transaction', + url: 'SageTransactionTypes', + }, + alias: 'stt', + inWhere: true, + }, + format: (row, dashIfEmpty) => dashIfEmpty(row.sageTransactionType), }, { align: 'left', @@ -218,22 +246,34 @@ const columns = computed(() => [ condition: (value) => !value, icon: 'vn:disabled', }, + columnFilter: { + inWhere: true, + }, }, { align: 'left', label: t('customer.extendedList.tableVisibleColumns.isVies'), name: 'isVies', + columnFilter: { + inWhere: true, + }, }, { align: 'left', label: t('customer.extendedList.tableVisibleColumns.isTaxDataChecked'), name: 'isTaxDataChecked', + columnFilter: { + inWhere: true, + }, }, { align: 'left', label: t('customer.extendedList.tableVisibleColumns.isEqualizated'), name: 'isEqualizated', created: true, + columnFilter: { + inWhere: true, + }, }, { align: 'left', @@ -244,36 +284,57 @@ const columns = computed(() => [ condition: (value) => value, icon: 'vn:frozen', }, + columnFilter: { + inWhere: true, + }, }, { align: 'left', label: t('customer.extendedList.tableVisibleColumns.hasToInvoice'), name: 'hasToInvoice', + columnFilter: { + inWhere: true, + }, }, { align: 'left', label: t('customer.extendedList.tableVisibleColumns.hasToInvoiceByAddress'), name: 'hasToInvoiceByAddress', + columnFilter: { + inWhere: true, + }, }, { align: 'left', label: t('customer.extendedList.tableVisibleColumns.isToBeMailed'), name: 'isToBeMailed', + columnFilter: { + inWhere: true, + }, }, { align: 'left', label: t('customer.extendedList.tableVisibleColumns.hasLcr'), name: 'hasLcr', + columnFilter: { + inWhere: true, + }, }, { align: 'left', label: t('customer.extendedList.tableVisibleColumns.hasCoreVnl'), name: 'hasCoreVnl', + columnFilter: { + inWhere: true, + }, }, { align: 'left', label: t('customer.extendedList.tableVisibleColumns.hasSepaVnl'), name: 'hasSepaVnl', + columnFilter: { + inWhere: true, + }, }, { align: 'right', diff --git a/src/pages/Customer/ExtendedList/CustomerExtendedListActions.vue b/src/pages/Customer/ExtendedList/CustomerExtendedListActions.vue deleted file mode 100644 index 8355c7560..000000000 --- a/src/pages/Customer/ExtendedList/CustomerExtendedListActions.vue +++ /dev/null @@ -1,60 +0,0 @@ - - - - - -es: - Client ticket list: Listado de tickets del cliente - Preview: Vista previa - diff --git a/src/pages/Customer/ExtendedList/CustomerExtendedListFilter.vue b/src/pages/Customer/ExtendedList/CustomerExtendedListFilter.vue deleted file mode 100644 index 1be20f26c..000000000 --- a/src/pages/Customer/ExtendedList/CustomerExtendedListFilter.vue +++ /dev/null @@ -1,571 +0,0 @@ - - - - - -es: - Social name: Razón social -