From 113df44705815331027fab318eb722ab09ae7308 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Fri, 29 Dec 2023 16:54:35 -0300 Subject: [PATCH] create entries basic structure and add create entry and clone travel with entries feature to travel list and travel summary --- src/i18n/en/index.js | 12 +++ src/i18n/es/index.js | 11 ++ src/pages/Entry/Card/EntryCard.vue | 26 +++++ src/pages/Entry/EntryCreate.vue | 135 ++++++++++++++++++++++++ src/pages/Entry/EntryList.vue | 22 ++++ src/pages/Entry/EntryMain.vue | 17 +++ src/pages/Supplier/SupplierCreate.vue | 10 -- src/pages/Travel/Card/TravelSummary.vue | 22 ++-- src/pages/Travel/TravelList.vue | 6 +- src/router/modules/entry.js | 61 +++++++++++ src/router/modules/index.js | 2 + src/router/routes.js | 2 + src/stores/useNavigationStore.js | 1 + 13 files changed, 310 insertions(+), 17 deletions(-) create mode 100644 src/pages/Entry/Card/EntryCard.vue create mode 100644 src/pages/Entry/EntryCreate.vue create mode 100644 src/pages/Entry/EntryList.vue create mode 100644 src/pages/Entry/EntryMain.vue create mode 100644 src/router/modules/entry.js diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index 7f3237050..878dc03b8 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -207,6 +207,18 @@ export default { contactChannel: 'Contact channel', }, }, + entry: { + pageTitles: { + entries: 'Entries', + list: 'List', + createEntry: 'New entry', + summary: 'Summary', + create: 'Create', + }, + list: { + newEntry: 'New entry', + }, + }, ticket: { pageTitles: { tickets: 'Tickets', diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index 60b813f3a..4d29947a7 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -206,6 +206,17 @@ export default { contactChannel: 'Canal de contacto', }, }, + entry: { + pageTitles: { + entries: 'Entradas', + list: 'Listado', + summary: 'Resumen', + create: 'Crear', + }, + list: { + newEntry: 'Nueva entrada', + }, + }, ticket: { pageTitles: { tickets: 'Tickets', diff --git a/src/pages/Entry/Card/EntryCard.vue b/src/pages/Entry/Card/EntryCard.vue new file mode 100644 index 000000000..5aa50fc94 --- /dev/null +++ b/src/pages/Entry/Card/EntryCard.vue @@ -0,0 +1,26 @@ + + diff --git a/src/pages/Entry/EntryCreate.vue b/src/pages/Entry/EntryCreate.vue new file mode 100644 index 000000000..30b54cb38 --- /dev/null +++ b/src/pages/Entry/EntryCreate.vue @@ -0,0 +1,135 @@ + + + + + + es: + Supplier *: Proveedor * + Travel *: EnvĂ­o * + Company *: Empresa * + diff --git a/src/pages/Entry/EntryList.vue b/src/pages/Entry/EntryList.vue new file mode 100644 index 000000000..1baa9e019 --- /dev/null +++ b/src/pages/Entry/EntryList.vue @@ -0,0 +1,22 @@ + + + diff --git a/src/pages/Entry/EntryMain.vue b/src/pages/Entry/EntryMain.vue new file mode 100644 index 000000000..66ce78f23 --- /dev/null +++ b/src/pages/Entry/EntryMain.vue @@ -0,0 +1,17 @@ + + + diff --git a/src/pages/Supplier/SupplierCreate.vue b/src/pages/Supplier/SupplierCreate.vue index 3317225d5..d6cfaeb42 100644 --- a/src/pages/Supplier/SupplierCreate.vue +++ b/src/pages/Supplier/SupplierCreate.vue @@ -51,13 +51,3 @@ const newSupplierForm = reactive({ - - diff --git a/src/pages/Travel/Card/TravelSummary.vue b/src/pages/Travel/Card/TravelSummary.vue index ad4659b11..c8a62ec00 100644 --- a/src/pages/Travel/Card/TravelSummary.vue +++ b/src/pages/Travel/Card/TravelSummary.vue @@ -2,15 +2,17 @@ import { onMounted, ref, computed, onUpdated } from 'vue'; import { useRoute, useRouter } from 'vue-router'; import { useI18n } from 'vue-i18n'; + +import { QCheckbox, QIcon } from 'quasar'; import CardSummary from 'components/ui/CardSummary.vue'; import VnLv from 'src/components/ui/VnLv.vue'; -import { getUrl } from 'src/composables/getUrl'; -import { toDate } from 'src/filters'; -import travelService from 'src/services/travel.service'; -import { QCheckbox, QIcon } from 'quasar'; -import { toCurrency } from 'filters/index'; import VnRow from 'components/ui/VnRow.vue'; +import travelService from 'src/services/travel.service'; +import { toDate, toCurrency } from 'src/filters'; +import { getUrl } from 'src/composables/getUrl'; +import axios from 'axios'; + onUpdated(() => summaryRef.value.fetch()); const route = useRoute(); @@ -40,9 +42,17 @@ const cloneTravel = () => { redirectToCreateView(stringifiedTravelData); }; +const cloneTravelWithEntries = () => { + try { + axios.post(`Travels/${$props.id}/cloneWithEntries`); + } catch (err) { + console.err('Error cloning travel with entries'); + } +}; + const headerMenuOptions = [ { name: t('travel.summary.cloneShipping'), action: cloneTravel }, - { name: t('travel.summary.CloneTravelAndEntries'), action: null }, + { name: t('travel.summary.CloneTravelAndEntries'), action: cloneTravelWithEntries }, { name: t('travel.summary.AddEntry'), action: null }, ]; diff --git a/src/pages/Travel/TravelList.vue b/src/pages/Travel/TravelList.vue index 56d529a7b..889f096aa 100644 --- a/src/pages/Travel/TravelList.vue +++ b/src/pages/Travel/TravelList.vue @@ -31,6 +31,10 @@ const redirectToCreateView = (queryParams) => { router.push({ name: 'TravelCreate', query: { travelData: queryParams } }); }; +const redirectCreateEntryView = (travelData) => { + router.push({ name: 'EntryCreate', query: { travelFk: travelData.id } }); +}; + const viewSummary = (id) => { quasar.dialog({ component: TravelSummaryDialog, @@ -103,7 +107,7 @@ onMounted(async () => { /> import('src/pages/Entry/EntryMain.vue'), + redirect: { name: 'EntryList' }, + children: [ + { + path: 'list', + name: 'EntryList', + meta: { + title: 'list', + icon: 'view_list', + }, + component: () => import('src/pages/Entry/EntryList.vue'), + }, + { + path: 'create', + name: 'EntryCreate', + meta: { + title: 'create', + }, + component: () => import('src/pages/Entry/EntryCreate.vue'), + }, + ], + }, + // { + // name: 'EntryCard', + // path: ':id', + // component: () => import('src/pages/Entry/Card/EntryCard.vue'), + // redirect: { name: 'EntrySummary' }, + // children: [ + // { + // name: 'EntrySummary', + // path: 'summary', + // meta: { + // title: 'summary', + // icon: 'launch', + // }, + // component: () => + // import('src/pages/Entry/Card/EntrySummary.vue'), + // }, + // ], + // }, + ], +}; diff --git a/src/router/modules/index.js b/src/router/modules/index.js index 68d1d8146..cc5034959 100644 --- a/src/router/modules/index.js +++ b/src/router/modules/index.js @@ -11,6 +11,7 @@ import Supplier from './Supplier'; import Travel from './travel'; import Order from './order'; import Department from './department'; +import Entry from './entry'; export default [ Customer, @@ -26,4 +27,5 @@ export default [ Order, invoiceIn, Department, + Entry, ]; diff --git a/src/router/routes.js b/src/router/routes.js index 32f5aaef6..6a2fa6a97 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -11,6 +11,7 @@ import travel from './modules/travel'; import department from './modules/department'; import shelving from 'src/router/modules/shelving'; import order from 'src/router/modules/order'; +import entry from 'src/router/modules/entry'; const routes = [ { @@ -63,6 +64,7 @@ const routes = [ supplier, travel, department, + entry, { path: '/:catchAll(.*)*', name: 'NotFound', diff --git a/src/stores/useNavigationStore.js b/src/stores/useNavigationStore.js index 63dce6162..6964c9401 100644 --- a/src/stores/useNavigationStore.js +++ b/src/stores/useNavigationStore.js @@ -19,6 +19,7 @@ export const useNavigationStore = defineStore('navigationStore', () => { 'supplier', 'travel', 'invoiceIn', + 'entry', ]; const pinnedModules = ref([]); const role = useRole();