Improve account list and view.

This commit is contained in:
James Cole
2025-08-31 19:20:02 +02:00
parent d959526eb3
commit 1e7ea4b76c
8 changed files with 154 additions and 67 deletions

View File

@@ -32,6 +32,7 @@ import {showWizardButton} from "../../support/page-settings/show-wizard-button.j
import {setVariable} from "../../store/set-variable.js";
import {getVariables} from "../../store/get-variables.js";
import pageNavigation from "../../support/page-navigation.js";
import {getVariable} from "../../store/get-variable.js";
// set type from URL
@@ -56,12 +57,12 @@ if(sortingColumn[0] === '-') {
page = parseInt(params.page ?? 1);
showInternalsButton();
showWizardButton();
// TODO currency conversion
// TODO page cleanup and recycle for transaction lists.
// TODO process startPeriod and endPeriod.
let index = function () {
return {
@@ -73,9 +74,9 @@ let index = function () {
show: false, text: '', url: '',
}, wait: {
show: false, text: '',
}
},
convertToPrimary: false,
totalPages: 1,
page: 1,
pageUrl: '',
@@ -259,6 +260,7 @@ let index = function () {
{name: this.getPreferenceKey('sd'), default: ''},
{name: this.getPreferenceKey('filters'), default: this.filters},
{name: this.getPreferenceKey('grouped'), default: true},
{name: 'convert_to_primary', default: false},
]).then((res) => {
// process columns:
for (let k in res[0]) {
@@ -283,6 +285,9 @@ let index = function () {
// group accounts
this.pageOptions.groupedAccounts = res[4];
// convert to primary?
this.convertToPrimary = res[5];
this.loadAccounts();
});
},
@@ -348,7 +353,6 @@ let index = function () {
if('asc' === this.pageOptions.sortDirection && '' !== sorting) {
sorting = '-' + sorting;
}
//const sorting = [{column: this.pageOptions.sortingColumn, direction: this.pageOptions.sortDirection}];
// filter instructions
let filters = {};
@@ -371,20 +375,20 @@ let index = function () {
sort: sorting,
filter: filters,
active: active,
currentMoment: today,
date: format(today,'yyyy-MM-dd'),
type: type,
page: this.page,
startPeriod: start,
endPeriod: end
// startPeriod: start,
// endPeriod: end
};
if (!this.tableColumns.balance_difference.enabled) {
delete params.startPeriod;
delete params.endPeriod;
// delete params.startPeriod;
// delete params.endPeriod;
}
this.accounts = [];
let groupedAccounts = {};
// one page only.o
// one page only
(new Get()).index(params).then(response => {
this.totalPages = response.meta.pagination.total_pages;
for (let i = 0; i < response.data.length; i++) {
@@ -406,9 +410,9 @@ let index = function () {
liability_direction: current.attributes.liability_direction,
interest: current.attributes.interest,
interest_period: current.attributes.interest_period,
balance: current.attributes.balance,
pc_balance: current.attributes.pc_balance,
balances: current.attributes.balances,
// balance: current.attributes.balance,
// pc_balance: current.attributes.pc_balance,
// balances: current.attributes.balances,
};
// get group info:
let groupId = current.attributes.object_group_id;
@@ -426,10 +430,9 @@ let index = function () {
}
}
groupedAccounts[groupId].accounts.push(account);
//this.accounts.push(account);
}
}
// order grouped accounts by order.
let sortable = [];
for (let set in groupedAccounts) {