Skip to content
Snippets Groups Projects
Commit aa6c3b69 authored by AUBRY JEAN-PASCAL's avatar AUBRY JEAN-PASCAL
Browse files

feat: add message if no species is selected and trigger it when species select field is empty

Refs #637
parent 0425770c
No related branches found
No related tags found
2 merge requests!252release: version 4.18.0,!236Resolve "Vérificateur: la vérification ne devrait pas être possible quand aucune espèce n'est sélectionnée"
......@@ -16,6 +16,7 @@ import { SelectField } from "./select-field";
export class SelectFieldSpeciesList extends SelectField {
constructor(parent: FormulaireNode) {
super(parent);
this._messageWhenEmpty = "INFO_VERIF_SELECT_SPECIES_FIRST";
this._multiple = true;
}
......
......@@ -292,9 +292,14 @@ export abstract class SelectField extends Field {
return this._entriesBaseId;
}
public isEmptySelectField() {
return this._selectedEntry !== undefined && Object.keys(this._selectedEntry).length === 0;
}
public get messageWhenEmpty(): string {
let msg: string;
if (this._selectedEntry === undefined && this._messageWhenEmpty) {
if ((this._selectedEntry === undefined && this._messageWhenEmpty) || this.isEmptySelectField()) {
msg = ServiceFactory.i18nService.localizeText(this._messageWhenEmpty);
}
return msg;
......
......@@ -664,6 +664,7 @@
"INFO_TRIGO_DESCRIPTION": "cosinus sinus tangent arc maths mathematics",
"INFO_TRIGO_TITRE_COURT": "Trigo. f.",
"INFO_VERIF_CREATE_PASS_FRIST": "Create first a fish ladder, a baffle fishway or a rock-ramp fishpass",
"INFO_VERIF_SELECT_SPECIES_FIRST": "Select first one or several fish species",
"INFO_VERIF_OK": "Crossing criteria are met for all species",
"INFO_VERIF_VARYING_OK": "Crossing criteria are met for all species and all pass modalities",
"WARNING_VERIF_OK_BUT": "Crossing criteria are met for all species, but there are warnings",
......
......@@ -665,6 +665,7 @@
"INFO_TRIGO_DESCRIPTION": "cosinus sinus tangente arc maths mathématiques",
"INFO_TRIGO_TITRE_COURT": "F. trigo.",
"INFO_VERIF_CREATE_PASS_FRIST": "Créer d'abord une passe à bassins, à ralentisseurs, ou à macrorugosités",
"INFO_VERIF_SELECT_SPECIES_FIRST": "Selectionner d'abord une ou plusieurs espèces",
"INFO_VERIF_OK": "Les critères de franchissement sont remplis pour toutes les espèces",
"INFO_VERIF_VARYING_OK": "Les critères de franchissement sont remplis pour toutes les espèces et toutes les modalités de la passe",
"WARNING_VERIF_OK_BUT": "Les critères de franchissement sont remplis pour toutes les espèces, mais il y a des avertissements",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment