From 2ee4f0e65ce48a88b92f512db52d4392f962d391 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 18 Dec 2024 08:19:07 +0100 Subject: [PATCH 01/32] fix: remove params when searching by id on VnSearchbar --- src/components/ui/VnSearchbar.vue | 14 ++++++++++++-- src/pages/Order/Card/OrderCatalog.vue | 3 ++- src/pages/Zone/Card/ZoneLocationsTree.vue | 8 +++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index 4e90245d6..92babfcc6 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -63,6 +63,10 @@ const props = defineProps({ type: Function, default: undefined, }, + searchRemoveParams: { + type: Boolean, + default: true, + }, }); const searchText = ref(); @@ -101,12 +105,18 @@ async function search() { const filter = { params: { - ...Object.fromEntries(staticParams), search: searchText.value, }, - ...{ filter: props.filter }, + filter: props.filter, }; + if (!props.searchRemoveParams || !searchText.value) { + filter.params = { + ...Object.fromEntries(staticParams), + search: searchText.value, + }; + } + if (props.whereFilter) { filter.filter = { where: props.whereFilter(searchText.value), diff --git a/src/pages/Order/Card/OrderCatalog.vue b/src/pages/Order/Card/OrderCatalog.vue index 26133a7eb..2ede429a0 100644 --- a/src/pages/Order/Card/OrderCatalog.vue +++ b/src/pages/Order/Card/OrderCatalog.vue @@ -1,7 +1,7 @@ - + [ name: 'itemFk', ...defaultColumnAttrs, isId: true, - cardVisible: true, columnField: { component: 'input', type: 'number', @@ -65,14 +64,12 @@ const columns = computed(() => [ name: 'name', ...defaultColumnAttrs, create: true, - cardVisible: true, }, { label: t('item.fixedPrice.groupingPrice'), field: 'rate2', name: 'rate2', ...defaultColumnAttrs, - cardVisible: true, component: 'input', type: 'number', }, @@ -81,7 +78,6 @@ const columns = computed(() => [ field: 'rate3', name: 'rate3', ...defaultColumnAttrs, - cardVisible: true, component: 'input', type: 'number', }, @@ -91,7 +87,6 @@ const columns = computed(() => [ field: 'minPrice', name: 'minPrice', ...defaultColumnAttrs, - cardVisible: true, component: 'input', type: 'number', }, @@ -100,7 +95,6 @@ const columns = computed(() => [ field: 'started', name: 'started', format: ({ started }) => toDate(started), - cardVisible: true, ...defaultColumnAttrs, columnField: { component: 'date', @@ -116,7 +110,6 @@ const columns = computed(() => [ field: 'ended', name: 'ended', ...defaultColumnAttrs, - cardVisible: true, columnField: { component: 'date', class: 'shrink', @@ -251,11 +244,14 @@ const upsertPrice = async (props, resetMinPrice = false) => { } if (!changes.updates && !changes.creates) return; const data = await upsertFixedPrice(row); - tableRef.value.CrudModelRef.formData[props.rowIndex] = data; + Object.assign(tableRef.value.CrudModelRef.formData[props.rowIndex], data); + notify(t('globals.dataSaved'), 'positive'); + tableRef.value.reload(); }; async function upsertFixedPrice(row) { const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row); + data.hasMinPrice = data.hasMinPrice ? 1 : 0; return data; } @@ -395,18 +391,11 @@ function handleOnDataSave({ CrudModelRef }) { From 9a631a61f90711e281244ddcb7ae2b8d93c96a55 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 3 Jan 2025 10:46:43 +0100 Subject: [PATCH 16/32] fix: refs #8197 redirection --- src/components/common/VnSection.vue | 14 ++++++++++++-- src/components/ui/VnSearchbar.vue | 1 + src/pages/Order/Card/OrderSummary.vue | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/common/VnSection.vue b/src/components/common/VnSection.vue index e69e586b5..f55826a22 100644 --- a/src/components/common/VnSection.vue +++ b/src/components/common/VnSection.vue @@ -4,6 +4,7 @@ import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnTableFilter from '../VnTable/VnTableFilter.vue'; import { onBeforeMount, computed } from 'vue'; import { useArrayData } from 'src/composables/useArrayData'; +import { useRoute } from 'vue-router'; const $props = defineProps({ section: { @@ -40,8 +41,17 @@ const $props = defineProps({ }, }); -const sectionValue = computed(() => $props.section ?? $props.dataKey); +const route = useRoute(); let arrayData; +const sectionValue = computed(() => $props.section ?? $props.dataKey); +const isMainSection = computed(() => { + const isSame = sectionValue.value == route.name; + if (!isSame && arrayData) { + arrayData.reset(['userParams', 'userFilter']); + } + return isSame; +}); + onBeforeMount(() => { if ($props.dataKey) arrayData = useArrayData($props.dataKey, { @@ -74,6 +84,6 @@ onBeforeMount(() => { - + diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index 4e284d8e4..a2d3b9ee1 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -126,6 +126,7 @@ async function search() { delete filter.params.search; } await arrayData.applyFilter(filter); + searchText.value = undefined; }