0
0
Fork 0

fix: refs #7717 fix catalog filter, searchbar redirect and search

This commit is contained in:
Jon Elias 2024-07-19 14:53:44 +02:00
parent 873d8ad2c3
commit 7f376c8ea4
5 changed files with 30 additions and 8 deletions

View File

@ -6,6 +6,7 @@ import { useI18n } from 'vue-i18n';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import CatalogItem from 'components/ui/CatalogItem.vue'; import CatalogItem from 'components/ui/CatalogItem.vue';
import OrderCatalogFilter from 'pages/Order/Card/OrderCatalogFilter.vue'; import OrderCatalogFilter from 'pages/Order/Card/OrderCatalogFilter.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
const route = useRoute(); const route = useRoute();
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -52,6 +53,17 @@ function extractValueTags(items) {
</script> </script>
<template> <template>
<Teleport to="#searchbar">
<VnSearchbar
data-key="OrderCatalogList"
:user-params="catalogParams"
:static-params="['orderFk', 'orderBy']"
:redirect="false"
url="Orders/CatalogFilter"
:label="t('Search items')"
:info="t('You can search orders by reference')"
/>
</Teleport>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above> <QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8"> <QScrollArea class="fit text-grey-8">
<OrderCatalogFilter <OrderCatalogFilter

View File

@ -27,7 +27,6 @@ const props = defineProps({
required: true, required: true,
}, },
}); });
const categoryList = ref(null); const categoryList = ref(null);
const selectedCategoryFk = ref(null); const selectedCategoryFk = ref(null);
const typeList = ref(null); const typeList = ref(null);
@ -84,7 +83,14 @@ const selectedCategory = computed(() =>
(category) => category?.id === selectedCategoryFk.value (category) => category?.id === selectedCategoryFk.value
) )
); );
function filterFn(val, update) {
update(() => {
const needle = val.toLowerCase();
tagOptions.value = props.tagValue.filter(
(v) => v.toLowerCase().indexOf(needle) > -1
);
});
}
const selectedType = computed(() => { const selectedType = computed(() => {
return (typeList.value || []).find((type) => type?.id === selectedTypeFk.value); return (typeList.value || []).find((type) => type?.id === selectedTypeFk.value);
}); });
@ -352,7 +358,7 @@ const useLang = (values) => {
v-if="!selectedTag" v-if="!selectedTag"
:label="t('params.value')" :label="t('params.value')"
v-model="value.value" v-model="value.value"
:options="tagValue || []" :options="tagOptions || []"
option-value="value" option-value="value"
option-label="value" option-label="value"
dense dense
@ -362,6 +368,8 @@ const useLang = (values) => {
use-input use-input
class="filter-input" class="filter-input"
@new-value="createValue" @new-value="createValue"
@filter="filterFn"
@update:model-value="applyTagFilter(params, searchFn)"
/> />
<VnSelect <VnSelect
v-else-if="selectedTag === 1" v-else-if="selectedTag === 1"
@ -377,6 +385,7 @@ const useLang = (values) => {
use-input use-input
class="filter-input" class="filter-input"
@new-value="createValue" @new-value="createValue"
@update:model-value="applyTagFilter(params, searchFn)"
/> />
<VnInput <VnInput
v-else v-else
@ -386,6 +395,7 @@ const useLang = (values) => {
outlined outlined
rounded rounded
class="filter-input" class="filter-input"
@keyup.enter="applyTagFilter(params, searchFn)"
/> />
<QIcon <QIcon
name="delete" name="delete"
@ -400,7 +410,7 @@ const useLang = (values) => {
@click="tagValues.push({})" @click="tagValues.push({})"
/> />
</QItem> </QItem>
<QItem> <!-- <QItem>
<QItemSection class="q-py-sm"> <QItemSection class="q-py-sm">
<QBtn <QBtn
:label="t('Search')" :label="t('Search')"
@ -414,7 +424,7 @@ const useLang = (values) => {
@click.stop="applyTagFilter(params, searchFn)" @click.stop="applyTagFilter(params, searchFn)"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem> -->
<QSeparator /> <QSeparator />
</template> </template>
</VnFilterPanel> </VnFilterPanel>

View File

@ -72,7 +72,7 @@ export default {
title: 'catalog', title: 'catalog',
icon: 'vn:basket', icon: 'vn:basket',
}, },
component: () => import('src/pages/Order/OrderCatalog.vue'), component: () => import('src/pages/Order/Card/OrderCatalog.vue'),
}, },
{ {
name: 'OrderVolume', name: 'OrderVolume',
@ -81,7 +81,7 @@ export default {
title: 'volume', title: 'volume',
icon: 'vn:volume', icon: 'vn:volume',
}, },
component: () => import('src/pages/Order/OrderVolume.vue'), component: () => import('src/pages/Order/Card/OrderVolume.vue'),
}, },
{ {
name: 'OrderLines', name: 'OrderLines',
@ -90,7 +90,7 @@ export default {
title: 'lines', title: 'lines',
icon: 'vn:lines', icon: 'vn:lines',
}, },
component: () => import('src/pages/Order/OrderLines.vue'), component: () => import('src/pages/Order/Card/OrderLines.vue'),
}, },
], ],
}, },