New endpoint, fixed logo, better account overview.

This commit is contained in:
James Cole
2024-03-09 19:31:27 +01:00
parent f2c9e20aef
commit 9078781d61
17 changed files with 412 additions and 157 deletions

View File

@@ -36,12 +36,16 @@ import {getVariable} from "../store/get-variable.js";
import {getViewRange} from "../support/get-viewrange.js";
import {loadTranslations} from "../support/load-translations.js";
import adminlte from 'admin-lte';
store.addPlugin(observePlugin);
window.bootstrapped = false;
window.store = store;
// always grab the preference "marker" from Firefly III.
getFreshVariable('lastActivity').then((serverValue) => {
const localValue = store.get('lastActivity');

View File

@@ -51,9 +51,17 @@ let index = function () {
enabled: true
},
},
sortingColumn: '',
sortDirection: '',
accounts: [],
sort(column) {
this.sortingColumn = column;
this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
this.loadAccounts();
return false;
},
formatMoney(amount, currencyCode) {
return formatMoney(amount, currencyCode);
},
@@ -69,14 +77,29 @@ let index = function () {
},
loadAccounts() {
this.notifications.wait.show = true;
this.notifications.wait.text = i18next.t('firefly.wait_loading_data')
this.accounts = [];
// sort instructions
// &sorting[0][column]=description&sorting[0][direction]=asc
const sorting = [{column: this.sortingColumn, direction: this.sortDirection}];
// one page only.
(new Get()).index({type: type, page: this.page}).then(response => {
(new Get()).index({sorting: sorting, type: type, page: this.page}).then(response => {
for (let i = 0; i < response.data.data.length; i++) {
if (response.data.data.hasOwnProperty(i)) {
let current = response.data.data[i];
let account = {
id: parseInt(current.id),
active: current.attributes.active,
name: current.attributes.name,
type: current.attributes.type,
// role: current.attributes.account_role,
iban: null === current.attributes.iban ? '' : current.attributes.iban.match(/.{1,4}/g).join(' '),
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,
};
this.accounts.push(account);
}

View File

@@ -0,0 +1,105 @@
/*!
* adminlte-filteres.scss
* Copyright (c) 2024 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
// less adminlte code because the CSS is massive otherwise.
// copied from:
/*!
* AdminLTE v4.0.0-alpha2
* Author: Colorlib
* Website: AdminLTE.io <https://adminlte.io>
* License: Open source - MIT <https://opensource.org/licenses/MIT>
*/
// Bootstrap Configuration
// ---------------------------------------------------
@import "bootstrap/scss/functions";
// AdminLTE Configuration
// ---------------------------------------------------
@import "admin-lte/src/scss/bootstrap-variables"; // little modified are here
// Bootstrap Configuration
// ---------------------------------------------------
@import "bootstrap/scss/variables";
@import "bootstrap/scss/variables-dark";
@import "bootstrap/scss/maps";
@import "bootstrap/scss/mixins";
@import "bootstrap/scss/utilities";
// Bootstrap Layout & components
@import "bootstrap/scss/root";
@import "bootstrap/scss/reboot";
@import "bootstrap/scss/type";
@import "bootstrap/scss/images";
@import "bootstrap/scss/containers";
@import "bootstrap/scss/grid";
@import "bootstrap/scss/tables";
@import "bootstrap/scss/forms";
@import "bootstrap/scss/buttons";
@import "bootstrap/scss/transitions";
@import "bootstrap/scss/dropdown";
@import "bootstrap/scss/button-group";
@import "bootstrap/scss/nav";
@import "bootstrap/scss/navbar";
@import "bootstrap/scss/card";
//@import "bootstrap/scss/accordion";
@import "bootstrap/scss/breadcrumb";
@import "bootstrap/scss/pagination";
@import "bootstrap/scss/badge";
@import "bootstrap/scss/alert";
@import "bootstrap/scss/progress";
@import "bootstrap/scss/list-group";
@import "bootstrap/scss/close";
//@import "bootstrap/scss/toasts";
@import "bootstrap/scss/modal";
@import "bootstrap/scss/tooltip";
@import "bootstrap/scss/popover";
//@import "bootstrap/scss/carousel";
@import "bootstrap/scss/spinners";
@import "bootstrap/scss/offcanvas";
@import "bootstrap/scss/placeholders";
// Bootstrap Helpers
@import "bootstrap/scss/helpers";
// Bootstrap Utilities
@import "bootstrap/scss/utilities/api";
// AdminLTE Configuration
// ---------------------------------------------------
@import "admin-lte/src/scss/variables";
@import "admin-lte/src/scss/variables-dark";
@import "admin-lte/src/scss/mixins";
// AdiminLTE Parts
// ---------------------------------------------------
@import "admin-lte/src/scss/parts/core";
@import "admin-lte/src/scss/parts/components";
@import "admin-lte/src/scss/parts/extra-components";
// @import "admin-lte/src/scss/parts/pages";
@import "admin-lte/src/scss/pages/login_and_register";
@import "admin-lte/src/scss/parts/miscellaneous";

View File

@@ -38,7 +38,7 @@ $success: #64B624 !default;
// @import "bootstrap/scss/bootstrap";
// admin LTE
@import "admin-lte/src/scss/adminlte";
@import "adminlte-filtered";
// @import "~bootstrap-sass/assets/stylesheets/bootstrap";

View File

@@ -57,11 +57,27 @@
<thead>
<tr>
<td>&nbsp;</td>
<td>Active?</td>
<td>Name</td>
<td>
<a href="#" x-on:click.prevent="sort('active')">Active?</a>
<em x-show="sortingColumn === 'active' && sortDirection === 'asc'" class="fa-solid fa-arrow-down-wide-short"></em>
<em x-show="sortingColumn === 'active' && sortDirection === 'desc'" class="fa-solid fa-arrow-up-wide-short"></em>
</td>
<td>
<a href="#" x-on:click.prevent="sort('name')">Name</a>
<em x-show="sortingColumn === 'name' && sortDirection === 'asc'" class="fa-solid fa-arrow-down-z-a"></em>
<em x-show="sortingColumn === 'name' && sortDirection === 'desc'" class="fa-solid fa-arrow-up-z-a"></em>
</td>
<td>Type</td>
<td>Account number</td>
<td>Current balance</td>
<td>
<a href="#" x-on:click.prevent="sort('iban')">Account number</a>
<em x-show="sortingColumn === 'iban' && sortDirection === 'asc'" class="fa-solid fa-arrow-down-z-a"></em>
<em x-show="sortingColumn === 'iban' && sortDirection === 'desc'" class="fa-solid fa-arrow-up-z-a"></em>
</td>
<td>
<a href="#" x-on:click.prevent="sort('balance')">Current balance</a>
<em x-show="sortingColumn === 'balance' && sortDirection === 'asc'" class="fa-solid fa-arrow-down-wide-short"></em>
<em x-show="sortingColumn === 'balance' && sortDirection === 'desc'" class="fa-solid fa-arrow-up-wide-short"></em>
</td>
<td>Last activity</td>
<td>Balance difference</td>
<td>&nbsp;</td>
@@ -70,20 +86,46 @@
<tbody>
<template x-for="(account, index) in accounts" :key="index">
<tr>
<td>&nbsp;</td>
<td>TODO</td>
<td>
&nbsp;
<template x-if="account.active">
<em class="text-success fa-solid fa-check"></em>
&nbsp;</template>
<template x-if="!account.active">
<em class="text-danger fa-solid fa-xmark"></em>
&nbsp;</template>
</td>
<td>
<a :href="'./accounts/show/' + account.id">
<span x-text="account.name"></span>
</a>
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>
<span x-text="account.type"></span>
<span x-text="account.role"></span>
</td>
<td>
<!-- IBAN and no account nr -->
<template x-if="'' === account.account_number && '' !== account.iban">
<span x-text="account.iban + 'A'"></span>
</template>
<!-- no IBAN and account nr -->
<template x-if="'' !== account.account_number && '' === account.iban">
<span x-text="account.account_number"></span>
</template>
<!-- both -->
<template x-if="'' !== account.account_number && '' !== account.iban">
<span>
<span x-text="account.iban"></span>
(<span x-text="account.account_number"></span>)
</span>
</template>
</td>
<td>
<span x-text="formatMoney(account.current_balance, account.currency_code)"></span>
</td>
<td>TODO</td>
<td>TODO</td>
<td>&nbsp;</td>
</tr>
</template>

View File

@@ -4,7 +4,7 @@
<!--begin::Brand Link-->
<a href="{{route('index') }}" class="brand-link">
<!--begin::Brand Image-->
<img src="v2/i/logo.png" alt="Firefly III Logo"
<img src="images/logo.png" alt="Firefly III Logo"
class="brand-image opacity-75 shadow">
<!--end::Brand Image-->
<!--begin::Brand Text-->