Skip to content

Firefly III: a personal finances manager

Fix missing references, expand charts.

James Cole5e3fc28dd726
diff --git a/package-lock.json b/package-lock.json
index f3c2cbc0a4..64a457b8dc 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -65,6 +65,12 @@
"temporal-polyfill": "^1.0.1"
}
},
+ "node_modules/@kurkle/color": {
+ "version": "0.3.4",
+ "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.4.tgz",
+ "integrity": "sha512-M5UknZPHRu3DEDWoipU6sE8PdkZ6Z/S+v4dD+Ke8IaNlpdSQah50lz1KtcFBa2vsdOnwbbnxJwVM4wty6udA5w==",
+ "license": "MIT"
+ },
"node_modules/@oxc-project/types": {
"version": "0.147.0",
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.147.0.tgz",
@@ -203,6 +209,9 @@
"arm"
],
"dev": true,
+ "libc": [
+ "glibc"
+ ],
"license": "MIT",
"optional": true,
"os": [
@@ -224,6 +233,9 @@
"arm"
],
"dev": true,
+ "libc": [
+ "musl"
+ ],
"license": "MIT",
"optional": true,
"os": [
@@ -245,6 +257,9 @@
"arm64"
],
"dev": true,
+ "libc": [
+ "glibc"
+ ],
"license": "MIT",
"optional": true,
"os": [
@@ -266,6 +281,9 @@
"arm64"
],
"dev": true,
+ "libc": [
+ "musl"
+ ],
"license": "MIT",
"optional": true,
"os": [
@@ -287,6 +305,9 @@
"x64"
],
"dev": true,
+ "libc": [
+ "glibc"
+ ],
"license": "MIT",
"optional": true,
"os": [
@@ -308,6 +329,9 @@
"x64"
],
"dev": true,
+ "libc": [
+ "musl"
+ ],
"license": "MIT",
"optional": true,
"os": [
@@ -497,6 +521,9 @@
"arm64"
],
"dev": true,
+ "libc": [
+ "glibc"
+ ],
"license": "MIT",
"optional": true,
"os": [
@@ -514,6 +541,9 @@
"arm64"
],
"dev": true,
+ "libc": [
+ "musl"
+ ],
"license": "MIT",
"optional": true,
"os": [
@@ -531,6 +561,9 @@
"ppc64"
],
"dev": true,
+ "libc": [
+ "glibc"
+ ],
"license": "MIT",
"optional": true,
"os": [
@@ -548,6 +581,9 @@
"s390x"
],
"dev": true,
+ "libc": [
+ "glibc"
+ ],
"license": "MIT",
"optional": true,
"os": [
@@ -565,6 +601,9 @@
"x64"
],
"dev": true,
+ "libc": [
+ "glibc"
+ ],
"license": "MIT",
"optional": true,
"os": [
@@ -582,6 +621,9 @@
"x64"
],
"dev": true,
+ "libc": [
+ "musl"
+ ],
"license": "MIT",
"optional": true,
"os": [
@@ -886,6 +928,18 @@
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
+ "node_modules/chart.js": {
+ "version": "4.5.1",
+ "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.5.1.tgz",
+ "integrity": "sha512-GIjfiT9dbmHRiYi6Nl2yFCq7kkwdkp1W/lp2J99rX0yo9tgJGn3lKQATztIjb5tVtevcBtIdICNWqlq5+E8/Pw==",
+ "license": "MIT",
+ "dependencies": {
+ "@kurkle/color": "^0.3.0"
+ },
+ "engines": {
+ "pnpm": ">=8"
+ }
+ },
"node_modules/chokidar": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz",
@@ -1805,6 +1859,9 @@
"arm64"
],
"dev": true,
+ "libc": [
+ "glibc"
+ ],
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1826,6 +1883,9 @@
"arm64"
],
"dev": true,
+ "libc": [
+ "musl"
+ ],
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1847,6 +1907,9 @@
"x64"
],
"dev": true,
+ "libc": [
+ "glibc"
+ ],
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1868,6 +1931,9 @@
"x64"
],
"dev": true,
+ "libc": [
+ "musl"
+ ],
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -2726,6 +2792,7 @@
"bootstrap5-autocomplete": "^1",
"bootstrap5-tags": "^1.7.17",
"cally": "^0.9.2",
+ "chart.js": "^4.5.1",
"date-fns": "^4.4.0",
"fullcalendar": "^7.0.1",
"i18next": "^26.0.3",
diff --git a/package.json b/package.json
index 6d3925ab36..093f2c88a3 100644
--- a/package.json
+++ b/package.json
@@ -7,5 +7,8 @@
],
"dependencies": {
"patch-package": "^8.0.1"
+ },
+ "allowScripts": {
+ "@parcel/[email protected]": true
}
}
diff --git a/public/v1/js/ff/piggy-banks/show.js b/public/v1/js/ff/piggy-banks/show.js
index 7ef6bcf6d3..4eeeb92350 100644
--- a/public/v1/js/ff/piggy-banks/show.js
+++ b/public/v1/js/ff/piggy-banks/show.js
@@ -20,19 +20,19 @@
$(function () {
"use strict";
- if (typeof(lineChart) === 'function' && typeof(piggyBankID) !== 'undefined') {
+ if (false && typeof(lineChart) === 'function' && typeof(piggyBankID) !== 'undefined') {
lineChart('chart/piggy-bank/' + piggyBankID, 'piggy-bank-history');
}
- $('.confirm-history-delete').click(function() {
- return confirm(confirmText);
- });
+ // $('.confirm-history-delete').click(function() {
+ // return confirm(confirmText);
+ // });
// on submit of logout button:
- $('.reset-link').click(function(e) {
- console.log('here we are');
- e.preventDefault();
- document.getElementById('reset-form').submit();
- return false;
- });
+ // $('.reset-link').click(function(e) {
+ // console.log('here we are');
+ // e.preventDefault();
+ // document.getElementById('reset-form').submit();
+ // return false;
+ // });
});
diff --git a/resources/assets/v3/js/pages/piggy-banks/show.js b/resources/assets/v3/js/pages/piggy-banks/show.js
new file mode 100644
index 0000000000..06619ff2f3
--- /dev/null
+++ b/resources/assets/v3/js/pages/piggy-banks/show.js
@@ -0,0 +1,76 @@
+/*
+ * dashboard.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 '../../boot/bootstrap.js';
+import sidebar from '../../pages/shared/sidebar.js';
+import dates from '../shared/dates.js';
+import i18next from "i18next";
+import {drawChart} from '../../shared/draw-chart.js';
+import {getVariable} from "../../store/get-variable.js";
+
+let show = function () {
+ return {
+ init() {
+ // console.log('Generic JS for page with few features.');
+ //const ctx = document.getElementById('piggy-bank-history');
+ getVariable('anonymous').then((value) => {
+ drawChart('line', 'some-url', 'piggy-bank-history', value);
+ });
+
+
+
+
+ },
+ confirmHistoryRemoval(e) {
+ if(confirm(i18next.t('firefly.reset_history_confirm'))) {
+ document.getElementById('reset-form').submit()
+ }
+ return false;
+ }
+ }
+};
+
+
+const comps = {
+ show,
+ sidebar,
+ dates
+};
+
+function loadPage(comps) {
+ // console.log('loadPage');
+ Object.keys(comps).forEach(comp => {
+ let data = comps[comp]();
+ Alpine.data(comp, () => data);
+ // console.log(comp);
+ });
+ Alpine.start();
+}
+
+// wait for load until bootstrapped event is received.
+document.addEventListener('firefly-iii-bootstrapped', () => {
+ // console.log('Loaded through event listener.');
+ loadPage(comps);
+});
+// or is bootstrapped before event is triggered.
+if (window.bootstrapped) {
+ // console.log('Loaded through window variable.');
+ loadPage(comps);
+}
diff --git a/resources/assets/v3/js/pages/transactions/create.js b/resources/assets/v3/js/pages/transactions/create.js
index 094da62455..f023a2c745 100644
--- a/resources/assets/v3/js/pages/transactions/create.js
+++ b/resources/assets/v3/js/pages/transactions/create.js
@@ -52,7 +52,6 @@ import {onMapClick} from './shared/on-map-click.js';
import {onMapZoom} from "./shared/on-map-zoom.js";
import {clearLocation} from './shared/clear-location.js';
import {removeSplit} from "./shared/remove-split.js";
-import {loadLinkTypes} from "./shared/load-link-types.js";
import {createLinkAutocomplete} from "./shared/create-link-autocomplete.js";
import {editLink} from "./shared/edit-link.js";
import {switchLink} from "./shared/switch-link.js";
@@ -63,6 +62,7 @@ import {redirectAfterTransactionLinks} from './shared/redirect-after-transaction
import {processTransactionLinks} from './shared/process-transaction-links.js';
import {addTabListener} from "./shared/add-tab-listener.js";
import {autoStep} from "./shared/auto-step.js";
+import {respondToTabSwitch} from "./shared/respond-to-tab-switch.js";
let create = function () {
return {
@@ -198,6 +198,7 @@ let create = function () {
redirectAfterTransactionLinks: redirectAfterTransactionLinks,
addTabListener: addTabListener,
autoStep: autoStep,
+ respondToTabSwitch: respondToTabSwitch,
filterForeignCurrencies(code) {
let list = [];
@@ -248,16 +249,7 @@ let create = function () {
this.entries[index].category_name = '';
},
- respondToTabSwitch(event) {
- // event.target // newly activated tab
- // event.relatedTarget // previous active tab
- let index = parseInt(event.currentTarget.dataset.index);
- console.log(this);
- if (this.maps.hasOwnProperty(index)) {
- this.maps[index].invalidateSize();
- }
- //console.log('Switched to new tab!', event.target.dataset.index);
- },
+
diff --git a/resources/assets/v3/js/pages/transactions/edit.js b/resources/assets/v3/js/pages/transactions/edit.js
index 1548f43b9d..7888efa918 100644
--- a/resources/assets/v3/js/pages/transactions/edit.js
+++ b/resources/assets/v3/js/pages/transactions/edit.js
@@ -30,7 +30,7 @@ import {processUploadError} from "./shared/process-upload-error.js";
import {loadSubscriptions} from "./shared/load-subscriptions.js";
import Tags from "bootstrap5-tags";
import i18next from "i18next";
-import {createEmptySplit, defaultErrorSet} from "./shared/create-empty-split.js";
+import {defaultErrorSet} from "./shared/create-empty-split.js";
import {parseFromEntries} from "./shared/parse-from-entries.js";
import Put from "../../api/model/transaction/put.js";
import {showMessageOrRedirectUser} from "./shared/show-message-or-redirect.js";
@@ -66,6 +66,7 @@ import {processTransactionLinks} from "./shared/process-transaction-links.js";
import {redirectAfterTransactionLinks} from "./shared/redirect-after-transaction-links.js";
import {addTabListener} from "./shared/add-tab-listener.js";
import {autoStep} from "./shared/auto-step.js";
+import {respondToTabSwitch} from "./shared/respond-to-tab-switch.js";
const urls = getUrls();
@@ -160,7 +161,7 @@ let transactions = function () {
changedForeignAmount: changedForeignAmount,
showMessageOrRedirectUser: showMessageOrRedirectUser,
parseErrors: parseErrors,
- addSplit:addSplit,
+ addSplit: addSplit,
clearSourceAccount: clearSourceAccount,
clearDestinationAccount: clearDestinationAccount,
detectTransactionType: detectTransactionType,
@@ -185,6 +186,7 @@ let transactions = function () {
loadTransactionLinks: loadTransactionLinks,
addTabListener: addTabListener,
autoStep: autoStep,
+ respondToTabSwitch: respondToTabSwitch,
// part of the account selection auto-complete
@@ -222,25 +224,25 @@ let transactions = function () {
this.entries = parseDownloadedSplits(data.attributes.transactions, parseInt(data.id));
// set empty arrays
- for(let i = 0; i < this.entries.length; i++) {
+ for (let i = 0; i < this.entries.length; i++) {
this.links[i] = []; // empty set of links.
}
// set amountCurrency.
- for(let i in this.formData.enabledCurrencies) {
- if(this.formData.enabledCurrencies.hasOwnProperty(i)) {
- if(this.formData.enabledCurrencies[i].code === this.entries[0].currency_code) {
+ for (let i in this.formData.enabledCurrencies) {
+ if (this.formData.enabledCurrencies.hasOwnProperty(i)) {
+ if (this.formData.enabledCurrencies[i].code === this.entries[0].currency_code) {
this.formData.amountCurrency = this.formData.enabledCurrencies[i];
console.log('selected ' + this.formData.amountCurrency.code + ' as amount currency.');
}
}
}
// limit foreignCurrencies to a single one when it's a transfer
- if('transfer' === this.groupProperties.transactionType) {
+ if ('transfer' === this.groupProperties.transactionType) {
this.formData.foreignCurrencies = [];
- for(let i in this.formData.enabledCurrencies) {
- if(this.formData.enabledCurrencies.hasOwnProperty(i)) {
- if(this.formData.enabledCurrencies[i].code === this.entries[0].forein_currency_code) {
+ for (let i in this.formData.enabledCurrencies) {
+ if (this.formData.enabledCurrencies.hasOwnProperty(i)) {
+ if (this.formData.enabledCurrencies[i].code === this.entries[0].forein_currency_code) {
this.formData.foreignCurrencies.push(this.formData.enabledCurrencies[i]);
}
}
@@ -370,7 +372,7 @@ let transactions = function () {
if (null === this.groupProperties.title && transactions.length > 1) {
submission.group_title = transactions[0].description;
}
- if(1 === transactions.length) {
+ if (1 === transactions.length) {
submission.group_title = null;
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/respond-to-tab-switch.js b/resources/assets/v3/js/pages/transactions/shared/respond-to-tab-switch.js
new file mode 100644
index 0000000000..e13407ecd9
--- /dev/null
+++ b/resources/assets/v3/js/pages/transactions/shared/respond-to-tab-switch.js
@@ -0,0 +1,30 @@
+/*
+ * respond-to-tab-switch.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/>.
+ */
+
+export function respondToTabSwitch(event) {
+ // event.target // newly activated tab
+ // event.relatedTarget // previous active tab
+ let index = parseInt(event.currentTarget.dataset.index);
+ console.log(this);
+ if (this.maps.hasOwnProperty(index)) {
+ this.maps[index].invalidateSize();
+ }
+ //console.log('Switched to new tab!', event.target.dataset.index);
+};
diff --git a/resources/assets/v3/js/shared/draw-chart.js b/resources/assets/v3/js/shared/draw-chart.js
new file mode 100644
index 0000000000..39bf4eb6f2
--- /dev/null
+++ b/resources/assets/v3/js/shared/draw-chart.js
@@ -0,0 +1,106 @@
+/*
+ * draw-chart.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 Chart from 'chart.js/auto';
+
+let defaultChartOptions = {
+
+ elements: {
+ line: {
+ cubicInterpolationMode: 'monotone'
+ }
+ },
+ responsive: true,
+ maintainAspectRatio: false,
+ scales: {
+ x: {
+ axis: 'x',
+ grid: {
+ display: false
+ }
+ },
+ y: {
+ display: true,
+ beginAtZero: true,
+ ticks: {
+ // break ticks when too long.
+ callback: function (value, index, ticks) {
+ if(anonymous) {
+ return '0';
+ }
+ return formatLabel(value, 20);
+ }
+ }
+ },
+ // ],
+ // yAxes: [{
+ // ticks: {
+ // callback: function (tickValue) {
+ // "use strict";
+ // if (anonymous) {
+ // return accounting.formatMoney(0);
+ // }
+ // // use first symbol or null:
+ // return accounting.formatMoney(tickValue);
+ // },
+ // beginAtZero: true
+ // }
+ //
+ // }]
+ },
+ // tooltips: {
+ // mode: 'label',
+ // callbacks: {
+ // label: function (tooltipItem, data) {
+ // "use strict";
+ // var string = accounting.formatMoney(tooltipItem.yLabel, data.datasets[tooltipItem.datasetIndex].currency_symbol);
+ // if (anonymous) {
+ // string = accounting.formatMoney(0);
+ // }
+ // return data.datasets[tooltipItem.datasetIndex].label + ': ' + string;
+ // }
+ // }
+ // }
+};
+
+export function drawChart(type, url, holder, anonymous) {
+ if ('line' === type) {
+ drawLineChart(url, holder, anonymous);
+ }
+}
+
+function drawLineChart(url, holder) {
+ // lineChart
+ console.log('here we are');
+ const ctx = document.getElementById(holder).getContext('2d');
+
+ new Chart(ctx, {
+ type: 'line',
+ data: {
+ labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
+ datasets: [{
+ label: '# of Votes',
+ data: [12, 19, 3, 5, 2, 3],
+ borderWidth: 1
+ }]
+ },
+ options: defaultChartOptions
+ });
+}
diff --git a/resources/assets/v3/package.json b/resources/assets/v3/package.json
index 709c37db5b..b8a13de9e5 100644
--- a/resources/assets/v3/package.json
+++ b/resources/assets/v3/package.json
@@ -12,6 +12,7 @@
"bootstrap5-autocomplete": "^1",
"bootstrap5-tags": "^1.7.17",
"cally": "^0.9.2",
+ "chart.js": "^4.5.1",
"date-fns": "^4.4.0",
"fullcalendar": "^7.0.1",
"i18next": "^26.0.3",
diff --git a/resources/assets/v3/vite.config.js b/resources/assets/v3/vite.config.js
index bd371ffa07..0493dbb06f 100644
--- a/resources/assets/v3/vite.config.js
+++ b/resources/assets/v3/vite.config.js
@@ -40,10 +40,6 @@ export default defineConfig(({command, mode, isSsrBuild, isPreview}) => {
// CSS for entire app
'sass/app.scss',
- // accounts
- 'js/pages/accounts/create.js',
- 'js/pages/accounts/edit.js',
-
// dashboard
'js/pages/dashboard/boxes.js',
'js/pages/dashboard/dashboard.js',
@@ -53,6 +49,8 @@ export default defineConfig(({command, mode, isSsrBuild, isPreview}) => {
'js/pages/blank.js', // small bootstrap
// accounts
+ 'js/pages/accounts/create.js',
+ 'js/pages/accounts/edit.js',
// administrations
'js/pages/administrations/index.js',
@@ -70,6 +68,9 @@ export default defineConfig(({command, mode, isSsrBuild, isPreview}) => {
// object groups
+ // piggy banks
+ 'js/pages/piggy-banks/show.js',
+
// profile
'js/pages/profile/oauth.js',
@@ -98,7 +99,6 @@ export default defineConfig(({command, mode, isSsrBuild, isPreview}) => {
'js/pages/webhooks/show.js',
'js/pages/webhooks/index.js',
- // piggy banks
],
buildDirectory: '../../../../public/build',
// publicDirectory: '../../../public',
diff --git a/resources/views/piggy-banks/show.blade.php b/resources/views/piggy-banks/show.blade.php
index 5c9c4ae951..e138c37e93 100644
--- a/resources/views/piggy-banks/show.blade.php
+++ b/resources/views/piggy-banks/show.blade.php
@@ -1,171 +1,185 @@
@extends('layout.v3.session')
@section('content')
- <div class="row">
- <div class="col-lg-8 col-md-8 col-sm-6">
- <div class="card mb-2" id="piggyChart">
- <div class="card-header">
- <h3 class="card-title">{{ __('firefly.events') }}</h3>
- </div>
- <div class="card-body">
- <canvas id="piggy-bank-history" class="wide-chart" height="400" width="100%"></canvas>
+ <div x-data="show">
+ <div class="row">
+ <div class="col-lg-8 col-md-8 col-sm-6">
+ <div class="card mb-2" id="piggyChart">
+ <div class="card-header">
+ <h3 class="card-title">{{ __('firefly.events') }}</h3>
+ </div>
+ <div class="card-body">
+ <canvas id="piggy-bank-history" class="wide-chart" height="400" width="100%"></canvas>
+ </div>
</div>
</div>
- </div>
- <div class="col-lg-4 col-md-4 col-sm-6">
- <div class="card mb-2">
- <div class="card-header">
- <div class="row">
- <div class="col">
- <h3 class="card-title">{{ __('firefly.details') }}</h3>
- </div>
- <div class="col text-end">
- <div class="dropdown">
- <button class="btn btn-sm btn-secondary-outline dropdown-toggle" type="button" id="card_header_menu" data-bs-toggle="dropdown" aria-expanded="false">
- <span class="bi bi-list"></span>
- </button>
- <ul class="dropdown-menu" aria-labelledby="card_header_menu">
- <li><a class="dropdown-item" href="{{ route('piggy-banks.edit', $piggy['id']) }}?_from={{ urlencode($FF3_FROM) }}"><span class="bi bi-pencil"></span> {{ __('firefly.edit') }}</a></li>
- <li><a class="dropdown-item" href="{{ route('piggy-banks.delete', $piggy['id']) }}?_from={{ urlencode($FF3_FROM) }}"><span class="bi bi-trash"></span> {{ __('firefly.delete') }}</a></li>
- </ul>
+ <div class="col-lg-4 col-md-4 col-sm-6">
+ <div class="card mb-2">
+ <div class="card-header">
+ <div class="row">
+ <div class="col">
+ <h3 class="card-title">{{ __('firefly.details') }}</h3>
+ </div>
+ <div class="col text-end">
+ <div class="dropdown">
+ <button class="btn btn-sm btn-secondary-outline dropdown-toggle" type="button"
+ id="card_header_menu" data-bs-toggle="dropdown" aria-expanded="false">
+ <span class="bi bi-list"></span>
+ </button>
+ <ul class="dropdown-menu" aria-labelledby="card_header_menu">
+ <li><a class="dropdown-item"
+ href="{{ route('piggy-banks.edit', $piggy['id']) }}?_from={{ urlencode($FF3_FROM) }}"><span
+ class="bi bi-pencil"></span> {{ __('firefly.edit') }}</a></li>
+ <li><a class="dropdown-item"
+ href="{{ route('piggy-banks.delete', $piggy['id']) }}?_from={{ urlencode($FF3_FROM) }}"><span
+ class="bi bi-trash"></span> {{ __('firefly.delete') }}</a></li>
+ </ul>
+ </div>
</div>
</div>
</div>
- </div>
- <div class="card-body p-0">
- <table class="table table-responsive table-hover" id="piggyDetails">
- <tr>
- <td class="forty">{{ __('firefly.saveOnAccounts') }}</td>
- <td>
- @foreach($piggy['accounts'] as $account)
- <a href="{{ route('accounts.show', [$account['account_id']]) }}">{{ $account['name'] }}</a><br>
- @endforeach
- </td>
- </tr>
- @if('' !== (string)$piggy['object_group_title'])
- <tr>
- <td class="forty">{{ __('firefly.object_group') }}</td>
- <td>{{ $piggy['object_group_title'] }}</a></td>
- </tr>
- @endif
- @if(null !== $piggy['target_amount'])
+ <div class="card-body p-0">
+ <table class="table table-responsive table-hover" id="piggyDetails">
<tr>
- <td>{{ __('firefly.target_amount') }}</td>
+ <td class="forty">{{ __('firefly.saveOnAccounts') }}</td>
<td>
- {!! format_amount_by_symbol($piggy['target_amount'], $piggy['currency_symbol'], $piggy['currency_decimal_places']) !!}
+ @foreach($piggy['accounts'] as $account)
+ <a href="{{ route('accounts.show', [$account['account_id']]) }}">{{ $account['name'] }}</a>
+ <br>
+ @endforeach
</td>
</tr>
- @endif
- @foreach($piggy['accounts'] as $account)
+ @if('' !== (string)$piggy['object_group_title'])
+ <tr>
+ <td class="forty">{{ __('firefly.object_group') }}</td>
+ <td>{{ $piggy['object_group_title'] }}</a></td>
+ </tr>
+ @endif
+ @if(null !== $piggy['target_amount'])
+ <tr>
+ <td>{{ __('firefly.target_amount') }}</td>
+ <td>
+ {!! format_amount_by_symbol($piggy['target_amount'], $piggy['currency_symbol'], $piggy['currency_decimal_places']) !!}
+ </td>
+ </tr>
+ @endif
+ @foreach($piggy['accounts'] as $account)
+ <tr>
+ <td>
+ {{ __('firefly.saved_so_far') }}
+ (<a href="{{ route('accounts.show', $account['account_id']) }}">{{ $account['name'] }}</a>)
+ </td>
+ <td>
+ {!! format_amount_by_symbol($account['current_amount'], $piggy['currency_symbol'], $piggy['currency_decimal_places']) !!}
+ </td>
+ </tr>
+
+ @endforeach
<tr>
+ <td>{{ __('firefly.saved_so_far_total') }}</td>
<td>
- {{ __('firefly.saved_so_far') }}
- (<a href="{{ route('accounts.show', $account['account_id']) }}">{{ $account['name'] }}</a>)
- </td>
- <td>
- {!! format_amount_by_symbol($account['current_amount'], $piggy['currency_symbol'], $piggy['currency_decimal_places']) !!}
+ {!! format_amount_by_symbol($piggy['current_amount'], $piggy['currency_symbol'], $piggy['currency_decimal_places']) !!}
</td>
</tr>
-
- @endforeach
- <tr>
- <td>{{ __('firefly.saved_so_far_total') }}</td>
- <td>
- {!! format_amount_by_symbol($piggy['current_amount'], $piggy['currency_symbol'], $piggy['currency_decimal_places']) !!}
- </td>
- </tr>
- @if(null !== $piggy['left_to_save'])
+ @if(null !== $piggy['left_to_save'])
+ <tr>
+ <td>{{ __('firefly.left_to_save') }}</td>
+ <td>
+ {!! format_amount_by_symbol($piggy['left_to_save'], $piggy['currency_symbol'], $piggy['currency_decimal_places']) !!}
+ </td>
+ </tr>
+ @endif
<tr>
- <td>{{ __('firefly.left_to_save') }}</td>
+ <td>{{ __('firefly.start_date') }}</td>
<td>
- {!! format_amount_by_symbol($piggy['left_to_save'], $piggy['currency_symbol'], $piggy['currency_decimal_places']) !!}
+ @if(null !== $piggyBank->start_date)
+ {{ $piggyBank->start_date->isoFormat($monthAndDayFormat) }}
+ @else
+ <em>{{ __('firefly.no_start_date') }}</em>
+ @endif
</td>
</tr>
- @endif
- <tr>
- <td>{{ __('firefly.start_date') }}</td>
- <td>
- @if(null !== $piggyBank->start_date)
- {{ $piggyBank->start_date->isoFormat($monthAndDayFormat) }}
- @else
- <em>{{ __('firefly.no_start_date') }}</em>
- @endif
- </td>
- </tr>
- <tr>
- <td>{{ __('firefly.target_date') }}</td>
- <td>
- @if(null !== $piggyBank->target_date)
- {{ $piggyBank->target_date->isoFormat($monthAndDayFormat) }}
- @else
- <em>{{ __('firefly.no_target_date') }}</em>
- @endif
- </td>
- </tr>
- @if(null !== $piggyBank->target_date && null !== $piggy['save_per_month'])
<tr>
- <td>{{ __('firefly.suggested_amount') }}</td>
+ <td>{{ __('firefly.target_date') }}</td>
<td>
- {!! format_amount_by_symbol($piggy['save_per_month'], $piggy['currency_symbol'], $piggy['currency_decimal_places']) !!}
+ @if(null !== $piggyBank->target_date)
+ {{ $piggyBank->target_date->isoFormat($monthAndDayFormat) }}
+ @else
+ <em>{{ __('firefly.no_target_date') }}</em>
+ @endif
</td>
</tr>
- @endif
- </table>
- </div>
- </div>
- <div class="card mb-2">
- <div class="card-header">
- <h3 class="card-title">{{ __('firefly.event_history') }} (<a class="confirm-history-delete reset-link" href="#">{{ __('firefly.reset_history') }}</a>)</h3>
- </div>
- <div class="card-body p-0" id="piggyEvents">
- <x-lists.piggy-bank-events :events="$events" :show-piggy-bank="false"/>
+ @if(null !== $piggyBank->target_date && null !== $piggy['save_per_month'])
+ <tr>
+ <td>{{ __('firefly.suggested_amount') }}</td>
+ <td>
+ {!! format_amount_by_symbol($piggy['save_per_month'], $piggy['currency_symbol'], $piggy['currency_decimal_places']) !!}
+ </td>
+ </tr>
+ @endif
+ </table>
+ </div>
</div>
- </div>
- </div>
- </div>
- <div class="row">
-
- @if('' !== (string) $piggy['notes'])
- <div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
-
<div class="card mb-2">
<div class="card-header">
- <h3 class="card-title">{{ trans('form.notes') }}</h3>
+ <h3 class="card-title">{{ __('firefly.event_history') }}
+ <small>(<a @click.prevent="confirmHistoryRemoval"
+ class="confirm-history-delete reset-link" href="#">{{ __('firefly.reset_history') }}</a>)</small>
+ </h3>
</div>
- <div class="card-body markdown">{!! parse_markdown($piggy['notes']) !!}
+ <div class="card-body p-0" id="piggyEvents">
+ <x-lists.piggy-bank-events :events="$events" :show-piggy-bank="false"/>
</div>
</div>
-
</div>
- @endif
- @if($attachments->count() > 0)
- <div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
- <div class="card mb-2">
- <div class="card-header">
- <h3 class="card-title">
- {{ __('firefly.attachments') }}
- </h3>
+ </div>
+ <div class="row">
+
+ @if('' !== (string) $piggy['notes'])
+ <div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
+
+ <div class="card mb-2">
+ <div class="card-header">
+ <h3 class="card-title">{{ trans('form.notes') }}</h3>
+ </div>
+ <div class="card-body markdown">{!! parse_markdown($piggy['notes']) !!}
+ </div>
</div>
- <div class="card-body p-0">
- <x-lists.attachments :attachments="$attachments" />
+
+ </div>
+ @endif
+ @if($attachments->count() > 0)
+ <div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
+ <div class="card mb-2">
+ <div class="card-header">
+ <h3 class="card-title">
+ {{ __('firefly.attachments') }}
+ </h3>
+ </div>
+ <div class="card-body p-0">
+ <x-lists.attachments :attachments="$attachments"/>
+ </div>
</div>
</div>
- </div>
- @endif
+ @endif
+ </div>
+ <form id="reset-form" action="{{ route('piggy-banks.reset', [$piggyBank->id]) }}" method="POST" class="hidden">
+ <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
+ </form>
</div>
- <form id="reset-form" action="{{ route('piggy-banks.reset', [$piggyBank->id]) }}" method="POST" class="hidden">
- <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
- </form>
@endsection
@section('scripts')
- @vite(['js/pages/generic.js'])
+ @vite(['js/pages/piggy-banks/show.js'])
<script type="text/javascript" nonce="{{ $JS_NONCE }}">
var piggyBankID = {{ $piggyBank->id }};
- var confirmText= '{{__('firefly.reset_history_confirm') }}';
+ var confirmText = '{{__('firefly.reset_history_confirm') }}';
</script>
- <script type="text/javascript" src="v1/js/lib/Chart.bundle.min.js?v={{ $FF_BUILD_TIME }}" nonce="{{ $JS_NONCE }}"></script>
- <script type="text/javascript" src="v1/js/ff/charts.defaults.js?v={{ $FF_BUILD_TIME }}" nonce="{{ $JS_NONCE }}"></script>
+ <script type="text/javascript" src="v1/js/lib/Chart.bundle.min.js?v={{ $FF_BUILD_TIME }}"
+ nonce="{{ $JS_NONCE }}"></script>
+ <script type="text/javascript" src="v1/js/ff/charts.defaults.js?v={{ $FF_BUILD_TIME }}"
+ nonce="{{ $JS_NONCE }}"></script>
<script type="text/javascript" src="v1/js/ff/charts.js?v={{ $FF_BUILD_TIME }}" nonce="{{ $JS_NONCE }}"></script>
- <script type="text/javascript" src="v1/js/ff/piggy-banks/show.js?v={{ $FF_BUILD_TIME }}" nonce="{{ $JS_NONCE }}"></script>
+ <script type="text/javascript" src="v1/js/ff/piggy-banks/show.js?v={{ $FF_BUILD_TIME }}"
+ nonce="{{ $JS_NONCE }}"></script>
@endsection