From 17eb2de757de596054c255e3e88b20e05a85e03e Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Thu, 23 May 2019 22:54:31 +0200
Subject: [PATCH] FEAT #10551 TIME 1 begin filter sign / visa / note

---
 lang/en.json                                    | 16 ++++++++++------
 lang/fr.json                                    | 14 +++++++++-----
 src/frontend/app/service/signatures.service.ts  |  4 ++--
 src/frontend/app/sidebar/sidebar.component.html |  6 ++++--
 src/frontend/app/sidebar/sidebar.component.scss |  4 ++++
 src/frontend/app/sidebar/sidebar.component.ts   |  3 ++-
 6 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/lang/en.json b/lang/en.json
index 131558a151..033e1c1aaf 100755
--- a/lang/en.json
+++ b/lang/en.json
@@ -134,11 +134,15 @@
 		"wrongLoginPassword"                 : "Wrong login or password",
 		"wrongPassword"                      : "Wrong password",
 		"wsUser"                             : "Web service user",
-		"visaUser"                             : "Visa user",
-		"signUser"                             : "Sign user",
-		"visaProcessInfo"                             : "Visa to",
-		"signProcessInfo"                             : "Sign to",
-		"inProgress"                             : "In progress",
-		"waiting"                             : "Waiting"
+		"visaUser": "Visa user",
+		"signUser": "Sign user",
+		"visaProcessInfo": "Visa to",
+		"signProcessInfo": "Sign to",
+		"inProgress": "In progress",
+		"waiting": "Waiting",
+		"visaLabel": "to approve",
+		"signLabel": "to sign",
+		"noteLabel": "to note",
+		"documents": "document(s)"
 	}
 }
diff --git a/lang/fr.json b/lang/fr.json
index 8b38f6d967..f7a98845d2 100755
--- a/lang/fr.json
+++ b/lang/fr.json
@@ -135,10 +135,14 @@
 		"wrongPassword"                      : "Mauvais mot de passe",
 		"wsUser"                             : "Utilisateur web service",
 		"visaUser"                             : "Viseur",
-		"signUser"                             : "Signataire",
-		"visaProcessInfo"                             : "Visé le",
-		"signProcessInfo"                             : "Signé le",
-		"inProgress"                             : "En cours",
-		"waiting"                             : "En attente"
+		"signUser": "Signataire",
+		"visaProcessInfo": "Visé le",
+		"signProcessInfo": "Signé le",
+		"inProgress": "En cours",
+		"waiting": "En attente",
+		"visaLabel": "à viser",
+		"signLabel": "à signer",
+		"noteLabel": "à annoter",
+		"documents": "document(s)"
 	}
 }
diff --git a/src/frontend/app/service/signatures.service.ts b/src/frontend/app/service/signatures.service.ts
index cbda913f04..8a29de1040 100755
--- a/src/frontend/app/service/signatures.service.ts
+++ b/src/frontend/app/service/signatures.service.ts
@@ -31,7 +31,7 @@ export class SignaturesContentService {
     workingAreaHeight = 0;
     renderingDoc = true;
     mobileMode = true;
-    mode = 'SIGN';
+    mode = '';
     scale = 1;
     x = 0;
     y = 0;
@@ -77,7 +77,7 @@ export class SignaturesContentService {
         } else {
             this.mobileMode = false;
         }
-        this.mode = 'SIGN';
+        this.mode = '';
         this.scale = 1;
         this.x = 0;
         this.y = 85;
diff --git a/src/frontend/app/sidebar/sidebar.component.html b/src/frontend/app/sidebar/sidebar.component.html
index 9e7748530b..c3e5b66823 100755
--- a/src/frontend/app/sidebar/sidebar.component.html
+++ b/src/frontend/app/sidebar/sidebar.component.html
@@ -11,10 +11,12 @@
       </div>
     </header>
     <header class="sidebar-header">
+      1 {{'lang.documents' | translate}}&nbsp;<span class="primary" *ngIf="signaturesService.mode != ''">{{'lang.'+signaturesService.mode+'Label' | translate}}</span>
     </header>
     <section class="sidebar-btn">
-      <button class="btn btn-xs blue filter" [ngClass]="[signaturesService.mode == 'NOTE' ? 'active' : '']" (click)="filter('NOTE')">{{'lang.annotation' | translate}} <span *ngIf="signaturesService.documentsListCount['NOTE']" class="badgeNbDocument">{{signaturesService.documentsListCount["NOTE"]}}</span></button>
-      <button class="btn btn-xs blue filter" [ngClass]="[signaturesService.mode == 'SIGN' ? 'active' : '']" (click)="filter('SIGN')">{{'lang.signature' | translate}} <span *ngIf="signaturesService.documentsListCount['SIGN']" class="badgeNbDocument">{{signaturesService.documentsListCount["SIGN"]}}</span></button>
+      <button class="btn btn-xs blue filter" [ngClass]="[signaturesService.mode == 'sign' ? 'active' : '']" (click)="filter('sign')"><i class="fas fa-file-signature"></i></button>
+      <button class="btn btn-xs blue filter" [ngClass]="[signaturesService.mode == 'visa' ? 'active' : '']" (click)="filter('visa')"><i class="fas fa-thumbs-up"></i></button>
+      <button class="btn btn-xs blue filter" [ngClass]="[signaturesService.mode == 'note' ? 'active' : '']" (click)="filter('note')"><i class="far fa-comment-dots"></i></button>
     </section>
   </div>
   <ul #listContent class="nav" detect-scroll (onScroll)="handleScroll($event)" [bottomOffset]="1" [topOffset]="1">
diff --git a/src/frontend/app/sidebar/sidebar.component.scss b/src/frontend/app/sidebar/sidebar.component.scss
index 9bd82f19d6..9f282f1c63 100644
--- a/src/frontend/app/sidebar/sidebar.component.scss
+++ b/src/frontend/app/sidebar/sidebar.component.scss
@@ -153,6 +153,10 @@
   right: 10px;
 }
 
+.filter {
+  width: 35px;
+}
+
 .filter.active {
   background: $primary;
 }
diff --git a/src/frontend/app/sidebar/sidebar.component.ts b/src/frontend/app/sidebar/sidebar.component.ts
index 30a61a5144..4afc027d63 100755
--- a/src/frontend/app/sidebar/sidebar.component.ts
+++ b/src/frontend/app/sidebar/sidebar.component.ts
@@ -83,7 +83,8 @@ export class SidebarComponent implements OnInit {
     }
 
     filter(mode: string) {
-        this.signaturesService.mode = mode;
+        this.signaturesService.mode == mode ? this.signaturesService.mode = '' : this.signaturesService.mode = mode;
+        
         this.offset = 0;
         this.http.get('../rest/documents?limit=' + this.limit + '&offset=' + this.offset + '&mode=' + this.signaturesService.mode)
             .subscribe((data: any) => {
-- 
GitLab