0
0
Fork 0

fix: filter and correct list

This commit is contained in:
Pablo Natek 2024-08-06 14:17:17 +02:00
parent 28efe4aacf
commit 990fe65a63
3 changed files with 20 additions and 55 deletions

View File

@ -1,7 +1,5 @@
<script setup> <script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
import VnSelect from 'components/common/VnSelect.vue'; import VnSelect from 'components/common/VnSelect.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
@ -16,39 +14,9 @@ const props = defineProps({
}); });
const emit = defineEmits(['search']); const emit = defineEmits(['search']);
const workerList = ref([]);
const agencyList = ref([]);
const vehicleList = ref([]);
const warehouseList = ref([]);
</script> </script>
<template> <template>
<FetchData
url="Workers/search"
:filter="{ fields: ['id', 'nickname'] }"
sort-by="nickname ASC"
limit="30"
@on-fetch="(data) => (workerList = data)"
auto-load
/>
<FetchData
url="AgencyModes/isActive"
:filter="{ fields: ['id', 'name'] }"
sort-by="name ASC"
limit="30"
@on-fetch="(data) => (agencyList = data)"
auto-load
/>
<FetchData
url="Vehicles"
:filter="{ fields: ['id', 'numberPlate'] }"
sort-by="numberPlate ASC"
limit="30"
@on-fetch="(data) => (vehicleList = data)"
auto-load
/>
<FetchData url="Warehouses" @on-fetch="(data) => (warehouseList = data)" auto-load />
<VnFilterPanel <VnFilterPanel
:data-key="props.dataKey" :data-key="props.dataKey"
:search-button="true" :search-button="true"
@ -62,19 +30,17 @@ const warehouseList = ref([]);
</template> </template>
<template #body="{ params }"> <template #body="{ params }">
<QItem class="q-my-sm"> <QItem class="q-my-sm">
<QItemSection v-if="workerList"> <QItemSection>
<VnSelect <VnSelect
:label="t('Worker')" :label="t('Worker')"
v-model="params.workerFk" v-model="params.workerFk"
:options="workerList" url="Workers/search"
sort-by="nickname ASC"
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
dense dense
outlined outlined
rounded rounded
emit-value
map-options
use-input
:input-debounce="0" :input-debounce="0"
> >
<template #option="{ itemProps, opt }"> <template #option="{ itemProps, opt }">
@ -91,19 +57,17 @@ const warehouseList = ref([]);
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem class="q-my-sm"> <QItem class="q-my-sm">
<QItemSection v-if="agencyList"> <QItemSection>
<VnSelect <VnSelect
:label="t('Agency')" :label="t('Agency')"
v-model="params.agencyModeFk" v-model="params.agencyModeFk"
:options="agencyList" url="AgencyModes/isActive"
sort-by="name ASC"
option-value="id" option-value="id"
option-label="name" option-label="name"
dense dense
outlined outlined
rounded rounded
emit-value
map-options
use-input
:input-debounce="0" :input-debounce="0"
/> />
</QItemSection> </QItemSection>
@ -147,19 +111,17 @@ const warehouseList = ref([]);
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem class="q-my-sm"> <QItem class="q-my-sm">
<QItemSection v-if="vehicleList"> <QItemSection>
<VnSelect <VnSelect
:label="t('Vehicle')" :label="t('Vehicle')"
v-model="params.vehicleFk" v-model="params.vehicleFk"
:options="vehicleList" url="Vehicles"
sort-by="numberPlate ASC"
option-value="id" option-value="id"
option-label="numberPlate" option-label="numberPlate"
dense dense
outlined outlined
rounded rounded
emit-value
map-options
use-input
:input-debounce="0" :input-debounce="0"
/> />
</QItemSection> </QItemSection>
@ -170,19 +132,16 @@ const warehouseList = ref([]);
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem class="q-my-sm"> <QItem class="q-my-sm">
<QItemSection v-if="vehicleList"> <QItemSection>
<VnSelect <VnSelect
:label="t('Warehouse')" :label="t('Warehouse')"
v-model="params.warehouseFk" v-model="params.warehouseFk"
:options="warehouseList" url="Warehouses"
option-value="id" option-value="id"
option-label="name" option-label="name"
dense dense
outlined outlined
rounded rounded
emit-value
map-options
use-input
:input-debounce="0" :input-debounce="0"
/> />
</QItemSection> </QItemSection>

View File

@ -9,10 +9,9 @@ const { t } = useI18n();
data-key="RouteList" data-key="RouteList"
:label="t('Search route')" :label="t('Search route')"
:info="t('You can search by route reference')" :info="t('You can search by route reference')"
url="Routes/filter"
/> />
</template> </template>
<style scoped lang="scss"></style>
<i18n> <i18n>
es: es:
Search route: Buscar rutas Search route: Buscar rutas

View File

@ -11,6 +11,8 @@ import axios from 'axios';
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue'; import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
import RouteListTicketsDialog from 'pages/Route/Card/RouteListTicketsDialog.vue'; import RouteListTicketsDialog from 'pages/Route/Card/RouteListTicketsDialog.vue';
import RouteSummary from 'pages/Route/Card/RouteSummary.vue'; import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
@ -271,13 +273,18 @@ const openTicketsDialog = (id) => {
</QCard> </QCard>
</QDialog> </QDialog>
<VnSubToolbar /> <VnSubToolbar />
<RightMenu>
<template #right-panel>
<RouteFilter data-key="RouteList" />
</template>
</RightMenu>
<VnTable <VnTable
class="route-list" class="route-list"
ref="tableRef" ref="tableRef"
data-key="RouteList" data-key="RouteList"
url="Routes/filter" url="Routes/filter"
:columns="columns" :columns="columns"
:right-search="true" :right-search="false"
:is-editable="true" :is-editable="true"
:filter="routeFilter" :filter="routeFilter"
redirect="route" redirect="route"