0
0
Fork 0

feat(orderList): use orderFilter and fixed this

This commit is contained in:
Alex Moreno 2024-08-09 13:07:37 +02:00
parent 5741cca878
commit ee71ae9d24
2 changed files with 94 additions and 152 deletions

View File

@ -21,15 +21,13 @@ const salesPersonFilter = {
fields: ['id', 'nickname'], fields: ['id', 'nickname'],
}; };
const salesPersonList = ref(null); const salesPersonList = ref(null);
const sourceFilter = { fields: ['value'] }; const sourceList = ref([]);
const sourceList = ref(null);
</script> </script>
<template> <template>
<FetchData <FetchData
url="AgencyModes/isActive" url="AgencyModes/isActive"
:filter="agencyFilter" :filter="agencyFilter"
limit="30"
sort-by="name ASC" sort-by="name ASC"
auto-load auto-load
@on-fetch="(data) => (agencyList = data)" @on-fetch="(data) => (agencyList = data)"
@ -37,7 +35,6 @@ const sourceList = ref(null);
<FetchData <FetchData
url="Workers/search" url="Workers/search"
:filter="salesPersonFilter" :filter="salesPersonFilter"
limit="30"
sort-by="nickname ASC" sort-by="nickname ASC"
@on-fetch="(data) => (salesPersonList = data)" @on-fetch="(data) => (salesPersonList = data)"
:params="{ departmentCodes: ['VT'] }" :params="{ departmentCodes: ['VT'] }"
@ -45,8 +42,7 @@ const sourceList = ref(null);
/> />
<FetchData <FetchData
url="Orders/getSourceValues" url="Orders/getSourceValues"
:filter="sourceFilter" :filter="{ fields: ['value'] }"
limit="30"
sort-by="value ASC" sort-by="value ASC"
@on-fetch="(data) => (sourceList = data)" @on-fetch="(data) => (sourceList = data)"
auto-load auto-load
@ -59,148 +55,88 @@ const sourceList = ref(null);
</div> </div>
</template> </template>
<template #body="{ params }"> <template #body="{ params }">
<QItem> <div class="q-px-md q-gutter-y-sm">
<QItemSection> <VnInput
<VnInput :label="t('customerId')"
is-outlined v-model="params.clientFk"
:label="t('customerId')" lazy-rules
v-model="params.clientFk" dense
lazy-rules outlined
> rounded
<template #prepend> />
<QIcon name="badge" size="sm"></QIcon> <VnSelect
</template> :label="t('agency')"
</VnInput> v-model="params.agencyModeFk"
</QItemSection> :options="agencyList"
</QItem> :input-debounce="0"
<QItem> dense
<QItemSection v-if="agencyList"> outlined
<VnSelect rounded
:label="t('agency')" />
v-model="params.agencyModeFk" <VnSelect
:options="agencyList" :label="t('salesPerson')"
option-value="id" v-model="params.workerFk"
option-label="name" url="Workers/search"
dense :filter="{ departmentCodes: ['VT'] }"
outlined sort-by="nickname ASC"
rounded option-label="nickname"
emit-value dense
map-options outlined
use-input rounded
:input-debounce="0" >
/> <template #option="{ itemProps, opt }">
</QItemSection> <QItem v-bind="itemProps">
<QItemSection v-else> <QItemSection>
<QSkeleton type="QInput" class="full-width" /> <QItemLabel>{{ opt.name }}</QItemLabel>
</QItemSection> <QItemLabel caption>
</QItem> {{ opt.nickname }},{{ opt.code }}
<QItem> </QItemLabel>
<QItemSection v-if="salesPersonList"> </QItemSection>
<VnSelect </QItem>
:label="t('salesPerson')" </template>
v-model="params.workerFk" </VnSelect>
:options="salesPersonList" <VnInputDate
option-value="id" v-model="params.from"
option-label="name" :label="t('fromLanded')"
dense dense
outlined outlined
rounded rounded
emit-value />
map-options <VnInputDate
use-input v-model="params.to"
:input-debounce="0" :label="t('toLanded')"
> dense
<template #option="{ itemProps, opt }"> outlined
<QItem v-bind="itemProps"> rounded
<QItemSection> />
<QItemLabel>{{ opt.name }}</QItemLabel> <VnInput
<QItemLabel caption> :label="t('orderId')"
{{ opt.nickname }},{{ opt.code }} v-model="params.orderFk"
</QItemLabel> lazy-rules
</QItemSection> is-outlined
</QItem> />
</template> <VnSelect
</VnSelect> :label="t('application')"
</QItemSection> v-model="params.sourceApp"
<QItemSection v-else> :options="sourceList"
<QSkeleton type="QInput" class="full-width" /> option-label="value"
</QItemSection> dense
</QItem> outlined
<QItem> rounded
<QItemSection> :input-debounce="0"
<VnInputDate />
v-model="params.from" <QCheckbox
:label="t('fromLanded')" v-model="params.myTeam"
dense :label="t('myTeam')"
outlined toggle-indeterminate
rounded />
/> <QCheckbox
</QItemSection> v-model="params.isConfirmed"
</QItem> :label="t('isConfirmed')"
<QItem> toggle-indeterminate
<QItemSection> />
<VnInputDate <QCheckbox v-model="params.showEmpty" :label="t('showEmpty')" />
v-model="params.to" </div>
:label="t('toLanded')"
dense
outlined
rounded
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
:label="t('orderId')"
v-model="params.orderFk"
lazy-rules
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection v-if="sourceList">
<VnSelect
:label="t('application')"
v-model="params.sourceApp"
:options="sourceList"
option-label="value"
emit-value
map-options
use-input
dense
outlined
rounded
:input-debounce="0"
/>
</QItemSection>
<QItemSection v-else>
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
v-model="params.myTeam"
:label="t('myTeam')"
toggle-indeterminate
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
v-model="params.isConfirmed"
:label="t('isConfirmed')"
toggle-indeterminate
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox v-model="params.showEmpty" :label="t('showEmpty')" />
</QItemSection>
</QItem>
</template> </template>
</VnFilterPanel> </VnFilterPanel>
</template> </template>

View File

@ -9,6 +9,8 @@ import VnTable from 'src/components/VnTable/VnTable.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import OrderSearchbar from './Card/OrderSearchbar.vue'; import OrderSearchbar from './Card/OrderSearchbar.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import OrderFilter from './Card/OrderFilter.vue';
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
@ -119,9 +121,6 @@ const columns = computed(() => [
align: 'left', align: 'left',
name: 'total', name: 'total',
label: t('module.total'), label: t('module.total'),
columnFilter: {
inWhere: true,
},
format: ({ total }) => toCurrency(total), format: ({ total }) => toCurrency(total),
cardVisible: true, cardVisible: true,
}, },
@ -147,10 +146,16 @@ async function fetchClientAddress(id, data) {
</script> </script>
<template> <template>
<OrderSearchbar /> <OrderSearchbar />
<RightMenu>
<template #right-panel>
<OrderFilter data-key="OrderList" />
</template>
</RightMenu>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="OrderList" data-key="OrderList"
url="Orders/filter" url="Orders/filter"
:order="['landed DESC', 'clientFk ASC', 'id DESC']"
:create="{ :create="{
urlCreate: 'Orders/new', urlCreate: 'Orders/new',
title: 'Create Order', title: 'Create Order',
@ -162,9 +167,10 @@ async function fetchClientAddress(id, data) {
addressId: null, addressId: null,
}, },
}" }"
:user-params="{ showEmpty: false }"
:right-search="false"
:columns="columns" :columns="columns"
redirect="order" redirect="order"
auto-load
> >
<template #more-create-dialog="{ data }"> <template #more-create-dialog="{ data }">
<VnSelect <VnSelect