0
0
Fork 0

feat: refs #560 refactor descriptor

This commit is contained in:
Javi Gallego 2024-06-04 10:52:00 +02:00
parent 5f00f3bad4
commit f1df969fa6
4 changed files with 53 additions and 33 deletions

View File

@ -23,28 +23,43 @@ const props = defineProps({
}); });
const { t } = useI18n(); const { t } = useI18n();
const warehouseList = ref([]); const addressList = ref([]);
const form = computed(() => props.formData); const form = computed(() => props.formData);
const isDialog = computed(() => props.layout === 'dialog'); const isDialog = computed(() => props.layout === 'dialog');
const onFetch = (data) => {
addressList.value = data.map((roadmap) => ({
id: roadmap.addressFk,
nickname: roadmap.address ? roadmap.address.nickname : '',
}));
};
</script> </script>
<template> <template>
<FetchData <FetchData
url="Warehouses" url="RoadmapAddresses"
auto-load auto-load
:filter="{ fields: ['id', 'name'] }" :filter="{
sort-by="name" include: [
{
relation: 'address',
scope: {
fields: ['nickname'],
},
},
],
}"
limit="30" limit="30"
@on-fetch="(data) => (warehouseList = data)" @on-fetch="onFetch"
/> />
<div :class="[isDialog ? 'column' : 'form-gap', 'full-width flex']"> <div :class="[isDialog ? 'column' : 'form-gap', 'full-width flex']">
<QCardSection class="flex-grow q-px-none flex-1"> <QCardSection class="flex-grow q-px-none flex-1">
<VnSelect <VnSelect
v-model.number="form.warehouseFk" v-model.number="form.addressFk"
class="full-width" class="full-width"
:label="t('Warehouse')" :label="t('Address')"
:options="warehouseList" :options="addressList"
option-value="id" option-value="id"
option-label="name" option-label="nickname"
emit-value emit-value
map-options map-options
use-input use-input
@ -80,6 +95,7 @@ const isDialog = computed(() => props.layout === 'dialog');
</QCardSection> </QCardSection>
</div> </div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.form-gap { .form-gap {
gap: 16px; gap: 16px;
@ -93,9 +109,10 @@ const isDialog = computed(() => props.layout === 'dialog');
flex: 2; flex: 2;
} }
</style> </style>
<i18n> <i18n>
es: es:
Warehouse: Almacén Address: Dirección
ETA date: Fecha ETA ETA date: Fecha ETA
ETA hour: Hora ETA ETA hour: Hora ETA
Description: Descripción Description: Descripción

View File

@ -1,21 +1,17 @@
<script setup> <script setup>
import { useStateStore } from 'stores/useStateStore'; import VnCard from 'components/common/VnCard.vue';
import LeftMenu from 'components/LeftMenu.vue'; import RoadmapDescriptor from 'pages/Route/Roadmap/RoadmapDescriptor.vue';
import RoadmapDescriptor from "pages/Route/Roadmap/RoadmapDescriptor.vue"; import RoadmapFilter from 'pages/Route/Roadmap/RoadmapFilter.vue';
const stateStore = useStateStore();
</script> </script>
<template> <template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256"> <VnCard
<QScrollArea class="fit"> data-key="Roadmap"
<RoadmapDescriptor /> base-url="Roadmaps"
<QSeparator /> :descriptor="RoadmapDescriptor"
<LeftMenu source="card" /> :filter-panel="RoadmapFilter"
</QScrollArea> search-data-key="RoadmapList"
</QDrawer> search-url="Roadmaps"
<QPageContainer> searchbar-label="Search roadmap"
<QPage> searchbar-info="You can search by roadmap id or customer name"
<RouterView></RouterView> />
</QPage>
</QPageContainer>
</template> </template>

View File

@ -55,7 +55,16 @@ const filter = {
{ relation: 'worker' }, { relation: 'worker' },
{ {
relation: 'roadmapStop', relation: 'roadmapStop',
scope: { include: [{ relation: 'address' }] }, scope: {
include: [
{
relation: 'address',
scope: {
fields: ['nickname'],
},
},
],
},
}, },
], ],
}; };
@ -154,8 +163,6 @@ const openAddStopDialog = () => {
:rows="entity?.roadmapStop" :rows="entity?.roadmapStop"
:rows-per-page-options="[0]" :rows-per-page-options="[0]"
row-key="id" row-key="id"
flat
hide-pagination
/> />
</QCard> </QCard>
</template> </template>
@ -171,7 +178,7 @@ es:
Worker: Trabajador Worker: Trabajador
Observations: Observaciones Observations: Observaciones
Stops: Paradas Stops: Paradas
Warehouse: Almacén Address: Dirección
Go to stops: Ir a paradas Go to stops: Ir a paradas
Add stop: Añadir parada Add stop: Añadir parada
</i18n> </i18n>

View File

@ -284,9 +284,9 @@ function navigateToRoadmapSummary(event, row) {
<i18n> <i18n>
es: es:
Search roadmaps: Buscar troncales Search roadmaps: Buscar troncales
You can search by roadmap reference: Puedes buscar por referencia de la troncal You can search by roadmap reference: Puedes buscar por referencia del troncal
Delete roadmap(s): Eliminar troncal(es) Delete roadmap(s): Eliminar troncal(es)
Selected roadmaps will be removed: Las troncales seleccionadas serán eliminadas Selected roadmaps will be removed: Los troncales seleccionadas serán eliminados
Are you sure you want to continue?: ¿Seguro que quieres continuar? Are you sure you want to continue?: ¿Seguro que quieres continuar?
The date can't be empty: La fecha no puede estar vacía The date can't be empty: La fecha no puede estar vacía
Clone Selected Routes: Clonar rutas seleccionadas Clone Selected Routes: Clonar rutas seleccionadas