Skip to content

Firefly III: a personal finances manager

Lower threshold, show right away.

James Cole6ffb8f998e76
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 e4c8d16f03..dd61aa8a3b 100644
--- a/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js
+++ b/resources/assets/v3/js/pages/transactions/shared/add-autocomplete.js
@@ -82,7 +82,7 @@ export function addAllAutocompleteToForm() {
allowClear: true,
server: urls.tag,
liveServer: true,
- suggestionsThreshold: 3,
+ suggestionsThreshold: 0,
debounceTime: 200,
clearEnd: true,
labelField: "tag",
@@ -103,7 +103,7 @@ export function addAllAutocompleteToForm() {
serverUrl: urls.account,
account_types: filters.source,
onRenderItem: renderAccount,
- suggestionsThreshold: 3,
+ suggestionsThreshold: 0,
debounceTime: 200,
valueField: "id",
labelField: "name",
@@ -115,7 +115,7 @@ export function addAllAutocompleteToForm() {
serverUrl: urls.account,
valueField: "id",
labelField: "name",
- suggestionsThreshold: 3,
+ suggestionsThreshold: 0,
debounceTime: 200,
autoselectFirst: true,
account_types: filters.destination,
@@ -127,7 +127,7 @@ export function addAllAutocompleteToForm() {
selector: "input.ac-category",
serverUrl: urls.category,
valueField: "id",
- suggestionsThreshold: 3,
+ suggestionsThreshold: 0,
debounceTime: 200,
labelField: "name",
onChange: changeCategory,
@@ -137,13 +137,14 @@ export function addAllAutocompleteToForm() {
selector: "input.ac-description",
serverUrl: urls.description,
valueField: "id",
- suggestionsThreshold: 3,
- debounceTime: 200,
+ suggestionsThreshold: 0,
+ debounceTime: 100,
labelField: "name",
onChange: changeDescription,
onSelectItem: changeDescription,
});
- }, 150);
+ }, 100);
+
}
export function addAutocomplete(options) {
@@ -161,6 +162,7 @@ export function addAutocomplete(options) {
},
},
queryParam: "query",
+ showAllSuggestions: true,
hiddenInput: false,
// preventBrowserAutocomplete: true,
highlightTyped: true,
@@ -172,19 +174,25 @@ export function addAutocomplete(options) {
if (typeof options.onRenderItem !== "undefined" && null !== options.onRenderItem) {
params.onRenderItem = options.onRenderItem;
}
- if (options.valueField) {
+ if (Object.hasOwn(options, 'valueField')) {
params.valueField = options.valueField;
}
- if (options.labelField) {
+ if (Object.hasOwn(options, 'suggestionsThreshold')) {
+ params.suggestionsThreshold = options.suggestionsThreshold;
+ }
+ if (Object.hasOwn(options, 'debounceTime')) {
+ params.debounceTime = options.debounceTime;
+ }
+ if (Object.hasOwn(options, 'labelField')) {
params.labelField = options.labelField;
}
- if (options.onSelectItem) {
+ if (Object.hasOwn(options, 'onSelectItem')) {
params.onSelectItem = options.onSelectItem;
}
- if (options.onChange) {
+ if (Object.hasOwn(options, 'onChange')) {
params.onChange = options.onChange;
}
- if (options.hiddenValue) {
+ if (Object.hasOwn(options, 'hiddenValue')) {
params.hiddenValue = options.hiddenValue;
}
diff --git a/resources/assets/v3/js/shared/focus-first-input.js b/resources/assets/v3/js/shared/focus-first-input.js
index 203e2c1534..71c8a03acd 100644
--- a/resources/assets/v3/js/shared/focus-first-input.js
+++ b/resources/assets/v3/js/shared/focus-first-input.js
@@ -19,13 +19,29 @@
*/
export default function focusFirstInput() {
- let list = document.querySelectorAll('div.app-content form input[type="text"]:enabled');
+ let list = document.querySelectorAll('div.app-content form input[type="search"]:enabled');
if (list.length > 0) {
list[0].focus();
+ console.log('[a] Focus on first search.');
+ return;
+ }
+ list = document.querySelectorAll('div.app-content input[type="search"]:enabled');
+ if (list.length > 0) {
+ list[0].focus();
+ console.log('[b] Focus on first search.');
+
+ return;
+ }
+ list = document.querySelectorAll('div.app-content form input[type="text"]:enabled');
+ if (list.length > 0) {
+ list[0].focus();
+ console.log('[c] Focus on first text.');
return;
}
list = document.querySelectorAll('div.app-content input[type="text"]:enabled');
if (list.length > 0) {
list[0].focus();
+ console.log('[d] Focus on first text.');
}
+
}
diff --git a/resources/views/partials/form/transaction/description.blade.php b/resources/views/partials/form/transaction/description.blade.php
index 079daaf626..1cd050d70b 100644
--- a/resources/views/partials/form/transaction/description.blade.php
+++ b/resources/views/partials/form/transaction/description.blade.php
@@ -4,7 +4,7 @@
</label>
<div class="col-sm-10">
<div class="input-group">
- <input type="text" class="form-control ac-description"
+ <input type="search" class="form-control ac-description"
:id="'description_' + index"
@change="changedDescription"
@keyup="keyUpFromDescription"
diff --git a/resources/views/preferences/index.blade.php b/resources/views/preferences/index.blade.php
index c1584105ad..332895941f 100644
--- a/resources/views/preferences/index.blade.php
+++ b/resources/views/preferences/index.blade.php
@@ -170,26 +170,26 @@
{{ __('firefly.pref_optional_fields_transaction_help') }}
</p>
<h4>{{ __('firefly.optional_tj_date_fields') }}</h4>
- {!! ExpandedForm::checkbox('tj[interest_date]','1', $tjOptionalFields['interest_date'],['label' => __('firefly.pref_optional_tj_interest_date')]) !!}
- {!! ExpandedForm::checkbox('tj[book_date]','1', $tjOptionalFields['book_date'],['label' => __('firefly.pref_optional_tj_book_date')]) !!}
- {!! ExpandedForm::checkbox('tj[process_date]','1', $tjOptionalFields['process_date'],['label' => __('firefly.pref_optional_tj_process_date')]) !!}
- {!! ExpandedForm::checkbox('tj[due_date]','1', $tjOptionalFields['due_date'],['label' => __('firefly.pref_optional_tj_due_date')]) !!}
- {!! ExpandedForm::checkbox('tj[payment_date]','1', $tjOptionalFields['payment_date'],['label' => __('firefly.pref_optional_tj_payment_date')]) !!}
- {!! ExpandedForm::checkbox('tj[invoice_date]','1', $tjOptionalFields['invoice_date'],['label' => __('firefly.pref_optional_tj_invoice_date')]) !!}
+ {!! ExpandedForm::checkbox('tj[interest_date]','1', $tjOptionalFields['interest_date'] ?? false,['label' => __('firefly.pref_optional_tj_interest_date')]) !!}
+ {!! ExpandedForm::checkbox('tj[book_date]','1', $tjOptionalFields['book_date'] ?? false,['label' => __('firefly.pref_optional_tj_book_date')]) !!}
+ {!! ExpandedForm::checkbox('tj[process_date]','1', $tjOptionalFields['process_date'] ?? false,['label' => __('firefly.pref_optional_tj_process_date')]) !!}
+ {!! ExpandedForm::checkbox('tj[due_date]','1', $tjOptionalFields['due_date'] ?? false,['label' => __('firefly.pref_optional_tj_due_date')]) !!}
+ {!! ExpandedForm::checkbox('tj[payment_date]','1', $tjOptionalFields['payment_date'] ?? false,['label' => __('firefly.pref_optional_tj_payment_date')]) !!}
+ {!! ExpandedForm::checkbox('tj[invoice_date]','1', $tjOptionalFields['invoice_date'] ?? false,['label' => __('firefly.pref_optional_tj_invoice_date')]) !!}
<h4>{{ __('firefly.optional_tj_other_fields') }}</h4>
- {!! ExpandedForm::checkbox('tj[internal_reference]','1', $tjOptionalFields['internal_reference'],['label' => __('firefly.pref_optional_tj_internal_reference')]) !!}
- {!! ExpandedForm::checkbox('tj[external_url]','1', $tjOptionalFields['external_url'],['label' => __('firefly.pref_optional_tj_external_url')]) !!}
- {!! ExpandedForm::checkbox('tj[notes]','1', $tjOptionalFields['notes'],['label' => __('firefly.pref_optional_tj_notes')]) !!}
+ {!! ExpandedForm::checkbox('tj[internal_reference]','1', $tjOptionalFields['internal_reference'] ?? false,['label' => __('firefly.pref_optional_tj_internal_reference')]) !!}
+ {!! ExpandedForm::checkbox('tj[external_url]','1', $tjOptionalFields['external_url'] ?? false,['label' => __('firefly.pref_optional_tj_external_url')]) !!}
+ {!! ExpandedForm::checkbox('tj[notes]','1', $tjOptionalFields['notes'] ?? false,['label' => __('firefly.pref_optional_tj_notes')]) !!}
@if($mapEnabled)
- {!! ExpandedForm::checkbox('tj[location]','1', $tjOptionalFields['location'],['label' => __('firefly.pref_optional_tj_location')]) !!}
+ {!! ExpandedForm::checkbox('tj[location]','1', $tjOptionalFields['location'] ?? false,['label' => __('firefly.pref_optional_tj_location')]) !!}
@else
{!! ExpandedForm::checkbox('__DISABLED__','1', false, ['disabled' => true, 'helpText'=> __('firefly.no_external_map_disabled'),'label' => __('firefly.pref_optional_tj_location')]) !!}
@endif
- {!! ExpandedForm::checkbox('tj[links]','1', $tjOptionalFields['links'],['label' => __('firefly.pref_optional_tj_links')]) !!}
+ {!! ExpandedForm::checkbox('tj[links]','1', $tjOptionalFields['links'] ?? false,['label' => __('firefly.pref_optional_tj_links')]) !!}
<h4>{{ __('firefly.optional_tj_attachment_fields') }}</h4>
- {!! ExpandedForm::checkbox('tj[attachments]','1', $tjOptionalFields['attachments'], ['label' => __('firefly.pref_optional_tj_attachments')]) !!}
+ {!! ExpandedForm::checkbox('tj[attachments]','1', $tjOptionalFields['attachments'] ?? false, ['label' => __('firefly.pref_optional_tj_attachments')]) !!}
</div>
</div>