From f60670cb87958d2c9012ad156a8ae40e45eb526a Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 8 Apr 2024 10:49:53 +0200 Subject: [PATCH 01/33] refs #7172 change vnselectfilter --- src/pages/Claim/Card/ClaimBasicData.vue | 36 ++++++++++++++++++------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/src/pages/Claim/Card/ClaimBasicData.vue b/src/pages/Claim/Card/ClaimBasicData.vue index c7c5ab8a2..aad003031 100644 --- a/src/pages/Claim/Card/ClaimBasicData.vue +++ b/src/pages/Claim/Card/ClaimBasicData.vue @@ -2,7 +2,7 @@ import { ref } from 'vue'; import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; - +import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import FetchData from 'components/FetchData.vue'; import FormModel from 'components/FormModel.vue'; import VnRow from 'components/ui/VnRow.vue'; @@ -40,11 +40,7 @@ const workers = ref([]); const workersCopy = ref([]); const claimStates = ref([]); const claimStatesCopy = ref([]); - -function setWorkers(data) { - workers.value = data; - workersCopy.value = data; -} +const workersOptions = ref([]); function setClaimStates(data) { claimStates.value = data; @@ -89,8 +85,9 @@ const statesFilter = {
- - + --> + + +
Date: Wed, 10 Apr 2024 14:16:20 +0200 Subject: [PATCH 02/33] refs #7172 fix vnSelectFilter --- src/pages/Claim/Card/ClaimBasicData.vue | 47 +------------------------ 1 file changed, 1 insertion(+), 46 deletions(-) diff --git a/src/pages/Claim/Card/ClaimBasicData.vue b/src/pages/Claim/Card/ClaimBasicData.vue index aad003031..26175dab9 100644 --- a/src/pages/Claim/Card/ClaimBasicData.vue +++ b/src/pages/Claim/Card/ClaimBasicData.vue @@ -36,8 +36,6 @@ const claimFilter = { ], }; -const workers = ref([]); -const workersCopy = ref([]); const claimStates = ref([]); const claimStatesCopy = ref([]); const workersOptions = ref([]); @@ -47,25 +45,6 @@ function setClaimStates(data) { claimStatesCopy.value = data; } -const workerFilter = { - options: workers, - filterFn: (options, value) => { - const search = value.toLowerCase(); - - if (value === '') return workersCopy.value; - - return options.value.filter((row) => { - const id = row.id; - const name = row.name.toLowerCase(); - - const idMatches = id == search; - const nameMatches = name.indexOf(search) > -1; - - return idMatches || nameMatches; - }); - }, -}; - const statesFilter = { options: claimStates, filterFn: (options, value) => { @@ -87,7 +66,6 @@ const statesFilter = { :filter="{ where: { role: 'salesPerson' } }" @on-fetch="(data) => (workersOptions = data)" auto-load - limit="30" />
- + + From 127567898da40f416db6d3fcc3da7231dba59a3d Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 26 Apr 2024 13:27:58 +0200 Subject: [PATCH 13/33] fix: add filter panel --- src/pages/Item/ItemTypeList.vue | 22 +++++++++++- src/pages/ItemType/ItemTypeFilter.vue | 49 +++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/pages/ItemType/ItemTypeFilter.vue diff --git a/src/pages/Item/ItemTypeList.vue b/src/pages/Item/ItemTypeList.vue index b0b4de540..5b106916d 100644 --- a/src/pages/Item/ItemTypeList.vue +++ b/src/pages/Item/ItemTypeList.vue @@ -6,6 +6,7 @@ import VnPaginate from 'src/components/ui/VnPaginate.vue'; import VnLv from 'src/components/ui/VnLv.vue'; import CardList from 'src/components/ui/CardList.vue'; import ItemTypeSummary from 'src/pages/ItemType/Card/ItemTypeSummary.vue'; +import ItemTypeFilter from 'src/pages/ItemType/ItemTypeFilter.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import { useStateStore } from 'stores/useStateStore'; @@ -31,12 +32,31 @@ const redirectToCreateView = () => { + +
+ + + {{ t('globals.collapseMenu') }} + + +
+
+ + + + +
+import { useI18n } from 'vue-i18n'; +import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; +import VnInput from 'src/components/common/VnInput.vue'; +const { t } = useI18n(); + +const props = defineProps({ + dataKey: { + type: String, + required: true, + }, +}); + + + + + +en: + params: + name: Name + code: Code +es: + params: + name: Nombre + code: Código + Name: Nombre + Code: Código + From 76cd79173cabe0996c03a982b8773c5bd8df107e Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 26 Apr 2024 13:50:11 +0200 Subject: [PATCH 14/33] refs #7172 fix select --- src/pages/Claim/Card/ClaimBasicData.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/Claim/Card/ClaimBasicData.vue b/src/pages/Claim/Card/ClaimBasicData.vue index f6feae4ba..adb9b4c08 100644 --- a/src/pages/Claim/Card/ClaimBasicData.vue +++ b/src/pages/Claim/Card/ClaimBasicData.vue @@ -2,7 +2,7 @@ import { ref } from 'vue'; import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; -import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; +import VnSelect from 'src/components/common/VnSelect.vue'; import FetchData from 'components/FetchData.vue'; import FormModel from 'components/FormModel.vue'; import VnRow from 'components/ui/VnRow.vue'; @@ -108,7 +108,7 @@ const statesFilter = {
- - +
Date: Fri, 26 Apr 2024 14:49:54 +0200 Subject: [PATCH 15/33] fix: add exprBuilder --- src/components/ui/VnFilterPanel.vue | 3 ++- src/components/ui/VnSearchbar.vue | 2 ++ src/pages/Item/ItemTypeList.vue | 17 +++++++++++++++-- src/pages/ItemType/ItemTypeFilter.vue | 8 +++++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index 96d097191..cde48e9b3 100644 --- a/src/components/ui/VnFilterPanel.vue +++ b/src/components/ui/VnFilterPanel.vue @@ -145,7 +145,8 @@ const customTags = computed(() => ); async function remove(key) { - userParams.value[key] = null; + // userParams.value[key] = null; + if (userParams.value[key]) delete userParams.value[key]; await search(); emit('remove', key); } diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index fc8475ace..da8d43c95 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -81,8 +81,10 @@ async function search() { const staticParams = Object.entries(store.userParams).filter( ([key, value]) => value && (props.staticParams || []).includes(key) ); + // const filter =props?.where? { where: JSON.parse(props.where) }: {} await arrayData.applyFilter({ params: { + // filter , ...Object.fromEntries(staticParams), search: searchText.value, }, diff --git a/src/pages/Item/ItemTypeList.vue b/src/pages/Item/ItemTypeList.vue index 5b106916d..1e21c1719 100644 --- a/src/pages/Item/ItemTypeList.vue +++ b/src/pages/Item/ItemTypeList.vue @@ -24,6 +24,17 @@ const redirectToItemTypeSummary = (id) => { const redirectToCreateView = () => { router.push({ name: 'ItemTypeCreate' }); }; +const exprBuilder = (param, value) => { + switch (param) { + case 'name': + case 'code': + case 'search': + return { + name: { like: `%${value}%` }, + code: { like: `%${value}%` }, + }; + } +}; - + diff --git a/src/pages/ItemType/ItemTypeFilter.vue b/src/pages/ItemType/ItemTypeFilter.vue index 33238545f..2a86795c2 100644 --- a/src/pages/ItemType/ItemTypeFilter.vue +++ b/src/pages/ItemType/ItemTypeFilter.vue @@ -10,10 +10,16 @@ const props = defineProps({ required: true, }, }); + +const emit = defineEmits(['search']);