Compare commits

...

2 Commits

Author SHA1 Message Date
Robert Ferrús 21ad042cea feat: refs #8077 customerBalanceDueTotal
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2024-10-15 10:24:09 +02:00
Robert Ferrús 1095538a08 feat: refs #8077 customerDefaulter 2024-10-14 13:03:42 +02:00
2 changed files with 12 additions and 14 deletions

View File

@ -1,25 +1,25 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toCurrency } from 'filters/index'; import { toCurrency } from 'filters/index';
import { ref } from 'vue';
import FetchData from 'components/FetchData.vue';
const $props = defineProps({ const balanceDueTotal = ref(0);
amount: {
type: Number,
required: true,
},
});
const { t } = useI18n(); const { t } = useI18n();
</script> </script>
<template> <template>
<FetchData
:url="`Defaulters/filter?sumAmount=true`"
auto-load
@on-fetch="( [{sumAmount}] ) => balanceDueTotal = sumAmount"
></FetchData>
<div class="card_balance q-px-md q-py-sm q-my-sm"> <div class="card_balance q-px-md q-py-sm q-my-sm">
<h6 class="title_balance text-center">{{ t('Total') }}</h6> <h6 class="title_balance text-center">{{ t('Total') }}</h6>
<div class="row"> <div class="row">
<p class="key_balance">{{ t('Balance due') }}:&ensp;</p> <p class="key_balance">{{ t('Balance due') }}:&ensp;</p>
<b class="value_balance"> <b class="value_balance">
{{ toCurrency($props.amount) }} {{ toCurrency(balanceDueTotal) }}
</b> </b>
</div> </div>
</div> </div>

View File

@ -16,7 +16,6 @@ const { t } = useI18n();
const quasar = useQuasar(); const quasar = useQuasar();
const dataRef = ref(null); const dataRef = ref(null);
const balanceDueTotal = ref(0);
const selected = ref([]); const selected = ref([]);
const columns = computed(() => [ const columns = computed(() => [
@ -165,9 +164,7 @@ const viewAddObservation = (rowsSelected) => {
}); });
}; };
const onFetch = async (data) => {
balanceDueTotal.value = data.reduce((acc, { amount = 0 }) => acc + amount, 0);
};
function exprBuilder(param, value) { function exprBuilder(param, value) {
switch (param) { switch (param) {
@ -190,9 +187,10 @@ function exprBuilder(param, value) {
</script> </script>
<template> <template>
<VnSubToolbar> <VnSubToolbar>
<template #st-data> <template #st-data>
<CustomerBalanceDueTotal :amount="balanceDueTotal" /> <CustomerBalanceDueTotal/>
</template> </template>
<template #st-actions> <template #st-actions>
<QBtn <QBtn