From 126e1323bf7f074047c781f2533a135327df2ec3 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 14 Dec 2023 12:06:25 +0100 Subject: [PATCH 1/7] refs #6334 refresh --- src/pages/Claim/Card/ClaimLines.vue | 116 ++++++---------------------- 1 file changed, 25 insertions(+), 91 deletions(-) diff --git a/src/pages/Claim/Card/ClaimLines.vue b/src/pages/Claim/Card/ClaimLines.vue index 9d2a12804..4eaef2958 100644 --- a/src/pages/Claim/Card/ClaimLines.vue +++ b/src/pages/Claim/Card/ClaimLines.vue @@ -6,9 +6,8 @@ import { useQuasar } from 'quasar'; import { useRoute } from 'vue-router'; import { useArrayData } from 'composables/useArrayData'; import { useStateStore } from 'stores/useStateStore'; -import VnPaginate from 'components/ui/VnPaginate.vue'; +import CrudModel from 'components/CrudModel.vue'; import FetchData from 'components/FetchData.vue'; -import VnConfirm from 'components/ui/VnConfirm.vue'; import { toDate, toCurrency, toPercentage } from 'filters/index'; import VnDiscount from 'components/common/vnDiscount.vue'; @@ -17,6 +16,7 @@ import ClaimLinesImport from './ClaimLinesImport.vue'; const quasar = useQuasar(); const route = useRoute(); const { t } = useI18n(); + const stateStore = useStateStore(); const arrayData = useArrayData('ClaimLines'); const store = arrayData.store; @@ -36,16 +36,17 @@ const linesFilter = { }, }; +const claimLinesForm = ref(); const claim = ref(null); async function onFetchClaim(data) { claim.value = data; - fetchMana(); } -const amount = ref(0); -const amountClaimed = ref(0); +const amount = ref(); +const amountClaimed = ref(); async function onFetch(rows) { + if (!rows || !rows.length) return; amount.value = rows.reduce( (acumulator, { sale }) => acumulator + sale.price * sale.quantity, 0 @@ -141,60 +142,23 @@ function onUpdateDiscount(response) { }); } -async function confirmRemove() { - const rows = selected.value; - const count = rows.length; - - if (count === 0) { - return quasar.notify({ - message: 'You must select at least one row', - type: 'warning', - }); - } - - quasar - .dialog({ - component: VnConfirm, - componentProps: { - title: t('Delete claimed sales'), - message: t('You are about to remove {count} rows', count, { count }), - data: { rows }, - promise: remove, - }, - }) - .onOk(() => { - for (const row of rows) { - const orgData = store.data; - const index = orgData.findIndex((item) => item.id === row.id); - store.data.splice(index, 1); - selected.value = []; - } - }); -} - -async function remove({ rows }) { - if (!rows.length) return; - const body = { deletes: rows.map((row) => row.id) }; - await axios.post(`ClaimBeginnings/crud`, body); - quasar.notify({ - type: 'positive', - message: t('globals.rowRemoved'), - }); -} - function showImportDialog() { quasar .dialog({ component: ClaimLinesImport, + componentProps: { + ticketId: claim.value.ticketFk, + }, }) - .onOk(() => arrayData.refresh()); + .onOk(() => claimLinesForm.value.reload()); +} +function isSubToolbarShown() { + return amount.value && amountClaimed; } - + - -
- - {{ t('globals.remove') }} - - - {{ t('globals.add') }} - - -
-
- - - - - - - - - + + @@ -421,7 +356,6 @@ en: You are about to remove {count} row | You are about to remove {count} rows' es: - Claimed lines: LĂ­neas reclamadas Delivered: Entregado Quantity: Cantidad Claimed: Reclamada From 3acc4b0d58d73c1e421a4f648d1b3d946d3f504e Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 3 Jan 2024 09:59:27 +0100 Subject: [PATCH 2/7] vn qtoolbar --- src/pages/Claim/Card/ClaimCard.vue | 14 +++++++++++++- src/pages/Claim/Card/ClaimLines.vue | 4 +++- src/pages/Customer/Card/CustomerCard.vue | 7 +++++++ src/stores/useStateStore.js | 11 +++++++---- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/pages/Claim/Card/ClaimCard.vue b/src/pages/Claim/Card/ClaimCard.vue index a8c832967..41e4a46cb 100644 --- a/src/pages/Claim/Card/ClaimCard.vue +++ b/src/pages/Claim/Card/ClaimCard.vue @@ -8,7 +8,7 @@ import { useI18n } from 'vue-i18n'; import { useRoute } from 'vue-router'; import ClaimDescriptor from './ClaimDescriptor.vue'; -import { onMounted } from 'vue'; +import { onMounted, onUnmounted } from 'vue'; const stateStore = useStateStore(); const { t } = useI18n(); const route = useRoute(); @@ -22,6 +22,18 @@ const $props = defineProps({ const entityId = computed(() => { return $props.id || route.params.id; }); + +onMounted(() => { + console.log('MOUNTED', stateStore.isSubToolbarShown()); + stateStore.toggleSubToolbar(); + console.log('MOUNTED', stateStore.isSubToolbarShown()); +}); + +onUnmounted(() => { + console.log('MOUNTED', stateStore.isSubToolbarShown()); + stateStore.toggleSubToolbar(); + console.log('MOUNTED', stateStore.isSubToolbarShown()); +});