Skip to content
Snippets Groups Projects
Commit 1cb7f6ff authored by mathias.chouet's avatar mathias.chouet
Browse files

Fix #222

parent 8ca96581
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,10 @@ import { SelectFieldModel } from "../../formulaire/select-field-model";
import { FormulairePab } from "../../formulaire/definition/concrete/form-pab";
import { SelectModelFieldLineComponent } from "../select-model-field-line/select-model-field-line.component";
import { FieldsetContainer } from "../../formulaire/fieldset-container";
import { NotificationsService } from "../../services/notifications/notifications.service";
import { I18nService } from "../../services/internationalisation/internationalisation.service";
import { sprintf } from "sprintf-js";
@Component({
selector: "field-set",
......@@ -140,6 +144,11 @@ export class FieldSetComponent implements DoCheck {
@Output()
protected tabPressed = new EventEmitter<any>();
public constructor(
private notifService: NotificationsService,
private i18nService: I18nService
) { }
private hasRadioFix(): boolean {
if (this._fieldSet.hasInputs) {
switch (this._fieldSet.getInput(0).radioConfig) {
......@@ -325,6 +334,13 @@ export class FieldSetComponent implements DoCheck {
clone: false
});
}
let msg: string;
if (this.childrenToAdd === 1) {
msg = this.i18nService.localizeText("INFO_FSC_FS_ADDED");
} else {
msg = sprintf(this.i18nService.localizeText("INFO_FSC_FS_ADDED_N_TIMES"), this.childrenToAdd);
}
this.notifService.notify(msg);
this.childrenToAdd = 1; // reinit to avoid confusion
}
......@@ -338,6 +354,14 @@ export class FieldSetComponent implements DoCheck {
clone: true
});
}
const pos = (this._fieldSet.parent as FieldsetContainer).getFieldsetPosition(this._fieldSet) + 1;
let msg: string;
if (this.childrenToAdd === 1) {
msg = sprintf(this.i18nService.localizeText("INFO_FSC_FS_COPIED"), pos);
} else {
msg = sprintf(this.i18nService.localizeText("INFO_FSC_FS_COPIED_N_TIMES"), pos, this.childrenToAdd);
}
this.notifService.notify(msg);
this.childrenToAdd = 1; // reinit to avoid confusion
}
......@@ -345,20 +369,32 @@ export class FieldSetComponent implements DoCheck {
* clic sur le bouton supprimer
*/
private onRemoveClick() {
const pos = (this._fieldSet.parent as FieldsetContainer).getFieldsetPosition(this._fieldSet) + 1;
this.removeFieldset.emit(this._fieldSet);
this.notifService.notify(
sprintf(this.i18nService.localizeText("INFO_FSC_FS_REMOVED"), pos)
);
}
/**
* clic sur le bouton monter
*/
private onMoveUpClick() {
const pos = (this._fieldSet.parent as FieldsetContainer).getFieldsetPosition(this._fieldSet) + 1;
this.moveFieldsetUp.emit(this._fieldSet);
this.notifService.notify(
sprintf(this.i18nService.localizeText("INFO_FSC_FS_MOVED"), pos)
);
}
/**
* clic sur le bouton descendre
*/
private onMoveDownClick() {
const pos = (this._fieldSet.parent as FieldsetContainer).getFieldsetPosition(this._fieldSet) + 1;
this.moveFieldsetDown.emit(this._fieldSet);
this.notifService.notify(
sprintf(this.i18nService.localizeText("INFO_FSC_FS_MOVED"), pos)
);
}
}
......@@ -88,6 +88,12 @@
"INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_1": "Partially submerged",
"INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_2": "Submerged",
"INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_3": "Zero flow",
"INFO_FSC_FS_ADDED": "1 device added",
"INFO_FSC_FS_ADDED_N_TIMES": "%s devices added",
"INFO_FSC_FS_COPIED": "Device #%s copied",
"INFO_FSC_FS_COPIED_N_TIMES": "Device #%s copied %s times",
"INFO_FSC_FS_MOVED": "Device #%s moved",
"INFO_FSC_FS_REMOVED": "Device #%s removed",
"INFO_LECHAPTCALMON_TITRE_COURT": "Lechapt-C.",
"INFO_LECHAPTCALMON_TITRE": "Lechapt-Calmon",
"INFO_LIB_ALPHA": "Alpha coefficient",
......@@ -97,7 +103,7 @@
"INFO_LIB_BETA": "Beta coefficient",
"INFO_LIB_BT": "Half opening of the triangle",
"INFO_LIB_CD": "Discharge coefficient",
"INFO_LIB_CLOISON": "Cross wall ",
"INFO_LIB_CLOISON": "Cross wall #",
"INFO_LIB_CV": "Cv: Velocity coefficient",
"INFO_LIB_CVQT": "CV.QT: Corrected discharge",
"INFO_LIB_DH": "Fall",
......
......@@ -88,6 +88,12 @@
"INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_1": "Partiellement noyé",
"INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_2": "Noyé",
"INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_3": "Débit nul",
"INFO_FSC_FS_ADDED": "1 ouvrage ajouté",
"INFO_FSC_FS_ADDED_N_TIMES": "%s ouvrages ajoutés",
"INFO_FSC_FS_COPIED": "Ouvrage n°%s copié",
"INFO_FSC_FS_COPIED_N_TIMES": "Ouvrage n°%s copié %s fois",
"INFO_FSC_FS_MOVED": "Ouvrage n°%s déplacé",
"INFO_FSC_FS_REMOVED": "Ouvrage n°%s supprimé",
"INFO_LECHAPTCALMON_TITRE_COURT": "Lechapt-C.",
"INFO_LECHAPTCALMON_TITRE": "Lechapt-Calmon",
"INFO_LIB_ALPHA": "Coefficient alpha",
......
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