From 06c0f491281df78a661a71a0a9bb21c4e25411b1 Mon Sep 17 00:00:00 2001 From: jgallego Date: Fri, 16 Aug 2024 10:10:40 +0200 Subject: [PATCH 1/6] feat: refs #7346 add seriaType option --- src/pages/InvoiceOut/InvoiceOutGlobalForm.vue | 38 ++++++++++++++++--- src/pages/InvoiceOut/InvoiceOutList.vue | 4 +- src/stores/invoiceOutGlobal.js | 11 +++++- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue index 23c63ee6a..5fc519061 100644 --- a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue +++ b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue @@ -20,20 +20,18 @@ const { initialDataLoading, formInitialData, invoicing, status } = const { makeInvoice, setStatusValue } = invoiceOutGlobalStore; const clientsToInvoice = ref('all'); - const companiesOptions = ref([]); - const printersOptions = ref([]); - const clientsOptions = ref([]); - +const serialTypesOptions = ref([]); const formData = ref({}); const optionsInitialData = computed(() => { return ( companiesOptions.value.length > 0 && printersOptions.value.length > 0 && - clientsOptions.value.length > 0 + clientsOptions.value.length > 0 && + serialTypesOptions.value.length > 0 ); }); @@ -60,7 +58,22 @@ onMounted(async () => { /> - + { outlined rounded /> + diff --git a/src/pages/InvoiceOut/InvoiceOutList.vue b/src/pages/InvoiceOut/InvoiceOutList.vue index 822f6bb33..b08e12b3e 100644 --- a/src/pages/InvoiceOut/InvoiceOutList.vue +++ b/src/pages/InvoiceOut/InvoiceOutList.vue @@ -198,7 +198,7 @@ watchEffect(selectedRows); :url="`${MODEL}/filter`" :create="{ urlCreate: 'InvoiceOuts/createManualInvoice', - title: t('Create Manual Invoice'), + title: t('Create manual invoice'), onDataSaved: ({ id }) => tableRef.redirect(id), formInitialData: { active: true, @@ -275,10 +275,12 @@ en: fileAllowed: Successful download of CSV file youCanSearchByInvoiceReference: You can search by invoice reference createInvoice: Make invoice + Create manual invoice: Create manual invoice es: searchInvoice: Buscar factura emitida fileDenied: El navegador denegó la descarga de archivos... fileAllowed: Descarga exitosa de archivo CSV youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura createInvoice: Crear factura + Create manual invoice: Crear factura manual diff --git a/src/stores/invoiceOutGlobal.js b/src/stores/invoiceOutGlobal.js index bb9a3d376..ca123d0b3 100644 --- a/src/stores/invoiceOutGlobal.js +++ b/src/stores/invoiceOutGlobal.js @@ -19,6 +19,7 @@ export const useInvoiceOutGlobalStore = defineStore({ maxShipped: null, clientId: null, printer: null, + invoiceType: null, }, addresses: [], minInvoicingDate: null, @@ -100,6 +101,7 @@ export const useInvoiceOutGlobalStore = defineStore({ maxShipped: new Date(formData.maxShipped), clientId: formData.clientId ? formData.clientId : null, companyFk: formData.companyFk, + invoiceType: formData.invoiceType, }; this.validateMakeInvoceParams(params, clientsToInvoice); @@ -152,7 +154,13 @@ export const useInvoiceOutGlobalStore = defineStore({ ); throw new Error('Invoice date in the future'); } - + if (!params.invoiceType) { + notify( + 'invoiceOut.globalInvoices.errors.chooseValidinvoiceType', + 'negative' + ); + throw new Error('Invalid Serial Type'); + } if (!params.companyFk) { notify('invoiceOut.globalInvoices.errors.chooseValidCompany', 'negative'); throw new Error('Invalid company'); @@ -180,6 +188,7 @@ export const useInvoiceOutGlobalStore = defineStore({ invoiceDate: new Date(formData.invoiceDate), maxShipped: new Date(formData.maxShipped), companyFk: formData.companyFk, + invoiceType: formData.invoiceType, }; this.status = 'invoicing'; From 0eb699bcbedd910007abee213e271962e77118d8 Mon Sep 17 00:00:00 2001 From: jgallego Date: Tue, 20 Aug 2024 10:10:11 +0200 Subject: [PATCH 2/6] feat: refs #7346 formdata uses serialType --- src/i18n/locale/en.yml | 1 + src/i18n/locale/es.yml | 1 + src/pages/InvoiceOut/Card/InvoiceOutDescriptorMenu.vue | 4 ++-- src/pages/InvoiceOut/InvoiceOutGlobalForm.vue | 2 +- src/pages/Ticket/Card/TicketSaleMoreActions.vue | 4 ++-- src/stores/invoiceOutGlobal.js | 10 +++++----- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 7d3682525..7f15ecf6a 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -689,6 +689,7 @@ invoiceOut: chooseValidClient: Choose a valid client chooseValidCompany: Choose a valid company chooseValidPrinter: Choose a valid printer + chooseValidSerialType: Choose a serial type fillDates: Invoice date and the max date should be filled invoiceDateLessThanMaxDate: Invoice date can not be less than max date invoiceWithFutureDate: Exists an invoice with a future date diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 8157f1803..fb892f015 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -695,6 +695,7 @@ invoiceOut: chooseValidClient: Selecciona un cliente válido chooseValidCompany: Selecciona una empresa válida chooseValidPrinter: Selecciona una impresora válida + chooseValidSerialType: Selecciona una tipo de serie válida fillDates: La fecha de la factura y la fecha máxima deben estar completas invoiceDateLessThanMaxDate: La fecha de la factura no puede ser menor que la fecha máxima invoiceWithFutureDate: Existe una factura con una fecha futura diff --git a/src/pages/InvoiceOut/Card/InvoiceOutDescriptorMenu.vue b/src/pages/InvoiceOut/Card/InvoiceOutDescriptorMenu.vue index e524faa24..4c02ccf84 100644 --- a/src/pages/InvoiceOut/Card/InvoiceOutDescriptorMenu.vue +++ b/src/pages/InvoiceOut/Card/InvoiceOutDescriptorMenu.vue @@ -222,7 +222,7 @@ const showTransferInvoiceForm = async () => { {{ t('Generate PDF invoice') }} - {{ t('Refund...') }} + {{ t('Refund') }} @@ -250,7 +250,7 @@ es: Delete invoice: Eliminar factura Book invoice: Asentar factura Generate PDF invoice: Generar PDF factura - Refund...: Abono + Refund: Abono As PDF: como PDF As CSV: como CSV Send PDF: Enviar PDF diff --git a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue index 5fc519061..88d55b093 100644 --- a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue +++ b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue @@ -110,7 +110,7 @@ onMounted(async () => { /> { - {{ t('Refund...') }} + {{ t('Refund') }} @@ -279,7 +279,7 @@ es: Add claim: Crear reclamación Mark as reserved: Marcar como reservado Unmark as reserved: Desmarcar como reservado - Refund...: Abono... + Refund: Abono with warehouse: con almacén without warehouse: sin almacén Claim out of time: Reclamación fuera de plazo diff --git a/src/stores/invoiceOutGlobal.js b/src/stores/invoiceOutGlobal.js index ca123d0b3..669d65728 100644 --- a/src/stores/invoiceOutGlobal.js +++ b/src/stores/invoiceOutGlobal.js @@ -19,7 +19,7 @@ export const useInvoiceOutGlobalStore = defineStore({ maxShipped: null, clientId: null, printer: null, - invoiceType: null, + serialType: null, }, addresses: [], minInvoicingDate: null, @@ -101,7 +101,7 @@ export const useInvoiceOutGlobalStore = defineStore({ maxShipped: new Date(formData.maxShipped), clientId: formData.clientId ? formData.clientId : null, companyFk: formData.companyFk, - invoiceType: formData.invoiceType, + serialType: formData.serialType, }; this.validateMakeInvoceParams(params, clientsToInvoice); @@ -154,9 +154,9 @@ export const useInvoiceOutGlobalStore = defineStore({ ); throw new Error('Invoice date in the future'); } - if (!params.invoiceType) { + if (!params.serialType) { notify( - 'invoiceOut.globalInvoices.errors.chooseValidinvoiceType', + 'invoiceOut.globalInvoices.errors.chooseValidSerialType', 'negative' ); throw new Error('Invalid Serial Type'); @@ -188,7 +188,7 @@ export const useInvoiceOutGlobalStore = defineStore({ invoiceDate: new Date(formData.invoiceDate), maxShipped: new Date(formData.maxShipped), companyFk: formData.companyFk, - invoiceType: formData.invoiceType, + serialType: formData.serialType, }; this.status = 'invoicing'; From 3d5807463b55065b053d6235452927eb1fe3263e Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 21 Aug 2024 13:46:19 +0200 Subject: [PATCH 3/6] feat: refs #7346 refactor --- src/pages/InvoiceOut/InvoiceOutGlobalForm.vue | 38 ++++++++++--------- src/pages/Item/Card/ItemBasicData.vue | 1 - 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue index 88d55b093..3dc34dc15 100644 --- a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue +++ b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue @@ -24,15 +24,28 @@ const companiesOptions = ref([]); const printersOptions = ref([]); const clientsOptions = ref([]); const serialTypesOptions = ref([]); + +const handleInvoiceOutSerialsFetch = (data) => { + const uniqueTypes = new Set(); + serialTypesOptions.value = data.filter((item) => { + if (item.type === null || uniqueTypes.has(item.type)) { + return false; + } + uniqueTypes.add(item.type); + return true; + }); +}; + const formData = ref({}); const optionsInitialData = computed(() => { - return ( - companiesOptions.value.length > 0 && - printersOptions.value.length > 0 && - clientsOptions.value.length > 0 && - serialTypesOptions.value.length > 0 - ); + const optionsArrays = [ + companiesOptions.value, + printersOptions.value, + clientsOptions.value, + serialTypesOptions.value, + ]; + return optionsArrays.every((arr) => arr.length > 0); }); const getStatus = computed({ @@ -60,18 +73,7 @@ onMounted(async () => { Date: Wed, 21 Aug 2024 14:13:36 +0200 Subject: [PATCH 4/6] feat: refs #7346 sonarLint warnings --- src/css/app.scss | 4 ---- src/pages/InvoiceOut/InvoiceOutGlobal.vue | 12 +++++++----- src/stores/invoiceOutGlobal.js | 9 ++------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/css/app.scss b/src/css/app.scss index c233b14f0..b2976b86a 100644 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -103,10 +103,6 @@ select:-webkit-autofill { border-radius: 8px; } -.card-width { - width: 770px; -} - .vn-card-list { width: 100%; max-width: 60em; diff --git a/src/pages/InvoiceOut/InvoiceOutGlobal.vue b/src/pages/InvoiceOut/InvoiceOutGlobal.vue index eecc61bc2..5f2eb3c02 100644 --- a/src/pages/InvoiceOut/InvoiceOutGlobal.vue +++ b/src/pages/InvoiceOut/InvoiceOutGlobal.vue @@ -94,11 +94,13 @@ const selectCustomerId = (id) => { }; const statusText = computed(() => { - return status.value === 'invoicing' - ? `${t(`status.${status.value}`)} ${ - addresses.value[getAddressNumber.value]?.clientId - }` - : t(`status.${status.value}`); + const baseStatus = t(`status.${status.value}`); + const clientId = + status.value === 'invoicing' + ? addresses.value[getAddressNumber.value]?.clientId || '' + : ''; + + return clientId ? `${baseStatus} ${clientId}`.trim() : baseStatus; }); onMounted(() => (stateStore.rightDrawer = true)); diff --git a/src/stores/invoiceOutGlobal.js b/src/stores/invoiceOutGlobal.js index 669d65728..42acac013 100644 --- a/src/stores/invoiceOutGlobal.js +++ b/src/stores/invoiceOutGlobal.js @@ -200,12 +200,7 @@ export const useInvoiceOutGlobalStore = defineStore({ this.addressIndex++; this.isInvoicing = false; } catch (err) { - if ( - err && - err.response && - err.response.status >= 400 && - err.response.status < 500 - ) { + if (err?.response?.status >= 400 && err?.response?.status < 500) { this.invoiceClientError(address, err.response?.data?.error?.message); return; } else { @@ -252,7 +247,7 @@ export const useInvoiceOutGlobalStore = defineStore({ params, }); - if (data.data && data.data.error) throw new Error(); + if (data?.data?.error) throw new Error(); const status = exportFile('negativeBases.csv', data, { encoding: 'windows-1252', From d0ccce26567cee02c49466d62a78312d45529ee3 Mon Sep 17 00:00:00 2001 From: jgallego Date: Fri, 23 Aug 2024 10:32:36 +0200 Subject: [PATCH 5/6] feat: refs #7346 elimino === --- src/pages/InvoiceOut/InvoiceOutGlobalForm.vue | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue index 3dc34dc15..362ede4be 100644 --- a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue +++ b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue @@ -26,14 +26,9 @@ const clientsOptions = ref([]); const serialTypesOptions = ref([]); const handleInvoiceOutSerialsFetch = (data) => { - const uniqueTypes = new Set(); - serialTypesOptions.value = data.filter((item) => { - if (item.type === null || uniqueTypes.has(item.type)) { - return false; - } - uniqueTypes.add(item.type); - return true; - }); + serialTypesOptions.value = Array.from( + new Set(data.map((item) => item.type).filter((type) => type)) + ); }; const formData = ref({}); From efc7df5a60cd4b5ea0c0fa00a8a8b55c20840bca Mon Sep 17 00:00:00 2001 From: jgallego Date: Fri, 23 Aug 2024 12:19:54 +0200 Subject: [PATCH 6/6] delivery traducido a Reparto --- src/pages/Claim/locale/es.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Claim/locale/es.yml b/src/pages/Claim/locale/es.yml index 90bef8e66..052416aa7 100644 --- a/src/pages/Claim/locale/es.yml +++ b/src/pages/Claim/locale/es.yml @@ -42,7 +42,7 @@ claim: pickup: Recoger null: No agency: Agencia - delivery: Entrega + delivery: Reparto fileDescription: 'ID de reclamación {claimId} del cliente {clientName} con ID {clientId}' noData: 'No hay imágenes/videos, haz clic aquí o arrastra y suelta el archivo' dragDrop: Arrastra y suelta aquí