mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-10 12:24:50 +00:00
Expand accounts page.
This commit is contained in:
@@ -77,7 +77,7 @@ let index = function () {
|
||||
sort(column) {
|
||||
this.sortingColumn = column;
|
||||
this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
|
||||
const url = './accounts/'+type+'?column='+column+'&direction='+this.sortDirection;
|
||||
const url = './accounts/' + type + '?column=' + column + '&direction=' + this.sortDirection;
|
||||
|
||||
window.history.pushState({}, "", url);
|
||||
|
||||
@@ -140,6 +140,11 @@ let index = function () {
|
||||
this.accounts[index].nameEditorVisible = true;
|
||||
},
|
||||
loadAccounts() {
|
||||
|
||||
// get start and end from the store:
|
||||
const start = new Date(window.store.get('start'));
|
||||
const end = new Date(window.store.get('end'));
|
||||
|
||||
this.notifications.wait.show = true;
|
||||
this.notifications.wait.text = i18next.t('firefly.wait_loading_data')
|
||||
this.accounts = [];
|
||||
@@ -147,7 +152,7 @@ let index = function () {
|
||||
// &sorting[0][column]=description&sorting[0][direction]=asc
|
||||
const sorting = [{column: this.sortingColumn, direction: this.sortDirection}];
|
||||
// one page only.o
|
||||
(new Get()).index({sorting: sorting, type: type, page: this.page}).then(response => {
|
||||
(new Get()).index({sorting: sorting, type: type, page: this.page, start: start, end: end}).then(response => {
|
||||
for (let i = 0; i < response.data.data.length; i++) {
|
||||
if (response.data.data.hasOwnProperty(i)) {
|
||||
let current = response.data.data[i];
|
||||
@@ -165,7 +170,10 @@ let index = function () {
|
||||
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
|
||||
};
|
||||
console.log(current.attributes.balance_difference);
|
||||
this.accounts.push(account);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import {format} from "date-fns";
|
||||
import {getVariable} from "../../store/get-variable.js";
|
||||
import formatMoney from "../../util/format-money.js";
|
||||
import {getCacheKey} from "../../support/get-cache-key.js";
|
||||
import {cleanupCache} from "../../support/cleanup-cache.js";
|
||||
|
||||
let afterPromises = false;
|
||||
export default () => ({
|
||||
@@ -38,6 +39,7 @@ export default () => ({
|
||||
const start = new Date(window.store.get('start'));
|
||||
const end = new Date(window.store.get('end'));
|
||||
const boxesCacheKey = getCacheKey('dashboard-boxes-data', start, end);
|
||||
cleanupCache();
|
||||
|
||||
const cacheValid = window.store.get('cacheValid');
|
||||
let cachedData = window.store.get(boxesCacheKey);
|
||||
|
||||
34
resources/assets/v2/src/support/cleanup-cache.js
Normal file
34
resources/assets/v2/src/support/cleanup-cache.js
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* load-translations.js
|
||||
* Copyright (c) 2023 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/>.
|
||||
*/
|
||||
|
||||
import {format} from "date-fns";
|
||||
import store from "store";
|
||||
|
||||
function cleanupCache() {
|
||||
const localValue = store.get('lastActivity');
|
||||
|
||||
store.each(function(value, key) {
|
||||
if(key.startsWith('dcx') && !key.includes(localValue)) {
|
||||
store.remove(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export {cleanupCache};
|
||||
@@ -23,7 +23,7 @@ import store from "store";
|
||||
|
||||
function getCacheKey(string, start, end) {
|
||||
const localValue = store.get('lastActivity');
|
||||
const cacheKey = format(start, 'y-MM-dd') + '_' + format(end, 'y-MM-dd') + '_' + string + localValue;
|
||||
const cacheKey = 'dcx' + format(start, 'yMMdd')+ format(end, 'yMMdd') + string + localValue;
|
||||
console.log('getCacheKey: ' + cacheKey);
|
||||
return String(cacheKey);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
import {defineConfig} from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
import manifestSRI from 'vite-plugin-manifest-sri';
|
||||
import * as fs from "fs";
|
||||
|
||||
const host = '127.0.0.1';
|
||||
|
||||
@@ -64,8 +65,8 @@ export default defineConfig({
|
||||
],
|
||||
publicDirectory: '../../../public',
|
||||
refresh: true,
|
||||
}) //,
|
||||
// manifestSRI(),
|
||||
}),
|
||||
manifestSRI(),
|
||||
|
||||
],
|
||||
|
||||
@@ -73,5 +74,12 @@ export default defineConfig({
|
||||
server: {
|
||||
usePolling: true,
|
||||
host: '10.0.0.15',
|
||||
// hmr: {
|
||||
// protocol: 'wss',
|
||||
// },
|
||||
https: {
|
||||
key: fs.readFileSync(`/sites/vm/tls-certificates/wildcard.sd.internal.key`),
|
||||
cert: fs.readFileSync(`/sites/vm/tls-certificates/wildcard.sd.internal.crt`),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -2090,6 +2090,7 @@ return [
|
||||
'logout' => 'Logout',
|
||||
'logout_other_sessions' => 'Logout all other sessions',
|
||||
'toggleNavigation' => 'Toggle navigation',
|
||||
'toggle_dropdown' => 'Toggle dropdown',
|
||||
'searchPlaceholder' => 'Search...',
|
||||
'version' => 'Version',
|
||||
'dashboard' => 'Dashboard',
|
||||
|
||||
@@ -83,14 +83,30 @@
|
||||
<em x-show="sortingColumn === 'last_activity' && sortDirection === 'asc'" class="fa-solid fa-arrow-down-wide-short"></em>
|
||||
<em x-show="sortingColumn === 'last_activity' && sortDirection === 'desc'" class="fa-solid fa-arrow-up-wide-short"></em>
|
||||
</td>
|
||||
<td>Balance difference</td>
|
||||
<td> </td>
|
||||
<td>
|
||||
<a href="#" x-on:click.prevent="sort('balance_difference')">Balance difference</a>
|
||||
<em x-show="sortingColumn === 'balance_difference' && sortDirection === 'asc'" class="fa-solid fa-arrow-down-wide-short"></em>
|
||||
<em x-show="sortingColumn === 'balance_difference' && sortDirection === 'desc'" class="fa-solid fa-arrow-up-wide-short"></em>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template x-for="(account, index) in accounts" :key="index">
|
||||
<tr>
|
||||
<td>TODO</td>
|
||||
<td>
|
||||
<!-- Example split danger button -->
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a :href="'./accounts/edit/' + account.id" class="btn btn-sm btn-light"><em class="fa-solid fa-pencil"></em></a>
|
||||
<button type="button" class="btn btn-light dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<span class="visually-hidden">{{ __('firefly.toggle_dropdown') }}</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" :href="'./accounts/show/' + account.id"><em class="fa-solid fa-eye"></em> {{ __('firefly.show') }}</a></li>
|
||||
<li><a class="dropdown-item" :href="'./accounts/reconcile/' + account.id"><em class="fa-solid fa-calculator"></em> {{ __('firefly.reconcile_selected') }}</a></li>
|
||||
<li><a class="dropdown-item" :href="'./accounts/delete/' + account.id"><em class="fa-solid fa-trash"></em> {{ __('firefly.delete') }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<template x-if="account.active">
|
||||
<em class="text-success fa-solid fa-check"></em>
|
||||
@@ -150,8 +166,11 @@
|
||||
<td>
|
||||
<span x-text="account.last_activity"></span>
|
||||
</td>
|
||||
<td>TODO 2 </td>
|
||||
<td> </td>
|
||||
<td>
|
||||
<template x-if="null !== account.balance_difference">
|
||||
<span x-text="formatMoney(account.balance_difference, account.currency_code)"></span>
|
||||
</template>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
|
||||
@@ -35,7 +35,10 @@
|
||||
|
||||
<!-- begin date range drop down -->
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link daterange-holder" data-bs-toggle="dropdown" href="#"></a>
|
||||
<a class="nav-link daterange-holder d-none d-sm-block" data-bs-toggle="dropdown" href="#"></a>
|
||||
<a class="nav-link daterange-icon d-block d-sm-none" data-bs-toggle="dropdown" href="#">
|
||||
<em class="fa-regular fa-calendar-days"></em>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-end">
|
||||
<a href="#" class="dropdown-item daterange-current" @click="changeDateRange">
|
||||
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
</template>
|
||||
</h3>
|
||||
<template x-if="loading">
|
||||
<p>
|
||||
<p class="d-none d-xs-block">
|
||||
<em class="fa-solid fa-spinner fa-spin"></em>
|
||||
</p>
|
||||
</template>
|
||||
<template x-if="!loading && 0 !== balanceBox.amounts.length">
|
||||
<p>
|
||||
<p class="d-none d-sm-block">
|
||||
<a href="{{ route('reports.report.default', ['allAssetAccounts',$start->format('Ymd'),$end->format('Ymd')]) }}">{{ __('firefly.in_out_period') }}</a>
|
||||
</p>
|
||||
</template>
|
||||
<template x-if="!loading && 0 === balanceBox.amounts.length">
|
||||
<p>
|
||||
<p class="d-none d-sm-block">
|
||||
TODO (no money in or out)
|
||||
</p>
|
||||
</template>
|
||||
@@ -33,7 +33,7 @@
|
||||
<i class="fa-solid fa-scale-balanced"></i>
|
||||
</span>
|
||||
|
||||
<div class="small-box-footer hover-footer">
|
||||
<div class="small-box-footer hover-footer d-none d-xl-block">
|
||||
<template x-if="0 === balanceBox.subtitles.length">
|
||||
<span> </span>
|
||||
</template>
|
||||
@@ -66,21 +66,21 @@
|
||||
</h3>
|
||||
</template>
|
||||
<template x-if="loading">
|
||||
<p>
|
||||
<p class="d-none d-sm-block">
|
||||
<em class="fa-solid fa-spinner fa-spin"></em>
|
||||
</p>
|
||||
</template>
|
||||
<template x-if="!loading && billBox.unpaid.length > 0">
|
||||
<p><a href="{{ route('bills.index') }}">{{ __('firefly.bills_to_pay') }}</a></p>
|
||||
<p class="d-none d-sm-block"><a href="{{ route('bills.index') }}">{{ __('firefly.bills_to_pay') }}</a></p>
|
||||
</template>
|
||||
<template x-if="0 === billBox.unpaid.length && !loading">
|
||||
<p>TODO No subscriptions are waiting to be paid</p>
|
||||
<p class="d-none d-sm-block">TODO No subscriptions are waiting to be paid</p>
|
||||
</template>
|
||||
</div>
|
||||
<span class="small-box-icon">
|
||||
<em class="fa-regular fa-calendar"></em>
|
||||
</span>
|
||||
<span class="small-box-footer">
|
||||
<span class="small-box-footer d-none d-xl-block">
|
||||
<template x-if="0 === billBox.paid.length">
|
||||
<span> </span>
|
||||
</template>
|
||||
@@ -117,21 +117,21 @@
|
||||
</h3>
|
||||
|
||||
<template x-if="loading">
|
||||
<p>
|
||||
<p class="d-none d-sm-block">
|
||||
<em class="fa-solid fa-spinner fa-spin"></em>
|
||||
</p>
|
||||
</template>
|
||||
<template x-if="!loading && 0 !== leftBox.left.length">
|
||||
<p><a href="{{ route('budgets.index') }}">{{ __('firefly.left_to_spend') }}</a></p>
|
||||
<p class="d-none d-sm-block"><a href="{{ route('budgets.index') }}">{{ __('firefly.left_to_spend') }}</a></p>
|
||||
</template>
|
||||
<template x-if="!loading && 0 === leftBox.left.length">
|
||||
<p>TODO no money is budgeted in this period</p>
|
||||
<p class="d-none d-sm-block">TODO no money is budgeted in this period</p>
|
||||
</template>
|
||||
</div>
|
||||
<span class="small-box-icon">
|
||||
<em class="fa-solid fa-money-check-dollar"></em>
|
||||
</span>
|
||||
<span class="small-box-footer">
|
||||
<span class="small-box-footer d-none d-xl-block">
|
||||
<template x-if="0 !== leftBox.perDay.length">
|
||||
<span>{{ __('firefly.per_day') }}:</span>
|
||||
</template>
|
||||
@@ -163,12 +163,12 @@
|
||||
</h3>
|
||||
|
||||
<template x-if="loading">
|
||||
<p>
|
||||
<p class="d-none d-sm-block">
|
||||
<em class="fa-solid fa-spinner fa-spin"></em>
|
||||
</p>
|
||||
</template>
|
||||
<template x-if="!loading">
|
||||
<p>
|
||||
<p class="d-none d-sm-block">
|
||||
<a href="{{ route('reports.report.default', ['allAssetAccounts','currentYearStart','currentYearEnd']) }}">{{ __('firefly.net_worth') }}</a>
|
||||
</p>
|
||||
</template>
|
||||
@@ -176,7 +176,7 @@
|
||||
<span class="small-box-icon">
|
||||
<i class="fa-solid fa-chart-line"></i>
|
||||
</span>
|
||||
<span class="small-box-footer">
|
||||
<span class="small-box-footer d-none d-xl-block">
|
||||
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,16 @@
|
||||
<a class="nav-link" href="{{ route(Route::current()->getName(), Route::current()->parameters()) }}?force_default_layout=true">
|
||||
<i class="fa-solid fa-landmark"></i>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">
|
||||
<em class="fa-solid fa-sliders"></em>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">
|
||||
<em class="fa-solid fa-hat-wizard"></em>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link" data-bs-toggle="dropdown" href="#">
|
||||
|
||||
Reference in New Issue
Block a user