Skip to content

Firefly III: a personal finances manager

new stuff

Sander Dorigo2f72a11ca4cf
diff --git a/resources/assets/v3/js/pages/transactions/create.js b/resources/assets/v3/js/pages/transactions/create.js
index dda8e6c515..a14b912666 100644
--- a/resources/assets/v3/js/pages/transactions/create.js
+++ b/resources/assets/v3/js/pages/transactions/create.js
@@ -21,7 +21,7 @@
import '../../boot/bootstrap.js';
import sidebar from '../../pages/shared/sidebar.js';
import dates from '../shared/dates.js';
-import {createEmptySplit, defaultErrorSet} from "./shared/create-empty-split.js";
+import {createEmptySplit, getAccount, 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";
@@ -299,6 +299,17 @@ let create = function () {
del.delete(this.groupProperties.id);
// console.error(event);
},
+ clearDescription(index) {
+ this.entries[index].description = '';
+ },
+ clearSourceAccount(index) {
+ this.entries[index].source_account = getAccount();
+ this.detectTransactionType();
+ },
+ clearDestinationAccount(index) {
+ this.entries[index].destination_account = getAccount();
+ this.detectTransactionType();
+ },
init() {
console.log('init()');
diff --git a/resources/assets/v3/js/pages/transactions/shared/create-empty-split.js b/resources/assets/v3/js/pages/transactions/shared/create-empty-split.js
index 95ea4c61dd..b377c47575 100644
--- a/resources/assets/v3/js/pages/transactions/shared/create-empty-split.js
+++ b/resources/assets/v3/js/pages/transactions/shared/create-empty-split.js
@@ -21,7 +21,7 @@
import format from "date-fns/format";
-function getAccount() {
+export function getAccount() {
return {
id: '',
name: '',
diff --git a/resources/views/partials/form/transaction/description.blade.php b/resources/views/partials/form/transaction/description.blade.php
index 7f789f5608..dff9260bfd 100644
--- a/resources/views/partials/form/transaction/description.blade.php
+++ b/resources/views/partials/form/transaction/description.blade.php
@@ -3,6 +3,7 @@
<em title="{{ __('firefly.description') }}" class="bi bi-fonts"></em>
</label>
<div class="col-sm-10">
+ <div class="input-group">
<input type="text" class="form-control ac-description"
:id="'description_' + index"
@change="changedDescription"
@@ -11,6 +12,8 @@
:class="{'is-invalid': transaction.errors.description.length > 0, 'form-control': true}"
:data-index="index"
placeholder="{{ __('firefly.description') }}">
+ <button tabindex="-1" class="btn btn-outline-secondary" type="button" @click="clearDescription(index)"><em class="bi bi-trash"></em></button>
+ </div>
<template x-if="transaction.errors.description.length > 0">
<div class="invalid-feedback"
x-text="transaction.errors.description[0]">
diff --git a/resources/views/partials/form/transaction/destination-account.blade.php b/resources/views/partials/form/transaction/destination-account.blade.php
index 4175863f82..152b4d63c8 100644
--- a/resources/views/partials/form/transaction/destination-account.blade.php
+++ b/resources/views/partials/form/transaction/destination-account.blade.php
@@ -4,6 +4,7 @@
<em title="{{ __('firefly.destination_account') }}" class="bi bi-arrow-right"></em>
</label>
<div class="col-sm-10">
+ <div class="input-group">
<input type="text"
:class="{'is-invalid': transaction.errors.destination_account.length > 0, 'form-control': true, 'ac-dest': true}"
:id="'dest_' + index"
@@ -11,6 +12,8 @@
:data-index="index"
@changed="changedDestinationAccount"
placeholder="{{ __('firefly.destination_account') }}">
+ <button tabindex="-1" class="btn btn-outline-secondary" type="button" @click="clearDestinationAccount(index)"><em class="bi bi-trash"></em></button>
+ </div>
<template x-if="transaction.errors.destination_account.length > 0">
<div class="invalid-feedback"
x-text="transaction.errors.destination_account[0]">
diff --git a/resources/views/partials/form/transaction/source-account.blade.php b/resources/views/partials/form/transaction/source-account.blade.php
index adc5c4e703..90f7d54d97 100644
--- a/resources/views/partials/form/transaction/source-account.blade.php
+++ b/resources/views/partials/form/transaction/source-account.blade.php
@@ -4,6 +4,7 @@
<em title="{{ __('firefly.source_account') }}" class="bi bi-arrow-left"></em>
</label>
<div class="col-sm-10">
+ <div class="input-group">
<input type="text"
:class="{'is-invalid': transaction.errors.source_account.length > 0, 'form-control': true, 'ac-source': true}"
:id="'source_' + index"
@@ -11,6 +12,8 @@
:data-index="index"
@changed="changedSourceAccount"
placeholder="{{ __('firefly.source_account') }}">
+ <button tabindex="-1" class="btn btn-outline-secondary" type="button" @click="clearSourceAccount(index)"><em class="bi bi-trash"></em></button>
+ </div>
<template x-if="transaction.errors.source_account.length > 0">
<div class="invalid-feedback"
x-text="transaction.errors.source_account[0]">