From 505052d84dfd0955e249e9222c112221c9e2f538 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Thu, 16 Nov 2023 16:44:35 -0300 Subject: [PATCH] [WIP] global invoices --- package-lock.json | 12 +- src/composables/useState.js | 6 +- src/composables/useUserConfig.js | 15 +- src/i18n/en/index.js | 1 + src/i18n/es/index.js | 1 + src/pages/InvoiceOut/InvoiceOutGlobal.vue | 32 +++ src/pages/InvoiceOut/InvoiceOutGlobalForm.vue | 214 ++++++++++++++++++ src/router/modules/invoiceOut.js | 28 ++- src/services/InvoiceOut.service.js | 53 +++++ 9 files changed, 341 insertions(+), 21 deletions(-) create mode 100644 src/pages/InvoiceOut/InvoiceOutGlobal.vue create mode 100644 src/pages/InvoiceOut/InvoiceOutGlobalForm.vue create mode 100644 src/services/InvoiceOut.service.js diff --git a/package-lock.json b/package-lock.json index a3a9dcc63..c541ee00e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,14 +1,14 @@ { "name": "salix-front", - "version": "23.40.01", + "version": "23.48.01", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "salix-front", - "version": "0.0.1", + "version": "23.48.01", "dependencies": { - "@quasar/cli": "^2.2.1", + "@quasar/cli": "^2.3.0", "@quasar/extras": "^1.16.4", "axios": "^1.4.0", "chromium": "^3.0.3", @@ -946,9 +946,9 @@ } }, "node_modules/@quasar/cli": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@quasar/cli/-/cli-2.2.1.tgz", - "integrity": "sha512-PMwJ76IeeNRRBw+08hUMjhqGC6JKJ/t1zIb+IOiyR5D4rkBR26Ha/Z46OD3KfwUprq4Q8s4ieB1+d3VY8FhPKg==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@quasar/cli/-/cli-2.3.0.tgz", + "integrity": "sha512-DNFDemicj3jXe5+Ib+5w9Bwj1U3yoHQkqn0bU/qysIl/p0MmGA1yqOfUF0V4fw/5or1dfCvStIA/oZxUcC+2pQ==", "dependencies": { "@quasar/ssl-certificate": "^1.0.0", "ci-info": "^3.8.0", diff --git a/src/composables/useState.js b/src/composables/useState.js index f0ff830ab..1c797e992 100644 --- a/src/composables/useState.js +++ b/src/composables/useState.js @@ -8,6 +8,7 @@ const user = ref({ nickname: '', lang: '', darkMode: null, + companyFk: null, }); const roles = ref([]); @@ -23,6 +24,7 @@ export function useState() { nickname: user.value.nickname, lang: user.value.lang, darkMode: user.value.darkMode, + companyFk: user.value.companyFk, }; }); } @@ -34,6 +36,7 @@ export function useState() { nickname: data.nickname, lang: data.lang, darkMode: data.darkMode, + companyFk: data.companyFk, }; } @@ -59,7 +62,6 @@ export function useState() { delete state.value[name]; } - return { getUser, setUser, @@ -69,6 +71,6 @@ export function useState() { get, unset, drawer, - headerMounted + headerMounted, }; } diff --git a/src/composables/useUserConfig.js b/src/composables/useUserConfig.js index 767ffb54e..2a22ae339 100644 --- a/src/composables/useUserConfig.js +++ b/src/composables/useUserConfig.js @@ -5,10 +5,17 @@ export function useUserConfig() { const state = useState(); async function fetch() { - const { data } = await axios.get('UserConfigs/getUserConfig'); - const user = state.getUser().value; - user.darkMode = data.darkMode; - state.setUser(user); + try { + const { data } = await axios.get('UserConfigs/getUserConfig'); + const user = state.getUser().value; + user.darkMode = data.darkMode; + user.companyFk = data.companyFk; + state.setUser(user); + + return data; + } catch (error) { + console.error('Error fetching user config:', error); + } } return { diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index 948332d46..5fec1bdc2 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -348,6 +348,7 @@ export default { pageTitles: { invoiceOuts: 'Invoices Out', list: 'List', + globalInvoicing: 'Global invoicing', createInvoiceOut: 'Create invoice out', summary: 'Summary', basicData: 'Basic Data', diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index 9b452ab22..671dfa3a4 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -348,6 +348,7 @@ export default { pageTitles: { invoiceOuts: 'Fact. emitidas', list: 'Listado', + globalInvoicing: 'Facturación global', createInvoiceOut: 'Crear fact. emitida', summary: 'Resumen', basicData: 'Datos básicos', diff --git a/src/pages/InvoiceOut/InvoiceOutGlobal.vue b/src/pages/InvoiceOut/InvoiceOutGlobal.vue new file mode 100644 index 000000000..6fb6e618a --- /dev/null +++ b/src/pages/InvoiceOut/InvoiceOutGlobal.vue @@ -0,0 +1,32 @@ + + + + + + + diff --git a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue new file mode 100644 index 000000000..6d29d9ba5 --- /dev/null +++ b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue @@ -0,0 +1,214 @@ + + + + + + { + "en": { + "invoiceDate": "Invoice date", + "maxShipped": "Max date", + "allClients": "All clients", + "oneClient": "One client", + "company": "Company", + "printer": "Printer", + "invoiceOut": "Invoice out", + "client": "Client" + }, + "es": { + "invoiceDate": "Fecha de factura", + "maxShipped": "Fecha límite", + "allClients": "Todos los clientes", + "oneClient": "Un solo cliente", + "company": "Empresa", + "printer": "Impresora", + "invoiceOut": "Facturar", + "client": "Cliente" + + } + } + diff --git a/src/router/modules/invoiceOut.js b/src/router/modules/invoiceOut.js index daf5041e9..e8e18a810 100644 --- a/src/router/modules/invoiceOut.js +++ b/src/router/modules/invoiceOut.js @@ -5,12 +5,12 @@ export default { name: 'InvoiceOut', meta: { title: 'invoiceOuts', - icon: 'vn:invoice-out' + icon: 'vn:invoice-out', }, component: RouterView, redirect: { name: 'InvoiceOutMain' }, menus: { - main: ['InvoiceOutList'], + main: ['InvoiceOutList', 'InvoiceOutGlobal'], card: [], }, children: [ @@ -28,8 +28,17 @@ export default { icon: 'view_list', }, component: () => import('src/pages/InvoiceOut/InvoiceOutList.vue'), - } - ] + }, + { + path: 'global-invoicing', + name: 'InvoiceOutGlobal', + meta: { + title: 'globalInvoicing', + icon: 'view_list', + }, + component: () => import('src/pages/InvoiceOut/InvoiceOutGlobal.vue'), + }, + ], }, { name: 'InvoiceOutCard', @@ -41,11 +50,12 @@ export default { name: 'InvoiceOutSummary', path: 'summary', meta: { - title: 'summary' + title: 'summary', }, - component: () => import('src/pages/InvoiceOut/Card/InvoiceOutSummary.vue'), - } - ] + component: () => + import('src/pages/InvoiceOut/Card/InvoiceOutSummary.vue'), + }, + ], }, - ] + ], }; diff --git a/src/services/InvoiceOut.service.js b/src/services/InvoiceOut.service.js new file mode 100644 index 000000000..b5f23869e --- /dev/null +++ b/src/services/InvoiceOut.service.js @@ -0,0 +1,53 @@ +import axios from 'axios'; + +const invoiceOutService = { + getInvoiceOutConfig: async (path = '', params) => { + try { + const { data } = await axios.get(path, { + params, + }); + + return data; + } catch (err) { + console.error('Error fetching invoice date'); + } + }, + + getCompanies: async (filter) => { + try { + const { data } = await axios.get('Companies', { + filter, + }); + + return data; + } catch (err) { + console.error('Error fetching companies'); + } + }, + + getPrinters: async (filter) => { + try { + const { data } = await axios.get('Printers', { + filter, + }); + + return data; + } catch (err) { + console.error('Error fetching printers'); + } + }, + + getClients: async (filter) => { + try { + const { data } = await axios.get('Clients', { + filter, + }); + + return data; + } catch (err) { + console.error('Error fetching clients'); + } + }, +}; + +export default invoiceOutService;