From 8a47fa0d0b2fb18753c07cd958f2158c93e1a76e Mon Sep 17 00:00:00 2001 From: carlosfonseca Date: Thu, 23 Nov 2023 12:28:51 -0500 Subject: [PATCH 1/7] =?UTF-8?q?Se=20hace=20correcci=C3=B3n=20en=20el=20des?= =?UTF-8?q?plegable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ui/CardDescriptor.vue | 27 +++++++-------------- src/components/ui/CardList2.vue | 32 +++++++++++++++---------- src/pages/InvoiceOut/InvoiceOutList.vue | 31 ++++++++++++++---------- 3 files changed, 48 insertions(+), 42 deletions(-) diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue index a000bd1e4..86c524095 100644 --- a/src/components/ui/CardDescriptor.vue +++ b/src/components/ui/CardDescriptor.vue @@ -83,6 +83,7 @@ const options = [ + - - - - {{ option }} - - - + + {{ t('components.cardDescriptor.summary') }} + - + {{ t('components.cardDescriptor.moreOptions') }} - - + + + {{ option }} + diff --git a/src/components/ui/CardList2.vue b/src/components/ui/CardList2.vue index fd70a6854..f93a311c4 100644 --- a/src/components/ui/CardList2.vue +++ b/src/components/ui/CardList2.vue @@ -1,21 +1,35 @@ - + +import { useI18n } from 'vue-i18n'; +import { useStateStore } from 'stores/useStateStore'; +import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; + +const stateStore = useStateStore(); +const { t } = useI18n(); + + + + + + + + + diff --git a/src/pages/Travel/Card/TravelSummary.vue b/src/pages/Travel/Card/TravelSummary.vue new file mode 100644 index 000000000..c476b6bc0 --- /dev/null +++ b/src/pages/Travel/Card/TravelSummary.vue @@ -0,0 +1,264 @@ + + + + diff --git a/src/pages/Travel/Card/TravelSummaryDialog.vue b/src/pages/Travel/Card/TravelSummaryDialog.vue new file mode 100644 index 000000000..8351d6e5b --- /dev/null +++ b/src/pages/Travel/Card/TravelSummaryDialog.vue @@ -0,0 +1,29 @@ + + + + + diff --git a/src/pages/Travel/TravelCreate.vue b/src/pages/Travel/TravelCreate.vue new file mode 100644 index 000000000..fa8520f95 --- /dev/null +++ b/src/pages/Travel/TravelCreate.vue @@ -0,0 +1,157 @@ + + + + + + + + + diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue new file mode 100644 index 000000000..716c7632f --- /dev/null +++ b/src/pages/Travel/TravelList.vue @@ -0,0 +1,132 @@ + + + + + + + + { + "en": { + Search suppliers: Search suppliers + }, + "es": { + Search suppliers: Buscar proveedores + } + } + diff --git a/src/pages/Travel/TravelMain.vue b/src/pages/Travel/TravelMain.vue new file mode 100644 index 000000000..66ce78f23 --- /dev/null +++ b/src/pages/Travel/TravelMain.vue @@ -0,0 +1,17 @@ + + + diff --git a/src/router/modules/index.js b/src/router/modules/index.js index 2456e57aa..d6141fb81 100644 --- a/src/router/modules/index.js +++ b/src/router/modules/index.js @@ -6,5 +6,16 @@ import Worker from './worker'; import Wagon from './wagon'; import Route from './route'; import Supplier from './Supplier'; +import Travel from './travel'; -export default [Customer, Ticket, Claim, InvoiceOut, Worker, Wagon, Route, Supplier]; +export default [ + Customer, + Ticket, + Claim, + InvoiceOut, + Worker, + Wagon, + Route, + Supplier, + Travel, +]; diff --git a/src/router/modules/invoiceOut.js b/src/router/modules/invoiceOut.js index ec30e4fc0..084cf6ac3 100644 --- a/src/router/modules/invoiceOut.js +++ b/src/router/modules/invoiceOut.js @@ -34,7 +34,7 @@ export default { name: 'InvoiceOutGlobal', meta: { title: 'globalInvoicing', - icon: 'view_list', + icon: 'contact_support', }, component: () => import('src/pages/InvoiceOut/InvoiceOutGlobal.vue'), }, diff --git a/src/router/modules/travel.js b/src/router/modules/travel.js new file mode 100644 index 000000000..9ba10380e --- /dev/null +++ b/src/router/modules/travel.js @@ -0,0 +1,59 @@ +import { RouterView } from 'vue-router'; + +export default { + path: '/travel', + name: 'Travel', + meta: { + title: 'travel', + icon: 'vn:package', + }, + component: RouterView, + redirect: { name: 'TravelMain' }, + menus: { + main: ['TravelList'], + card: [], + }, + children: [ + { + path: '', + name: 'TravelMain', + component: () => import('src/pages/Travel/TravelMain.vue'), + redirect: { name: 'TravelList' }, + children: [ + { + path: 'list', + name: 'TravelList', + meta: { + title: 'list', + icon: 'view_list', + }, + component: () => import('src/pages/Travel/TravelList.vue'), + }, + { + path: 'create', + name: 'TravelCreate', + meta: { + title: 'create', + }, + component: () => import('src/pages/Travel/TravelCreate.vue'), + }, + ], + }, + { + name: 'TravelCard', + path: ':id', + component: () => import('src/pages/Travel/Card/TravelCard.vue'), + redirect: { name: 'TravelSummary' }, + children: [ + { + name: 'TravelSummary', + path: 'summary', + meta: { + title: 'summary', + }, + component: () => import('src/pages/Travel/Card/TravelSummary.vue'), + }, + ], + }, + ], +}; diff --git a/src/router/routes.js b/src/router/routes.js index faf340e0c..dc4b51ec2 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -6,6 +6,7 @@ import invoiceOut from './modules/invoiceOut'; import wagon from './modules/wagon'; import supplier from './modules/Supplier'; import route from './modules/route'; +import travel from './modules/travel'; const routes = [ { @@ -53,6 +54,7 @@ const routes = [ wagon, route, supplier, + travel, { path: '/:catchAll(.*)*', name: 'NotFound', diff --git a/src/services/InvoiceOut.service.js b/src/services/invoiceOut.service.js similarity index 100% rename from src/services/InvoiceOut.service.js rename to src/services/invoiceOut.service.js diff --git a/src/services/Suppliers.service.js b/src/services/suppliers.service.js similarity index 100% rename from src/services/Suppliers.service.js rename to src/services/suppliers.service.js diff --git a/src/services/travel.service.js b/src/services/travel.service.js new file mode 100644 index 000000000..606e2eb48 --- /dev/null +++ b/src/services/travel.service.js @@ -0,0 +1,32 @@ +import axios from 'axios'; + +const travelService = { + getTravels: async (filter = {}) => { + try { + return await axios.get('Travels/filter', filter); + } catch (err) { + console.error(`Error fetching travels`, err); + return err.response; + } + }, + + createTravel: async (params) => { + try { + return await axios.patch('Travels', params); + } catch (err) { + console.error(`Error creating travel`, err); + return err.response; + } + }, + + getTravelEntries: async (param) => { + try { + return await axios.get(`Travels/${param}/getEntries`); + } catch (err) { + console.error(`Error fetching travel entries`, err); + return err.response; + } + }, +}; + +export default travelService; diff --git a/src/stores/invoiceOutGlobal.js b/src/stores/invoiceOutGlobal.js index 7223f7655..128d5a397 100644 --- a/src/stores/invoiceOutGlobal.js +++ b/src/stores/invoiceOutGlobal.js @@ -1,6 +1,6 @@ import { defineStore } from 'pinia'; import { useUserConfig } from 'src/composables/useUserConfig'; -import invoiceOutService from 'src/services/InvoiceOut.service.js'; +import invoiceOutService from 'src/services/invoiceOut.service'; import useNotify from 'src/composables/useNotify.js'; const { notify } = useNotify(); diff --git a/src/stores/travel.js b/src/stores/travel.js new file mode 100644 index 000000000..799c773e8 --- /dev/null +++ b/src/stores/travel.js @@ -0,0 +1,36 @@ +import { defineStore } from 'pinia'; +import travelService from 'src/services/travel.service'; + +export const useTravelStore = defineStore({ + id: 'travel', + + state: () => ({ + initialDataLoading: true, + travels: [], + }), + actions: { + async init() { + await this.fetchAllData(); + }, + + async fetchAllData() { + const { data } = await travelService.getTravels(); + this.travels = data || []; + }, + + async createTravel(travelData) { + const params = { + ref: travelData.ref, + agencyModeFk: travelData.agencyModeFk.value, + warehouseOutFk: travelData.warehouseOutFk.value, + warehouseInFk: travelData.warehouseInFk.value, + landed: new Date(travelData.landed), + shipped: new Date(travelData.shipped), + }; + + return await travelService.createTravel(params); + }, + }, + + getters: {}, +}); diff --git a/src/stores/useNavigationStore.js b/src/stores/useNavigationStore.js index ea4e175ab..9933924e0 100644 --- a/src/stores/useNavigationStore.js +++ b/src/stores/useNavigationStore.js @@ -15,6 +15,7 @@ export const useNavigationStore = defineStore('navigationStore', () => { 'wagon', 'route', 'supplier', + 'travel', ]; const pinnedModules = ref([]); const role = useRole(); From e291a69846448dc39fa3cfbd70f1bd4fa75529c0 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Sat, 25 Nov 2023 19:42:24 -0300 Subject: [PATCH 3/7] Add travel clone feature --- src/pages/Travel/TravelCreate.vue | 30 ++++++++++++++++++++------- src/pages/Travel/TravelList.vue | 34 ++++++++++++++++++------------- 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/src/pages/Travel/TravelCreate.vue b/src/pages/Travel/TravelCreate.vue index fa8520f95..b0ea45917 100644 --- a/src/pages/Travel/TravelCreate.vue +++ b/src/pages/Travel/TravelCreate.vue @@ -3,10 +3,12 @@ import { useI18n } from 'vue-i18n'; import { reactive, computed } from 'vue'; import FetchData from 'components/FetchData.vue'; import { useTravelStore } from 'src/stores/travel'; -import { useRouter } from 'vue-router'; +import { useRouter, useRoute } from 'vue-router'; import { inputSelectFilter } from 'src/composables/inputSelectFilterFn.js'; +import { onBeforeMount } from 'vue'; const { t } = useI18n(); +const route = useRoute(); const router = useRouter(); const travelStore = useTravelStore(); @@ -29,6 +31,15 @@ const warehousesOptions = reactive({ filtered: [], }); +onBeforeMount(() => { + if (route.query.travelData) { + const travelData = JSON.parse(route.query.travelData); + for (let key in travelData) { + newTravelData[key] = travelData[key]; + } + } +}); + const createTravel = async () => { const response = await travelStore.createTravel(newTravelData); if (response.status === 200) router.push({ path: `/travel/${response.data.id}` }); @@ -52,6 +63,10 @@ const canSubmit = computed(() => { } return true; }); + +const redirectToTravelList = () => { + router.push({ name: 'TravelList' }); +};