From 66d9c710bc171458ff36a1a0b02bd9b2a4a89ef5 Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Fri, 1 Feb 2019 15:00:30 +0100
Subject: [PATCH] FEAT #9082 remove filters param for actions tool

---
 src/frontend/app/list/basket-list.component.html       |  2 +-
 src/frontend/app/list/basket-list.component.ts         |  1 -
 .../app/list/filters/filters-tool.component.html       | 10 +++++-----
 .../app/list/filters/filters-tool.component.scss       |  6 ++++++
 .../app/list/filters/filters-tool.component.ts         |  4 ++--
 .../app/list/summarySheet/summary-sheet.component.ts   |  5 ++---
 6 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/frontend/app/list/basket-list.component.html b/src/frontend/app/list/basket-list.component.html
index 21b1c1d98ff..6b5f5ad5e31 100644
--- a/src/frontend/app/list/basket-list.component.html
+++ b/src/frontend/app/list/basket-list.component.html
@@ -18,7 +18,7 @@
                 <div class="row" style="margin:0px;">
                     <div class="col-md-12" style="display:flex;">
                         <app-filters-tool style="flex:1;" #filtersTool [currentBasketInfo]="currentBasketInfo"
-                            [listProperties]="this.listProperties" [snavR]="snav2" [nbSelectedRes]="selectedRes.length" (toggleAllRes)="toggleAllRes($event)" (refreshEvent)="refreshDao()"></app-filters-tool>
+                            [listProperties]="this.listProperties" [snavR]="snav2" [selectedRes]="selectedRes" (toggleAllRes)="toggleAllRes($event)" (refreshEvent)="refreshDao()"></app-filters-tool>
                         <mat-paginator #paginatorResultList [length]="resultsLength" [pageSize]="10" class="paginatorResultList"></mat-paginator>
                     </div>
                 </div>
diff --git a/src/frontend/app/list/basket-list.component.ts b/src/frontend/app/list/basket-list.component.ts
index 3b969c72034..fd91ebeff02 100755
--- a/src/frontend/app/list/basket-list.component.ts
+++ b/src/frontend/app/list/basket-list.component.ts
@@ -256,7 +256,6 @@ export class BasketListComponent implements OnInit {
                     element[key] = this.lang.undefined;
                 } else if (["senders", "recipients"].indexOf(key) > 0) {
                     if (element[key].length > 1) {
-                        console.log(element[key]);
                         element[key] = this.lang.isMulticontact;
                     } else {
                         element[key] = element[key][0];
diff --git a/src/frontend/app/list/filters/filters-tool.component.html b/src/frontend/app/list/filters/filters-tool.component.html
index a10462ca28d..59d084b4b19 100644
--- a/src/frontend/app/list/filters/filters-tool.component.html
+++ b/src/frontend/app/list/filters/filters-tool.component.html
@@ -44,19 +44,19 @@
     <button mat-icon-button [matMenuTriggerFor]="menuParamList">
         <mat-icon color="primary" fontSet="fas" fontIcon="fa-cog fa-2x"></mat-icon>
     </button>
-    <mat-menu #menuParamList="matMenu">
+    <mat-menu class="actionsTool" #menuParamList="matMenu">
         <div style="text-align: center;font-size: 10px;opacity: 0.5;margin-top:-10px;">
-            {{nbSelectedRes}} {{lang.selectedElements}}
+            {{selectedRes.length}} {{lang.selectedElements}}
         </div>
-        <button mat-menu-item [disabled]="nbSelectedRes == 0">
+        <button mat-menu-item [disabled]="selectedRes.length == 0">
             <mat-icon fontSet="fas" fontIcon="fa-print fa-2x"></mat-icon>
             <span>{{lang.printResultList}}</span>
         </button>
-        <button mat-menu-item (click)="openSummarySheet();" [disabled]="nbSelectedRes == 0">
+        <button mat-menu-item (click)="openSummarySheet();" [disabled]="selectedRes.length == 0">
             <mat-icon fontSet="fas" fontIcon="fa-link fa-2x"></mat-icon>
             <span>{{lang.summarySheets}}</span>
         </button>
-        <button mat-menu-item (click)="openListAdmin();" [disabled]="nbSelectedRes == 0">
+        <button mat-menu-item (click)="openListAdmin();" [disabled]="selectedRes.length == 0">
             <mat-icon fontSet="fas" fontIcon="fa-file-export fa-2x"></mat-icon>
             <span>{{lang.exportDatas}}</span>
         </button>
diff --git a/src/frontend/app/list/filters/filters-tool.component.scss b/src/frontend/app/list/filters/filters-tool.component.scss
index 19ed6937036..63d74d5a974 100644
--- a/src/frontend/app/list/filters/filters-tool.component.scss
+++ b/src/frontend/app/list/filters/filters-tool.component.scss
@@ -103,4 +103,10 @@
 
 .mat-menu-content:not(:empty) {
     padding-top: 18px;
+}
+
+.actionsTool {
+    .mat-icon {
+        height: auto;
+    }
 }
\ No newline at end of file
diff --git a/src/frontend/app/list/filters/filters-tool.component.ts b/src/frontend/app/list/filters/filters-tool.component.ts
index 33d28713964..ae80ad6f563 100644
--- a/src/frontend/app/list/filters/filters-tool.component.ts
+++ b/src/frontend/app/list/filters/filters-tool.component.ts
@@ -63,7 +63,7 @@ export class FiltersToolComponent implements OnInit {
     @Input('currentBasketInfo') currentBasketInfo: any;
 
     @Input('snavR') sidenavRight: MatSidenav;
-    @Input('nbSelectedRes') nbSelectedRes: number;
+    @Input('selectedRes') selectedRes: any;
 
     @Output('refreshEvent') refreshEvent = new EventEmitter<string>();
     @Output('toggleAllRes') toggleAllRes = new EventEmitter<string>();
@@ -294,7 +294,7 @@ export class FiltersToolComponent implements OnInit {
                 ownerId: this.currentBasketInfo.ownerId,
                 groupId: this.currentBasketInfo.groupId,
                 basketId: this.currentBasketInfo.basketId,
-                filters: this.filtersListService.getUrlFilters()
+                selectedRes: this.selectedRes,
             }
         });
     }
diff --git a/src/frontend/app/list/summarySheet/summary-sheet.component.ts b/src/frontend/app/list/summarySheet/summary-sheet.component.ts
index 250000f9aa9..2c1018099d1 100644
--- a/src/frontend/app/list/summarySheet/summary-sheet.component.ts
+++ b/src/frontend/app/list/summarySheet/summary-sheet.component.ts
@@ -138,12 +138,11 @@ export class SummarySheetComponent implements OnInit {
             }
         });
 
-        console.log(this.dataAvailable);
-        this.http.get('../../rest/resourcesList/users/' + this.data.ownerId + '/groups/' + this.data.groupId + '/baskets/' + this.data.basketId + '/summarySheets?units=' + btoa(JSON.stringify(currElemData)) + '&init' + this.data.filters, { responseType: "blob" })
+        this.http.get('../../rest/resourcesList/users/' + this.data.ownerId + '/groups/' + this.data.groupId + '/baskets/' + this.data.basketId + '/summarySheets?units=' + btoa(JSON.stringify(currElemData)), { responseType: "blob" })
             .subscribe((data) => {
                 let downloadLink = document.createElement('a');
                 downloadLink.href = window.URL.createObjectURL(data);
-                downloadLink.setAttribute('download', "summary_sheet.pdf");
+                downloadLink.setAttribute('download', this.lang.summarySheet.replace(' ','_') + ".pdf");
                 document.body.appendChild(downloadLink);
                 downloadLink.click();
 
-- 
GitLab