diff --git a/src/components/CreateThermographForm.vue b/src/components/CreateThermographForm.vue new file mode 100644 index 000000000..d4511a0e7 --- /dev/null +++ b/src/components/CreateThermographForm.vue @@ -0,0 +1,114 @@ + + + + (thermographsModels = data)" + auto-load + url="Thermographs/getThermographModels" + /> + (warehousesOptions = data)" + auto-load + url="Warehouses" + :filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }" + /> + (temperaturesOptions = data)" + auto-load + url="Temperatures" + /> + + + + + + + + + + + + + + + + + + + + + + + + +es: + Identifier: Identificador + Model: Modelo + Warehouse: Almacén + Temperature: Temperatura + New thermograph: Nuevo termógrafo + diff --git a/src/components/EditPictureForm.vue b/src/components/EditPictureForm.vue index 44d44587f..9f69896b5 100644 --- a/src/components/EditPictureForm.vue +++ b/src/components/EditPictureForm.vue @@ -276,13 +276,9 @@ const makeRequest = async () => { {{ - t( - 'components.editPictureForm.allowedFilesText', - { - allowedContentTypes: - allowedContentTypes, - } - ) + t('globals.allowedFilesText', { + allowedContentTypes: allowedContentTypes, + }) }} diff --git a/src/components/common/VnInput.vue b/src/components/common/VnInput.vue index 76e91a5d8..8a01e0bee 100644 --- a/src/components/common/VnInput.vue +++ b/src/components/common/VnInput.vue @@ -1,5 +1,6 @@ + + (agenciesOptions = data)" + auto-load + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/pages/Travel/Card/TravelCard.vue b/src/pages/Travel/Card/TravelCard.vue index 34ecc25ee..1b185592b 100644 --- a/src/pages/Travel/Card/TravelCard.vue +++ b/src/pages/Travel/Card/TravelCard.vue @@ -17,7 +17,6 @@ const stateStore = useStateStore(); - diff --git a/src/pages/Travel/Card/TravelDescriptor.vue b/src/pages/Travel/Card/TravelDescriptor.vue index 6a45710ad..c7501b1d4 100644 --- a/src/pages/Travel/Card/TravelDescriptor.vue +++ b/src/pages/Travel/Card/TravelDescriptor.vue @@ -2,10 +2,13 @@ import { ref, computed } from 'vue'; import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; -import { toDate } from 'src/filters'; + import CardDescriptor from 'components/ui/CardDescriptor.vue'; import VnLv from 'src/components/ui/VnLv.vue'; +import TravelDescriptorMenuItems from './TravelDescriptorMenuItems.vue'; + import useCardDescription from 'src/composables/useCardDescription'; +import { toDate } from 'src/filters'; const $props = defineProps({ id: { @@ -28,6 +31,7 @@ const filter = { 'warehouseInFk', 'warehouseOutFk', 'cargoSupplierFk', + 'agencyModeFk', ], include: [ { @@ -66,6 +70,25 @@ const setData = (entity) => { @on-fetch="setData" data-key="travelData" > + + + + {{ t('Go to module index') }} + + + + + + @@ -73,8 +96,32 @@ const setData = (entity) => { + + + + {{ t('All travels with current agency') }} + + + - + +es: + Go to module index: Ir al índice del módulo + The travel will be deleted: El envío será eliminado + Do you want to delete this travel?: ¿Quieres eliminar este envío? + All travels with current agency: Todos los envíos con la agencia actual diff --git a/src/pages/Travel/Card/TravelDescriptorMenuItems.vue b/src/pages/Travel/Card/TravelDescriptorMenuItems.vue new file mode 100644 index 000000000..17b9333ca --- /dev/null +++ b/src/pages/Travel/Card/TravelDescriptorMenuItems.vue @@ -0,0 +1,108 @@ + + + + + {{ t('travel.summary.cloneShipping') }} + + + + {{ t('travel.summary.CloneTravelAndEntries') }} + + + + + {{ t('travel.summary.deleteTravel') }} + + + + + + {{ t('travel.summary.AddEntry') }} + + + + + + +es: + The travel will be deleted: El envío será eliminado + Do you want to delete this travel?: ¿Quieres eliminar este envío? + diff --git a/src/pages/Travel/Card/TravelLog.vue b/src/pages/Travel/Card/TravelLog.vue new file mode 100644 index 000000000..1a2667ff7 --- /dev/null +++ b/src/pages/Travel/Card/TravelLog.vue @@ -0,0 +1,6 @@ + + + + diff --git a/src/pages/Travel/Card/TravelSummary.vue b/src/pages/Travel/Card/TravelSummary.vue index 4f0e8860a..2ed6a0487 100644 --- a/src/pages/Travel/Card/TravelSummary.vue +++ b/src/pages/Travel/Card/TravelSummary.vue @@ -1,22 +1,19 @@ + (warehouses = data)" + auto-load + /> setTravelData(data)" > - + - + {{ t('travel.pageTitles.summary') }} + {{ travel.ref }} - {{ travel.id }} @@ -207,10 +255,8 @@ const openEntryDescriptor = () => {}; {{ t('components.cardDescriptor.moreOptions') }} - - - {{ option.name }} - + + @@ -225,11 +271,10 @@ const openEntryDescriptor = () => {}; /> - @@ -242,11 +287,10 @@ const openEntryDescriptor = () => {}; /> - @@ -255,13 +299,12 @@ const openEntryDescriptor = () => {}; - + - + {{ t('travel.summary.entries') }} - - + {}; row-key="id" class="full-width q-mt-md" > - - - - {{ props.value }} - {{ - props.col.toolTip - }} - + + + + {{ t(col.label) }} + + + + + + + + + + {{ value }} + + + + + + + + {{ value }} + + + + + + + + + {{ entriesTotalHb }} + {{ entriesTotalFreight }} + {{ entriesTotalPackageValue }} + {{ entriesTotalCc }} + {{ entriesTotalPallet }} + {{ entriesTotalM3 }} + + + + + {{ t('travel.summary.thermographs') }} + + + + - diff --git a/src/pages/Travel/Card/TravelThermographs.vue b/src/pages/Travel/Card/TravelThermographs.vue new file mode 100644 index 000000000..435d9054f --- /dev/null +++ b/src/pages/Travel/Card/TravelThermographs.vue @@ -0,0 +1,216 @@ + + + + (warehouses = data)" + auto-load + /> + + + + + + + {{ t('Download file') }} + + + + + + + {{ t('Edit file') }} + + + + + + + {{ t('Remove thermograph') }} + + + + + + + + + + {{ t('Add thermograph') }} + + + + + +es: + Add thermograph: Añadir termógrafo + Download file: Descargar fichero + Edit file: Editar fichero + Remove thermograph: Eliminar termógrafo + Thermograph removed: Termógrafo eliminado + Are you sure you want to remove the thermograph?: ¿Seguro que quieres quitar el termógrafo? + No results: Sin resultados + diff --git a/src/pages/Travel/Card/TravelThermographsForm.vue b/src/pages/Travel/Card/TravelThermographsForm.vue new file mode 100644 index 000000000..6758cb6ff --- /dev/null +++ b/src/pages/Travel/Card/TravelThermographsForm.vue @@ -0,0 +1,348 @@ + + + + (allowedContentTypes = data.join(', '))" + auto-load + /> + (thermographsOptions = data)" + :filter="thermographFilter" + auto-load + /> + (dmsTypesOptions = data)" + auto-load + /> + (companiesOptions = data)" + :filter="{ order: 'code' }" + auto-load + /> + (warehousesOptions = data)" + :filter="{ order: 'name' }" + auto-load + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ t('Select files') }} + + + {{ + t('globals.allowedFilesText', { + allowedContentTypes: allowedContentTypes, + }) + }} + + + + + + + + + + + +es: + Select files: Selecciona ficheros + Thermograph created: Termógrafo creado + New thermograph: Nuevo termógrafo + diff --git a/src/pages/Travel/ExtraCommunity.vue b/src/pages/Travel/ExtraCommunity.vue index 2dcd4bb51..f08cc64cb 100644 --- a/src/pages/Travel/ExtraCommunity.vue +++ b/src/pages/Travel/ExtraCommunity.vue @@ -16,8 +16,8 @@ import { toCurrency } from 'src/filters'; import { useArrayData } from 'composables/useArrayData'; import { toDate } from 'src/filters'; import { usePrintService } from 'composables/usePrintService'; -import travelService from 'src/services/travel.service'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; +import axios from 'axios'; const router = useRouter(); const stateStore = useStateStore(); @@ -223,9 +223,13 @@ const openReportPdf = () => { }; const saveFieldValue = async (val, field, index) => { - const id = rows.value[index].id; - const params = { [field]: val }; - await travelService.updateTravel(id, params); + try { + const id = rows.value[index].id; + const params = { [field]: val }; + await axios.patch(`Travels/${id}`, params); + } catch (err) { + console.error('Error updating travel'); + } }; const navigateToTravelId = (id) => { diff --git a/src/pages/Travel/TravelCreate.vue b/src/pages/Travel/TravelCreate.vue index c8ac7e690..abee03562 100644 --- a/src/pages/Travel/TravelCreate.vue +++ b/src/pages/Travel/TravelCreate.vue @@ -1,7 +1,7 @@ @@ -63,6 +64,7 @@ onBeforeMount(() => { model="travel" :form-initial-data="newTravelForm" :observe-form-changes="viewAction === 'create'" + @on-data-saved="redirectToTravelBasicData" > @@ -82,62 +84,13 @@ onBeforeMount(() => { - - - - - - - - - - - - - + /> - - - - - - - - - - - - - + diff --git a/src/pages/Travel/TravelFilter.vue b/src/pages/Travel/TravelFilter.vue index 62439a2e4..c1c0d1bee 100644 --- a/src/pages/Travel/TravelFilter.vue +++ b/src/pages/Travel/TravelFilter.vue @@ -6,8 +6,7 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnInput from 'src/components/common/VnInput.vue'; import FetchData from 'components/FetchData.vue'; - -import { toDate } from 'src/filters'; +import VnInputDate from 'components/common/VnInputDate.vue'; const { t } = useI18n(); const props = defineProps({ @@ -60,7 +59,7 @@ const decrement = (paramsObj, key) => { {{ formatFn(tag.value) }} - + { { { { - - - - - - - - - - - - - + is-outlined + /> - - - - - - - - - - - - - + v-model="params.landedTo" + is-outlined + /> @@ -216,6 +170,7 @@ const decrement = (paramsObj, key) => { { - - en: params: diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue index 85caf85f1..edcfbac52 100644 --- a/src/pages/Travel/TravelList.vue +++ b/src/pages/Travel/TravelList.vue @@ -1,5 +1,5 @@ + (warehouses = data)" + auto-load + /> @@ -66,22 +93,43 @@ onMounted(async () => { :value="row.agencyModeName" /> - - + + + + {{ toDate(row.shipped) }} + + {{ toDate(row.shipped) }} + + + + + + {{ toDate(row.landed) }} + + {{ toDate(row.landed) }} + + - { en: addEntry: Add entry - es: addEntry: Añadir entrada - - diff --git a/src/router/modules/travel.js b/src/router/modules/travel.js index 43c444ae2..a9670525f 100644 --- a/src/router/modules/travel.js +++ b/src/router/modules/travel.js @@ -43,7 +43,6 @@ export default { name: 'TravelCreate', meta: { title: 'travelCreate', - icon: '', }, component: () => import('src/pages/Travel/TravelCreate.vue'), }, @@ -69,9 +68,8 @@ export default { meta: { title: 'basicData', icon: 'vn:settings', - // roles: [], }, - // component: () => import(), + component: () => import('src/pages/Travel/Card/TravelBasicData.vue'), }, { name: 'TravelHistory', @@ -79,19 +77,45 @@ export default { meta: { title: 'history', icon: 'history', - // roles: [], }, - // component: () => import(), + component: () => import('src/pages/Travel/Card/TravelLog.vue'), }, { name: 'TravelThermographs', - path: 'thermographs', + path: 'thermographs/:thermographId?', meta: { title: 'thermographs', icon: 'vn:thermometer', - // roles: [], }, - // component: () => import(), + redirect: { + name: 'TravelThermographsIndex', + }, + children: [ + { + name: 'TravelThermographsIndex', + path: 'index', + component: () => + import('src/pages/Travel/Card/TravelThermographs.vue'), + }, + { + name: 'TravelThermographsCreate', + path: 'create', + props: { viewAction: 'create' }, + component: () => + import( + 'src/pages/Travel/Card/TravelThermographsForm.vue' + ), + }, + { + name: 'TravelThermographsEdit', + path: 'edit', + props: { viewAction: 'edit' }, + component: () => + import( + 'src/pages/Travel/Card/TravelThermographsForm.vue' + ), + }, + ], }, ], }, diff --git a/src/services/travel.service.js b/src/services/travel.service.js deleted file mode 100644 index 469b8b237..000000000 --- a/src/services/travel.service.js +++ /dev/null @@ -1,23 +0,0 @@ -import axios from 'axios'; - -const travelService = { - getTravelEntries: async (param) => { - try { - return await axios.get(`Travels/${param}/getEntries`); - } catch (err) { - console.error(`Error fetching travel entries`, err); - return err.response; - } - }, - - updateTravel: async (id, params) => { - try { - return await axios.patch(`Travels/${id}`, params); - } catch (err) { - console.error(`Error updating travel`, err); - return err.response; - } - }, -}; - -export default travelService;