#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 () => {
isLoading.value = true;
try {
await axios.post('ExpeditionTrucks', { ...roadmapStopForm });
await axios.post('RoadmapStops', { ...roadmapStopForm });
emit('ok');
} finally {
isLoading.value = false;

View File

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

View File

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

View File

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

View File

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

View File

@ -35,9 +35,9 @@ onUnmounted(hideRightDrawer);
const columns = ref([
{
name: 'warehouse',
label: t('Warehouse'),
field: (row) => dashIfEmpty(row?.warehouse?.name),
name: 'address',
label: t('Address'),
field: (row) => dashIfEmpty(row?.address?.nickname),
sortable: true,
align: 'left',
},
@ -54,8 +54,17 @@ const filter = {
{ relation: 'supplier' },
{ relation: 'worker' },
{
relation: 'expeditionTruck',
scope: { include: [{ relation: 'warehouse' }] },
relation: 'roadmapStop',
scope: {
include: [
{
relation: 'address',
scope: {
fields: ['nickname'],
},
},
],
},
},
],
};
@ -151,11 +160,9 @@ const openAddStopDialog = () => {
</div>
<QTable
:columns="columns"
:rows="entity?.expeditionTruck"
:rows="entity?.roadmapStop"
:rows-per-page-options="[0]"
row-key="id"
flat
hide-pagination
/>
</QCard>
</template>
@ -171,7 +178,7 @@ es:
Worker: Trabajador
Observations: Observaciones
Stops: Paradas
Warehouse: Almacén
Address: Dirección
Go to stops: Ir a paradas
Add stop: Añadir parada
</i18n>

View File

@ -284,9 +284,9 @@ function navigateToRoadmapSummary(event, row) {
<i18n>
es:
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)
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?
The date can't be empty: La fecha no puede estar vacía
Clone Selected Routes: Clonar rutas seleccionadas

View File

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