Compare commits

..

No commits in common. "21ad042cea724340ac285e558fa2c09f2f7ef032" and "b1385cf08aa69c0a5eb49ca0003aca0ba18c9860" have entirely different histories.

2 changed files with 15 additions and 13 deletions

View File

@ -1,25 +1,25 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { toCurrency } from 'filters/index';
import { ref } from 'vue';
import FetchData from 'components/FetchData.vue';
const balanceDueTotal = ref(0);
import { toCurrency } from 'filters/index';
const $props = defineProps({
amount: {
type: Number,
required: true,
},
});
const { t } = useI18n();
</script>
<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">
<h6 class="title_balance text-center">{{ t('Total') }}</h6>
<div class="row">
<p class="key_balance">{{ t('Balance due') }}:&ensp;</p>
<b class="value_balance">
{{ toCurrency(balanceDueTotal) }}
{{ toCurrency($props.amount) }}
</b>
</div>
</div>

View File

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