From b5b37b03e0ecfab710d4935786f41b5e1180dd8d Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Fri, 27 Sep 2019 16:41:44 +0200
Subject: [PATCH] FEAT #11269 TIME 0:20 add var lang

---
 .../app/indexation/indexation.component.html  | 22 ++++++++-----------
 .../indexing-form.component.html              |  6 ++---
 .../indexing-form/indexing-form.component.ts  |  6 ++---
 src/frontend/lang/lang-en.ts                  |  6 +++++
 src/frontend/lang/lang-fr.ts                  |  6 +++++
 src/frontend/lang/lang-nl.ts                  |  6 +++++
 6 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/src/frontend/app/indexation/indexation.component.html b/src/frontend/app/indexation/indexation.component.html
index 5fb49b0b299..f0e4ea26058 100644
--- a/src/frontend/app/indexation/indexation.component.html
+++ b/src/frontend/app/indexation/indexation.component.html
@@ -8,19 +8,18 @@
                 <button mat-button class="button-form-primary" [matMenuTriggerFor]="IndexingModelsMenu"
                     style="flex:1;margin-right:20px;">
                     <span class="menu-label">
-                        {{currentIndexingModel.label}} {{currentIndexingModel.default ? '(par défaut)': ''}}
+                        {{currentIndexingModel.label}} {{currentIndexingModel.default ? '(' + lang.default + ')': ''}}
                     </span>
                     <i class="fa fa-chevron-down menu-icon"></i></button>
                 <mat-menu #IndexingModelsMenu="matMenu" [class]="'menuForm'">
                     <ng-container *ngFor="let indexingModel of indexingModels">
                         <button *ngIf="indexingModel.id !== currentIndexingModel.id" mat-menu-item
                             (click)="loadIndexingModel(indexingModel)">{{indexingModel.label}}
-                            {{indexingModel.default ? '(par défaut)': ''}}</button>
+                            {{indexingModel.default ? '(' + lang.default + ')': ''}}</button>
                     </ng-container>
                 </mat-menu>
                 <button mat-button *ngIf="!appService.getViewMode()" class="button-form-primary"
-                    style="flex:1;align-items: center;justify-content: center;text-align: center;display: flex;">Enregistrer
-                    comme modèle</button>
+                    style="flex:1;align-items: center;justify-content: center;text-align: center;display: flex;">{{lang.saveAsModel}}</button>
                 <button mat-icon-button *ngIf="appService.getViewMode()" class="button-form-primary"
                     (click)="onSubmit()">
                     <mat-icon class="far fa-edit"></mat-icon>
@@ -38,22 +37,19 @@
                     </span>
                     <i class="fa fa-chevron-down menu-icon"></i></button>
                 <mat-menu #menu="matMenu" [class]="'menuForm'">
-                    <button mat-menu-item>Item 1</button>
-                    <button mat-menu-item>Item 2</button>
+                    <button mat-menu-item>Action 2</button>
+                    <button mat-menu-item>Action 3</button>
                 </mat-menu>
                 <button mat-button *ngIf="!appService.getViewMode()" class="button-form-primary"
                     style="width: 150px;align-items: center;justify-content: center;text-align: center;display: flex;"
-                    (click)="onSubmit()">Valider</button>
+                    (click)="onSubmit()">{{lang.validate}}</button>
                 <button mat-icon-button *ngIf="appService.getViewMode()" class="button-form-primary"
                     (click)="onSubmit()">
                     <mat-icon class="fa fa-check"></mat-icon>
                 </button>
             </div>
         </ng-container>
-        <div *ngIf="indexingModels.length === 0" class="emptyModel">
-            Aucun modèle d'enregistrement disponible<br /><br />
-            <small>Veuillez créer un modèle depuis Administation > Modèle d'enregistrement</small>
-        </div>
+        <div *ngIf="indexingModels.length === 0" class="emptyModel" [innerHTML]="lang.noAvailableIndexingModel"></div>
     </mat-sidenav>
     <mat-sidenav-content>
         <div class="bg-head">
@@ -79,8 +75,8 @@
                         <i class="fa fa-chevron-down menu-icon"></i>
                     </button>
                     <mat-menu #menu="matMenu" [class]="'menuForm'">
-                        <button mat-menu-item>Item 1</button>
-                        <button mat-menu-item>Item 2</button>
+                        <button mat-menu-item>Modèle 1</button>
+                        <button mat-menu-item>Modèle 2</button>
                     </mat-menu>
                     <button mat-button class="button-form-primary"
                         style="align-items: center;justify-content: center;text-align: center;display: flex;">Choisissez
diff --git a/src/frontend/app/indexation/indexing-form/indexing-form.component.html b/src/frontend/app/indexation/indexing-form/indexing-form.component.html
index bcf761a78f4..c3e4c8a64f3 100644
--- a/src/frontend/app/indexation/indexing-form/indexing-form.component.html
+++ b/src/frontend/app/indexation/indexing-form/indexing-form.component.html
@@ -3,7 +3,7 @@
 </div>
 <ng-container *ngIf="!loading">
     <div *ngIf="!adminMode" style="display: flex;align-items: center;justify-content: flex-end;margin-top: 10px;margin-bottom: -20px;">
-        <button mat-button class="categoryLabel" (click)="toggleMailTracking()" matTooltip="Activer le suivi de courrier">
+        <button mat-button class="categoryLabel" (click)="toggleMailTracking()" [title]="arrFormControl['mail­tracking'].value ? lang.untrackThisMail : lang.trackThisMail">
             {{lang[currentCategory]}}
             <mat-icon color="primary" class="{{this.arrFormControl['mail­tracking'].value ? 'fas':'far'}} fa-star" style="font-size: 20px;"></mat-icon>
         </button>
@@ -23,8 +23,8 @@
                     <ng-container *ngFor="let field of this['indexingModels_'+category];let i=index">
                         <div class="fieldRow" *ngIf="field.unit === category" cdkDrag cdkDragLockAxis="y"
                             [cdkDragData]="field">
-                            <div class="fieldLabel" *ngIf="!adminMode && !appService.getViewMode()">
-                                <i *ngIf="adminMode" class="fas fa-bars fa-2x" color="primary" style="cursor: move"
+                            <div class="fieldLabel" *ngIf="(!adminMode && !appService.getViewMode()) || adminMode">
+                                <i *ngIf="adminMode" [title]="lang.move" class="fas fa-bars fa-2x" color="primary" style="cursor: move"
                                     cdkDragHandle></i>&nbsp;
                                 {{field.label}}
                                 <button *ngIf="adminMode && !field.system" mat-icon-button
diff --git a/src/frontend/app/indexation/indexing-form/indexing-form.component.ts b/src/frontend/app/indexation/indexing-form/indexing-form.component.ts
index 4917d7b1b6b..661d08f4c2e 100644
--- a/src/frontend/app/indexation/indexing-form/indexing-form.component.ts
+++ b/src/frontend/app/indexation/indexing-form/indexing-form.component.ts
@@ -198,7 +198,6 @@ export class IndexingFormComponent implements OnInit {
                     });
                     this.initElemForm();
                 }),
-                //finalize(() => this.loading = false),
                 catchError((err: any) => {
                     this.notify.handleErrors(err);
                     return of(false);
@@ -498,7 +497,7 @@ export class IndexingFormComponent implements OnInit {
                             this.initValidator(field);
                         });
                     });
-                    this.notify.error("Champs introuvables! les données de base ont été chargés");
+                    this.notify.error(this.lang.noFieldInModelMsg);
                 } else {
                     data.indexingModel.fields.forEach((field: any) => {
                         fieldExist = false;
@@ -544,7 +543,7 @@ export class IndexingFormComponent implements OnInit {
                             this['indexingModels_' + field.unit].push(field);
                             this.initValidator(field);
                         } else {
-                            this.notify.error("Le champ " + field.identifier + " n'existe pas !");
+                            this.notify.error(this.lang.fieldNotExist + ': ' + field.identifier);
                         }
 
                     });
@@ -553,7 +552,6 @@ export class IndexingFormComponent implements OnInit {
                 this.initElemForm();
                 this.createForm();
             }),
-            //finalize(() => this.loading = false),
             catchError((err: any) => {
                 this.notify.handleErrors(err);
                 return of(false);
diff --git a/src/frontend/lang/lang-en.ts b/src/frontend/lang/lang-en.ts
index 4941bce8c3f..fd5eefcc74d 100755
--- a/src/frontend/lang/lang-en.ts
+++ b/src/frontend/lang/lang-en.ts
@@ -1123,4 +1123,10 @@ export const LANG_EN = {
     "autocompleteInput" : "Autocomplete input",
     "typeEnterToCreate" : "Type on <b>enter</b> to create element",
     "ged_doc" : "GED Document",
+    "trackThisMail" : "Track this mail",
+    "untrackThisMail" : "Untrack this mail",
+    "noFieldInModelMsg" : "No field found ! Default fields have been loaded",
+    "fieldNotExist" : "Field not exist",
+    "saveAsModel" : "Save as Model",
+    "noAvailableIndexingModel" : "No indexing model found<br /><br /><small>Please create a model in Administation > Indexing model</small>",
 };
diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts
index 8e4387d9bcb..064b4e3996c 100755
--- a/src/frontend/lang/lang-fr.ts
+++ b/src/frontend/lang/lang-fr.ts
@@ -1160,4 +1160,10 @@ export const LANG_FR = {
     "autocompleteInput" : "Auto-completion",
     "typeEnterToCreate" : "Taper sur <b>entrée</b> pour créer l'element",
     "ged_doc" : "Document GED",
+    "trackThisMail" : "Suivre le courrier",
+    "untrackThisMail" : "Ne plus suivre le courrier",
+    "noFieldInModelMsg" : "Champs introuvables! les données de base ont été chargées",
+    "fieldNotExist" : "Le champ n'existe pas",
+    "saveAsModel" : "Enregistrer comme modèle",
+    "noAvailableIndexingModel" : "Aucun modèle d'enregistrement disponible<br /><br /><small>Veuillez créer un modèle depuis Administation > Modèle d'enregistrement</small>",
 };
diff --git a/src/frontend/lang/lang-nl.ts b/src/frontend/lang/lang-nl.ts
index c0c2ac962e9..44c9ae3161a 100755
--- a/src/frontend/lang/lang-nl.ts
+++ b/src/frontend/lang/lang-nl.ts
@@ -1149,4 +1149,10 @@ export const LANG_NL = {
     "autocompleteInput" : "Autocomplete input", //_TO_TRANSLATE
     "typeEnterToCreate" : "Type on <b>enter</b> to create element", //_TO_TRANSLATE
     "ged_doc" : "GED Document", //_TO_TRANSLATE
+    "trackThisMail" : "Track this mail", //_TO_TRANSLATE
+    "untrackThisMail" : "Untrack this mail", //_TO_TRANSLATE
+    "noFieldInModelMsg" : "No field found ! Default fields have been loaded", //_TO_TRANSLATE
+    "fieldNotExist" : "Field not exist", //_TO_TRANSLATE
+    "saveAsModel" : "Save as Model", //_TO_TRANSLATE
+    "noAvailableIndexingModel" : "No indexing model found<br /><br /><small>Please create a model in Administation > Indexing model</small>", //_TO_TRANSLATE
 };
-- 
GitLab