diff --git a/src/components/CreateBankEntityForm.vue b/src/components/CreateBankEntityForm.vue new file mode 100644 index 000000000..be213239f --- /dev/null +++ b/src/components/CreateBankEntityForm.vue @@ -0,0 +1,148 @@ + + + + + + + +en: + title: New bank entity + subtitle: Please, ensure you put the correct data! + name: Name * + swift: Swift * + country: Country + id: Entity code +es: + title: Nueva entidad bancaria + subtitle: ¡Por favor, asegúrate de poner los datos correctos! + name: Nombre * + swift: Swift * + country: País + id: Código de la entidad + diff --git a/src/components/CreateNewCityForm.vue b/src/components/CreateNewCityForm.vue new file mode 100644 index 000000000..b028509e8 --- /dev/null +++ b/src/components/CreateNewCityForm.vue @@ -0,0 +1,117 @@ + + + + + + + +es: + New city: Nueva ciudad + Please, ensure you put the correct data!: ¡Por favor, asegúrese de poner los datos correctos! + Name: Nombre + Province: Provincia + diff --git a/src/components/CreateNewPostcodeForm.vue b/src/components/CreateNewPostcodeForm.vue new file mode 100644 index 000000000..0905f6bc3 --- /dev/null +++ b/src/components/CreateNewPostcodeForm.vue @@ -0,0 +1,184 @@ + + + + + + + +es: + New postcode: Nuevo código postal + Please, ensure you put the correct data!: ¡Por favor, asegúrese de poner los datos correctos! + City: Ciudad + Province: Provincia + Country: País + Postcode: Código postal + diff --git a/src/components/CreateNewProvinceForm.vue b/src/components/CreateNewProvinceForm.vue new file mode 100644 index 000000000..1896aec3f --- /dev/null +++ b/src/components/CreateNewProvinceForm.vue @@ -0,0 +1,118 @@ + + + + + + + +es: + New postcode: Nuevo código postal + Please, ensure you put the correct data!: ¡Por favor, asegúrese de poner los datos correctos! + Name: Nombre + Autonomy: Autonomía + diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index de614ea95..62993ef24 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -230,6 +230,7 @@ watch(formUrl, async () => { :showing="isLoading" :label="t('globals.pleaseWait')" color="primary" + style="min-width: 100%" /> - - -es: - New postcode: Nuevo código postal - Please, ensure you put the correct data!: ¡Por favor, asegúrese de poner los datos correctos! - City: Ciudad - Province: Provincia - Country: País - diff --git a/src/pages/Customer/CustomerExtendedList.vue b/src/pages/Customer/CustomerExtendedList.vue new file mode 100644 index 000000000..da3c6ced4 --- /dev/null +++ b/src/pages/Customer/CustomerExtendedList.vue @@ -0,0 +1,141 @@ + + + + + diff --git a/src/pages/Customer/CustomerExtendedListFilter.vue b/src/pages/Customer/CustomerExtendedListFilter.vue new file mode 100644 index 000000000..99ff1d6b6 --- /dev/null +++ b/src/pages/Customer/CustomerExtendedListFilter.vue @@ -0,0 +1,153 @@ + + + + + + + +en: + params: + identifier: Identifier + socialName: Social name + salesPerson: Salesperson + phone: Phone + city: City + email: Email +es: + params: + identifier: Identificador + socialName: Razón social + salesPerson: Comercial + phone: Teléfono + city: Población + email: Email + Identifier: Identificador + Social name: Razón social + Salesperson: Comercial + Phone: Teléfono + City: Población + Email: Email + diff --git a/src/pages/InvoiceIn/InvoiceInList.vue b/src/pages/InvoiceIn/InvoiceInList.vue index 692251bff..fec70ade6 100644 --- a/src/pages/InvoiceIn/InvoiceInList.vue +++ b/src/pages/InvoiceIn/InvoiceInList.vue @@ -154,7 +154,7 @@ function viewSummary(id) { - + { - - diff --git a/src/pages/Worker/WorkerCreate.vue b/src/pages/Worker/WorkerCreate.vue new file mode 100644 index 000000000..66b6e4cd8 --- /dev/null +++ b/src/pages/Worker/WorkerCreate.vue @@ -0,0 +1,366 @@ + + + diff --git a/src/pages/Worker/WorkerList.vue b/src/pages/Worker/WorkerList.vue index a09c370ef..e7e86d16e 100644 --- a/src/pages/Worker/WorkerList.vue +++ b/src/pages/Worker/WorkerList.vue @@ -27,6 +27,10 @@ function viewSummary(id) { }, }); } + +const redirectToCreateView = () => { + router.push({ name: 'WorkerCreate' }); +}; + + + + {{ t('worker.list.newWorker') }} + + diff --git a/src/router/modules/customer.js b/src/router/modules/customer.js index 7c9940ebe..ec81a9c77 100644 --- a/src/router/modules/customer.js +++ b/src/router/modules/customer.js @@ -10,7 +10,7 @@ export default { component: RouterView, redirect: { name: 'CustomerMain' }, menus: { - main: ['CustomerList', 'CustomerPayments'], + main: ['CustomerList', 'CustomerPayments', 'CustomerExtendedList'], card: ['CustomerBasicData'], }, children: [ @@ -46,6 +46,16 @@ export default { }, component: () => import('src/pages/Customer/CustomerPayments.vue'), }, + { + path: 'extendedList', + name: 'CustomerExtendedList', + meta: { + title: 'extendedList', + icon: 'vn:client', + }, + component: () => + import('src/pages/Customer/CustomerExtendedList.vue'), + }, ], }, { diff --git a/src/router/modules/travel.js b/src/router/modules/travel.js index 06605667e..43c444ae2 100644 --- a/src/router/modules/travel.js +++ b/src/router/modules/travel.js @@ -42,7 +42,7 @@ export default { path: 'create', name: 'TravelCreate', meta: { - title: 'extraCommunity', + title: 'travelCreate', icon: '', }, component: () => import('src/pages/Travel/TravelCreate.vue'), diff --git a/src/router/modules/worker.js b/src/router/modules/worker.js index e5ee7c1a2..dfc994e96 100644 --- a/src/router/modules/worker.js +++ b/src/router/modules/worker.js @@ -29,6 +29,15 @@ export default { }, component: () => import('src/pages/Worker/WorkerList.vue'), }, + { + path: 'create', + name: 'WorkerCreate', + meta: { + title: 'workerCreate', + icon: '', + }, + component: () => import('src/pages/Worker/WorkerCreate.vue'), + }, ], }, { diff --git a/src/services/invoiceOut.service.js b/src/services/invoiceOut.service.js deleted file mode 100644 index 17f710cb5..000000000 --- a/src/services/invoiceOut.service.js +++ /dev/null @@ -1,45 +0,0 @@ -import axios from 'axios'; - -const request = async (method, url, params = {}) => { - try { - let response; - - if (method === 'GET') { - response = await axios.get(url, { params }); - } else if (method === 'POST') { - response = await axios.post(url, params); - } - return response.data; - } catch (err) { - console.error(`Error with ${method} request to ${url}`, err); - return err.response; - } -}; - -const invoiceOutService = { - getNegativeBasesCsv: async (params) => { - return await request('GET', 'InvoiceOuts/negativeBasesCsv', params); - }, - - getInvoiceDate: async (params) => { - return await request('GET', 'InvoiceOuts/getInvoiceDate', params); - }, - - getFindOne: async (params) => { - return await request('GET', 'InvoiceOutConfigs/findOne', params); - }, - - getClientsToInvoice: async (params) => { - return await request('POST', 'InvoiceOuts/clientsToInvoice', params); - }, - - invoiceClient: async (params) => { - return await request('POST', 'InvoiceOuts/invoiceClient', params); - }, - - makePdfAndNotify: async (invoiceId, params) => { - return await request('POST', `InvoiceOuts/${invoiceId}/makePdfAndNotify`, params); - }, -}; - -export default invoiceOutService; diff --git a/src/stores/invoiceOutGlobal.js b/src/stores/invoiceOutGlobal.js index d449a577d..7b763df63 100644 --- a/src/stores/invoiceOutGlobal.js +++ b/src/stores/invoiceOutGlobal.js @@ -1,8 +1,8 @@ import { defineStore } from 'pinia'; import { useUserConfig } from 'src/composables/useUserConfig'; -import invoiceOutService from 'src/services/invoiceOut.service'; import useNotify from 'src/composables/useNotify.js'; import { exportFile } from 'quasar'; +import axios from 'axios'; const { notify } = useNotify(); @@ -60,18 +60,29 @@ export const useInvoiceOutGlobalStore = defineStore({ }, async fetchInvoiceOutConfig(companyFk) { - this.formInitialData.companyFk = companyFk; - const params = { companyFk: companyFk }; - const { issued } = await invoiceOutService.getInvoiceDate(params); - const stringDate = issued.substring(0, 10); - this.minInvoicingDate = stringDate; - this.formInitialData.invoiceDate = stringDate; + try { + this.formInitialData.companyFk = companyFk; + const params = { companyFk: companyFk }; + + const { data } = await axios.get('InvoiceOuts/getInvoiceDate', { + params, + }); + + const stringDate = data.issued.substring(0, 10); + this.minInvoicingDate = stringDate; + this.formInitialData.invoiceDate = stringDate; + } catch (err) { + console.error('Error fetching invoice out global initial data'); + throw new Error(); + } }, async fetchParallelism() { const filter = { fields: ['parallelism'] }; - const { parallelism } = await invoiceOutService.getFindOne(filter); - this.parallelism = parallelism; + const { data } = await axios.get('InvoiceOutConfigs/findOne', { + filter, + }); + this.parallelism = data.parallelism; }, async makeInvoice(formData, clientsToInvoice) { @@ -90,11 +101,12 @@ export const useInvoiceOutGlobalStore = defineStore({ if (clientsToInvoice == 'all') params.clientId = undefined; - const addressesResponse = await invoiceOutService.getClientsToInvoice( + const addressesResponse = await await axios.post( + 'InvoiceOuts/clientsToInvoice', params ); - this.addresses = addressesResponse; + this.addresses = addressesResponse.data; if (!this.addresses || !this.addresses.length > 0) { notify( @@ -151,31 +163,45 @@ export const useInvoiceOutGlobalStore = defineStore({ }, async invoiceClient(address, formData) { - if (this.nRequests === this.parallelism || this.isInvoicing) return; + try { + if (this.nRequests === this.parallelism || this.isInvoicing) return; - if (this.status === 'stopping') { - if (this.nRequests) return; - this.invoicing = false; - this.status = 'done'; - return; - } + if (this.status === 'stopping') { + if (this.nRequests) return; + this.invoicing = false; + this.status = 'done'; + return; + } - const params = { - clientId: address.clientId, - addressId: address.id, - invoiceDate: new Date(formData.invoiceDate), - maxShipped: new Date(formData.maxShipped), - companyFk: formData.companyFk, - }; + const params = { + clientId: address.clientId, + addressId: address.id, + invoiceDate: new Date(formData.invoiceDate), + maxShipped: new Date(formData.maxShipped), + companyFk: formData.companyFk, + }; - this.status = 'invoicing'; - this.invoicing = true; + this.status = 'invoicing'; + this.invoicing = true; - const invoiceResponse = await invoiceOutService.invoiceClient(params); + const invoiceResponse = await axios.post( + 'InvoiceOuts/invoiceClient', + params + ); - if (invoiceResponse.data.error) { - if (invoiceResponse.status >= 400 && invoiceResponse.status < 500) { - this.invoiceClientError(address, invoiceResponse); + if (invoiceResponse.data) { + this.makePdfAndNotify(invoiceResponse.data, address); + } + + this.isInvoicing = false; + } catch (err) { + if ( + err && + err.response && + err.response.status >= 400 && + err.response.status < 500 + ) { + this.invoiceClientError(address, err.response); this.addressIndex++; return; } else { @@ -187,11 +213,6 @@ export const useInvoiceOutGlobalStore = defineStore({ ); throw new Error('Critical invoicing error, process stopped'); } - } else { - this.isInvoicing = false; - if (invoiceResponse.data) { - this.makePdfAndNotify(invoiceResponse.data, address); - } } }, @@ -200,7 +221,7 @@ export const useInvoiceOutGlobalStore = defineStore({ this.nRequests++; this.totalPdfs++; const params = { printerFk: this.printer }; - await invoiceOutService.makePdfAndNotify(invoiceId, params); + await axios.post(`InvoiceOuts/${invoiceId}/makePdfAndNotify`, params); this.nPdfs++; this.nRequests--; } catch (err) { @@ -222,11 +243,14 @@ export const useInvoiceOutGlobalStore = defineStore({ async getNegativeBasesCsv(from, to) { try { const params = { from: from, to: to }; - const CSVResponse = await invoiceOutService.getNegativeBasesCsv(params); - if (CSVResponse.data && CSVResponse.data.error) throw new Error(); + const { data } = await axios.get('InvoiceOuts/negativeBasesCsv', { + params, + }); - const status = exportFile('negativeBases.csv', CSVResponse, { + if (data.data && data.data.error) throw new Error(); + + const status = exportFile('negativeBases.csv', data, { encoding: 'windows-1252', mimeType: 'text/csv;charset=windows-1252;', }); @@ -236,6 +260,7 @@ export const useInvoiceOutGlobalStore = defineStore({ } } catch (err) { notify('invoiceOut.negativeBases.errors.downloadCsvFailed', 'negative'); + throw new Error(); } },