feat(customerList): add searchbar
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Alex Moreno 2024-06-19 15:02:26 +02:00
parent 188bc3ff4f
commit 02f8288b22
3 changed files with 16 additions and 5 deletions

View File

@ -1,5 +1,5 @@
<script setup>
import { computed } from 'vue';
import { onBeforeMount, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData';
import { useStateStore } from 'stores/useStateStore';
@ -32,10 +32,15 @@ const url = computed(() => {
return props.customUrl;
});
useArrayData(props.dataKey, {
const arrayData = useArrayData(props.dataKey, {
url: url.value,
filter: props.filter,
});
onBeforeMount(async () => {
if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id };
await arrayData.fetch({ append: false });
});
</script>
<template>
<QDrawer

View File

@ -5,12 +5,12 @@ import CustomerFilter from '../CustomerFilter.vue';
</script>
<template>
<VnCard
data-key="Client"
data-key="Customer"
base-url="Clients"
:descriptor="CustomerDescriptor"
:filter-panel="CustomerFilter"
search-data-key="CustomerList"
search-url="Clients/filter"
search-url="Clients/extendedListFilter"
searchbar-label="Search customer"
searchbar-info="You can search by customer id or name"
/>

View File

@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import VnTable from 'components/VnTable/VnTable.vue';
import VnLocation from 'src/components/common/VnLocation.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import CustomerSummary from './Card/CustomerSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
@ -382,9 +383,14 @@ function handleLocation(data, location) {
</script>
<template>
<VnSearchbar
:info="t('You can search by customer id or name')"
:label="t('Search customer')"
data-key="Customer"
/>
<VnTable
ref="tableRef"
data-key="CustomerExtendedList"
data-key="Customer"
url="Clients/extendedListFilter"
:create="{
urlCreate: 'Clients/createWithUser',