#4560 - gastos-reparto #421

Merged
jgallego merged 8 commits from 4560-gastos-reparto into dev 2024-06-10 08:16:58 +00:00
8 changed files with 64 additions and 48 deletions

View File

@ -34,7 +34,7 @@ const updateDefaultStop = (data) => {
const onSave = async () => { const onSave = async () => {
isLoading.value = true; isLoading.value = true;
try { try {
await axios.post('ExpeditionTrucks', { ...roadmapStopForm }); await axios.post('RoadmapStops', { ...roadmapStopForm });
emit('ok'); emit('ok');
} finally { } finally {
isLoading.value = false; isLoading.value = false;

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

@ -3,7 +3,6 @@ import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnInput from 'components/common/VnInput.vue'; import VnInput from 'components/common/VnInput.vue';
import VnInputTime from 'components/common/VnInputTime.vue'; import VnInputTime from 'components/common/VnInputTime.vue';
@ -22,7 +21,6 @@ const onSave = (data, response) => {
}; };
</script> </script>
<template> <template>
<VnSubToolbar />
<FetchData <FetchData
url="Suppliers" url="Suppliers"
auto-load auto-load

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

@ -1,7 +1,6 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import { ref } from 'vue'; import { ref } from 'vue';
import CrudModel from 'components/CrudModel.vue'; import CrudModel from 'components/CrudModel.vue';
@ -23,7 +22,6 @@ const updateDefaultStop = (data) => {
}; };
</script> </script>
<template> <template>
<VnSubToolbar />
<FetchData <FetchData
:url="`Roadmaps/${route.params?.id}`" :url="`Roadmaps/${route.params?.id}`"
auto-load auto-load
@ -33,9 +31,9 @@ const updateDefaultStop = (data) => {
<div class="q-pa-lg"> <div class="q-pa-lg">
<CrudModel <CrudModel
ref="roadmapStopsCrudRef" ref="roadmapStopsCrudRef"
data-key="ExpeditionTrucks" data-key="RoadmapStops"
url="ExpeditionTrucks" url="RoadmapStops"
model="ExpeditionTrucks" model="RoadmapStops"
:filter="{ where: { roadmapFk: route.params?.id } }" :filter="{ where: { roadmapFk: route.params?.id } }"
:default-remove="false" :default-remove="false"
:data-required="defaultStop" :data-required="defaultStop"
@ -86,7 +84,7 @@ const updateDefaultStop = (data) => {
</template> </template>
<i18n> <i18n>
es: es:
Warehouse: Almacén Address: Consignatario
ETA date: Fecha ETA ETA date: Fecha ETA
ETA hour: Hora ETA ETA hour: Hora ETA
Description: Descripción Description: Descripción

View File

@ -35,9 +35,9 @@ onUnmounted(hideRightDrawer);
const columns = ref([ const columns = ref([
{ {
name: 'warehouse', name: 'address',
label: t('Warehouse'), label: t('Address'),
field: (row) => dashIfEmpty(row?.warehouse?.name), field: (row) => dashIfEmpty(row?.address?.nickname),
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
@ -54,8 +54,17 @@ const filter = {
{ relation: 'supplier' }, { relation: 'supplier' },
{ relation: 'worker' }, { relation: 'worker' },
{ {
relation: 'expeditionTruck', relation: 'roadmapStop',
scope: { include: [{ relation: 'warehouse' }] }, scope: {
include: [
{
relation: 'address',
scope: {
fields: ['nickname'],
},
},
],
},
}, },
], ],
}; };
@ -151,11 +160,9 @@ const openAddStopDialog = () => {
</div> </div>
<QTable <QTable
:columns="columns" :columns="columns"
:rows="entity?.expeditionTruck" :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

View File

@ -2,12 +2,12 @@ import item from './modules/item';
import customer from './modules/customer'; import customer from './modules/customer';
import ticket from './modules/ticket'; import ticket from './modules/ticket';
import claim from './modules/claim'; import claim from './modules/claim';
import route from './modules/route';
import worker from './modules/worker'; import worker from './modules/worker';
import invoiceOut from './modules/invoiceOut'; import invoiceOut from './modules/invoiceOut';
import invoiceIn from './modules/invoiceIn'; import invoiceIn from './modules/invoiceIn';
import wagon from './modules/wagon'; import wagon from './modules/wagon';
import supplier from './modules/Supplier'; import supplier from './modules/Supplier';
import route from './modules/route';
import travel from './modules/travel'; import travel from './modules/travel';
import department from './modules/department'; import department from './modules/department';
import ItemType from './modules/itemType'; import ItemType from './modules/itemType';