mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-11 17:39:41 +00:00
Expand balances.
This commit is contained in:
@@ -352,12 +352,15 @@ let index = function () {
|
||||
|
||||
// filter instructions
|
||||
let filters = {};
|
||||
let type = this.filters.type;
|
||||
let active = this.filters.active;
|
||||
for (let k in this.filters) {
|
||||
if (this.filters.hasOwnProperty(k) && null !== this.filters[k]) {
|
||||
filters[k] = this.filters[k];
|
||||
//filters.push({column: k, filter: this.filters[k]});
|
||||
}
|
||||
}
|
||||
delete filters.type;
|
||||
|
||||
// get start and end from the store:
|
||||
const start = new Date(window.store.get('start'));
|
||||
@@ -367,24 +370,23 @@ let index = function () {
|
||||
let params = {
|
||||
sort: sorting,
|
||||
filter: filters,
|
||||
active: active,
|
||||
currentMoment: today,
|
||||
// type: type,
|
||||
page: {number: this.page},
|
||||
type: type,
|
||||
page: this.page,
|
||||
startPeriod: start,
|
||||
endPeriod: end
|
||||
};
|
||||
|
||||
if (!this.tableColumns.balance_difference.enabled) {
|
||||
delete params.startPeriod;
|
||||
delete params.enPeriod;
|
||||
delete params.endPeriod;
|
||||
}
|
||||
this.accounts = [];
|
||||
let groupedAccounts = {};
|
||||
// one page only.o
|
||||
(new Get()).index(params).then(response => {
|
||||
console.log(response);
|
||||
this.totalPages = response.meta.pagination.total_pages;
|
||||
console.log('a');
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
if (response.data.hasOwnProperty(i)) {
|
||||
let current = response.data[i];
|
||||
@@ -399,18 +401,14 @@ let index = function () {
|
||||
account_number: null === current.attributes.account_number ? '' : current.attributes.account_number,
|
||||
current_balance: current.attributes.current_balance,
|
||||
currency_code: current.attributes.currency_code,
|
||||
//native_current_balance: current.attributes.native_current_balance,
|
||||
//native_currency_code: current.attributes.native_currency_code,
|
||||
last_activity: null === current.attributes.last_activity ? '' : format(new Date(current.attributes.last_activity), i18next.t('config.month_and_day_fns')),
|
||||
//balance_difference: current.attributes.balance_difference,
|
||||
//native_balance_difference: current.attributes.native_balance_difference,
|
||||
liability_type: current.attributes.liability_type,
|
||||
liability_direction: current.attributes.liability_direction,
|
||||
interest: current.attributes.interest,
|
||||
interest_period: current.attributes.interest_period,
|
||||
//current_debt: current.attributes.current_debt,
|
||||
balance: current.attributes.balance,
|
||||
native_balance: current.attributes.native_balance,
|
||||
balances: current.attributes.balances,
|
||||
};
|
||||
// get group info:
|
||||
let groupId = current.attributes.object_group_id;
|
||||
|
||||
@@ -196,6 +196,14 @@ export default () => ({
|
||||
(new Get).show(accountId, new Date(window.store.get('end'))).then((response) => {
|
||||
let parent = response.data.data;
|
||||
|
||||
// apply function to each element of parent:
|
||||
parent.attributes.balances = parent.attributes.balances.map((balance) => {
|
||||
balance.amount_formatted = formatMoney(balance.amount, balance.currency_code);
|
||||
return balance;
|
||||
});
|
||||
console.log(parent);
|
||||
|
||||
|
||||
// get groups for account:
|
||||
const params = {
|
||||
page: 1,
|
||||
@@ -243,8 +251,7 @@ export default () => ({
|
||||
name: parent.attributes.name,
|
||||
order: parent.attributes.order,
|
||||
id: parent.id,
|
||||
balance: parent.attributes.balance,
|
||||
//native_balance: parent.attributes.native_balance,
|
||||
balances: parent.attributes.balances,
|
||||
groups: groups,
|
||||
});
|
||||
// console.log(parent.attributes);
|
||||
|
||||
@@ -76,7 +76,7 @@ function parsePaidTransactions(paid_dates, bill) {
|
||||
for (let i in paid_dates) {
|
||||
if (paid_dates.hasOwnProperty(i)) {
|
||||
const currentPayment = paid_dates[i];
|
||||
console.log(currentPayment);
|
||||
// console.log(currentPayment);
|
||||
// math: -100+(paid/expected)*100
|
||||
let percentage = Math.round(-100 + ((parseFloat(currentPayment.amount) ) / parseFloat(bill.amount)) * 100);
|
||||
let currentTransaction = {
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
x-text="account.name"></a>
|
||||
|
||||
<span class="small">
|
||||
<template x-for="balance in account.balance">
|
||||
<span>x</span>
|
||||
<template x-for="balance in account.balances">
|
||||
<template x-if="balance.type === 'current'">
|
||||
<span class="text-muted">(<span x-text="balance.amount_formatted"></span>)
|
||||
</span>
|
||||
</template>
|
||||
</template>
|
||||
<template x-for="balance in account.native_balance">
|
||||
<span>Y</span>
|
||||
</template>
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
|
||||
Reference in New Issue
Block a user