Skip to content

Firefly III: a personal finances manager

Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop

James Cole73f7cb426fc0
diff --cc resources/assets/v3/js/pages/dashboard/dashboard.js
index a289a08257,bee437342a..a16c44f777
--- a/resources/assets/v3/js/pages/dashboard/dashboard.js
+++ b/resources/assets/v3/js/pages/dashboard/dashboard.js
@@@ -23,11 -23,8 +23,11 @@@ import sidebar from "../../pages/shared
import dates from "../shared/dates.js";
import boxes from "./boxes.js";
import Alpine from "alpinejs";
- import Get from '../../api/model/piggy-bank/get.js';
+ import Get from "../../api/model/piggy-bank/get.js";
import formatMoney from "../../util/format-money.js";
+import {getVariable} from "../../store/get-variable.js";
+import {drawMultiCurrencyChart} from "../../shared/draw-chart.js";
+import format from "../../util/format.js";
let index = function () {
return {
@@@ -51,20 -38,34 +51,21 @@@
this.downloadPiggyBanks(1);
},
downloadPiggyBanks(page) {
- (new Get).list({page: page}).then((response) => {
- for(let i =0;i<response.data.data.length;i++){
- if(Object.hasOwn(response.data.data, i)){
+ new Get().list({ page: page }).then((response) => {
+ for (let i = 0; i < response.data.data.length; i++) {
+ if (Object.hasOwn(response.data.data, i)) {
let current = response.data.data[i];
+ let currentAmount = null === current.attributes.current_amount ? '0': current.attributes.current_amount;
+ let targetAmount = null === current.attributes.target_amount ? '0': current.attributes.target_amount;
let piggy = {
id: current.id,
name: current.attributes.name,
- percentage:
- null === current.attributes.percentage
- ? 0
- : parseInt(current.attributes.percentage),
- amount:
- formatMoney(
- current.attributes.current_amount,
- current.attributes.currency_code,
- ) +
- " / " +
- formatMoney(
- current.attributes.target_amount,
- current.attributes.currency_code,
- ),
+ percentage: null === current.attributes.percentage ? 0 : parseInt(current.attributes.percentage),
+ amount: formatMoney(currentAmount, current.attributes.currency_code) + ' / ' + formatMoney(targetAmount, current.attributes.currency_code)
};
- if (null === current.attributes.target_amount) {
- piggy.amount =
- formatMoney(
- current.attributes.current_amount,
- current.attributes.currency_code,
- ) + " / ∞";
+ if(null === current.attributes.target_amount) {
+ piggy.amount = formatMoney(currentAmount, current.attributes.currency_code) + ' / ∞';
++
}
this.piggyBanks.push(piggy);