From ea7ee97867f7feed2a11a7dacbeb6e29a69c7e0d Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 25 Jun 2024 09:35:21 +0200 Subject: [PATCH 1/2] proposals --- .../Ticket/Card/BasicData/BasicDataTable.vue | 6 +- .../Card/BasicData/TicketBasicDataForm.vue | 127 +++++++++--------- 2 files changed, 64 insertions(+), 69 deletions(-) diff --git a/src/pages/Ticket/Card/BasicData/BasicDataTable.vue b/src/pages/Ticket/Card/BasicData/BasicDataTable.vue index ef7d10a46..c14c95a70 100644 --- a/src/pages/Ticket/Card/BasicData/BasicDataTable.vue +++ b/src/pages/Ticket/Card/BasicData/BasicDataTable.vue @@ -106,10 +106,7 @@ const totalNewPrice = computed(() => { }); const totalDifference = computed(() => { - return rows.value.reduce( - (acc, item) => acc + item.component.difference * item.quantity, - 0 - ); + return rows.value.reduce((acc, item) => acc + item.component.difference, 0); }); const ticketHaveNegatives = () => { @@ -225,6 +222,7 @@ onUnmounted(() => (stateStore.rightDrawer = false)); :pagination="{ rowsPerPage: 0 }" class="full-width q-mt-md" :no-data-label="t('globals.noResults')" + flat > - + onFormModelInit()); - + From 9817ae8c2c1a32cbb7270b8f9499174adb186eb4 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 25 Jun 2024 13:35:16 +0200 Subject: [PATCH 2/2] fix: column hidden v-if --- src/pages/Ticket/Card/BasicData/BasicDataTable.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/pages/Ticket/Card/BasicData/BasicDataTable.vue b/src/pages/Ticket/Card/BasicData/BasicDataTable.vue index c14c95a70..60aeeb4f9 100644 --- a/src/pages/Ticket/Card/BasicData/BasicDataTable.vue +++ b/src/pages/Ticket/Card/BasicData/BasicDataTable.vue @@ -45,15 +45,18 @@ watch( const columns = computed(() => [ { + required: true, label: t('basicData.item'), name: 'item', align: 'left', format: (val) => val.name, }, { + required: true, label: t('basicData.description'), name: 'description', align: 'left', + hidden: true, }, { label: t('basicData.movable'), @@ -61,12 +64,14 @@ const columns = computed(() => [ align: 'left', }, { + required: true, label: t('basicData.quantity'), name: 'quantity', field: 'quantity', align: 'left', }, { + required: true, label: t('basicData.pricePPU'), name: 'price', field: 'price', @@ -74,6 +79,7 @@ const columns = computed(() => [ format: (val) => toCurrency(val), }, { + required: true, label: t('basicData.newPricePPU'), name: 'newPrice', field: (row) => row.component.newPrice, @@ -81,6 +87,7 @@ const columns = computed(() => [ format: (val) => toCurrency(val), }, { + required: true, label: t('basicData.difference'), name: 'difference', field: (row) => row.component.difference, @@ -108,18 +115,18 @@ const totalNewPrice = computed(() => { const totalDifference = computed(() => { return rows.value.reduce((acc, item) => acc + item.component.difference, 0); }); - +const showMovablecolumn = computed(() => (haveDifferences.value > 0 ? ['movable'] : [])); +const haveDifferences = computed(() => _ticketData.value.sale.haveDifferences); const ticketHaveNegatives = () => { let _haveNegatives = false; let haveNotNegatives = false; _ticketData.value.withoutNegatives = false; - const haveDifferences = _ticketData.value.sale.haveDifferences; _ticketData.value.sale.items.forEach((item) => { if (item.quantity > item.movable) _haveNegatives = true; else haveNotNegatives = true; }); - haveNegatives.value = _haveNegatives && haveNotNegatives && haveDifferences; + haveNegatives.value = _haveNegatives && haveNotNegatives && haveDifferences.value; if (haveNegatives.value) _ticketData.value.withoutNegatives = true; }; @@ -216,6 +223,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));