Release 1.19.7 (#3286)

* fix isWeekend() test for sunday fdow
* re-use the pattern for optgroup title
* prevent method on null
* composer update
* pre-select an option if it is the only available one
* added command to stop all active timesheets
This commit is contained in:
Kevin Papst
2022-05-07 23:47:32 +02:00
committed by GitHub
parent 100f8a5165
commit c8098b2e00
31 changed files with 818 additions and 484 deletions

View File

@@ -204,6 +204,23 @@ export default class KimaiFormSelect extends KimaiPlugin {
// if available, re-select the previous selected option (mostly usable for global activities)
select.val(selectedValue);
// pre-select an option if it is the only available one
if (select.val() === '') {
const allOptions = select.find('option');
const optionLength = allOptions.length;
let selectOption = '';
if (optionLength === 1) {
selectOption = allOptions[0].value;
} else if (optionLength === 2 && emptyOption.length === 1) {
selectOption = allOptions[1].value;
}
if (selectOption !== '') {
select.val(selectOption);
}
}
// if we don't trigger the change, the other selects won't reset
select.trigger('change');