Skip to content

Firefly III: a personal finances manager

Fix ability to set group title.

James Colef4f24632401e
diff --git a/resources/assets/v3/js/pages/transactions/create.js b/resources/assets/v3/js/pages/transactions/create.js
index 939fe41eed..51dde6b74b 100644
--- a/resources/assets/v3/js/pages/transactions/create.js
+++ b/resources/assets/v3/js/pages/transactions/create.js
@@ -87,6 +87,7 @@ let create = function () {
// properties for the entire transaction group
groupProperties: {
transactionType: 'unknown',
+ titleErrors: [],
title: null,
id: null,
totalAmount: 0,
@@ -429,7 +430,7 @@ let create = function () {
// catch for group title:
// TODO later this must be handled with more care (ie use the group title input)
- if (transactions.length > 1) {
+ if (transactions.length > 1 && ('' === submission.group_title || null === submission.group_title)) {
submission.group_title = transactions[0].description;
}
diff --git a/resources/assets/v3/js/pages/transactions/edit.js b/resources/assets/v3/js/pages/transactions/edit.js
index 976b399ca9..124fb4e511 100644
--- a/resources/assets/v3/js/pages/transactions/edit.js
+++ b/resources/assets/v3/js/pages/transactions/edit.js
@@ -245,7 +245,7 @@ let transactions = function () {
const data = response.data.data;
this.groupProperties.id = parseInt(data.id);
this.groupProperties.transactionType = data.attributes.transactions[0].type.toLowerCase();
- this.groupProperties.title = data.attributes.title ?? data.attributes.transactions[0].description;
+ this.groupProperties.title = data.attributes.group_title ?? data.attributes.transactions[0].description;
this.entries = parseDownloadedSplits(data.attributes.transactions, parseInt(data.id));
// remove waiting thing.
diff --git a/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js b/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js
index f3e0c93fea..ff0f94b5c8 100644
--- a/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js
+++ b/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js
@@ -97,6 +97,26 @@ export function parseFromEntries(entries, originals, transactionType) {
if (typeof entry.destination_account.id !== 'undefined' && '' !== entry.destination_account.id.toString()) {
current.destination_id = entry.destination_account.id;
}
+ if(i > 0) {
+ if('withdrawal' === transactionType) {
+ // overrule source
+ current.source_id = returnArray[0].source_id;
+ current.source_name = returnArray[0].source_name;
+ }
+ if('deposit' === transactionType) {
+ // overrule destination
+ current.destination_id = returnArray[0].destination_id;
+ current.destination_name = returnArray[0].destination_name;
+ }
+ if('transfer' === transactionType) {
+ // overrule both
+ current.source_id = returnArray[0].source_id;
+ current.source_name = returnArray[0].source_name;
+ current.destination_id = returnArray[0].destination_id;
+ current.destination_name = returnArray[0].destination_name;
+ }
+ console.log('Overrule depending on ', transactionType);
+ }
current.type = transactionType;
diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php
index e960e4ef02..8fcb20efcd 100644
--- a/resources/lang/en_US/firefly.php
+++ b/resources/lang/en_US/firefly.php
@@ -2452,6 +2452,7 @@ return [
'average_income_per_account' => 'Average income per account',
'total' => 'Total',
'description' => 'Description',
+ 'group-title' => 'Shared description for all transactions',
'sum_of_period' => 'Sum of period',
'average_in_period' => 'Average in period',
'no_account_role' => '(no role)',
diff --git a/resources/views/components/lists/groups-large.blade.php b/resources/views/components/lists/groups-large.blade.php
index b6aba7765c..4065ffec62 100644
--- a/resources/views/components/lists/groups-large.blade.php
+++ b/resources/views/components/lists/groups-large.blade.php
@@ -92,6 +92,17 @@
@endif
<td class="top-light-border d-xs-none text-end">
<div class=""> <!-- d-none ? -->
+
+ <button class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button" id="group_menu_{{ $group['id'] }}" data-bs-toggle="dropdown" aria-expanded="false">{{ __('firefly.actions') }} <span class="caret"></span></button>
+ <ul class="dropdown-menu" aria-labelledby="group_menu_{{ $group['id'] }}">
+ <li><a class="dropdown-item" href="{{ route('transactions.edit', [$group['id']]) }}"><span class="bi bi-pencil"></span> {{ __('firefly.edit') }}</a></li>
+ <li><a class="dropdown-item" href="{{ route('transactions.delete', [$group['id']]) }}"><span class="text-danger bi bi-trash"></span> {{ __('firefly.delete') }}</a></li>
+ <li><a class="dropdown-item" href="#" data-id="{{ $group['id'] }}" class="clone-transaction"><span class="bi bi-copy"></span> {{ __('firefly.clone') }}</a></li>
+ <li><a class="dropdown-item" href="#" data-id="{{ $group['id'] }}" class="clone-transaction-and-edit"><span class="bi bi-copy"></span> {{ __('firefly.clone_and_edit') }}</a></li>
+ </ul>
+
+
+ <!--
<button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">{{ __('firefly.actions') }} <span class="caret"></span></button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
@@ -100,6 +111,7 @@
<li><a href="#" data-id="{{ $group['id'] }}" class="clone-transaction"><span class="bi bi-copy"></span> {{ __('firefly.clone') }}</a></li>
<li><a href="#" data-id="{{ $group['id'] }}" class="clone-transaction-and-edit"><span class="bi bi-copy"></span> {{ __('firefly.clone_and_edit') }}</a></li>
</ul>
+ -->
</div>
</td>
<td class="top-light-border d-xs-none">&nbsp;</td><!-- would have checkbox -->
diff --git a/resources/views/components/transaction/split.blade.php b/resources/views/components/transaction/split.blade.php
index 3028341ef1..7b22cf1d35 100644
--- a/resources/views/components/transaction/split.blade.php
+++ b/resources/views/components/transaction/split.blade.php
@@ -7,6 +7,8 @@
<h3 class="card-title">{{ __('firefly.basic_journal_information') }}</h3>
</div>
<div class="card-body">
+ <!-- GROUP TITLE -->
+ @include('partials.form.transaction.group-title')
<!-- DESCRIPTION -->
@include('partials.form.transaction.description')
diff --git a/resources/views/partials/form/transaction/group-title.blade.php b/resources/views/partials/form/transaction/group-title.blade.php
new file mode 100644
index 0000000000..084f6eab99
--- /dev/null
+++ b/resources/views/partials/form/transaction/group-title.blade.php
@@ -0,0 +1,25 @@
+<template x-if="entries.length > 1">
+<div class="row mb-3">
+ <label for="group-title" class="col-sm-1 col-form-label d-none d-sm-block">
+ <em title="{{ __('firefly.group-title') }}" class="bi bi-body-text"></em>
+ </label>
+ <div class="col-sm-10">
+ <div class="input-group">
+ <input type="text" class="form-control ac-group-title"
+ id="group-title"
+ @change="changedGroupTitle"
+ @keyup.enter="submitTransaction()"
+ x-model="groupProperties.title"
+ :disabled="index > 0"
+ :class="{'is-invalid': groupProperties.titleErrors.length > 0, 'form-control': true}"
+ placeholder="{{ __('firefly.group-title') }}">
+ <button :disabled="index > 0" tabindex="-1" class="btn btn-outline-secondary" type="button" @click="cleargroupTitle()"><em class="bi bi-trash"></em></button>
+ </div>
+ <template x-if="groupProperties.titleErrors.length > 0">
+ <div class="invalid-feedback"
+ x-text="groupProperties.titleErrors[0]">
+ </div>
+ </template>
+ </div>
+</div>
+</template>