Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Rename model
Sander Dorigo35270a34c465
diff --git a/resources/assets/v3/js/api/model/transaction-link/delete.js b/resources/assets/v3/js/api/model/transaction-link/delete.jsnew file mode 100644index 0000000000..be6b87a86f--- /dev/null+++ b/resources/assets/v3/js/api/model/transaction-link/delete.js@@ -0,0 +1,28 @@+/*+ * post.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 Delete {+ delete(id) {+ let url = '/api/v1/transaction-links/' + parseInt(id);+ return api.delete(url);+ }+}diff --git a/resources/assets/v3/js/pages/transactions/create.js b/resources/assets/v3/js/pages/transactions/create.jsindex b412c66f46..4d95deab16 100644--- a/resources/assets/v3/js/pages/transactions/create.js+++ b/resources/assets/v3/js/pages/transactions/create.js@@ -53,7 +53,7 @@ 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 {loadTransactionLinks} from './shared/load-transaction-links.js';+import {loadLinkTypes} from './shared/load-transaction-links.js';import {createLinkAutocomplete} from "./shared/create-link-autocomplete.js";import {editLink} from "./shared/edit-link.js";import {switchLink} from "./shared/switch-link.js";@@ -297,7 +297,7 @@ let create = function () {this.formBehaviour.customFields = data;// linked-transactions-searchif (true === data.links) {- loadTransactionLinks().then(data => {+ loadLinkTypes().then(data => {//console.log(data);for (let i = 0; i < data.length; i++) {if (data.hasOwnProperty(i)) {diff --git a/resources/assets/v3/js/pages/transactions/edit.js b/resources/assets/v3/js/pages/transactions/edit.jsindex bae79c7f58..871544b206 100644--- a/resources/assets/v3/js/pages/transactions/edit.js+++ b/resources/assets/v3/js/pages/transactions/edit.js@@ -55,7 +55,7 @@ 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 {loadTransactionLinks} from "./shared/load-transaction-links.js";+import {loadLinkTypes} from "./shared/load-transaction-links.js";import {createLinkAutocomplete} from "./shared/create-link-autocomplete.js";import {editLink} from "./shared/edit-link.js";import {switchLink} from "./shared/switch-link.js";@@ -216,6 +216,8 @@ let transactions = function () {for(let i = 0; i < this.entries.length; i++) {this.links[i] = []; // empty set of links.+ // then fill the set using the ID.+ //this.l}// set amountCurrency.@@ -306,7 +308,7 @@ let transactions = function () {this.formBehaviour.customFields = data;// linked-transactions-searchif (true === data.links) {- loadTransactionLinks().then(data => {+ loadLinkTypes().then(data => {//console.log(data);for (let i = 0; i < data.length; i++) {if (data.hasOwnProperty(i)) {diff --git a/resources/assets/v3/js/pages/transactions/shared/load-transaction-links.js b/resources/assets/v3/js/pages/transactions/shared/load-link-types.jssimilarity index 94%rename from resources/assets/v3/js/pages/transactions/shared/load-transaction-links.jsrename to resources/assets/v3/js/pages/transactions/shared/load-link-types.jsindex 83d2cac002..b03381a46c 100644--- a/resources/assets/v3/js/pages/transactions/shared/load-transaction-links.js+++ b/resources/assets/v3/js/pages/transactions/shared/load-link-types.js@@ -1,6 +1,6 @@import Get from "../../../api/model/link-type/get.js";-export function loadTransactionLinks() {+export function loadLinkTypes() {let params = {page: 1, limit: 1337};diff --git a/resources/assets/v3/js/pages/transactions/shared/remove-link.js b/resources/assets/v3/js/pages/transactions/shared/remove-link.jsindex 000938230d..2265df4f1d 100644--- a/resources/assets/v3/js/pages/transactions/shared/remove-link.js+++ b/resources/assets/v3/js/pages/transactions/shared/remove-link.js@@ -18,8 +18,14 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.*/+import Delete from '../../../api/model/transaction-link/delete.js';+export function removeLink(e) {let rowIndex = parseInt(e.currentTarget.dataset.rowIndex);let index = parseInt(e.currentTarget.dataset.index);+ if(0 !== this.links[index][rowIndex].id) {+ // also actually delete it.+ (new Delete).delete(this.links[index][rowIndex].id);+ }this.links[index].splice(rowIndex, 1);-};+}