Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Update pages.
James Coleb3bf43e6b21b
diff --git a/app/View/Components/Dashboard/Boxes.php b/app/View/Components/Dashboard/Boxes.phpnew file mode 100644index 0000000000..07b2967d08--- /dev/null+++ b/app/View/Components/Dashboard/Boxes.php@@ -0,0 +1,27 @@+<?php++namespace FireflyIII\View\Components\Dashboard;++use Carbon\Carbon;+use Closure;+use Illuminate\Contracts\View\View;+use Illuminate\View\Component;++class Boxes extends Component+{+ /**+ * Create a new component instance.+ */+ public function __construct(public Carbon $start, public Carbon $end)+ {+ //+ }++ /**+ * Get the view / contents that represent the component.+ */+ public function render(): View|Closure|string+ {+ return view('components.dashboard.boxes');+ }+}diff --git a/config/breadcrumbs.php b/config/breadcrumbs.phpindex 0990173a93..295e2c3824 100644--- a/config/breadcrumbs.php+++ b/config/breadcrumbs.php@@ -49,7 +49,7 @@ return [|*/- 'view' => 'partials/layout/breadcrumbs',+ 'view' => 'partials/layout/breadcrumbs-v3',/*|--------------------------------------------------------------------------diff --git a/resources/assets/v3/js/api/summary/index.js b/resources/assets/v3/js/api/summary/index.jsnew file mode 100644index 0000000000..7ca126eaf3--- /dev/null+++ b/resources/assets/v3/js/api/summary/index.js@@ -0,0 +1,28 @@+/*+ * index.js+ * Copyright (c) 2023 [email protected]+ *+ * 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 {api} from "../../../boot/axios.js";++export default class Summary {+ get(start, end, code) {+ return api.get('/api/v1/summary/basic', {params: {start: start, end: end, code: code}});+ }+}diff --git a/resources/assets/v3/js/boot/axios.js b/resources/assets/v3/js/boot/axios.jsnew file mode 100644index 0000000000..0a8687eb40--- /dev/null+++ b/resources/assets/v3/js/boot/axios.js@@ -0,0 +1,40 @@+/*+ * axios.js+ * Copyright (c) 2022 [email protected]+ *+ * 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 axios from 'axios'++// Be careful when using SSR for cross-request state pollution+// due to creating a Singleton instance here;+// If any client changes this (global) instance, it might be a+// good idea to move this instance creation inside of the+// "export default () => {}" function below (which runs individually+// for each client)+++// for use inside Vue files (Options API) through this.$axios and this.$api+++const url = '/';+const api = axios.create({baseURL: url, withCredentials: true});++axios.defaults.withCredentials = true;+axios.defaults.baseURL = url;++export {api}diff --git a/resources/assets/v3/js/pages/dashboard/boxes.js b/resources/assets/v3/js/pages/dashboard/boxes.jsnew file mode 100644index 0000000000..901948e844--- /dev/null+++ b/resources/assets/v3/js/pages/dashboard/boxes.js@@ -0,0 +1,190 @@+/*+ * boxes.js+ * Copyright (c) 2026 [email protected]+ *+ * 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 Summary from "../../api/summary/index.js";+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 () => ({+ balanceBox: {amounts: [], subtitles: []},+ billBox: {paid: [], unpaid: []},+ leftBox: {left: [], perDay: []},+ netBox: {net: []},+ convertToPrimary: false,+ loading: false,+ boxData: null,+ boxOptions: null,+ eventListeners: {+ ['@convert-to-primary.window'](event){+ this.convertToPrimary = event.detail;+ this.accountList = [];+ console.log('I heard that! (dashboard/boxes)');+ this.boxData = null;+ this.loadBoxes();+ }+ },++ getFreshData() {+ const start = new Date(window.store.get('start'));+ const end = new Date(window.store.get('end'));+ // TODO cache key is hard coded, problem?+ const boxesCacheKey = getCacheKey('ds_boxes_data', {convertToPrimary: this.convertToPrimary, start: start, end: end});+ cleanupCache();++ //const cacheValid = window.store.get('cacheValid');+ let cachedData = window.store.get(boxesCacheKey);+ const cacheValid = false; // force refresh++ if (cacheValid && typeof cachedData !== 'undefined') {+ this.boxData = cachedData;+ this.generateOptions(this.boxData);++ return;+ }++ // get stuff+ let getter = new Summary();+ getter.get(format(start, 'yyyy-MM-dd'), format(end, 'yyyy-MM-dd'), null).then((response) => {+ this.boxData = response.data;+ window.store.set(boxesCacheKey, response.data);+ this.generateOptions(this.boxData);+ });+ },+ generateOptions(data) {+ this.balanceBox = {amounts: [], subtitles: []};+ this.billBox = {paid: [], unpaid: []};+ this.leftBox = {left: [], perDay: []};+ this.netBox = {net: []};+ let subtitles = {};++ // process new content:+ for (const i in data) {+ if (data.hasOwnProperty(i)) {+ const current = data[i];+ if (!current.hasOwnProperty('key')) {+ continue;+ }+ let key = current.key;+ // console.log('NOT PRIMARY CURRENCY');+ if (key.startsWith('balance-in-')) {+ this.balanceBox.amounts.push(formatMoney(current.monetary_value, current.currency_code));+ continue;+ }+ // spent info is used in subtitle:+ if (key.startsWith('spent-in-')) {+ // prep subtitles (for later)+ if (!subtitles.hasOwnProperty(current.currency_code)) {+ subtitles[current.currency_code] = '';+ }+ // append the amount spent.+ subtitles[current.currency_code] =+ subtitles[current.currency_code] ++ formatMoney(current.monetary_value, current.currency_code);+ continue;+ }+ // earned info is used in subtitle:+ if (key.startsWith('earned-in-')) {+ // prep subtitles (for later)+ if (!subtitles.hasOwnProperty(current.currency_code)) {+ subtitles[current.currency_code] = '';+ }+ // prepend the amount earned.+ subtitles[current.currency_code] =+ formatMoney(current.monetary_value, current.currency_code) + ' + ' ++ subtitles[current.currency_code];+ continue;+ }+++ if (key.startsWith('bills-unpaid-in-')) {+ this.billBox.unpaid.push(formatMoney(current.monetary_value, current.currency_code));+ continue;+ }+ if (key.startsWith('bills-paid-in-')) {+ this.billBox.paid.push(formatMoney(current.monetary_value, current.currency_code));+ continue;+ }+ if (key.startsWith('left-to-spend-in-')) {+ this.leftBox.left.push(formatMoney(current.monetary_value, current.currency_code));+ continue;+ }+ if (key.startsWith('left-per-day-to-spend-in-')) {+ this.leftBox.perDay.push(formatMoney(current.monetary_value, current.currency_code));+ continue;+ }+ if (key.startsWith('net-worth-in-')) {+ this.netBox.net.push(formatMoney(current.monetary_value, current.currency_code));++ }+ }+ }+ for (let i in subtitles) {+ if (subtitles.hasOwnProperty(i)) {+ this.balanceBox.subtitles.push(subtitles[i]);+ }+ }+ this.loading = false;+ },+ loadBoxes() {+ if (true === this.loading) {+ return;+ }+ this.loading = true;+ if (null === this.boxData) {+ this.getFreshData();+ return;+ }+ this.generateOptions(this.boxData);+ this.loading = false;+ },++ // Getter+ init() {+ // console.log('boxes init');+ // TODO can be replaced by "getVariables"+ Promise.all([getVariable('viewRange'), getVariable('convert_to_primary', false)]).then((values) => {+ // console.log('boxes after promises');+ afterPromises = true;+ this.convertToPrimary = values[1];+ this.loadBoxes();+ });+ window.store.observe('end', () => {+ if (!afterPromises) {+ return;+ }+ // console.log('boxes observe end');+ this.boxData = null;+ this.loadBoxes();+ });+ window.store.observe('convert_to_primary', (newValue) => {+ if (!afterPromises) {+ return;+ }+ // console.log('boxes observe convertToPrimary');+ this.convertToPrimary = newValue;+ this.loadBoxes();+ });+ },+});diff --git a/resources/assets/v3/js/pages/dashboard/dashboard.js b/resources/assets/v3/js/pages/dashboard/dashboard.jsindex 5c9fb40fa3..9fe008c966 100644--- a/resources/assets/v3/js/pages/dashboard/dashboard.js+++ b/resources/assets/v3/js/pages/dashboard/dashboard.js@@ -27,6 +27,7 @@ import "bootstrap-icons/font/bootstrap-icons.css"import '../../boot/bootstrap.js';import sidebar from '../../pages/shared/sidebar.js';+import boxes from 'boxes.js';let index = function () {return {@@ -40,7 +41,8 @@ let index = function () {const comps = {index,- sidebar+ sidebar,+ boxes};function loadPage(comps) {diff --git a/resources/assets/v3/js/store/get-variable.js b/resources/assets/v3/js/store/get-variable.jsnew file mode 100644index 0000000000..b3010827b0--- /dev/null+++ b/resources/assets/v3/js/store/get-variable.js@@ -0,0 +1,64 @@+/*+ * get-variable.js+ * Copyright (c) 2023 [email protected]+ *+ * 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 Get from "../api/v1/preferences/index.js";+import Post from "../api/v1/preferences/post.js";++export function getVariable(name, defaultValue = null) {+ const validCache = window.store.get('cacheValid');+ // currently unused, window.X can be used by the blade template+ // to make things available quicker than if the store has to grab it through the API.+ // then again, it's not that slow.+ if (validCache && window.hasOwnProperty(name)) {+ console.log('Returning "'+name+'" from window: ' + window[name]);+ return Promise.resolve(window[name]);+ }+ // load from store2, if it's present.+ const fromStore = window.store.get(name);+ if (validCache && typeof fromStore !== 'undefined') {+ console.log('Returning "'+name+'" from store: ' + fromStore);+ return Promise.resolve(fromStore);+ }+ let getter = (new Get);++ return getter.getByName(name).then((response) => {+ console.log('Returning "'+name+'" from server: ' + parseResponse(name, response));+ return Promise.resolve(parseResponse(name, response));+ }).catch((error) => {+ if('' === defaultValue) {+ // do not try to store empty strings.+ return Promise.resolve(defaultValue);+ }+ // preference does not exist (yet).+ // POST it and then return it anyway.+ let poster = (new Post);+ return poster.post(name, defaultValue).then((response) => {+ console.log('Returning "'+name+'" from POST: ' + parseResponse(name, response));+ return Promise.resolve(parseResponse(name, response));+ });+ });+}++export function parseResponse(name, response) {+ let value = response.data.data.attributes.data;+ window.store.set(name, value);+ return value;+}+diff --git a/resources/assets/v3/js/support/get-cache-key.js b/resources/assets/v3/js/support/get-cache-key.jsnew file mode 100644index 0000000000..adedf73b49--- /dev/null+++ b/resources/assets/v3/js/support/get-cache-key.js@@ -0,0 +1,96 @@+/*+ * load-translations.js+ * Copyright (c) 2023 [email protected]+ *+ * 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";+//const { createHash } = require('crypto');++++function getCacheKey(string, params) {+ const lastActivity = store.get('lastActivity')+ let newParams = {lastActivity: lastActivity, key: string};++ for (const key in params) {+ if (params.hasOwnProperty(key)) {+ if(params[key] === null || params[key] === undefined) {+ newParams[key] = '';+ continue;+ }+ if(params[key] instanceof Date) {+ newParams[key] = format(params[key], 'yMMdd');+ continue;+ }+ newParams[key] = params[key];+ }+ }+ return 'dcx_' + md5(JSON.stringify(newParams)).substring(0,12) + lastActivity;+}++// Formatted version of a popular md5 implementation+// Original copyright (c) Paul Johnston & Greg Holt.+// The function itself is now 42 lines long.++function md5(inputString) {+ var hc="0123456789abcdef";+ function rh(n) {var j,s="";for(j=0;j<=3;j++) s+=hc.charAt((n>>(j*8+4))&0x0F)+hc.charAt((n>>(j*8))&0x0F);return s;}+ function ad(x,y) {var l=(x&0xFFFF)+(y&0xFFFF);var m=(x>>16)+(y>>16)+(l>>16);return (m<<16)|(l&0xFFFF);}+ function rl(n,c) {return (n<<c)|(n>>>(32-c));}+ function cm(q,a,b,x,s,t) {return ad(rl(ad(ad(a,q),ad(x,t)),s),b);}+ function ff(a,b,c,d,x,s,t) {return cm((b&c)|((~b)&d),a,b,x,s,t);}+ function gg(a,b,c,d,x,s,t) {return cm((b&d)|(c&(~d)),a,b,x,s,t);}+ function hh(a,b,c,d,x,s,t) {return cm(b^c^d,a,b,x,s,t);}+ function ii(a,b,c,d,x,s,t) {return cm(c^(b|(~d)),a,b,x,s,t);}+ function sb(x) {+ var i;var nblk=((x.length+8)>>6)+1;var blks=new Array(nblk*16);for(i=0;i<nblk*16;i++) blks[i]=0;+ for(i=0;i<x.length;i++) blks[i>>2]|=x.charCodeAt(i)<<((i%4)*8);+ blks[i>>2]|=0x80<<((i%4)*8);blks[nblk*16-2]=x.length*8;return blks;+ }+ var i,x=sb(""+inputString),a=1732584193,b=-271733879,c=-1732584194,d=271733878,olda,oldb,oldc,oldd;+ for(i=0;i<x.length;i+=16) {olda=a;oldb=b;oldc=c;oldd=d;+ a=ff(a,b,c,d,x[i+ 0], 7, -680876936);d=ff(d,a,b,c,x[i+ 1],12, -389564586);c=ff(c,d,a,b,x[i+ 2],17, 606105819);+ b=ff(b,c,d,a,x[i+ 3],22,-1044525330);a=ff(a,b,c,d,x[i+ 4], 7, -176418897);d=ff(d,a,b,c,x[i+ 5],12, 1200080426);+ c=ff(c,d,a,b,x[i+ 6],17,-1473231341);b=ff(b,c,d,a,x[i+ 7],22, -45705983);a=ff(a,b,c,d,x[i+ 8], 7, 1770035416);+ d=ff(d,a,b,c,x[i+ 9],12,-1958414417);c=ff(c,d,a,b,x[i+10],17, -42063);b=ff(b,c,d,a,x[i+11],22,-1990404162);+ a=ff(a,b,c,d,x[i+12], 7, 1804603682);d=ff(d,a,b,c,x[i+13],12, -40341101);c=ff(c,d,a,b,x[i+14],17,-1502002290);+ b=ff(b,c,d,a,x[i+15],22, 1236535329);a=gg(a,b,c,d,x[i+ 1], 5, -165796510);d=gg(d,a,b,c,x[i+ 6], 9,-1069501632);+ c=gg(c,d,a,b,x[i+11],14, 643717713);b=gg(b,c,d,a,x[i+ 0],20, -373897302);a=gg(a,b,c,d,x[i+ 5], 5, -701558691);+ d=gg(d,a,b,c,x[i+10], 9, 38016083);c=gg(c,d,a,b,x[i+15],14, -660478335);b=gg(b,c,d,a,x[i+ 4],20, -405537848);+ a=gg(a,b,c,d,x[i+ 9], 5, 568446438);d=gg(d,a,b,c,x[i+14], 9,-1019803690);c=gg(c,d,a,b,x[i+ 3],14, -187363961);+ b=gg(b,c,d,a,x[i+ 8],20, 1163531501);a=gg(a,b,c,d,x[i+13], 5,-1444681467);d=gg(d,a,b,c,x[i+ 2], 9, -51403784);+ c=gg(c,d,a,b,x[i+ 7],14, 1735328473);b=gg(b,c,d,a,x[i+12],20,-1926607734);a=hh(a,b,c,d,x[i+ 5], 4, -378558);+ d=hh(d,a,b,c,x[i+ 8],11,-2022574463);c=hh(c,d,a,b,x[i+11],16, 1839030562);b=hh(b,c,d,a,x[i+14],23, -35309556);+ a=hh(a,b,c,d,x[i+ 1], 4,-1530992060);d=hh(d,a,b,c,x[i+ 4],11, 1272893353);c=hh(c,d,a,b,x[i+ 7],16, -155497632);+ b=hh(b,c,d,a,x[i+10],23,-1094730640);a=hh(a,b,c,d,x[i+13], 4, 681279174);d=hh(d,a,b,c,x[i+ 0],11, -358537222);+ c=hh(c,d,a,b,x[i+ 3],16, -722521979);b=hh(b,c,d,a,x[i+ 6],23, 76029189);a=hh(a,b,c,d,x[i+ 9], 4, -640364487);+ d=hh(d,a,b,c,x[i+12],11, -421815835);c=hh(c,d,a,b,x[i+15],16, 530742520);b=hh(b,c,d,a,x[i+ 2],23, -995338651);+ a=ii(a,b,c,d,x[i+ 0], 6, -198630844);d=ii(d,a,b,c,x[i+ 7],10, 1126891415);c=ii(c,d,a,b,x[i+14],15,-1416354905);+ b=ii(b,c,d,a,x[i+ 5],21, -57434055);a=ii(a,b,c,d,x[i+12], 6, 1700485571);d=ii(d,a,b,c,x[i+ 3],10,-1894986606);+ c=ii(c,d,a,b,x[i+10],15, -1051523);b=ii(b,c,d,a,x[i+ 1],21,-2054922799);a=ii(a,b,c,d,x[i+ 8], 6, 1873313359);+ d=ii(d,a,b,c,x[i+15],10, -30611744);c=ii(c,d,a,b,x[i+ 6],15,-1560198380);b=ii(b,c,d,a,x[i+13],21, 1309151649);+ a=ii(a,b,c,d,x[i+ 4], 6, -145523070);d=ii(d,a,b,c,x[i+11],10,-1120210379);c=ii(c,d,a,b,x[i+ 2],15, 718787259);+ b=ii(b,c,d,a,x[i+ 9],21, -343485551);a=ad(a,olda);b=ad(b,oldb);c=ad(c,oldc);d=ad(d,oldd);+ }+ return rh(a)+rh(b)+rh(c)+rh(d);+}++++export {getCacheKey};diff --git a/resources/assets/v3/js/util/cleanup-cache.js b/resources/assets/v3/js/util/cleanup-cache.jsnew file mode 100644index 0000000000..217d471b13--- /dev/null+++ b/resources/assets/v3/js/util/cleanup-cache.js@@ -0,0 +1,34 @@+/*+ * load-translations.js+ * Copyright (c) 2023 [email protected]+ *+ * 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};diff --git a/resources/assets/v3/js/util/format-money.js b/resources/assets/v3/js/util/format-money.jsnew file mode 100644index 0000000000..576a693bbe--- /dev/null+++ b/resources/assets/v3/js/util/format-money.js@@ -0,0 +1,38 @@+/*+ * format-money.js+ * Copyright (c) 2023 [email protected]+ *+ * 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";++export default function (amount, currencyCode) {+ if( (typeof amount !== 'number' && typeof amount !== 'string') || isNaN(amount)) {+ console.warn('format-money: amount is not a number:', amount);+ return '';+ }+ if(typeof currencyCode !== 'string' || currencyCode.length !== 3) {+ console.warn('format-money: currencyCode is not a valid ISO 4217 code:', currencyCode);+ return '';+ }+ let locale = window.__localeId__.replace('_', '-');++ return Intl.NumberFormat(locale, {+ style: 'currency',+ currency: currencyCode+ }).format(amount);+}diff --git a/resources/views/components/dashboard/boxes.blade.php b/resources/views/components/dashboard/boxes.blade.phpnew file mode 100644index 0000000000..b014d9e9f1--- /dev/null+++ b/resources/views/components/dashboard/boxes.blade.php@@ -0,0 +1,187 @@+<div class="row mb-2" x-data="boxes" x-bind="eventListeners">+ <div class="col-xl-3 col-lg-6 col-md-12 col-sm-12">+ <div class="small-box text-bg-primary">+ <div class="inner balance-box">+ <h4 class="hover-expand">+ <template x-if="0 === balanceBox.amounts.length">+ <span> </span>+ </template>+ <template x-for="(amount, index) in balanceBox.amounts" :key="index">+ <span>+ <span x-text="amount"></span><span+ :class="{ 'invisible': (balanceBox.amounts.length == index+1) }">, </span>+ </span>+ </template>+ </h4>+ <template x-if="loading">+ <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 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 class="d-none d-sm-block">+ TODO (no money in or out)+ </p>+ </template>+ </div>+ <span class="small-box-icon">+ <i class="fa-solid fa-scale-balanced"></i>+ </span>++ <div class="small-box-footer hover-footer d-none d-xl-block">+ <template x-if="0 === balanceBox.subtitles.length">+ <span> </span>+ </template>+ <template x-for="(subtitle, index) in balanceBox.subtitles" :key="index">+ <span>+ <span x-text="subtitle"></span><span+ :class="{ 'invisible': (balanceBox.amounts.length == index+1) }"> & </span>+ </span>+ </template>+ </div>+ </div>+ <!--end::Small Box Widget 1-->+ </div>+ <!--end::Col-->+ <div class="col-xl-3 col-lg-6 col-md-12 col-sm-12" style="flex-grow: 1;">+ <!--begin::Small Box Widget 2-->+ <div class="small-box text-bg-success">+ <div class="inner">+ <template x-if="0 === billBox.unpaid.length">+ <h4> </h4>+ </template>+ <template x-if="billBox.unpaid.length > 0">+ <h4 class="hover-expand">+ <template x-for="(amount, index) in billBox.unpaid" :key="index">+ <span>+ <span x-text="amount"></span><span+ :class="{ 'invisible': (billBox.unpaid.length == index+1) }">, </span>+ </span>+ </template>+ </h4>+ </template>+ <template x-if="loading">+ <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 class="d-none d-sm-block"><a href="{{ route('subscriptions.index') }}">{{ __('firefly.bills_to_pay') }}</a></p>+ </template>+ <template x-if="0 === billBox.unpaid.length && !loading">+ <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 d-none d-xl-block">+ <template x-if="0 === billBox.paid.length">+ <span> </span>+ </template>+ <template x-if="billBox.paid.length > 0">+ <span>+ {{ __('firefly.paid') }}:+ <template x-for="(amount, index) in billBox.paid" :key="index">+ <span>+ <span x-text="amount"></span><span+ :class="{ 'invisible': (billBox.paid.length == index+1) }">, </span>+ </span>+ </template>+ </span>+ </template>+ </span>+ </div>+ <!--end::Small Box Widget 2-->+ </div>+ <!--end::Col-->+ <div class="col-xl-3 col-lg-6 col-md-12 col-sm-12" style="flex-grow: 1;">+ <!--begin::Small Box Widget 3-->+ <div class="small-box text-bg-warning">+ <div class="inner">+ <h4 class="hover-expand">+ <template x-if="0 === leftBox.left.length">+ <span> </span>+ </template>+ <template x-for="(amount, index) in leftBox.left" :key="index">+ <span>+ <span x-text="amount"></span><span+ :class="{ 'invisible': (leftBox.left.length == index+1) }">, </span>+ </span>+ </template>+ </h4>++ <template x-if="loading">+ <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 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 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 d-none d-xl-block">+ <template x-if="0 !== leftBox.perDay.length">+ <span>{{ __('firefly.per_day') }}:</span>+ </template>+ <template x-if="0 === leftBox.perDay.length">+ <span> </span>+ </template>+ <template x-for="(amount, index) in leftBox.perDay" :key="index">+ <span>+ <span x-text="amount"></span><span+ :class="{ 'invisible': (leftBox.perDay.length == index+1) }">, </span>+ </span>+ </template>+ </span>+ </div>+ <!--end::Small Box Widget 3-->+ </div>+ <!--end::Col-->+ <div class="col-xl-3 col-lg-6 col-md-12 col-sm-12" style="flex-grow: 1;">+ <!--begin::Small Box Widget 4-->+ <div class="small-box text-bg-danger">+ <div class="inner">+ <h4 class="hover-expand">+ <template x-for="(amount, index) in netBox.net" :key="index">+ <span>+ <span x-text="amount"></span><span+ :class="{ 'invisible': (netBox.net.length == index+1) }">, </span>+ </span>+ </template>+ </h4>++ <template x-if="loading">+ <p class="d-none d-sm-block">+ <em class="fa-solid fa-spinner fa-spin"></em>+ </p>+ </template>+ <template x-if="!loading">+ <p class="d-none d-sm-block">+ <a href="{{ route('reports.report.default', ['allAssetAccounts','currentYearStart','currentYearEnd']) }}">{{ __('firefly.net_worth') }}</a>+ </p>+ </template>+ </div>+ <span class="small-box-icon">+ <i class="fa-solid fa-chart-line"></i>+ </span>+ <span class="small-box-footer d-none d-xl-block">+ + </span>+ </div>+ <!--end::Small Box Widget 4-->+ </div>+ <!--end::Col-->+</div>+<!--end::Row-->diff --git a/resources/views/index.blade.php b/resources/views/index.blade.phpindex e614b0f6a2..ce35e56074 100644--- a/resources/views/index.blade.php+++ b/resources/views/index.blade.php@@ -9,52 +9,52 @@TODO dark mode ook onthouden en dat script in het templateTODO fix create menu.+ <x-dashboard.boxes :start="$start" :end="$end" />+<div class="row" x-data="index"><div class="col-lg-8 col-md-12 col-sm-12"><!--ACCOUNTS -->- <div class="box box-primary">- <div class="box-header with-border">- <h3 class="box-title"><a href="{{ route('accounts.index',['asset']) }}"- title="{{ __('firefly.yourAccounts') }}">{{ __('firefly.yourAccounts') }}</a></h3>+ <div class="card card-primary card-outline mb-4">+ <div class="card-header with-border">+ <div class="card-title"><a href="{{ route('accounts.index',['asset']) }}" title="{{ __('firefly.yourAccounts') }}">{{ __('firefly.yourAccounts') }}</a></div></div>- <div class="box-body">+ <div class="card-body"><canvas id="accounts-chart" class="wide-chart" height="400" width="100%"></canvas></div>- <div class="box-footer">- <a href="{{ route('accounts.index',['asset']) }}" class="btn btn-default button-sm"><span- class="fa fa-money"></span> {{ __('firefly.go_to_asset_accounts') }}</a>+ <div class="card-footer">+ <a href="{{ route('accounts.index',['asset']) }}" class="btn btn-primary btn-sm"><span class="bi bi-cash"></span> {{ __('firefly.go_to_asset_accounts') }}</a></div></div><!--BUDGETS -->- <div class="box">- <div class="box-header with-border">- <h3 class="box-title"><a href="{{ route('budgets.index') }}"- title="{{ __('firefly.budgetsAndSpending') }}">{{ __('firefly.budgetsAndSpending') }}</a></h3>+ <div class="card card-outline mb-4">+ <div class="card-header with-border">+ <div class="card-title"><a href="{{ route('budgets.index') }}"+ title="{{ __('firefly.budgetsAndSpending') }}">{{ __('firefly.budgetsAndSpending') }}</a></div></div><div class="box-body"><canvas id="budgets-chart" class="wide-chart" height="400" width="100%"></canvas></div><div class="box-footer">- <a href="{{ route('budgets.index') }}" class="btn btn-default button-sm">+ <a href="{{ route('budgets.index') }}" class="btn btn-primary btn-sm"><span class="fa fa-pie-chart"></span><span>{{ __('firefly.go_to_budgets') }}</span></a></div></div><!--CATEGORIES -->- <div class="box">- <div class="box-header with-border">- <h3 class="box-title"><a href="{{ route('categories.index') }}"- title="{{ __('firefly.categories') }}">{{ __('firefly.categories') }}</a></h3>+ <div class="card card-outline mb-4">+ <div class="card-header with-border">+ <div class="card-title"><a href="{{ route('categories.index') }}"+ title="{{ __('firefly.categories') }}">{{ __('firefly.categories') }}</a></div></div><div class="box-body"><canvas id="categories-chart" class="wide-chart" height="400" width="100%"></canvas></div><div class="box-footer">- <a href="{{ route('categories.index') }}" class="btn btn-default button-sm">+ <a href="{{ route('categories.index') }}" class="btn btn-primary btn-sm"><span class="fa fa-bookmark"></span><span>{{ __('firefly.go_to_categories') }}</span></a>@@ -66,11 +66,11 @@<!--TRANSACTIONS --><div id="all_transactions">@foreach($transactions as $data)- <div class="box">+ <div class="card"><div class="box-header with-border">- <h3 class="box-title"><a+ <div class="card-title"><ahref="{{ route('accounts.show', [$data['account']['id']]) }}">{{ $data['account']['name'] }}</a>- </h3>+ </div></div>@if(count($data['transactions']) > 0)<div class="box-body no-padding">@@ -136,10 +136,10 @@@if($billCount > 0)<!--BILLS -->- <div class="box">+ <div class="card"><div class="box-header with-border">- <h3 class="box-title"><a href="{{ route('subscriptions.index') }}"- title="{{ __('firefly.bills') }}">{{ __('firefly.bills') }}</a></h3>+ <div class="card-title"><a href="{{ route('subscriptions.index') }}"+ title="{{ __('firefly.bills') }}">{{ __('firefly.bills') }}</a></div></div><div class="box-body">@@ -148,7 +148,7 @@</div></div><div class="box-footer">- <a href="{{ route('bills.index') }}" class="btn btn-default button-sm"><span+ <a href="{{ route('bills.index') }}" class="btn btn-primary btn-sm"><spanclass="fa fa-calendar"></span> {{ __('firefly.go_to_bills') }}</a></div></div>@@ -163,26 +163,26 @@<div class="row"><div class="col-lg-12 col-md-12 col-sm-12"><!--EXPENSE ACCOUNTS -->- <div class="box">+ <div class="card"><div class="box-header with-border">- <h3 class="box-title"><a href="{{ route('accounts.index',['expense']) }}"+ <div class="card-title"><a href="{{ route('accounts.index',['expense']) }}"title="{{ __('firefly.expense_accounts') }}">{{ __('firefly.expense_accounts') }}</a>- </h3>+ </div></div><div class="box-body"><canvas id="expense-accounts-chart" class="wide-chart" height="400"width="100%"></canvas></div><div class="box-footer">- <a href="{{ route('accounts.index', ['expense']) }}" class="btn btn-default button-sm"><span+ <a href="{{ route('accounts.index', ['expense']) }}" class="btn btn-primary btn-sm"><spanclass="fa fa-shopping-cart"></span> {{ __('firefly.go_to_expense_accounts') }}</a></div></div><!--OPTIONAL REVENUE ACCOUNTS -->- <div class="box">+ <div class="card"><div class="box-header with-border">- <h3 class="box-title"><a href="{{ route('accounts.index',['revenue']) }}"- title="{{ __('firefly.revenue_accounts') }}">{{ __('firefly.revenue_accounts') }}</a></h3>+ <div class="card-title"><a href="{{ route('accounts.index',['revenue']) }}"+ title="{{ __('firefly.revenue_accounts') }}">{{ __('firefly.revenue_accounts') }}</a></div></div><div class="box-body">@@ -190,7 +190,7 @@width="100%"></canvas></div><div class="box-footer">- <a href="{{ route('accounts.index', ['revenue']) }}" class="btn btn-default button-sm"><span+ <a href="{{ route('accounts.index', ['revenue']) }}" class="btn btn-primary btn-sm"><spanclass="fa fa-download"></span> {{ __('firefly.go_to_revenue_accounts') }}</a></div></div>diff --git a/resources/views/layout/v3/session.blade.php b/resources/views/layout/v3/session.blade.phpindex aa6147e17b..5f3a9ecdd0 100644--- a/resources/views/layout/v3/session.blade.php+++ b/resources/views/layout/v3/session.blade.php@@ -208,13 +208,16 @@<!--begin::Row--><div class="row"><div class="col-sm-6">- <h3 class="mb-0">Header</h3>+ <h3 class="mb-0">+ <em class="bi {{ $mainTitleIcon }}"></em>+ {{ $pageTitle }}++ <small class="text-xs text-muted">@if(isset($subTitleIcon))<em class="bi {{ $subTitleIcon }}"></em>X @endif{{$subTitle}}</small>+ </h3></div>+<div class="col-sm-6">- <ol class="breadcrumb float-sm-end">- <li class="breadcrumb-item"><a href="#">Home</a></li>- <li class="breadcrumb-item active" aria-current="page">Dashboard</li>- </ol>+ {{ Breadcrumbs::render() }}</div></div><!--end::Row-->@@ -241,14 +244,14 @@<!--begin::Footer--><footer class="app-footer"><!--begin::To the end-->- <div class="float-end d-none d-sm-inline">Anything you want</div>+ <div class="float-end d-none d-sm-inline">+ <a href="{{route('debug')}}">v{{ $FF_VERSION }}</a>+ </div><!--end::To the end--><!--begin::Copyright-->- <strong>- Bla bla bla- <a href="https://adminlte.io" class="text-decoration-none">AdminLTE.io</a>.- </strong>- All rights reserved.+ <span>+ <a href="https://www.firefly-iii.org/" target="_blank" title="Firefly III">Firefly III</a> © James Cole, <a href="https://www.gnu.org/licenses/agpl-3.0.html" title="AGPL-3.0-or-later.">AGPL-3.0-or-later</a>.+ </span><!--end::Copyright--></footer><!--end::Footer-->diff --git a/resources/views/partials/layout/breadcrumbs-v3.blade.php b/resources/views/partials/layout/breadcrumbs-v3.blade.phpnew file mode 100644index 0000000000..997300ed11--- /dev/null+++ b/resources/views/partials/layout/breadcrumbs-v3.blade.php@@ -0,0 +1,13 @@+@if(count($breadcrumbs) > 0)+<ol class="breadcrumb float-sm-end">+ @foreach($breadcrumbs as $breadcrumb)+ @if($breadcrumb->url && !$loop->last)+ <li class="breadcrumb-item"><a href="{{ $breadcrumb->url }}">{{ $breadcrumb->title }}</a></li>+ @endif+ @if(!$breadcrumb->url || $loop->last)+ <li class="breadcrumb-item active" aria-current="page">{{ $breadcrumb->title }}</li>+ @endif+ @endforeach++</ol>+@endif