Skip to content

Firefly III: a personal finances manager

Fix other autocompletes.

James Coleb8d661ee97e6
diff --git a/resources/assets/v3/js/pages/transactions/bulk-edit.js b/resources/assets/v3/js/pages/transactions/bulk-edit.js
index 9da0c6b3f0..7567c40580 100644
--- a/resources/assets/v3/js/pages/transactions/bulk-edit.js
+++ b/resources/assets/v3/js/pages/transactions/bulk-edit.js
@@ -31,13 +31,13 @@ let edit = function () {
detectCategoryChange(e) {
if('' !== e.target.value) {
// tags_action_do_nothing
- document.querySelector('input[name="ignore_category"]').removeAttribute('checked');
+ document.querySelector('input[name="ignore_category"]').checked = false;
}
},
detectBudgetChange(e) {
if(0 !== parseInt(e.target.value)) {
// tags_action_do_nothing
- document.querySelector('input[name="ignore_budget"]').removeAttribute('checked');
+ document.querySelector('input[name="ignore_budget"]').checked = false;
}
},
detectTagChange(e) {
diff --git a/resources/assets/v3/js/pages/transactions/mass-edit.js b/resources/assets/v3/js/pages/transactions/mass-edit.js
new file mode 100644
index 0000000000..90cf27c053
--- /dev/null
+++ b/resources/assets/v3/js/pages/transactions/mass-edit.js
@@ -0,0 +1,94 @@
+/*
+ * 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 {addAutocomplete} from "./shared/add-autocomplete.js";
+
+let edit = function () {
+ return {
+ init() {
+ // console.log('Generic JS for page with few features.');
+
+ // AC for description
+ addAutocomplete({
+ selector: 'input.ac-description',
+ serverUrl: '/api/v1/autocomplete/transactions',
+ valueField: 'description',
+ labelField: 'description',
+ });
+
+
+ // AC for destination account
+ addAutocomplete({
+ selector: 'input.ac-destination',
+ serverUrl: '/api/v1/autocomplete/accounts',
+ valueField: 'name',
+ labelField: 'name',
+ });
+
+ // AC for source account
+ addAutocomplete({
+ selector: 'input.ac-source',
+ serverUrl: '/api/v1/autocomplete/accounts',
+ valueField: 'name',
+ labelField: 'name',
+ });
+
+ // AC for category
+ addAutocomplete({
+ selector: 'input.ac-category',
+ serverUrl: '/api/v1/autocomplete/categories',
+ valueField: 'name',
+ labelField: 'name',
+ });
+
+ }
+ }
+};
+
+
+const comps = {
+ edit,
+ 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/vite.config.js b/resources/assets/v3/vite.config.js
index bd89967260..38506dd80e 100644
--- a/resources/assets/v3/vite.config.js
+++ b/resources/assets/v3/vite.config.js
@@ -83,6 +83,7 @@ export default defineConfig(({command, mode, isSsrBuild, isPreview}) => {
'js/pages/transactions/create.js',
'js/pages/transactions/edit.js',
'js/pages/transactions/bulk-edit.js',
+ 'js/pages/transactions/mass-edit.js',
'js/pages/transactions/show.js',
// tags
diff --git a/resources/views/budgets/budget-limits/create.blade.php b/resources/views/budgets/budget-limits/create.blade.php
index 3b192599f0..3216b70cfb 100644
--- a/resources/views/budgets/budget-limits/create.blade.php
+++ b/resources/views/budgets/budget-limits/create.blade.php
@@ -15,7 +15,7 @@
<input type="hidden" name="end" value="{{ $end->format('Y-m-d') }}"/>
<input type="hidden" name="budget_id" value="{{ $budget->id }}"/>
<div class="form-group mb-3">
- <select class="form-control" name="transaction_currency_id">
+ <select class="form-select" name="transaction_currency_id">
@foreach($currencies as $currency)
<option label="{{ $currency->name }}" value="{{ $currency->id }}">{{ $currency->name }}</option>
@endforeach
diff --git a/resources/views/budgets/index.blade.php b/resources/views/budgets/index.blade.php
index bac11d7667..6910f3b0aa 100644
--- a/resources/views/budgets/index.blade.php
+++ b/resources/views/budgets/index.blade.php
@@ -10,7 +10,7 @@
<div class="card-body">
<div class="row" id="periodNavigator">
<div class="col-lg-2 col-md-4 col-sm-12 col-xs-12">
- <select class="form-control selectPeriod" name="previous">
+ <select class="form-select selectPeriod" name="previous">
<option label="{{ __('firefly.select_date') }}" value="x">{{ __('firefly.select_date') }}</option>
@foreach($prevLoop as $array)
<option label="{{ $array['title'] }}" value="{{ $array['label'] }}" data-start="{{ $array['start']->format('Y-m-d') }}"
@@ -30,7 +30,7 @@
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-12 col-xs-12 text-end">
- <select class="form-control selectPeriod" name="next">
+ <select class="form-select selectPeriod" name="next">
<option label="{{ __('firefly.select_date') }}" value="x">{{ __('firefly.select_date') }}</option>
@foreach($nextLoop as $array)
<option label="{{ $array['title'] }}" value="{{ $array['label'] }}" data-start="{{ $array['start']->format('Y-m-d') }}"
diff --git a/resources/views/components/transaction/split.blade.php b/resources/views/components/transaction/split.blade.php
index 878ca040f8..dcc8f3d2f6 100644
--- a/resources/views/components/transaction/split.blade.php
+++ b/resources/views/components/transaction/split.blade.php
@@ -230,7 +230,7 @@
<input type="text" readonly class="form-control-plaintext" value="{{ __('firefly.this_transaction') }}">
</div>
<div class="col">
- <select class="form-control" name="link_type_id" :data-index="index" :id="'link_type_id_' + index">
+ <select class="form-select" name="link_type_id" :data-index="index" :id="'link_type_id_' + index">
<template x-for="type in formData.linkTypes ">
<option :value="type.id + '_inward'" :label="type.inward" x-text="type.inward"></option>
</template>
diff --git a/resources/views/partials/form/transaction/budget.blade.php b/resources/views/partials/form/transaction/budget.blade.php
index 94e98f51ff..37fbbd8a9f 100644
--- a/resources/views/partials/form/transaction/budget.blade.php
+++ b/resources/views/partials/form/transaction/budget.blade.php
@@ -13,7 +13,7 @@
</span>
</template>
<template x-if="!formStates.loadingBudgets">
- <select class="form-control"
+ <select class="form-select"
:id="'budget_id_' + index"
x-model="transaction.budget_id"
@keyup.enter="submitTransaction()"
diff --git a/resources/views/partials/form/transaction/foreign-amount.blade.php b/resources/views/partials/form/transaction/foreign-amount.blade.php
index d364fda784..6d3bdadac9 100644
--- a/resources/views/partials/form/transaction/foreign-amount.blade.php
+++ b/resources/views/partials/form/transaction/foreign-amount.blade.php
@@ -8,7 +8,7 @@
</div></span>
</template>
<template x-if="!formStates.loadingCurrencies">
- <select class="form-control"
+ <select class="form-select"
:id="'foreign_currency_code_' + index"
x-model="transaction.foreign_currency_code">
<template x-for="currency in formData.foreignCurrencies">
diff --git a/resources/views/partials/form/transaction/piggy-bank.blade.php b/resources/views/partials/form/transaction/piggy-bank.blade.php
index dcd4fc0155..0a90a47225 100644
--- a/resources/views/partials/form/transaction/piggy-bank.blade.php
+++ b/resources/views/partials/form/transaction/piggy-bank.blade.php
@@ -13,7 +13,7 @@
</span>
</template>
<template x-if="!formStates.loadingPiggyBanks">
- <select class="form-control"
+ <select class="form-select"
:id="'piggy_bank_id_' + index"
@keyup.enter="submitTransaction()"
x-model="transaction.piggy_bank_id">
diff --git a/resources/views/partials/form/transaction/subscription.blade.php b/resources/views/partials/form/transaction/subscription.blade.php
index 40c7d701b3..520ab14d02 100644
--- a/resources/views/partials/form/transaction/subscription.blade.php
+++ b/resources/views/partials/form/transaction/subscription.blade.php
@@ -12,7 +12,7 @@
</span>
</template>
<template x-if="!formStates.loadingSubscriptions">
- <select class="form-control"
+ <select class="form-select"
:id="'bill_id_' + index"
@keyup.enter="submitTransaction()"
x-model="transaction.bill_id">
diff --git a/resources/views/preferences/index.blade.php b/resources/views/preferences/index.blade.php
index aacf58b9cd..74d913266b 100644
--- a/resources/views/preferences/index.blade.php
+++ b/resources/views/preferences/index.blade.php
@@ -59,7 +59,7 @@
<p>{{ __('firefly.pref_languages_help') }}</p>
<div class="form-group">
<div class="col-sm-12">
- <select class="form-control" id="lang_holder" name="language">
+ <select class="form-select" id="lang_holder" name="language">
@foreach($languages as $key => $lang)
<option @if($language === $key)selected @endif
value="{{ $key }}">{{ $lang['name_locale'] }}
@@ -87,7 +87,7 @@
<p class="text-warning">{{ __('firefly.pref_locale_exception') }}</p>
<div class="form-group">
<div class="col-sm-12">
- <select class="form-control" id="locale_holder" name="locale">
+ <select class="form-select" id="locale_holder" name="locale">
@foreach($locales as $key => $loc)
<option @if($locale === $key) selected @endif
value="{{ $key }}">
diff --git a/resources/views/transactions/mass/edit.blade.php b/resources/views/transactions/mass/edit.blade.php
index 4fbe402455..0ca738fd59 100644
--- a/resources/views/transactions/mass/edit.blade.php
+++ b/resources/views/transactions/mass/edit.blade.php
@@ -1,6 +1,6 @@
@extends('layout.v3.session')
@section('content')
- <form method="POST" action="{{ route('transactions.mass.update') }}" accept-charset="UTF-8" class="form-horizontal" id="destroy">
+ <form method="POST" action="{{ route('transactions.mass.update') }}" accept-charset="UTF-8" class="form-horizontal" x-data="edit">
<input name="_token" type="hidden" value="{{ csrf_token() }}">
<div class="row">
@@ -36,7 +36,7 @@
</td>
<td>
{{-- DESCRIPTION --}}
- <input class="form-control form-control-sm" autocomplete="off"
+ <input class="form-control form-control-sm ac-description" autocomplete="off"
placeholder="{{ $journal['description'] }}" name="description[{{ $journal['transaction_journal_id'] }}]"
type="text" value="{{ $journal['description'] }}">
</td>
@@ -97,7 +97,7 @@
@if(false === $journal['reconciled'])
{{-- SOURCE ACCOUNT ID FOR TRANSFER OR WITHDRAWAL --}}
@if($journal['transaction_type_type'] == 'Transfer' or $journal['transaction_type_type'] == 'Withdrawal')
- <select class="form-control form-control-sm" name="source_id[{{ $journal['transaction_journal_id'] }}]">
+ <select class="form-select form-select-sm" name="source_id[{{ $journal['transaction_journal_id'] }}]">
@foreach($withdrawalSources as $account)
<option value="{{ $account->id }}" @if($account->id === $journal['source_account_id']) selected @endif
label="{{ $account->name }}">{{ $account->name }}</option>
@@ -108,7 +108,7 @@
{{-- SOURCE ACCOUNT NAME FOR DEPOSIT --}}
@if($journal['transaction_type_type'] == 'Deposit')
- <input class="form-control form-control-sm" spellcheck="false"
+ <input class="form-control ac-account form-control-sm" spellcheck="false"
placeholder="@if($journal['source_account_type'] !== 'Cash account'){{ $journal['source_account_name'] }}@endif"
autocomplete="off"
name="source_name[{{ $journal['transaction_journal_id'] }}]" type="text"
@@ -123,7 +123,7 @@
@if(false === $journal['reconciled'])
{{-- DESTINATION ACCOUNT NAME FOR TRANSFER AND DEPOSIT --}}
@if($journal['transaction_type_type'] == 'Transfer' || $journal['transaction_type_type'] == 'Deposit')
- <select class="form-control form-control-sm" name="destination_id[{{ $journal['transaction_journal_id'] }}]">
+ <select class="form-select form-select-sm" name="destination_id[{{ $journal['transaction_journal_id'] }}]">
@foreach($depositDestinations as $account)
<option value="{{ $account->id }}" @if($account->id === $journal['destination_account_id']) selected="selected" @endif
label="{{ $account->name }}">{{ $account->name }}</option>
@@ -133,7 +133,7 @@
{{-- DESTINATION ACCOUNT NAME FOR WITHDRAWAL --}}
@if($journal['transaction_type_type'] === 'Withdrawal')
- <input class="form-control form-control-sm" spellcheck="false"
+ <input class="form-control form-control-sm ac-account" spellcheck="false"
placeholder="@if(array_key_exists('destination_account_type', $journal) && $journal['destination_account_type'] !== 'Cash account'){{ $journal['destination_account_name'] }}@endif"
name="destination_name[{{ $journal['transaction_journal_id'] }}]" type="text" autocomplete="off"
value="@if(array_key_exists('destination_account_type', $journal) && $journal['destination_account_type'] !== 'Cash account') {{ $journal['destination_account_name'] }}@endif">
@@ -142,13 +142,13 @@
</td>
{{-- category --}}
<td class="position-relative">
- <input class="form-control form-control-sm" placeholder="{{ $journal['category_name'] }}" autocomplete="off" spellcheck="false"
+ <input class="form-control ac-category form-control-sm" placeholder="{{ $journal['category_name'] }}" autocomplete="off" spellcheck="false"
name="category[{{ $journal['transaction_journal_id'] }}]" type="text" value="{{ $journal['category_name'] }}">
</td>
{{-- budget --}}
<td>
@if($journal['transaction_type_type'] === 'Withdrawal')
- <select class="form-control form-control-sm" name="budget_id[{{ $journal['transaction_journal_id'] }}]">
+ <select class="form-select form-select-sm" name="budget_id[{{ $journal['transaction_journal_id'] }}]">
<option value="0" label="({{ __('firefly.no_budget') }})"
@if($journal['budget_id'] === 0) selected="selected" @endif>{{ __('firefly.no_budget') }}</option>
@foreach($budgets as $budget)
@@ -172,10 +172,5 @@
</form>
@endsection
@section('scripts')
- @vite(['js/pages/generic.js'])
- <script type="text/javascript" src="v1/js/lib/bootstrap-simple-autocomplete.js?v={{ $FF_BUILD_TIME }}" nonce="{{ $JS_NONCE }}"></script>
- <script type="text/javascript" src="v1/js/ff/transactions/mass/edit.js?v={{ $FF_BUILD_TIME }}" nonce="{{ $JS_NONCE }}"></script>
-@endsection
-@section('scripts')
- @vite(['js/pages/generic.js'])
+ @vite(['js/pages/transactions/mass-edit.js'])
@endsection