diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index a5560dfc0..4ad566bf8 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -128,13 +128,14 @@ async function save() { try { const body = $props.mapper ? $props.mapper(formData.value) : formData.value; + let response if ($props.urlCreate) { - await axios.post($props.urlCreate, body); + response = await axios.post($props.urlCreate, body); notify('globals.dataCreated', 'positive'); } else { - await axios.patch($props.urlUpdate || $props.url, body); + response = await axios.patch($props.urlUpdate || $props.url, body); } - emit('onDataSaved', formData.value); + emit('onDataSaved', formData.value, response); originalData.value = JSON.parse(JSON.stringify(formData.value)); hasChanges.value = false; } catch (err) { diff --git a/src/components/common/VnInputTime.vue b/src/components/common/VnInputTime.vue new file mode 100644 index 000000000..b705d91f6 --- /dev/null +++ b/src/components/common/VnInputTime.vue @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + +es: + Cancel: Cancelar + diff --git a/src/filters/index.js b/src/filters/index.js index f0120e663..478cb0ac8 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -8,11 +8,13 @@ import toPercentage from './toPercentage'; import toLowerCamel from './toLowerCamel'; import dashIfEmpty from './dashIfEmpty'; import dateRange from './dateRange'; +import toHour from './toHour'; export { toLowerCase, toLowerCamel, toDate, + toHour, toDateString, toDateHour, toRelativeDate, diff --git a/src/filters/isValidDate.js b/src/filters/isValidDate.js new file mode 100644 index 000000000..8365564b8 --- /dev/null +++ b/src/filters/isValidDate.js @@ -0,0 +1,3 @@ +export default function isValidDate(date) { + return !isNaN(new Date(date).getTime()); +} diff --git a/src/filters/toHour.js b/src/filters/toHour.js new file mode 100644 index 000000000..f24f81949 --- /dev/null +++ b/src/filters/toHour.js @@ -0,0 +1,16 @@ +import isValidDate from 'filters/isValidDate'; + +export default function toHour(date) { + if (!isValidDate(date)) { + return '--:--'; + } + const dateHour = new Date(date); + let hours = dateHour.getUTCHours(); + hours = hours % 12; + hours = hours ? hours : 12; + + let minutes = dateHour.getUTCMinutes(); + minutes = minutes < 10 ? minutes.toString().padStart(2, '0') : minutes; + + return `${hours}:${minutes} ${dateHour.getUTCHours() >= 12 ? 'PM' : 'AM'}`; +} diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index cf051d564..742134ecd 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -883,6 +883,10 @@ export default { pageTitles: { routes: 'Routes', cmrsList: 'External CMRs list', + RouteList: 'List', + create: 'Create', + basicData: 'Basic Data', + summary: 'Summary' }, cmr: { list: { diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index c8e5cd2f9..ed6633bd9 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -883,6 +883,10 @@ export default { pageTitles: { routes: 'Rutas', cmrsList: 'Listado de CMRs externos', + RouteList: 'Listado', + create: 'Crear', + basicData: 'Datos básicos', + summary: 'Summary', }, cmr: { list: { diff --git a/src/pages/Route/Card/RouteCard.vue b/src/pages/Route/Card/RouteCard.vue new file mode 100644 index 000000000..46b997b65 --- /dev/null +++ b/src/pages/Route/Card/RouteCard.vue @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + diff --git a/src/pages/Route/Card/RouteDescriptor.vue b/src/pages/Route/Card/RouteDescriptor.vue new file mode 100644 index 000000000..218764277 --- /dev/null +++ b/src/pages/Route/Card/RouteDescriptor.vue @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + +es: + Date: Fecha + Agency: Agencia + Zone: Zona + Volume: Volumen + Description: Descripción + diff --git a/src/pages/Route/Card/RouteDescriptorMenu.vue b/src/pages/Route/Card/RouteDescriptorMenu.vue new file mode 100644 index 000000000..b661d1cd7 --- /dev/null +++ b/src/pages/Route/Card/RouteDescriptorMenu.vue @@ -0,0 +1,63 @@ + + + + + + + {{ t('deleteRoute') }} + + + + +en: + confirmDeletion: Confirm deletion + confirmDeletionMessage: Are you sure you want to delete this route? + deleteRoute: Delete route +es: + confirmDeletion: Confirmar eliminación, + confirmDeletionMessage: Seguro que quieres eliminar esta ruta? + deleteRoute: Eliminar ruta + diff --git a/src/pages/Route/Card/RouteDescriptorProxy.vue b/src/pages/Route/Card/RouteDescriptorProxy.vue new file mode 100644 index 000000000..541f9716a --- /dev/null +++ b/src/pages/Route/Card/RouteDescriptorProxy.vue @@ -0,0 +1,15 @@ + + + + + + diff --git a/src/pages/Route/Card/RouteFilter.vue b/src/pages/Route/Card/RouteFilter.vue new file mode 100644 index 000000000..45580d913 --- /dev/null +++ b/src/pages/Route/Card/RouteFilter.vue @@ -0,0 +1,234 @@ + + + + (workerList = data)" + auto-load + /> + (agencyList = data)" + auto-load + /> + (vehicleList = data)" + auto-load + /> + (warehouseList = data)" auto-load /> + + + + {{ t(`params.${tag.label}`) }}: + {{ formatFn(tag.value) }} + + + + + + + + + + + {{ opt.name }} + + {{ opt.nickname }},{{ opt.code }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +en: + params: + warehouseFk: Warehouse + description: Description + m3: m³ + vehicleFk: Vehicle + agencyModeFk: Agency + workerFk: Worker + from: From + to: To +es: + params: + warehouseFk: Almacén + description: Descripción + m3: m³ + vehicleFk: Vehículo + agencyModeFk: Agencia + workerFk: Trabajador + from: Desde + to: Hasta + Warehouse: Almacén + Description: Descripción + Vehicle: Vehículo + Agency: Agencia + Worker: Trabajador + From: Desde + To: Hasta + diff --git a/src/pages/Route/Card/RouteForm.vue b/src/pages/Route/Card/RouteForm.vue new file mode 100644 index 000000000..49a067c00 --- /dev/null +++ b/src/pages/Route/Card/RouteForm.vue @@ -0,0 +1,214 @@ + + + + (workerList = data)" + auto-load + /> + (agencyList = data)" + auto-load + /> + (vehicleList = data)" + auto-load + /> + + + + + + + + + {{ opt.name }} + + {{ opt.nickname }},{{ opt.code }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/pages/Route/Card/RouteSearchbar.vue b/src/pages/Route/Card/RouteSearchbar.vue new file mode 100644 index 000000000..9ee4a602f --- /dev/null +++ b/src/pages/Route/Card/RouteSearchbar.vue @@ -0,0 +1,20 @@ + + + + + + + + +es: + Search route: Buscar rutas + You can search by route reference: Puedes buscar por referencia de la ruta + diff --git a/src/pages/Route/Card/RouteSummary.vue b/src/pages/Route/Card/RouteSummary.vue new file mode 100644 index 000000000..a10ca088e --- /dev/null +++ b/src/pages/Route/Card/RouteSummary.vue @@ -0,0 +1,314 @@ + + + + + + + + + + + + {{ `${entity?.route.id} - ${entity?.route?.description}` }} + + + + + + + + + + + {{ dashIfEmpty(entity?.route?.worker?.user?.name) }} + + + + + + + + + + + + + + + + + {{ t('route.summary.description') }} + + + {{ dashIfEmpty(entity?.route?.description) }} + + + + + + {{ t('route.summary.tickets') }} + + + + + + {{ value }} + + + + + + + {{ value }} + + + + + + + + {{ value }} + + + + + + + + {{ value }} + + + + + + + + + + +en: + route: + summary: + date: Date + agency: Agency + vehicle: Vehicle + driver: Driver + cost: Cost + started: Started time + finished: Finished time + kmStart: Km start + kmEnd: Km end + volume: Volume + packages: Packages + description: Description + tickets: Tickets + order: Order + street: Street + city: City + pc: PC + client: Client + warehouse: Warehouse + m3: m³ + packaging: Packaging + ticket: Ticket +es: + route: + summary: + date: Fecha + agency: Agencia + vehicle: Vehículo + driver: Conductor + cost: Costo + started: Hora inicio + finished: Hora fin + kmStart: Km inicio + kmEnd: Km fin + volume: Volumen + packages: Bultos + description: Descripción + tickets: Tickets + order: Orden + street: Dirección fiscal + city: Población + pc: CP + client: Cliente + warehouse: Almacén + packaging: Encajado + diff --git a/src/pages/Route/Card/RouteSummaryDialog.vue b/src/pages/Route/Card/RouteSummaryDialog.vue new file mode 100644 index 000000000..4a943a93a --- /dev/null +++ b/src/pages/Route/Card/RouteSummaryDialog.vue @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/src/pages/Route/RouteList.vue b/src/pages/Route/RouteList.vue new file mode 100644 index 000000000..591f723e9 --- /dev/null +++ b/src/pages/Route/RouteList.vue @@ -0,0 +1,530 @@ + + + + + + + + + + + + {{ t('globals.collapseMenu') }} + + + + + + + + + {{ t('Select the starting date') }} + + + + + + + + + + {{ t('Clone') }} + + + + + + + + + + (workers = data)" + auto-load + /> + (agencyList = data)" auto-load /> + (vehicleList = data)" auto-load /> + + + + + {{ t('Clone Selected Routes') }} + + + + {{ t('Mark as served') }} + + + + + + + + + + + {{ props.row?.workerUserName }} + updateWorker(props.row, worker) + " + > + $event.target.select()" + > + + + + {{ opt.name }} + {{ + opt.nickname + }} + + + + + + + + + + {{ props.row?.agencyName }} + updateAgency(props.row, agency) + " + > + $event.target.select()" + /> + + + + + + {{ props.row?.vehiclePlateNumber }} + updateVehicle(props.row, vehicle) + " + > + $event.target.select()" + /> + + + + + + {{ toDate(props.row?.created) }} + + $event.target.select()" + /> + + + + + + {{ props.row?.description }} + + $event.target.select()" + /> + + + + + + {{ toHour(props.row.started) }} + + $event.target.select()" + /> + + + + + + {{ toHour(props.row.finished) }} + + $event.target.select()" + /> + + + + + + + + {{ t('Add ticket') }} + + + {{ t('Preview') }} + + + + + + + + + + + + + + {{ t('newRoute') }} + + + + + + + + +en: + newRoute: New Route +es: + ID: ID + Worker: Trabajador + Agency: Agencia + Vehicle: Vehículo + Date: Fecha + Description: Descripción + Hour started: Hora inicio + Hour finished: Hora fin + newRoute: Nueva Ruta + Clone Selected Routes: Clonar rutas seleccionadas + Select the starting date: Seleccione la fecha de inicio + Stating date: Fecha de inicio + Cancel: Cancelar + Clone: Clonar + Mark as served: Marcar como servidas + diff --git a/src/router/modules/route.js b/src/router/modules/route.js index acda898de..614345913 100644 --- a/src/router/modules/route.js +++ b/src/router/modules/route.js @@ -10,15 +10,15 @@ export default { component: RouterView, redirect: { name: 'RouteMain' }, menus: { - main: ['CmrList'], - card: [], + main: ['RouteList', 'CmrList'], + card: ['RouteBasicData'], }, children: [ { path: '/route', name: 'RouteMain', component: () => import('src/pages/Route/RouteMain.vue'), - redirect: { name: 'CmrList' }, + redirect: { name: 'RouteList' }, children: [ { path: 'cmr', @@ -29,6 +29,49 @@ export default { }, component: () => import('src/pages/Route/Cmr/CmrList.vue'), }, + { + path: 'list', + name: 'RouteList', + meta: { + title: 'RouteList', + icon: 'view_list', + }, + component: () => import('src/pages/Route/RouteList.vue'), + }, + { + path: 'create', + name: 'RouteCreate', + meta: { + title: 'create', + }, + component: () => import('src/pages/Route/Card/RouteForm.vue'), + }, + ], + }, + { + name: 'RouteCard', + path: ':id', + component: () => import('src/pages/Route/Card/RouteCard.vue'), + redirect: { name: 'RouteSummary' }, + children: [ + { + name: 'RouteBasicData', + path: 'basic-data', + meta: { + title: 'basicData', + icon: 'vn:settings', + }, + component: () => import('pages/Route/Card/RouteForm.vue'), + }, + { + name: 'RouteSummary', + path: 'summary', + meta: { + title: 'summary', + icon: 'open_in_new', + }, + component: () => import('pages/Route/Card/RouteSummary.vue'), + }, ], }, ],
+ {{ dashIfEmpty(entity?.route?.description) }} +
{{ t('Select the starting date') }}