0
0
Fork 0

feat: refs #6891 add redirection on VnfilterPanel

This commit is contained in:
Jorge Penadés 2024-05-06 14:27:04 +02:00
parent b487ff4adc
commit 15b080f7bd
2 changed files with 32 additions and 19 deletions

View File

@ -8,6 +8,7 @@ import useCardSize from 'src/composables/useCardSize';
import VnSubToolbar from '../ui/VnSubToolbar.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import LeftMenu from 'components/LeftMenu.vue';
import RightMenu from 'components/common/RightMenu.vue';
const props = defineProps({
dataKey: { type: String, required: true },
@ -15,6 +16,7 @@ const props = defineProps({
customUrl: { type: String, default: undefined },
filter: { type: Object, default: () => {} },
descriptor: { type: Object, required: true },
filterPanel: { type: Object, default: undefined },
searchbarDataKey: { type: String, default: undefined },
searchbarUrl: { type: String, default: undefined },
searchbarLabel: { type: String, default: '' },
@ -49,10 +51,8 @@ if (props.baseUrl) {
}
</script>
<template>
<Teleport
to="#searchbar"
v-if="stateStore.isHeaderMounted() && props.searchbarDataKey"
>
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#searchbar" v-if="props.searchbarDataKey">
<VnSearchbar
:data-key="props.searchbarDataKey"
:url="props.searchbarUrl"
@ -67,6 +67,16 @@ if (props.baseUrl) {
<LeftMenu source="card" />
</QScrollArea>
</QDrawer>
<RightMenu>
<template #right-panel>
<component
v-if="props.filterPanel"
:is="props.filterPanel"
:data-key="props.searchbarDataKey"
/>
</template>
</RightMenu>
</template>
<QPageContainer>
<QPage>
<VnSubToolbar />

View File

@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
import { useArrayData } from 'composables/useArrayData';
import { useRoute } from 'vue-router';
import toDate from 'filters/toDate';
import useRedirect from 'src/composables/useRedirect';
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
const { t } = useI18n();
@ -56,6 +56,7 @@ const arrayData = useArrayData(props.dataKey, {
const route = useRoute();
const store = arrayData.store;
const userParams = ref({});
const { navigate } = useRedirect();
onMounted(() => {
if (props.params) userParams.value = JSON.parse(JSON.stringify(props.params));
@ -92,6 +93,7 @@ async function search() {
isLoading.value = false;
emit('search');
navigate(store.data, {});
}
async function reload() {
@ -102,6 +104,7 @@ async function reload() {
if (!props.showAll && !params.length) store.data = [];
isLoading.value = false;
emit('refresh');
navigate(store.data, {});
}
async function clearFilters() {