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..4cbb850e1 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(); @@ -51,57 +51,55 @@ const rows = computed(() => arrayData.store.data || []); const tableColumnComponents = { id: { component: QBtn, - attrs: () => ({ flat: true, color: 'blue', class: 'col-content' }), + attrs: { flat: true, color: 'primary' }, }, cargoSupplierNickname: { component: QBtn, - attrs: () => ({ flat: true, color: 'blue', class: 'col-content' }), + attrs: { flat: true, color: 'primary', dense: true }, }, agencyModeName: { component: 'span', - attrs: () => ({ class: 'col-content' }), + attrs: {}, }, invoiceAmount: { component: 'span', - attrs: () => ({ - class: 'col-content', - }), + attrs: {}, }, ref: { component: QField, - attrs: () => ({ readonly: true, dense: true }), + attrs: { readonly: true, dense: true, class: 'cursor-pointer' }, }, stickers: { component: 'span', - attrs: () => ({ class: 'col-content' }), + attrs: {}, }, kg: { - component: 'span', - attrs: () => ({ class: 'col-content' }), + component: QField, + attrs: { readonly: true, dense: true, class: 'cursor-pointer' }, }, loadedKg: { component: 'span', - attrs: () => ({ class: 'col-content' }), + attrs: {}, }, volumeKg: { component: 'span', - attrs: () => ({ class: 'col-content' }), + attrs: {}, }, warehouseOutName: { component: 'span', - attrs: () => ({ class: 'col-content' }), + attrs: {}, }, shipped: { component: 'span', - attrs: () => ({ class: 'col-content' }), + attrs: {}, }, warehouseInName: { component: 'span', - attrs: () => ({ class: 'col-content' }), + attrs: {}, }, landed: { component: 'span', - attrs: () => ({ class: 'col-content' }), + attrs: {}, }, }; @@ -110,8 +108,9 @@ const columns = computed(() => [ label: 'id', field: 'id', name: 'id', - align: 'left', + align: 'center', showValue: true, + sortable: true, }, { label: t('supplier.pageTitles.supplier'), @@ -119,6 +118,7 @@ const columns = computed(() => [ name: 'cargoSupplierNickname', align: 'left', showValue: true, + sortable: true, }, { label: t('globals.agency'), @@ -126,6 +126,7 @@ const columns = computed(() => [ name: 'agencyModeName', align: 'left', showValue: true, + sortable: true, }, { label: t('globals.amount'), @@ -133,6 +134,7 @@ const columns = computed(() => [ field: 'entries', align: 'left', showValue: true, + sortable: true, format: (value) => toCurrency( value @@ -148,6 +150,7 @@ const columns = computed(() => [ name: 'ref', align: 'left', showValue: false, + sortable: true, }, { label: t('globals.packages'), @@ -155,13 +158,15 @@ const columns = computed(() => [ name: 'stickers', align: 'left', showValue: true, + sortable: true, }, { label: t('kg'), field: 'kg', name: 'kg', align: 'left', - showValue: true, + showValue: false, + sortable: true, }, { label: t('physicKg'), @@ -169,6 +174,7 @@ const columns = computed(() => [ name: 'loadedKg', align: 'left', showValue: true, + sortable: true, }, { label: 'KG Vol.', @@ -176,6 +182,7 @@ const columns = computed(() => [ name: 'volumeKg', align: 'left', showValue: true, + sortable: true, }, { label: t('globals.wareHouseOut'), @@ -183,14 +190,16 @@ const columns = computed(() => [ name: 'warehouseOutName', align: 'left', showValue: true, + sortable: true, }, { label: t('shipped'), field: 'shipped', name: 'shipped', align: 'left', - format: (value) => toDate(value.substring(0, 10)), showValue: true, + sortable: true, + format: (value) => toDate(value.substring(0, 10)), }, { label: t('globals.wareHouseIn'), @@ -198,14 +207,16 @@ const columns = computed(() => [ name: 'warehouseInName', align: 'left', showValue: true, + sortable: true, }, { label: t('landed'), field: 'landed', name: 'landed', align: 'left', - format: (value) => toDate(value.substring(0, 10)), showValue: true, + sortable: true, + format: (value) => toDate(value.substring(0, 10)), }, ]); @@ -223,9 +234,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) => { @@ -233,7 +248,7 @@ const navigateToTravelId = (id) => { }; const stopEventPropagation = (event, col) => { - if (!['ref', 'id', 'cargoSupplierNickname'].includes(col.name)) return; + if (!['ref', 'id', 'cargoSupplierNickname', 'kg'].includes(col.name)) return; event.preventDefault(); event.stopPropagation(); }; @@ -286,13 +301,13 @@ onMounted(async () => { hide-bottom row-key="clientId" :pagination="{ rowsPerPage: 0 }" - class="full-width q-mt-md" + class="full-width" > { > { v-for="entry in props.row.entries" :key="entry.id" :props="props" - class="secondary-row" + class="bg-vn-secondary-row" > - - {{ entry.id }} + + {{ entry.id }} - {{ - entry.supplierName - }} + + {{ entry.supplierName }} {{ - toCurrency(entry.invoiceAmount) - }}{{ toCurrency(entry.invoiceAmount) }} {{ entry.reference }}{{ entry.reference }} {{ entry.stickers }}{{ entry.stickers }} {{ entry.loadedkg }}{{ entry.loadedkg }} {{ entry.volumeKg }}{{ entry.volumeKg }} @@ -398,17 +408,6 @@ onMounted(async () => { - - en: searchExtraCommunity: Search for extra community shipping 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..792b393e4 100644 --- a/src/router/modules/travel.js +++ b/src/router/modules/travel.js @@ -34,7 +34,7 @@ export default { name: 'ExtraCommunity', meta: { title: 'extraCommunity', - icon: 'vn:shipment-01', + icon: 'vn:shipment', }, component: () => import('src/pages/Travel/ExtraCommunity.vue'), }, @@ -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;