0
0
Fork 0

Merge pull request '6820-changeKmroute' (!395) from 6820-changeKmroute into dev

Reviewed-on: verdnatura/salix-front#395
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Carlos Satorres 2024-05-22 13:56:18 +00:00
commit 1a4d8bb0c0
2 changed files with 20 additions and 13 deletions

View File

@ -28,7 +28,7 @@ const defaultInitialData = {
workerFk: null, workerFk: null,
isOk: false, isOk: false,
}; };
const maxDistance = ref();
const workerList = ref([]); const workerList = ref([]);
const agencyList = ref([]); const agencyList = ref([]);
const vehicleList = ref([]); const vehicleList = ref([]);
@ -81,12 +81,7 @@ const onSave = (data, response) => {
}; };
</script> </script>
<template> <template>
<VnSubToolbar /> <VnSubToolbar v-if="isNew" />
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#searchbar">
<RouteSearchbar />
</Teleport>
</template>
<FetchData <FetchData
url="Workers/search" url="Workers/search"
:filter="{ fields: ['id', 'nickname'] }" :filter="{ fields: ['id', 'nickname'] }"
@ -111,6 +106,12 @@ const onSave = (data, response) => {
@on-fetch="(data) => (vehicleList = data)" @on-fetch="(data) => (vehicleList = data)"
auto-load auto-load
/> />
<FetchData
url="RouteConfigs/findOne"
@on-fetch="({ kmMax }) => (maxDistance = kmMax)"
auto-load
sort-by="id ASC"
/>
<FormModel <FormModel
:url="isNew ? null : `Routes/${route.params?.id}`" :url="isNew ? null : `Routes/${route.params?.id}`"
:url-create="isNew ? 'Routes' : null" :url-create="isNew ? 'Routes' : null"
@ -174,7 +175,17 @@ const onSave = (data, response) => {
<template v-if="!isNew"> <template v-if="!isNew">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<VnInput v-model="data.kmStart" :label="t('Km Start')" clearable /> <VnInput v-model="data.kmStart" :label="t('Km Start')" clearable />
<VnInput v-model="data.kmEnd" :label="t('Km End')" clearable /> <QInput
v-model.number="data.kmEnd"
:label="t('Km End')"
:rules="[
(val) =>
val < maxDistance ||
t('Distance must be lesser than 4000'),
]"
clearable
type="number"
/>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<VnInputTime <VnInputTime
@ -221,4 +232,5 @@ es:
Description: Descripción Description: Descripción
Is served: Se ha servido Is served: Se ha servido
Created: Creado Created: Creado
Distance must be lesser than {maxDistance}: La distancia debe ser inferior a {maxDistance}
</i18n> </i18n>

View File

@ -222,11 +222,6 @@ const openSmsDialog = async () => {
</script> </script>
<template> <template>
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#searchbar">
<RouteSearchbar />
</Teleport>
</template>
<FetchData <FetchData
@on-fetch="(data) => (routeEntity = data)" @on-fetch="(data) => (routeEntity = data)"
auto-load auto-load