Skip to content

Firefly III: a personal finances manager

New views

Sander Dorigof5f214e7fcec
diff --git a/app/View/Components/Transaction/Split.php b/app/View/Components/Transaction/Split.php
index 76f9f997cd..a03001a4aa 100644
--- a/app/View/Components/Transaction/Split.php
+++ b/app/View/Components/Transaction/Split.php
@@ -8,12 +8,14 @@ use Illuminate\View\Component;
class Split extends Component
{
+ public array $optionalFields;
+
/**
* Create a new component instance.
*/
- public function __construct()
+ public function __construct(array $optionalFields)
{
- //
+ $this->optionalFields = $optionalFields;
}
/**
diff --git a/resources/assets/v2/src/support/load-translations.js b/resources/assets/v2/src/support/load-translations.js
index 6e7a372745..bbe7c76d7a 100644
--- a/resources/assets/v2/src/support/load-translations.js
+++ b/resources/assets/v2/src/support/load-translations.js
@@ -27,6 +27,7 @@ import LocalStorageBackend from "i18next-localstorage-backend";
let loaded = false;
function loadTranslations(locale) {
+ console.log('loadTranslations(' + locale + ')');
if (false === loaded) {
const replacedLocale = locale.replace('-', '_');
loaded = true;
diff --git a/resources/assets/v3/js/api/model/budget/get.js b/resources/assets/v3/js/api/model/budget/get.js
new file mode 100644
index 0000000000..2466c46463
--- /dev/null
+++ b/resources/assets/v3/js/api/model/budget/get.js
@@ -0,0 +1,33 @@
+/*
+ * list.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 {api} from "../../../boot/axios";
+export default class Get {
+
+ /**
+ *
+ * @param params
+ * @returns {Promise<AxiosResponse<any>>}
+ */
+ list(params) {
+ return api.get('/api/v1/budgets', {params: params});
+ }
+
+}
diff --git a/resources/assets/v3/js/api/model/currency/get.js b/resources/assets/v3/js/api/model/currency/get.js
new file mode 100644
index 0000000000..87e953f8c2
--- /dev/null
+++ b/resources/assets/v3/js/api/model/currency/get.js
@@ -0,0 +1,34 @@
+/*
+ * list.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 {api} from "../../../boot/axios";
+
+export default class Get {
+
+ /**
+ *
+ * @param params
+ * @returns {Promise<AxiosResponse<any>>}
+ */
+ list(params) {
+ return api.get('/api/v1/currencies', {params: params});
+ }
+
+}
diff --git a/resources/assets/v3/js/api/model/piggy-bank/get.js b/resources/assets/v3/js/api/model/piggy-bank/get.js
new file mode 100644
index 0000000000..c3df77d321
--- /dev/null
+++ b/resources/assets/v3/js/api/model/piggy-bank/get.js
@@ -0,0 +1,35 @@
+/*
+ * get.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";
+
+export default class Get {
+
+ /**
+ *
+ * @param params
+ * @returns {Promise<AxiosResponse<any>>}
+ */
+ list(params) {
+ return api.get('/api/v1/piggy-banks', {params: params});
+ }
+
+}
diff --git a/resources/assets/v3/js/api/model/subscription/get.js b/resources/assets/v3/js/api/model/subscription/get.js
new file mode 100644
index 0000000000..96088023b6
--- /dev/null
+++ b/resources/assets/v3/js/api/model/subscription/get.js
@@ -0,0 +1,42 @@
+/*
+ * get.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";
+
+export default class Get {
+
+ /**
+ *
+ * @param params
+ * @returns {Promise<AxiosResponse<any>>}
+ */
+ list(params) {
+ return api.get('/api/v1/subscriptions', {params: params});
+ }
+
+ paid(params) {
+ return api.get('/api/v1/subscriptions/sum/paid', {params: params});
+ }
+
+ unpaid(params) {
+ return api.get('/api/v1/subscriptions/sum/unpaid', {params: params});
+ }
+}
diff --git a/resources/assets/v3/js/boot/bootstrap.js b/resources/assets/v3/js/boot/bootstrap.js
index 0569c56aaa..4168f4de55 100644
--- a/resources/assets/v3/js/boot/bootstrap.js
+++ b/resources/assets/v3/js/boot/bootstrap.js
@@ -75,61 +75,61 @@ getFreshVariable('lastActivity').then((serverValue) => {
console.log('Bootstrapped!');
// page may have an introduction necessary to be played.
- if (!showTour) {
- return;
- }
- const url = '/';
- let site = axios.create({baseURL: url, withCredentials: true});
- axios.defaults.withCredentials = true;
- axios.defaults.baseURL = url;
-
- site.get(routeStepsUrl).then(function (data) {
- let hints = data.data;
-
- const tour = new Shepherd.Tour({
- useModalOverlay: true,
- defaultStepOptions: {
- // classes: 'shadow-md bg-purple-dark',
- scrollTo: true
- }
- });
-// cancel, complete
- tour.on('cancel', (eventOptions) => {
- site.post(routeForFinishedTour);
- });
- tour.on('complete', (eventOptions) => {
- site.post(routeForFinishedTour);
- });
-
- for (let i = 0; i < hints.length; i++) {
- if (hints.hasOwnProperty(i)) {
- let hint = hints[i];
-
- let step = {
- // id: 'example-step',
- text: hint.text,
-
- classes: 'example-step-extra-class',
- buttons: [
- {
- text: 'Next',
- action: tour.next
- }
- ]
- };
- if (hint.hasOwnProperty('element')) {
- step.attachTo = {
- element: hint.element,
- on: hint.position
- };
- }
- tour.addStep(step);
- }
- }
- tour.start();
-
-
- });
+ // if (!showTour) {
+ // return;
+ // }
+// const url = '/';
+// let site = axios.create({baseURL: url, withCredentials: true});
+// axios.defaults.withCredentials = true;
+// axios.defaults.baseURL = url;
+//
+// site.get(routeStepsUrl).then(function (data) {
+// let hints = data.data;
+//
+// const tour = new Shepherd.Tour({
+// useModalOverlay: true,
+// defaultStepOptions: {
+// // classes: 'shadow-md bg-purple-dark',
+// scrollTo: true
+// }
+// });
+// // cancel, complete
+// tour.on('cancel', (eventOptions) => {
+// site.post(routeForFinishedTour);
+// });
+// tour.on('complete', (eventOptions) => {
+// site.post(routeForFinishedTour);
+// });
+//
+// for (let i = 0; i < hints.length; i++) {
+// if (hints.hasOwnProperty(i)) {
+// let hint = hints[i];
+//
+// let step = {
+// // id: 'example-step',
+// text: hint.text,
+//
+// classes: 'example-step-extra-class',
+// buttons: [
+// {
+// text: 'Next',
+// action: tour.next
+// }
+// ]
+// };
+// if (hint.hasOwnProperty('element')) {
+// step.attachTo = {
+// element: hint.element,
+// on: hint.position
+// };
+// }
+// tour.addStep(step);
+// }
+// }
+// tour.start();
+//
+//
+// });
});
diff --git a/resources/assets/v3/js/pages/transactions/create.js b/resources/assets/v3/js/pages/transactions/create.js
index e5c914ba1d..bf246698b3 100644
--- a/resources/assets/v3/js/pages/transactions/create.js
+++ b/resources/assets/v3/js/pages/transactions/create.js
@@ -25,27 +25,26 @@ import {createEmptySplit, defaultErrorSet} from "./shared/create-empty-split.js"
// import {parseFromEntries} from "./shared/parse-from-entries.js";
import formatMoney from "../../util/format-money.js";
// import Post from "../../api/model/transaction/post.js";
-// import {loadCurrencies} from "./shared/load-currencies.js";
-// import {loadBudgets} from "./shared/load-budgets.js";
-// import {loadBudgets} from "./shared/load-budgets.js";
-// import {loadPiggyBanks} from "./shared/load-piggy-banks.js";
-// import {loadSubscriptions} from "./shared/load-subscriptions.js";
+import {loadCurrencies} from "./shared/load-currencies.js";
+import {loadBudgets} from "./shared/load-budgets.js";
+import {loadPiggyBanks} from "./shared/load-piggy-banks.js";
+import {loadSubscriptions} from "./shared/load-subscriptions.js";
//
// import 'leaflet/dist/leaflet.css';
import {addAutocomplete, getUrls} from "./shared/add-autocomplete.js";
-// import {
-// changeCategory,
-// changeDescription,
-// changeDestinationAccount,
-// changeSourceAccount,
-// selectDestinationAccount,
-// selectSourceAccount
-// } from "./shared/autocomplete-functions.js";
+import {
+ changeCategory,
+ changeDescription,
+ changeDestinationAccount,
+ changeSourceAccount,
+ selectDestinationAccount,
+ selectSourceAccount
+} from "./shared/autocomplete-functions.js";
// import {processAttachments} from "./shared/process-attachments.js";
// import {spliceErrorsIntoTransactions} from "./shared/splice-errors-into-transactions.js";
// import Tags from "bootstrap5-tags";
// import {addLocation} from "./shared/manage-locations.js";
-// import i18next from "i18next";
+import i18next from "i18next";
// TODO upload attachments to other file
// TODO fix two maps, perhaps disconnect from entries entirely.
// TODO group title
@@ -58,30 +57,31 @@ let create = function () {
return {
// transactions are stored in "entries":
entries: [],
- //
- // // state of the form is stored in formState:
- // formStates: {
- // loadingCurrencies: true,
- // loadingBudgets: true,
- // loadingPiggyBanks: true,
- // loadingSubscriptions: true,
- // isSubmitting: false,
- // returnHereButton: false,
- // saveAsNewButton: false, // edit form only
- // resetButton: false,
- // rulesButton: true,
- // webhooksButton: true,
- // categorySelectVisible: false
- // },
- //
- // // form behavior during transaction
- // formBehaviour: {
- // formType: 'create',
- // foreignCurrencyEnabled: true,
- // },
- //
- // // form data (except transactions) is stored in formData
+
+ // state of the form is stored in formState:
+ formStates: {
+ loadingCurrencies: true,
+ loadingBudgets: true,
+ loadingPiggyBanks: true,
+ loadingSubscriptions: true,
+ isSubmitting: false,
+ returnHereButton: false,
+ saveAsNewButton: false, // edit form only
+ resetButton: false,
+ rulesButton: true,
+ webhooksButton: true,
+ categorySelectVisible: false
+ },
+
+ // form behavior during transaction
+ formBehaviour: {
+ formType: 'create',
+ foreignCurrencyEnabled: true,
+ },
+
+ // form data (except transactions) is stored in formData
formData: {
+ primaryCurrency: null,
defaultCurrency: null,
enabledCurrencies: [],
primaryCurrencies: [],
@@ -90,16 +90,16 @@ let create = function () {
piggyBanks: [],
subscriptions: [],
},
- //
- // // properties for the entire transaction group
+
+ // properties for the entire transaction group
groupProperties: {
transactionType: 'unknown',
title: null,
id: null,
totalAmount: 0,
},
- //
- // // notifications
+
+ // notifications
notifications: {
error: {
show: false, text: '', url: '',
@@ -110,170 +110,169 @@ let create = function () {
}
},
- //
- //
- // // part of the account selection auto-complete
- // filters: {
- // source: [], destination: [],
- // },
- //
- // // events in the form
- // changedDateTime(event) {
- // console.warn('changedDateTime, event is not used');
- // },
- //
- // changedDescription(event) {
- // console.warn('changedDescription, event is not used');
- // },
- //
- // changedDestinationAccount(event) {
- // this.detectTransactionType();
- // },
- //
- // changedSourceAccount(event) {
- // this.detectTransactionType();
- // },
- //
- // detectTransactionType() {
- // const sourceType = this.entries[0].source_account.type ?? 'unknown';
- // const destType = this.entries[0].destination_account.type ?? 'unknown';
- // if ('unknown' === sourceType && 'unknown' === destType) {
- // this.groupProperties.transactionType = 'unknown';
- // console.warn('Cannot infer transaction type from two unknown accounts.');
- // return;
- // }
- //
- // // transfer: both are the same and in strict set of account types
- // if (sourceType === destType && ['Asset account', 'Loan', 'Debt', 'Mortgage'].includes(sourceType)) {
- // this.groupProperties.transactionType = 'transfer';
- // console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
- //
- // // this also locks the amount into the amount of the source account
- // // and the foreign amount (if different) in that of the destination account.
- // console.log('filter down currencies for transfer.');
- // this.filterPrimaryCurrencies(this.entries[0].source_account.currency_code);
- // this.filterForeignCurrencies(this.entries[0].destination_account.currency_code);
- // return;
- // }
- // // withdrawals:
- // if ('Asset account' === sourceType && ['Expense account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) {
- // this.groupProperties.transactionType = 'withdrawal';
- // console.log('[a] Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
- // this.filterPrimaryCurrencies(this.entries[0].source_account.currency_code);
- // return;
- // }
- // if ('Asset account' === sourceType && 'unknown' === destType) {
- // this.groupProperties.transactionType = 'withdrawal';
- // console.log('[b] Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
- // console.log(this.entries[0].source_account);
- // this.filterPrimaryCurrencies(this.entries[0].source_account.currency_code);
- // return;
- // }
- // if (['Debt', 'Loan', 'Mortgage'].includes(sourceType) && 'Expense account' === destType) {
- // this.groupProperties.transactionType = 'withdrawal';
- // console.log('[c] Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
- // this.filterPrimaryCurrencies(this.entries[0].source_account.currency_code);
- // return;
- // }
- //
- // // deposits:
- // if ('Revenue account' === sourceType && ['Asset account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) {
- // this.groupProperties.transactionType = 'deposit';
- // console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
- // return;
- // }
- // if ('unknown' === sourceType && ['Asset account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) {
- // this.groupProperties.transactionType = 'deposit';
- // console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
- // return;
- // }
- // if ('Expense account' === sourceType && ['Asset account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) {
- // this.groupProperties.transactionType = 'deposit';
- // console.warn('FORCE transaction type to be "' + this.groupProperties.transactionType + '".');
- // this.entries[0].source_account.id = '';
- // return;
- // }
- // if (['Debt', 'Loan', 'Mortgage'].includes(sourceType) && 'Asset account' === destType) {
- // this.groupProperties.transactionType = 'deposit';
- // console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
- // return;
- // }
- // console.warn('Unknown account combination between "' + sourceType + '" and "' + destType + '".');
- // },
- //
+
+
+ // part of the account selection auto-complete
+ filters: {
+ source: [], destination: [],
+ },
+
+ // events in the form
+ changedDateTime(event) {
+ console.warn('changedDateTime, event is not used');
+ },
+
+ changedDescription(event) {
+ console.warn('changedDescription, event is not used');
+ },
+
+ changedDestinationAccount(event) {
+ this.detectTransactionType();
+ },
+
+ changedSourceAccount(event) {
+ this.detectTransactionType();
+ },
+
+ detectTransactionType() {
+ const sourceType = this.entries[0].source_account.type ?? 'unknown';
+ const destType = this.entries[0].destination_account.type ?? 'unknown';
+ if ('unknown' === sourceType && 'unknown' === destType) {
+ this.groupProperties.transactionType = 'unknown';
+ console.warn('Cannot infer transaction type from two unknown accounts.');
+ return;
+ }
+
+ // transfer: both are the same and in strict set of account types
+ if (sourceType === destType && ['Asset account', 'Loan', 'Debt', 'Mortgage'].includes(sourceType)) {
+ this.groupProperties.transactionType = 'transfer';
+ console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
+
+ // this also locks the amount into the amount of the source account
+ // and the foreign amount (if different) in that of the destination account.
+ console.log('filter down currencies for transfer.');
+ this.filterPrimaryCurrencies(this.entries[0].source_account.currency_code);
+ this.filterForeignCurrencies(this.entries[0].destination_account.currency_code);
+ return;
+ }
+ // withdrawals:
+ if ('Asset account' === sourceType && ['Expense account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) {
+ this.groupProperties.transactionType = 'withdrawal';
+ console.log('[a] Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
+ this.filterPrimaryCurrencies(this.entries[0].source_account.currency_code);
+ return;
+ }
+ if ('Asset account' === sourceType && 'unknown' === destType) {
+ this.groupProperties.transactionType = 'withdrawal';
+ console.log('[b] Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
+ console.log(this.entries[0].source_account);
+ this.filterPrimaryCurrencies(this.entries[0].source_account.currency_code);
+ return;
+ }
+ if (['Debt', 'Loan', 'Mortgage'].includes(sourceType) && 'Expense account' === destType) {
+ this.groupProperties.transactionType = 'withdrawal';
+ console.log('[c] Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
+ this.filterPrimaryCurrencies(this.entries[0].source_account.currency_code);
+ return;
+ }
+
+ // deposits:
+ if ('Revenue account' === sourceType && ['Asset account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) {
+ this.groupProperties.transactionType = 'deposit';
+ console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
+ return;
+ }
+ if ('unknown' === sourceType && ['Asset account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) {
+ this.groupProperties.transactionType = 'deposit';
+ console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
+ return;
+ }
+ if ('Expense account' === sourceType && ['Asset account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) {
+ this.groupProperties.transactionType = 'deposit';
+ console.warn('FORCE transaction type to be "' + this.groupProperties.transactionType + '".');
+ this.entries[0].source_account.id = '';
+ return;
+ }
+ if (['Debt', 'Loan', 'Mortgage'].includes(sourceType) && 'Asset account' === destType) {
+ this.groupProperties.transactionType = 'deposit';
+ console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
+ return;
+ }
+ console.warn('Unknown account combination between "' + sourceType + '" and "' + destType + '".');
+ },
+
formattedTotalAmount() {
if (this.entries.length === 0) {
return formatMoney(this.groupProperties.totalAmount, 'EUR');
}
return formatMoney(this.groupProperties.totalAmount, this.entries[0].currency_code ?? 'EUR');
},
- //
- // filterForeignCurrencies(code) {
- // let list = [];
- // let currency;
- // for (let i in this.formData.enabledCurrencies) {
- // if (this.formData.enabledCurrencies.hasOwnProperty(i)) {
- // let current = this.formData.enabledCurrencies[i];
- // if (current.code === code) {
- // currency = current;
- // }
- // }
- // }
- // list.push(currency);
- // this.formData.foreignCurrencies = list;
- // // is he source account currency anyway:
- // if (1 === list.length && list[0].code === this.entries[0].source_account.currency_code) {
- // console.log('Foreign currency is same as source currency. Disable foreign amount.');
- // this.formBehaviour.foreignCurrencyEnabled = false;
- // }
- // if (1 === list.length && list[0].code !== this.entries[0].source_account.currency_code) {
- // console.log('Foreign currency is NOT same as source currency. Enable foreign amount.');
- // this.formBehaviour.foreignCurrencyEnabled = true;
- // }
- //
- // // this also forces the currency_code on ALL entries.
- // for (let i in this.entries) {
- // if (this.entries.hasOwnProperty(i)) {
- // this.entries[i].foreign_currency_code = code;
- // }
- // }
- // },
- //
- // filterPrimaryCurrencies(code) {
- // let list = [];
- // let currency;
- // for (let i in this.formData.enabledCurrencies) {
- // if (this.formData.enabledCurrencies.hasOwnProperty(i)) {
- // let current = this.formData.enabledCurrencies[i];
- // if (current.code === code) {
- // currency = current;
- // }
- // }
- // }
- // list.push(currency);
- // this.formData.primaryCurrencies = list;
- //
- // // this also forces the currency_code on ALL entries.
- // for (let i in this.entries) {
- // if (this.entries.hasOwnProperty(i)) {
- // this.entries[i].currency_code = code;
- // }
- // }
- // },
- //
- // changedAmount(e) {
- // const index = parseInt(e.target.dataset.index);
- // this.entries[index].amount = parseFloat(e.target.value);
- // this.groupProperties.totalAmount = 0;
- // for (let i in this.entries) {
- // if (this.entries.hasOwnProperty(i)) {
- // this.groupProperties.totalAmount = this.groupProperties.totalAmount + parseFloat(this.entries[i].amount);
- // }
- // }
- // },
- //
- addedSplit() {
+ filterForeignCurrencies(code) {
+ let list = [];
+ let currency;
+ for (let i in this.formData.enabledCurrencies) {
+ if (this.formData.enabledCurrencies.hasOwnProperty(i)) {
+ let current = this.formData.enabledCurrencies[i];
+ if (current.code === code) {
+ currency = current;
+ }
+ }
+ }
+ list.push(currency);
+ this.formData.foreignCurrencies = list;
+ // is he source account currency anyway:
+ if (1 === list.length && list[0].code === this.entries[0].source_account.currency_code) {
+ console.log('Foreign currency is same as source currency. Disable foreign amount.');
+ this.formBehaviour.foreignCurrencyEnabled = false;
+ }
+ if (1 === list.length && list[0].code !== this.entries[0].source_account.currency_code) {
+ console.log('Foreign currency is NOT same as source currency. Enable foreign amount.');
+ this.formBehaviour.foreignCurrencyEnabled = true;
+ }
+
+ // this also forces the currency_code on ALL entries.
+ for (let i in this.entries) {
+ if (this.entries.hasOwnProperty(i)) {
+ this.entries[i].foreign_currency_code = code;
+ }
+ }
+ },
+
+ filterPrimaryCurrencies(code) {
+ let list = [];
+ let currency;
+ for (let i in this.formData.enabledCurrencies) {
+ if (this.formData.enabledCurrencies.hasOwnProperty(i)) {
+ let current = this.formData.enabledCurrencies[i];
+ if (current.code === code) {
+ currency = current;
+ }
+ }
+ }
+ list.push(currency);
+ this.formData.primaryCurrencies = list;
+
+ // this also forces the currency_code on ALL entries.
+ for (let i in this.entries) {
+ if (this.entries.hasOwnProperty(i)) {
+ this.entries[i].currency_code = code;
+ }
+ }
+ },
+
+ changedAmount(e) {
+ const index = parseInt(e.target.dataset.index);
+ this.entries[index].amount = parseFloat(e.target.value);
+ this.groupProperties.totalAmount = 0;
+ for (let i in this.entries) {
+ if (this.entries.hasOwnProperty(i)) {
+ this.groupProperties.totalAmount = this.groupProperties.totalAmount + parseFloat(this.entries[i].amount);
+ }
+ }
+ },
+
+ addedSplit() {
},
//
@@ -293,28 +292,29 @@ let create = function () {
init() {
console.log('init()');
this.addSplit();
- //
- // // load currencies and save in form data.
- // loadCurrencies().then(data => {
- // this.formStates.loadingCurrencies = false;
- // this.formData.defaultCurrency = data.defaultCurrency;
- // this.formData.enabledCurrencies = data.enabledCurrencies;
- // this.formData.primaryCurrencies = data.primaryCurrencies;
- // this.formData.foreignCurrencies = data.foreignCurrencies;
- // });
- //
- // loadBudgets().then(data => {
- // this.formData.budgets = data;
- // this.formStates.loadingBudgets = false;
- // });
- // loadPiggyBanks().then(data => {
- // this.formData.piggyBanks = data;
- // this.formStates.loadingPiggyBanks = false;
- // });
- // loadSubscriptions().then(data => {
- // this.formData.subscriptions = data;
- // this.formStates.loadingSubscriptions = false;
- // });
+
+ // load currencies and save in form data.
+ loadCurrencies().then(data => {
+ this.formStates.loadingCurrencies = false;
+ this.formData.primaryCurrency = data.primaryCurrency;
+ this.formData.defaultCurrency = data.defaultCurrency;
+ this.formData.enabledCurrencies = data.enabledCurrencies;
+ this.formData.primaryCurrencies = data.primaryCurrencies;
+ this.formData.foreignCurrencies = data.foreignCurrencies;
+ });
+
+ loadBudgets().then(data => {
+ this.formData.budgets = data;
+ this.formStates.loadingBudgets = false;
+ });
+ loadPiggyBanks().then(data => {
+ this.formData.piggyBanks = data;
+ this.formStates.loadingPiggyBanks = false;
+ });
+ loadSubscriptions().then(data => {
+ this.formData.subscriptions = data;
+ this.formStates.loadingSubscriptions = false;
+ });
//
// document.addEventListener('upload-success', (event) => {
// this.processUpload(event);
@@ -342,10 +342,10 @@ let create = function () {
// });
//
//
- // // source can never be expense account
- // this.filters.source = ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Revenue account'];
- // // destination can never be revenue account
- // this.filters.destination = ['Expense account', 'Loan', 'Debt', 'Mortgage', 'Asset account'];
+ // source can never be expense account
+ this.filters.source = ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Revenue account'];
+ // destination can never be revenue account
+ this.filters.destination = ['Expense account', 'Loan', 'Debt', 'Mortgage', 'Asset account'];
},
// keyUpFromCategory(e) {
// if (e.key === 'Enter' && false === this.formStates.categorySelectVisible) {
@@ -467,6 +467,45 @@ let create = function () {
console.log('addSplit()');
this.entries.push(createEmptySplit());
+ setTimeout(() => {
+ const count = this.entries.length - 1;
+ const renderAccount = function (item, b, c) {
+ return item.name_with_balance + '<br><small class="text-muted">' + i18next.t('firefly.account_type_' + item.type) + '</small>';
+ };
+
+ addAutocomplete({
+ selector: 'input.ac-description',
+ serverUrl: urls.description,
+ valueField: 'id',
+ labelField: 'description',
+ onChange: changeDescription,
+ onSelectItem: changeDescription,
+ });
+
+ addAutocomplete({
+ selector: 'input.ac-source',
+ serverUrl: urls.account,
+ onRenderItem: renderAccount,
+ valueField: 'id',
+ labelField: 'name_with_balance',
+ onChange: changeSourceAccount,
+ onSelectItem: selectSourceAccount,
+ hiddenValue: this.entries[count].source_account.alpine_name
+ });
+
+ addAutocomplete({
+ selector: 'input.ac-dest',
+ serverUrl: urls.account,
+ account_types: this.filters.destination,
+ valueField: 'id',
+ labelField: 'name_with_balance',
+ onRenderItem: renderAccount,
+ onChange: changeDestinationAccount,
+ onSelectItem: selectDestinationAccount
+ });
+
+ }, 150);
+
// setTimeout(() => {
// // render tags:
// Tags.init('select.ac-tags', {
@@ -487,36 +526,16 @@ let create = function () {
// }
// }
// });
- // const count = this.entries.length - 1;
+ //
// // if(document.querySelector('#location_map_' + count)) { }
// addLocation(count);
//
// // addedSplit, is called from the HTML
// // for source account
- // const renderAccount = function (item, b, c) {
- // return item.name_with_balance + '<br><small class="text-muted">' + i18next.t('firefly.account_type_' + item.type) + '</small>';
- // };
+
// console.log('here we are in');
- // addAutocomplete({
- // selector: 'input.ac-source',
- // serverUrl: urls.account,
- // onRenderItem: renderAccount,
- // valueField: 'id',
- // labelField: 'name_with_balance',
- // onChange: changeSourceAccount,
- // onSelectItem: selectSourceAccount,
- // hiddenValue: this.entries[count].source_account.alpine_name
- // });
- // addAutocomplete({
- // selector: 'input.ac-dest',
- // serverUrl: urls.account,
- // account_types: this.filters.destination,
- // valueField: 'id',
- // labelField: 'name_with_balance',
- // onRenderItem: renderAccount,
- // onChange: changeDestinationAccount,
- // onSelectItem: selectDestinationAccount
- // });
+
+
// addAutocomplete({
// selector: 'input.ac-category',
// serverUrl: urls.category,
@@ -536,13 +555,13 @@ let create = function () {
//
// }, 150);
},
- //
- // removeSplit(index) {
- // this.entries.splice(index, 1);
- // // fall back to index 0
- // const triggerFirstTabEl = document.querySelector('#split-0-tab')
- // triggerFirstTabEl.click();
- // },
+
+ removeSplit(index) {
+ this.entries.splice(index, 1);
+ // fall back to index 0
+ const triggerFirstTabEl = document.querySelector('#split-0-tab')
+ triggerFirstTabEl.click();
+ },
//
// clearLocation(e) {
// e.preventDefault();
diff --git a/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js b/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js
index a71dcf023e..1c59bf8cb3 100644
--- a/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js
+++ b/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js
@@ -22,7 +22,7 @@ import Autocomplete from "bootstrap5-autocomplete";
export function getUrls() {
return {
- description: '/api/v1/autocomplete/transaction-descriptions',
+ description: '/api/v1/autocomplete/transactions',
account: '/api/v1/autocomplete/accounts',
category: '/api/v1/autocomplete/categories',
tag: '/api/v1/autocomplete/tags',
diff --git a/resources/assets/v3/js/pages/transactions/shared/load-budgets.js b/resources/assets/v3/js/pages/transactions/shared/load-budgets.js
index 8416953fc3..a2f883f8bf 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-budgets.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-budgets.js
@@ -19,7 +19,7 @@
*/
-import Get from "../../../api/v1/model/budget/get.js";
+import Get from "../../../api/model/budget/get.js";
export function loadBudgets() {
let params = {
diff --git a/resources/assets/v3/js/pages/transactions/shared/load-currencies.js b/resources/assets/v3/js/pages/transactions/shared/load-currencies.js
index 2580a1389b..28bc480c89 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-currencies.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-currencies.js
@@ -19,7 +19,7 @@
*/
-import Get from "../../../api/v1/model/currency/get.js";
+import Get from "../../../api/model/currency/get.js";
export function loadCurrencies() {
let params = {
@@ -52,7 +52,9 @@ export function loadCurrencies() {
};
if (obj.primary) {
+ console.log('Made ' + obj.code + ' primary.');
returnData.primaryCurrency = obj;
+ console.log(returnData.primaryCurrency);
}
returnData.enabledCurrencies.push(obj);
returnData.primaryCurrencies.push(obj);
diff --git a/resources/assets/v3/js/pages/transactions/shared/load-piggy-banks.js b/resources/assets/v3/js/pages/transactions/shared/load-piggy-banks.js
index c014345539..1776211a85 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-piggy-banks.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-piggy-banks.js
@@ -18,7 +18,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import Get from "../../../api/v1/model/piggy-bank/get.js";
+import Get from "../../../api/model/piggy-bank/get.js";
export function loadPiggyBanks() {
let params = {
diff --git a/resources/assets/v3/js/pages/transactions/shared/load-subscriptions.js b/resources/assets/v3/js/pages/transactions/shared/load-subscriptions.js
index a3ecb8b657..af800ed32a 100644
--- a/resources/assets/v3/js/pages/transactions/shared/load-subscriptions.js
+++ b/resources/assets/v3/js/pages/transactions/shared/load-subscriptions.js
@@ -18,7 +18,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import SubscriptionGet from "../../../api/v1/model/subscription/get.js";
+import SubscriptionGet from "../../../api/model/subscription/get.js";
export function loadSubscriptions() {
let params = {
diff --git a/resources/views/components/transaction/split.blade.php b/resources/views/components/transaction/split.blade.php
index a3252a64d5..1a8b74c819 100644
--- a/resources/views/components/transaction/split.blade.php
+++ b/resources/views/components/transaction/split.blade.php
@@ -8,16 +8,16 @@
</div>
<div class="card-body">
<!-- DESCRIPTION -->
- include('partials.form.transaction.description')
+ @include('partials.form.transaction.description')
<!-- SOURCE ACCOUNT -->
- include('partials.form.transaction.source-account')
+ @include('partials.form.transaction.source-account')
<!-- DESTINATION ACCOUNT -->
- include('partials.form.transaction.destination-account')
+ @include('partials.form.transaction.destination-account')
<!-- DATE AND TIME -->
- include('partials.form.transaction.date-time')
+ @include('partials.form.transaction.date-time')
</div>
</div>
</div>
@@ -32,10 +32,10 @@
</div>
<div class="card-body">
<!-- AMOUNT -->
- include('partials.form.transaction.amount')
+ @include('partials.form.transaction.amount')
<!-- FOREIGN AMOUNT -->
- include('partials.form.transaction.foreign-amount')
+ @include('partials.form.transaction.foreign-amount')
</div>
</div>
</div>
@@ -49,22 +49,22 @@
</div>
<div class="card-body">
<!-- BUDGET -->
- include('partials.form.transaction.budget')
+ @include('partials.form.transaction.budget')
<!-- CATEGORY -->
- include('partials.form.transaction.category')
+ @include('partials.form.transaction.category')
<!-- PIGGY BANK -->
- include('partials.form.transaction.piggy-bank')
+ @include('partials.form.transaction.piggy-bank')
<!-- SUBSCRIPTION -->
- include('partials.form.transaction.subscription')
+ @include('partials.form.transaction.subscription')
<!-- TAGS -->
- include('partials.form.transaction.tags')
+ @include('partials.form.transaction.tags')
<!-- NOTES -->
- include('partials.form.transaction.notes')
+ @include('partials.form.transaction.notes')
</div>
</div>
diff --git a/resources/views/components/transaction/tab-list.blade.php b/resources/views/components/transaction/tab-list.blade.php
index ebe95b5fd2..5bdc8a4e0a 100644
--- a/resources/views/components/transaction/tab-list.blade.php
+++ b/resources/views/components/transaction/tab-list.blade.php
@@ -1,5 +1,6 @@
<div class="row">
<div class="col">
+
<ul class="nav nav-tabs" id="splitTabs" role="tablist">
<template x-for="transaction,index in entries">
<li class="nav-item" role="presentation">
@@ -9,14 +10,13 @@
:data-bs-target="'#split-'+index+'-pane'"
type="button" role="tab"
:aria-controls="'split-'+index+'-pane'"
- aria-selected="true">{{ __('firefly.single_split') }} #
- <span x-text="index+1"></span>
+ aria-selected="true">{{ __('firefly.single_split') }} #<span x-text="index+1"></span>
</button>
</li>
</template>
<li class="nav-item" role="presentation">
<button class="nav-link" type="button" role="tab" @click="addSplit()"
- ><em class="fa-solid fa-plus-circle"></em>
+ ><em class="bi bi-plus-circle"></em>
</button>
</li>
<li class="nav-item">
diff --git a/resources/views/partials/form/transaction/amount.blade.php b/resources/views/partials/form/transaction/amount.blade.php
new file mode 100644
index 0000000000..0d6884f45f
--- /dev/null
+++ b/resources/views/partials/form/transaction/amount.blade.php
@@ -0,0 +1,34 @@
+<div class="row mb-3">
+ <!-- select for currency -->
+ <div class="col-sm-3">
+ <!-- is loading currencies -->
+ <template x-if="formStates.loadingCurrencies">
+ <span class="form-control-plaintext"><em class="fa-solid fa-spinner fa-spin"></em></span>
+ </template>
+ <!-- is no longer loading currencies -->
+ <template x-if="!formStates.loadingCurrencies">
+ <select class="form-control" :id="'currency_code_' + index" x-model="transaction.currency_code">
+ <template x-for="currency in formData.primaryCurrencies">
+ <option :selected="currency.id == formData.primaryCurrency.id"
+ :label="currency.name" :value="currency.code"
+ x-text="currency.name"></option>
+ </template>
+ </select>
+ </template>
+ </div>
+ <!-- actual amount -->
+ <div class="col-sm-9">
+ <input type="number" step="any" min="0"
+ :id="'amount_' + index"
+ :data-index="index"
+ :class="{'is-invalid': transaction.errors.amount.length > 0, 'input-mask' : true, 'form-control': true}"
+ x-model="transaction.amount"
+ @keyup.enter="submitTransaction()"
+ @change="changedAmount"
+ placeholder="0.00">
+ <template x-if="transaction.errors.amount.length > 0">
+ <div class="invalid-feedback"
+ x-text="transaction.errors.amount[0]"></div>
+ </template>
+ </div>
+</div>
diff --git a/resources/views/partials/form/transaction/budget.blade.php b/resources/views/partials/form/transaction/budget.blade.php
new file mode 100644
index 0000000000..30db5c752d
--- /dev/null
+++ b/resources/views/partials/form/transaction/budget.blade.php
@@ -0,0 +1,29 @@
+<template x-if="groupProperties.transactionType != 'deposit' && groupProperties.transactionType != 'transfer'">
+ <div class="row mb-3">
+ <label :for="'budget_id_' + index"
+ class="col-sm-1 col-form-label d-none d-sm-block">
+ <em title="{{ __('firefly.budget') }}" class="bi bi-pie-chart"></em>
+ </label>
+ <div class="col-sm-10">
+ <template x-if="formStates.loadingBudgets">
+ <span class="form-control-plaintext">
+ <div class="spinner-border spinner-border-sm text-primary" role="status">
+ <span class="visually-hidden">Loading...</span>
+ </div>
+ </span>
+ </template>
+ <template x-if="!formStates.loadingBudgets">
+ <select class="form-control"
+ :id="'budget_id_' + index"
+ x-model="transaction.budget_id"
+ @keyup.enter="submitTransaction()"
+ >
+ <template x-for="budget in formData.budgets">
+ <option :label="budget.name" :value="budget.id" :selected="budget.id == transaction.budget_id"
+ x-text="budget.name"></option>
+ </template>
+ </select>
+ </template>
+ </div>
+ </div>
+</template>
diff --git a/resources/views/partials/form/transaction/category.blade.php b/resources/views/partials/form/transaction/category.blade.php
new file mode 100644
index 0000000000..91221903ac
--- /dev/null
+++ b/resources/views/partials/form/transaction/category.blade.php
@@ -0,0 +1,14 @@
+<div class="row mb-3">
+ <label :for="'category_name_' + index" class="col-sm-1 col-form-label d-none d-sm-block">
+ <em title="{{ __('firefly.category') }}" class="bi bi-bookmark"></em>
+ </label>
+ <div class="col-sm-10">
+ <input type="search"
+ class="form-control ac-category"
+ :id="'category_name_' + index"
+ @keyup="keyUpFromCategory"
+ x-model="transaction.category_name"
+ :data-index="index"
+ placeholder="{{ __('firefly.category') }}">
+ </div>
+</div>
diff --git a/resources/views/partials/form/transaction/date-time.blade.php b/resources/views/partials/form/transaction/date-time.blade.php
new file mode 100644
index 0000000000..a70ba8e98c
--- /dev/null
+++ b/resources/views/partials/form/transaction/date-time.blade.php
@@ -0,0 +1,12 @@
+<div class="row mb-3">
+ <label :for="'date_' + index" class="col-sm-1 col-form-label d-none d-sm-block">
+ <em title="{{ __('firefly.date_and_time') }}" class="fa-solid fa-calendar"></em>
+ </label>
+ <div class="col-sm-10">
+ <input type="datetime-local" class="form-control" :id="'date_' + index"
+ @change="changedDateTime"
+ @keyup.enter="submitTransaction()"
+ x-model="transaction.date"
+ >
+ </div>
+</div>
diff --git a/resources/views/partials/form/transaction/description.blade.php b/resources/views/partials/form/transaction/description.blade.php
new file mode 100644
index 0000000000..7f789f5608
--- /dev/null
+++ b/resources/views/partials/form/transaction/description.blade.php
@@ -0,0 +1,20 @@
+<div class="row mb-3">
+ <label :for="'description_' + index" class="col-sm-1 col-form-label d-none d-sm-block">
+ <em title="{{ __('firefly.description') }}" class="bi bi-fonts"></em>
+ </label>
+ <div class="col-sm-10">
+ <input type="text" class="form-control ac-description"
+ :id="'description_' + index"
+ @change="changedDescription"
+ @keyup.enter="submitTransaction()"
+ x-model="transaction.description"
+ :class="{'is-invalid': transaction.errors.description.length > 0, 'form-control': true}"
+ :data-index="index"
+ placeholder="{{ __('firefly.description') }}">
+ <template x-if="transaction.errors.description.length > 0">
+ <div class="invalid-feedback"
+ x-text="transaction.errors.description[0]">
+ </div>
+ </template>
+ </div>
+</div>
diff --git a/resources/views/partials/form/transaction/destination-account.blade.php b/resources/views/partials/form/transaction/destination-account.blade.php
new file mode 100644
index 0000000000..4175863f82
--- /dev/null
+++ b/resources/views/partials/form/transaction/destination-account.blade.php
@@ -0,0 +1,20 @@
+<div class="row mb-3">
+ <label :for="'dest_' + index"
+ class="col-sm-1 col-form-label d-none d-sm-block">
+ <em title="{{ __('firefly.destination_account') }}" class="bi bi-arrow-right"></em>
+ </label>
+ <div class="col-sm-10">
+ <input type="text"
+ :class="{'is-invalid': transaction.errors.destination_account.length > 0, 'form-control': true, 'ac-dest': true}"
+ :id="'dest_' + index"
+ x-model="transaction.destination_account.alpine_name"
+ :data-index="index"
+ @changed="changedDestinationAccount"
+ placeholder="{{ __('firefly.destination_account') }}">
+ <template x-if="transaction.errors.destination_account.length > 0">
+ <div class="invalid-feedback"
+ x-text="transaction.errors.destination_account[0]">
+ </div>
+ </template>
+ </div>
+</div>
diff --git a/resources/views/partials/form/transaction/foreign-amount.blade.php b/resources/views/partials/form/transaction/foreign-amount.blade.php
new file mode 100644
index 0000000000..39ab0e93df
--- /dev/null
+++ b/resources/views/partials/form/transaction/foreign-amount.blade.php
@@ -0,0 +1,38 @@
+<template x-if="formBehaviour.foreignCurrencyEnabled">
+ <div class="row mb-3">
+ <div class="col-sm-3">
+ <label class="form-label">&nbsp;</label>
+ <template x-if="formStates.loadingCurrencies">
+ <span class="form-control-plaintext"><em class="fa-solid fa-spinner fa-spin"></em></span>
+ </template>
+ <template x-if="!formStates.loadingCurrencies">
+ <select class="form-control"
+ :id="'foreign_currency_code_' + index"
+ x-model="transaction.foreign_currency_code">
+ <template x-for="currency in formData.foreignCurrencies">
+ <option :label="currency.name" :value="currency.code"
+ x-text="currency.name"></option>
+ </template>
+ </select>
+ </template>
+ </div>
+ <div class="col-sm-9">
+ <template x-if="groupProperties.transactionType != 'transfer'">
+ <label class="small form-label">{{ __('firefly.amount_foreign_if') }}</label>
+ </template>
+ <template x-if="groupProperties.transactionType == 'transfer'">
+ <label class="small form-label">{{ __('firefly.amount_destination_account') }}</label>
+ </template>
+ <input type="number" step="any" min="0"
+ :id="'amount_' + index"
+ :data-index="index"
+ :class="{'is-invalid': transaction.errors.foreign_amount.length > 0, 'input-mask' : true, 'form-control': true}"
+ x-model="transaction.foreign_amount"
+ @change="changedAmount"
+ placeholder="0.00">
+ <template x-if="transaction.errors.foreign_amount.length > 0">
+ <div class="invalid-feedback" x-text="transaction.errors.foreign_amount[0]"></div>
+ </template>
+ </div>
+ </div>
+</template>
diff --git a/resources/views/partials/form/transaction/notes.blade.php b/resources/views/partials/form/transaction/notes.blade.php
new file mode 100644
index 0000000000..dfeb71833e
--- /dev/null
+++ b/resources/views/partials/form/transaction/notes.blade.php
@@ -0,0 +1,13 @@
+@if(true === $optionalFields['notes'])
+<div class="row mb-3">
+ <label :for="'notes_' + index" class="col-sm-1 col-form-label d-none d-sm-block">
+ <em title="{{ __('firefly.notes') }}" class="fa-solid fa-font"></em>
+ </label>
+ <div class="col-sm-10">
+ <textarea class="form-control"
+ :id="'notes_' + index"
+ x-model="transaction.notes"
+ placeholder="{{ __('firefly.notes') }}"></textarea>
+ </div>
+</div>
+@endif
diff --git a/resources/views/partials/form/transaction/piggy-bank.blade.php b/resources/views/partials/form/transaction/piggy-bank.blade.php
new file mode 100644
index 0000000000..f0ba5d0f3a
--- /dev/null
+++ b/resources/views/partials/form/transaction/piggy-bank.blade.php
@@ -0,0 +1,33 @@
+<template x-if="groupProperties.transactionType != 'deposit' && groupProperties.transactionType != 'withdrawal'">
+ <div class="row mb-3">
+ <label :for="'piggy_bank_id_' + index"
+ class="col-sm-1 col-form-label d-none d-sm-block">
+ <em title="{{ __('firefly.piggy_bank') }}" class="bi bi-piggy-bank"></em>
+ </label>
+ <div class="col-sm-10">
+ <template x-if="formStates.loadingPiggyBanks">
+ <span class="form-control-plaintext">
+ <div class="spinner-border spinner-border-sm text-primary" role="status">
+ <span class="visually-hidden">Loading...</span>
+ </div>
+ </span>
+ </template>
+ <template x-if="!formStates.loadingPiggyBanks">
+ <select class="form-control"
+ :id="'piggy_bank_id_' + index"
+ @keyup.enter="submitTransaction()"
+ x-model="transaction.piggy_bank_id">
+ <template x-for="group in formData.piggyBanks">
+ <optgroup :label="group.name">
+ <template x-for="piggyBank in group.piggyBanks">
+ <option :label="piggyBank.name"
+ :value="piggyBank.id"
+ x-text="piggyBank.name"></option>
+ </template>
+ </optgroup>
+ </template>
+ </select>
+ </template>
+ </div>
+ </div>
+</template>
diff --git a/resources/views/partials/form/transaction/source-account.blade.php b/resources/views/partials/form/transaction/source-account.blade.php
new file mode 100644
index 0000000000..adc5c4e703
--- /dev/null
+++ b/resources/views/partials/form/transaction/source-account.blade.php
@@ -0,0 +1,20 @@
+<div class="row mb-3">
+ <label :for="'source_' + index"
+ class="col-sm-1 col-form-label d-none d-sm-block">
+ <em title="{{ __('firefly.source_account') }}" class="bi bi-arrow-left"></em>
+ </label>
+ <div class="col-sm-10">
+ <input type="text"
+ :class="{'is-invalid': transaction.errors.source_account.length > 0, 'form-control': true, 'ac-source': true}"
+ :id="'source_' + index"
+ x-model="transaction.source_account.alpine_name"
+ :data-index="index"
+ @changed="changedSourceAccount"
+ placeholder="{{ __('firefly.source_account') }}">
+ <template x-if="transaction.errors.source_account.length > 0">
+ <div class="invalid-feedback"
+ x-text="transaction.errors.source_account[0]">
+ </div>
+ </template>
+ </div>
+</div>
diff --git a/resources/views/partials/form/transaction/subscription.blade.php b/resources/views/partials/form/transaction/subscription.blade.php
new file mode 100644
index 0000000000..080d583e5f
--- /dev/null
+++ b/resources/views/partials/form/transaction/subscription.blade.php
@@ -0,0 +1,34 @@
+<template x-if="groupProperties.transactionType != 'transfer' && groupProperties.transactionType != 'deposit'">
+ <div class="row mb-3">
+ <label :for="'bill_id_' + index" class="col-sm-1 col-form-label d-none d-sm-block">
+ <em title="{{ __('firefly.subscription') }}" class="bi bi-calendar"></em>
+ </label>
+ <div class="col-sm-10">
+ <template x-if="formStates.loadingSubscriptions">
+ <span class="form-control-plaintext">
+ <div class="spinner-border spinner-border-sm text-primary" role="status">
+ <span class="visually-hidden">Loading...</span>
+ </div>
+ </span>
+ </template>
+ <template x-if="!formStates.loadingSubscriptions">
+ <select class="form-control"
+ :id="'bill_id_' + index"
+ @keyup.enter="submitTransaction()"
+ x-model="transaction.bill_id">
+ <template x-for="group in formData.subscriptions">
+ <optgroup :label="group.name">
+ <template
+ x-for="subscription in group.subscriptions">
+ <option :label="subscription.name"
+ :value="subscription.id"
+ :selected="subscription.id == transaction.bill_id"
+ x-text="subscription.name"></option>
+ </template>
+ </optgroup>
+ </template>
+ </select>
+ </template>
+ </div>
+ </div>
+</template>
diff --git a/resources/views/partials/form/transaction/tags.blade.php b/resources/views/partials/form/transaction/tags.blade.php
new file mode 100644
index 0000000000..6e1dd3701c
--- /dev/null
+++ b/resources/views/partials/form/transaction/tags.blade.php
@@ -0,0 +1,23 @@
+<div class="row mb-3">
+ <label :for="'tags_' + index"
+ class="col-sm-1 col-form-label d-none d-sm-block">
+ <em title="{{ __('firefly.tags') }}" class="bi bi-tag"></em>
+ </label>
+ <div class="col-sm-10">
+ <select
+ class="form-select ac-tags"
+ :id="'tags_' + index"
+ :name="'tags['+index+'][]'"
+ multiple>
+ <option value="">{{ __('firefly.select_tag') }}</option>
+ </select>
+
+ </div>
+</div>
+
+<!--
+ :value="tag"
+<template x-for="(tag, index) in transaction.tags" :key="index">
+ <option value="bla">bla</option>
+ </template>
+ -->
diff --git a/resources/views/transactions/create.blade.php b/resources/views/transactions/create.blade.php
index 94ff1b350a..36de3c602e 100644
--- a/resources/views/transactions/create.blade.php
+++ b/resources/views/transactions/create.blade.php
@@ -9,8 +9,8 @@
:zoomLevel="$zoomLevel"
:latitude="$latitude"
:longitude="$longitude"
- :optionalFields="$optionalFields"
- :optionalDateFields="$optionalDateFields" />
+ :optional-fields="$optionalFields"
+ :optional-date-fields="$optionalDateFields" />
</template>
</div>
</div>