Start improving bill overview.

This commit is contained in:
James Cole
2025-07-30 20:35:28 +02:00
parent 671ff95f22
commit a7973190c2
6 changed files with 254 additions and 91 deletions

View File

@@ -163,14 +163,10 @@ function downloadSubscriptions(params) {
currency_code: bill.currency_code,
paid: 0,
unpaid: 0,
// native_currency_code: bill.native_currency_code,
// native_paid: 0,
//native_unpaid: 0,
};
}
subscriptionData[objectGroupId].payment_info[bill.currency_code].unpaid += totalAmount;
//subscriptionData[objectGroupId].payment_info[bill.currency_code].native_unpaid += totalNativeAmount;
}
if (current.attributes.paid_dates.length > 0) {
@@ -178,8 +174,6 @@ function downloadSubscriptions(params) {
if (current.attributes.paid_dates.hasOwnProperty(ii)) {
// bill is paid!
// since bill is paid, 3 possible currencies:
// native, currency, foreign currency.
// foreign currency amount (converted to native or not) will be ignored.
let currentJournal = current.attributes.paid_dates[ii];
// new array for the currency
if (!subscriptionData[objectGroupId].payment_info.hasOwnProperty(currentJournal.currency_code)) {
@@ -187,15 +181,10 @@ function downloadSubscriptions(params) {
currency_code: bill.currency_code,
paid: 0,
unpaid: 0,
// native_currency_code: bill.native_currency_code,
// native_paid: 0,
//native_unpaid: 0,
};
}
const amount = parseFloat(currentJournal.amount) * -1;
// const nativeAmount = parseFloat(currentJournal.native_amount) * -1;
subscriptionData[objectGroupId].payment_info[currentJournal.currency_code].paid += amount;
// subscriptionData[objectGroupId].payment_info[currentJournal.currency_code].native_paid += nativeAmount;
}
}
}
@@ -221,6 +210,14 @@ export default () => ({
formatMoney(amount, currencyCode) {
return formatMoney(amount, currencyCode);
},
eventListeners: {
['@convert-to-native.window'](event){
console.log('I heard that! (dashboard/subscriptions)');
this.convertToNative = event.detail;
this.startSubscriptions();
}
},
startSubscriptions() {
this.loading = true;
let start = new Date(window.store.get('start'));

View File

@@ -1865,6 +1865,8 @@ return [
// bills:
'left_to_pay_lc' => 'left to pay',
'less_than_expected' => 'less than expected',
'more_than_expected' => 'more than expected',
'skip_help_text' => 'Use the skip field to create bi-monthly (skip = 1) or other custom intervals.',
'subscription' => 'Subscription',
'not_expected_period' => 'Not expected this period',

View File

@@ -1,4 +1,4 @@
<div class="col" x-data="subscriptions">
<div class="col" x-data="subscriptions" x-bind="eventListeners">
<template x-for="group in subscriptions">
<div class="card mb-2">
<div class="card-header">
@@ -62,7 +62,16 @@
<template x-for="transaction in bill.transactions">
<li>
<span :title="transaction.amount" x-text="transaction.amount"></span>
(<span title="Less or more than expected." x-text="transaction.percentage"></span>%)
<template x-if="transaction.percentage < 0">
<span>
(<span :title="transaction.percentage + '% {{ __("firefly.less_than_expected") }}'" x-text="transaction.percentage"></span>%)
</span>
</template>
<template x-if="transaction.percentage > 0">
<span>
(<span :title="transaction.percentage + '% {{ __("firefly.more_than_expected") }}'" x-text="transaction.percentage"></span>%)
</span>
</template>
</li>
</template>
</ul>