Commit 1cb7f6ff authored by Mathias Chouet's avatar Mathias Chouet :spaghetti:
Browse files

Fix #222

Showing with 49 additions and 1 deletion
+49 -1
...@@ -10,6 +10,10 @@ import { SelectFieldModel } from "../../formulaire/select-field-model"; ...@@ -10,6 +10,10 @@ import { SelectFieldModel } from "../../formulaire/select-field-model";
import { FormulairePab } from "../../formulaire/definition/concrete/form-pab"; import { FormulairePab } from "../../formulaire/definition/concrete/form-pab";
import { SelectModelFieldLineComponent } from "../select-model-field-line/select-model-field-line.component"; import { SelectModelFieldLineComponent } from "../select-model-field-line/select-model-field-line.component";
import { FieldsetContainer } from "../../formulaire/fieldset-container"; 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({ @Component({
selector: "field-set", selector: "field-set",
...@@ -140,6 +144,11 @@ export class FieldSetComponent implements DoCheck { ...@@ -140,6 +144,11 @@ export class FieldSetComponent implements DoCheck {
@Output() @Output()
protected tabPressed = new EventEmitter<any>(); protected tabPressed = new EventEmitter<any>();
public constructor(
private notifService: NotificationsService,
private i18nService: I18nService
) { }
private hasRadioFix(): boolean { private hasRadioFix(): boolean {
if (this._fieldSet.hasInputs) { if (this._fieldSet.hasInputs) {
switch (this._fieldSet.getInput(0).radioConfig) { switch (this._fieldSet.getInput(0).radioConfig) {
...@@ -325,6 +334,13 @@ export class FieldSetComponent implements DoCheck { ...@@ -325,6 +334,13 @@ export class FieldSetComponent implements DoCheck {
clone: false 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 this.childrenToAdd = 1; // reinit to avoid confusion
} }
...@@ -338,6 +354,14 @@ export class FieldSetComponent implements DoCheck { ...@@ -338,6 +354,14 @@ export class FieldSetComponent implements DoCheck {
clone: true 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 this.childrenToAdd = 1; // reinit to avoid confusion
} }
...@@ -345,20 +369,32 @@ export class FieldSetComponent implements DoCheck { ...@@ -345,20 +369,32 @@ export class FieldSetComponent implements DoCheck {
* clic sur le bouton supprimer * clic sur le bouton supprimer
*/ */
private onRemoveClick() { private onRemoveClick() {
const pos = (this._fieldSet.parent as FieldsetContainer).getFieldsetPosition(this._fieldSet) + 1;
this.removeFieldset.emit(this._fieldSet); this.removeFieldset.emit(this._fieldSet);
this.notifService.notify(
sprintf(this.i18nService.localizeText("INFO_FSC_FS_REMOVED"), pos)
);
} }
/** /**
* clic sur le bouton monter * clic sur le bouton monter
*/ */
private onMoveUpClick() { private onMoveUpClick() {
const pos = (this._fieldSet.parent as FieldsetContainer).getFieldsetPosition(this._fieldSet) + 1;
this.moveFieldsetUp.emit(this._fieldSet); this.moveFieldsetUp.emit(this._fieldSet);
this.notifService.notify(
sprintf(this.i18nService.localizeText("INFO_FSC_FS_MOVED"), pos)
);
} }
/** /**
* clic sur le bouton descendre * clic sur le bouton descendre
*/ */
private onMoveDownClick() { private onMoveDownClick() {
const pos = (this._fieldSet.parent as FieldsetContainer).getFieldsetPosition(this._fieldSet) + 1;
this.moveFieldsetDown.emit(this._fieldSet); this.moveFieldsetDown.emit(this._fieldSet);
this.notifService.notify(
sprintf(this.i18nService.localizeText("INFO_FSC_FS_MOVED"), pos)
);
} }
} }
...@@ -88,6 +88,12 @@ ...@@ -88,6 +88,12 @@
"INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_1": "Partially submerged", "INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_1": "Partially submerged",
"INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_2": "Submerged", "INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_2": "Submerged",
"INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_3": "Zero flow", "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_COURT": "Lechapt-C.",
"INFO_LECHAPTCALMON_TITRE": "Lechapt-Calmon", "INFO_LECHAPTCALMON_TITRE": "Lechapt-Calmon",
"INFO_LIB_ALPHA": "Alpha coefficient", "INFO_LIB_ALPHA": "Alpha coefficient",
...@@ -97,7 +103,7 @@ ...@@ -97,7 +103,7 @@
"INFO_LIB_BETA": "Beta coefficient", "INFO_LIB_BETA": "Beta coefficient",
"INFO_LIB_BT": "Half opening of the triangle", "INFO_LIB_BT": "Half opening of the triangle",
"INFO_LIB_CD": "Discharge coefficient", "INFO_LIB_CD": "Discharge coefficient",
"INFO_LIB_CLOISON": "Cross wall ", "INFO_LIB_CLOISON": "Cross wall #",
"INFO_LIB_CV": "Cv: Velocity coefficient", "INFO_LIB_CV": "Cv: Velocity coefficient",
"INFO_LIB_CVQT": "CV.QT: Corrected discharge", "INFO_LIB_CVQT": "CV.QT: Corrected discharge",
"INFO_LIB_DH": "Fall", "INFO_LIB_DH": "Fall",
......
...@@ -88,6 +88,12 @@ ...@@ -88,6 +88,12 @@
"INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_1": "Partiellement noyé", "INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_1": "Partiellement noyé",
"INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_2": "Noyé", "INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_2": "Noyé",
"INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_3": "Débit nul", "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_COURT": "Lechapt-C.",
"INFO_LECHAPTCALMON_TITRE": "Lechapt-Calmon", "INFO_LECHAPTCALMON_TITRE": "Lechapt-Calmon",
"INFO_LIB_ALPHA": "Coefficient alpha", "INFO_LIB_ALPHA": "Coefficient alpha",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment