From 0282f8dde81153f24e686d6df1bb06f5315ae6c6 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 28 Nov 2023 12:05:39 +0100 Subject: [PATCH] refs #5835 rate fixed & options descriptor created --- src/components/common/SendEmailDialog.vue | 7 +- src/components/common/VnSelectFilter.vue | 1 + src/components/ui/CardDescriptor.vue | 4 + src/i18n/es/index.js | 4 +- src/pages/Claim/Card/ClaimDescriptorMenu.vue | 2 +- .../InvoiceIn/Card/InvoiceInDescriptor.vue | 268 +++++++++++++++++- src/pages/InvoiceIn/Card/InvoiceInSummary.vue | 91 ++---- .../{ => claim}/claimAction.spec.js | 0 8 files changed, 293 insertions(+), 84 deletions(-) rename test/cypress/integration/{ => claim}/claimAction.spec.js (100%) diff --git a/src/components/common/SendEmailDialog.vue b/src/components/common/SendEmailDialog.vue index ab83c0949..0f574a795 100644 --- a/src/components/common/SendEmailDialog.vue +++ b/src/components/common/SendEmailDialog.vue @@ -24,12 +24,13 @@ const address = ref(props.data.address); const isLoading = ref(false); async function confirm() { - const response = { address }; - + const response = { address: address.value }; if (props.promise) { isLoading.value = true; + const { address: _address, ...restData } = props.data; + try { - Object.assign(response, props.data); + Object.assign(response, restData); await props.promise(response); } finally { isLoading.value = false; diff --git a/src/components/common/VnSelectFilter.vue b/src/components/common/VnSelectFilter.vue index f6400fb4f..b808f1a8a 100644 --- a/src/components/common/VnSelectFilter.vue +++ b/src/components/common/VnSelectFilter.vue @@ -89,6 +89,7 @@ const value = computed({ map-options use-input @filter="filterHandler" + hide-selected fill-input ref="vnSelectRef" > diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue index eef2e020b..499c95beb 100644 --- a/src/components/ui/CardDescriptor.vue +++ b/src/components/ui/CardDescriptor.vue @@ -35,6 +35,10 @@ const $props = defineProps({ const slots = useSlots(); const { t } = useI18n(); const entity = computed(() => useArrayData($props.dataKey).store.data); + +defineExpose({ + getData, +}); onMounted(async () => { await getData(); watch( diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index 4f946ffcc..d4deed5ee 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -427,8 +427,8 @@ export default { dueDay: 'Fecha de vencimiento', }, summary: { - supplier: 'Supplier', - supplierRef: 'Supplier ref.', + supplier: 'Proveedor', + supplierRef: 'Ref. proveedor', currency: 'Divisa', docNumber: 'Número documento', issued: 'Fecha de expedición', diff --git a/src/pages/Claim/Card/ClaimDescriptorMenu.vue b/src/pages/Claim/Card/ClaimDescriptorMenu.vue index 5688613d6..d88c3d120 100644 --- a/src/pages/Claim/Card/ClaimDescriptorMenu.vue +++ b/src/pages/Claim/Card/ClaimDescriptorMenu.vue @@ -37,7 +37,7 @@ function confirmPickupOrder() { data: { address: customer.email, }, - send: sendPickupOrder, + promise: sendPickupOrder, }, }); } diff --git a/src/pages/InvoiceIn/Card/InvoiceInDescriptor.vue b/src/pages/InvoiceIn/Card/InvoiceInDescriptor.vue index 016d2779c..c70568c1b 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInDescriptor.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInDescriptor.vue @@ -1,12 +1,20 @@ + + +es: + To book: Contabilizar + Are you sure you want to book this invoice?: Estas seguro de querer asentar esta factura? + Delete invoice: Eliminar factura + Are you sure you want to delete this invoice?: Estas seguro de querer eliminar esta factura? + Invoice deleted: Factura eliminada + Clone invoice: Clonar factura + Invoice cloned: Factura clonada + Show agricultural receipt as PDF: Ver recibo agrícola como PDF + Send agricultural receipt as PDF: Enviar recibo agrícola como PDF + Are you sure you want to send it?: Estás seguro que quieres enviarlo? + Send PDF invoice: Enviar factura a PDF + diff --git a/src/pages/InvoiceIn/Card/InvoiceInSummary.vue b/src/pages/InvoiceIn/Card/InvoiceInSummary.vue index d2855f56a..9c377e241 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInSummary.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInSummary.vue @@ -4,8 +4,6 @@ import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; import { toCurrency, toDate } from 'src/filters'; import { getUrl } from 'src/composables/getUrl'; -import { downloadFile } from 'src/composables/downloadFile'; - import CardSummary from 'components/ui/CardSummary.vue'; import VnLv from 'src/components/ui/VnLv.vue'; @@ -66,8 +64,8 @@ const vatColumns = ref([ { name: 'rate', label: 'invoiceIn.summary.rate', - field: (row) => row.taxRate, - format: (value) => value, + field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate), + format: (value) => toCurrency(value), sortable: true, align: 'left', }, @@ -173,6 +171,13 @@ function getIntrastatTotals(intrastat) { return totals; } +function getTaxTotal(tax) { + return tax.reduce( + (acc, cur) => acc + taxRate(cur.taxableBase, cur.taxTypeSage?.rate), + 0 + ); +} + function setData(entity) { if (!entity) return false; @@ -181,6 +186,13 @@ function setData(entity) { if (entity.invoiceInIntrastat.length) intrastatTotals.value = { ...getIntrastatTotals(entity.invoiceInIntrastat) }; } + +function taxRate(taxableBase, rate) { + if (rate && taxableBase) { + return (rate / 100) * taxableBase; + } + return 0; +} @@ -386,9 +349,10 @@ function setData(entity) { - + + - + + diff --git a/test/cypress/integration/claimAction.spec.js b/test/cypress/integration/claim/claimAction.spec.js similarity index 100% rename from test/cypress/integration/claimAction.spec.js rename to test/cypress/integration/claim/claimAction.spec.js