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

View File

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