From 3c5382a3590b96e76e93ef89025e218f72aa2f80 Mon Sep 17 00:00:00 2001
From: Alex Orluc <alex.orluc@maarch.org>
Date: Wed, 13 Jun 2018 09:11:59 +0200
Subject: [PATCH] FEAT #7847 add mass redirect baskets in profile + admin users

---
 .../Views/profile.component.html              | 194 +++++++--------
 .../Views/user-administration.component.html  | 220 +++++++++++-------
 .../user-administration.component.ts          |  44 +++-
 .../js/angular/app/profile.component.ts       |   8 +
 .../js/angular/lang/lang-en.ts                |   6 +-
 .../js/angular/lang/lang-fr.ts                |   6 +-
 6 files changed, 296 insertions(+), 182 deletions(-)

diff --git a/apps/maarch_entreprise/Views/profile.component.html b/apps/maarch_entreprise/Views/profile.component.html
index ce2a36be865..c9c2aa0eecd 100755
--- a/apps/maarch_entreprise/Views/profile.component.html
+++ b/apps/maarch_entreprise/Views/profile.component.html
@@ -192,7 +192,7 @@
                                                     {{lang.selectAll}}
                                                 </span>
                                                 <mat-form-field *ngIf="selectionBaskets.hasValue()">
-                                                    <input matTooltip="{{lang.redirectWhenAbscence}}" matTooltipPosition="above" type="text" placeholder="{{ lang.userToRedirect }}"
+                                                    <input matTooltip="{{lang.redirectWhenAbscence}}" matTooltipPosition="above" type="text" placeholder="{{ lang.redirectBaskets }}"
                                                         matInput [matAutocomplete]="auto" [formControl]="userCtrl">
                                                     <mat-autocomplete #auto="matAutocomplete">
                                                         <mat-option *ngFor="let user of filteredUsers | async" [value]="user.id" (click)="addBasketRedirection(user.id)">
@@ -210,107 +210,115 @@
                                                 </mat-form-field>
                                             </p>
                                         </mat-list-item>
+                                        <mat-divider></mat-divider>
                                         <ng-container *ngFor="let basket of user.baskets;let i = index">
-                                            <mat-list-item *ngIf="basket.group_id && basket.userToDisplay == ''">
+                                            <mat-list-item *ngIf="basket.group_id && basket.userToDisplay == ''" (mouseover)="showActions(basket.basket_id)" (mouseout)="hideActions(basket.basket_id)" style="cursor: pointer;">
                                                 <mat-icon mat-list-icon color="primary" *ngIf="basket.enabled">
                                                     <mat-checkbox (click)="$event.stopPropagation()" (change)="$event ? selectionBaskets.toggle(basket.basket_id) : null" [checked]="selectionBaskets.isSelected(basket.basket_id)" color="primary"></mat-checkbox>
                                                 </mat-icon>
-                                                <h4 mat-line [ngStyle]="{'opacity': basket.allowed ? '1' : '0.5'}" [attr.color]="basket.userToDisplay != '' ? 'primary': ''">{{basket.basket_name}}
-                                                    <span class="label label-primary" style="font-weight:normal">{{basket.group_desc}}</span>
-                                                </h4>
-                                                <!--<p mat-line [ngStyle]="{'opacity': basket.allowed ? '1' : '0.5'}">
-                                                    <mat-form-field *ngIf="basket.allowed" floatLabel="never">
-                                                        <input matTooltip="{{lang.redirectWhenAbscence}}" matTooltipPosition="above" type="text" placeholder="{{ lang.userToRedirect }}"
-                                                            matInput [matAutocomplete]="auto" [formControl]="userCtrl" [disabled]="!basket.allowed">
-                                                        <mat-autocomplete #auto="matAutocomplete">
-                                                            <mat-option *ngFor="let user of filteredUsers | async" [value]="user.id" (click)="addBasketRedirection(user.id,basket)">
-                                                                <p mat-line matTooltip="{{ user.otherInfo }}">
-                                                                    <span class="col-xm-1">
-                                                                        <mat-icon color="primary" class="fa fa-user fa-2x" style="margin-right:0px;"></mat-icon>
-                                                                    </span>
-                                                                    <span class="col-xm-11">
-                                                                        {{ user.idToDisplay }}
-                                                                        <small>{{ user.otherInfo }}</small>
-                                                                    </span>
-                                                                </p>
-                                                            </mat-option>
-                                                        </mat-autocomplete>
-                                                    </mat-form-field>
-                                                    <mat-form-field>
-                                                        <input type="text" color="warn" matInput disabled value="">
-                                                    </mat-form-field>
-                                                </p>-->
+                                                <h4 mat-line [attr.color]="basket.userToDisplay != '' ? 'primary': ''" style="display: flex;align-items: center;">
+                                                        <span (click)="selectionBaskets.toggle(basket.basket_id);" [ngStyle]="{'opacity': basket.allowed ? '1' : '0.5'}" style="flex: 2;overflow: hidden;text-overflow: ellipsis;">
+                                                            {{basket.basket_name}}
+                                                            <span class="label label-primary" style="font-weight:normal">{{basket.group_desc}}</span>
+                                                        </span>
+            
+                                                        <span id="{{basket.basket_id}}" style="display:none;flex:1;background: white;text-align: right">
+                                                            <i class="fa fa-ellipsis-v" style="opacity: 0.2;"></i>
+                                                            <button [matMenuTriggerFor]="menu2" mat-icon-button matTooltip="{{lang.redirectBasket}}" (click)="selectionBaskets.clear();selectionBaskets.select(basket.basket_id);">
+                                                                <mat-icon class="fa fa-reply"></mat-icon>
+                                                            </button>
+                                                            <mat-menu #menu2="matMenu">
+                                                                <mat-form-field style="padding:10px;width:200px !important;">
+                                                                    <input (click)="$event.stopPropagation()" type="text" placeholder="{{ lang.users }}" matInput [matAutocomplete]="auto" [formControl]="userCtrl">
+                                                                    <mat-autocomplete #auto="matAutocomplete">
+                                                                        <mat-option *ngFor="let user of filteredUsers | async" [value]="user.id" (click)="addBasketRedirection(user.id)">
+                                                                            <p mat-line matTooltip="{{ user.otherInfo }}">
+                                                                                <span class="col-xm-1">
+                                                                                    <mat-icon color="primary" class="fa fa-user fa-2x" style="margin-right:0px;"></mat-icon>
+                                                                                </span>
+                                                                                <span class="col-xm-11">
+                                                                                    {{ user.idToDisplay }}
+                                                                                    <small>{{ user.otherInfo }}</small>
+                                                                                </span>
+                                                                            </p>
+                                                                        </mat-option>
+                                                                    </mat-autocomplete>
+                                                                </mat-form-field>
+                                                            </mat-menu>
+                                                        </span>
+                                                    </h4>
                                             </mat-list-item>
                                         </ng-container>
                                     </mat-list>
                                 </div>
                                 <div class="col-sm-6" style="overflow:hidden;">
-                                    <mat-list>
-                                        <h4>{{lang.basketsRedirected}}</h4>
-                                        <mat-divider></mat-divider>
-                                        <div style="margin-top:40px">
-                                            <ng-container *ngFor="let basket of user.baskets;let i = index">
-                                                <mat-list-item *ngIf="basket.group_id && basket.userToDisplay != ''">
-                                                    <mat-icon mat-list-icon color="primary" *ngIf="basket.enabled" style="margin-top:-60px;" class="fa fa-paper-plane">
-                                                    </mat-icon>
-                                                    <h4 mat-line [ngStyle]="{'opacity': basket.allowed ? '1' : '0.5'}" [attr.color]="basket.userToDisplay != '' ? 'primary': ''">{{basket.basket_name}}
-                                                        <span class="label label-primary" style="font-weight:normal">{{basket.group_id}}</span>
-                                                    </h4>
-                                                    <p mat-line [ngStyle]="{'opacity': basket.allowed ? '1' : '0.5'}">
-                                                        <mat-form-field>
-                                                            <input type="text" color="warn" matInput disabled value="{{lang.redirectedTo}} {{basket.userToDisplay}}">
-                                                            <button mat-button color="warn" matSuffix mat-icon-button aria-label="Clear" (click)="delBasketRedirection(basket)" matTooltip="Supprimer la redirection">
-                                                                <mat-icon color="warn" class="fa fa-times text-danger"></mat-icon>
-                                                            </button>
-                                                        </mat-form-field>
-                                                    </p>
-                                                </mat-list-item>
-                                            </ng-container>
-                                        </div>
-
-                                        <h4>{{lang.basketsAssigned}}</h4>
-                                        <mat-divider></mat-divider>
-                                        <div style="margin-top:40px">
-                                            <ng-container *ngFor="let basket of user.baskets;let i = index">
-                                                <mat-list-item *ngIf="!basket.group_id">
-                                                    <mat-icon mat-list-icon color="primary" style="margin-top:-60px;" class="fa fa-reply">
-                                                    </mat-icon>
-                                                    <h4 mat-line [attr.color]="basket.userToDisplay != '' ? 'primary': ''">{{basket.basket_name}}
-                                                        <span class="label label-primary" style="font-weight:normal">{{basket.group_id}}</span>
-                                                    </h4>
-                                                    <p mat-line>
-                                                        <mat-form-field *ngIf="basket.userToDisplay == ''" floatLabel="never">
-                                                            <input matTooltip="{{lang.redirectBasket}}" matTooltipPosition="above" type="text" placeholder="{{lang.userToRedirect}}"
-                                                                matInput [matAutocomplete]="auto" [formControl]="userCtrl">
-                                                            <mat-autocomplete #auto="matAutocomplete">
-                                                                <mat-option *ngFor="let user of filteredUsers | async" [value]="user.id" (click)="reassignBasketRedirection(user.id,basket)">
-                                                                    <p mat-line matTooltip="{{ user.otherInfo }}">
-                                                                        <span class="col-xm-1">
-                                                                            <mat-icon color="primary" class="fa fa-user fa-2x" style="margin-right:0px;"></mat-icon>
-                                                                        </span>
-                                                                        <span class="col-xm-11">
-                                                                            {{ user.idToDisplay }}
-                                                                            <small>{{ user.otherInfo }}</small>
-                                                                        </span>
-                                                                    </p>
-                                                                </mat-option>
-                                                            </mat-autocomplete>
-                                                        </mat-form-field>
-                                                        <mat-form-field>
-                                                            <input type="text" color="warn" matInput disabled value="{{lang.assignBy}} {{basket.userToDisplay}}">
-                                                            <button mat-button color="warn" matSuffix mat-icon-button aria-label="Clear" (click)="basket.userToDisplay =''" matTooltip="{{lang.reassign}}">
-                                                                <mat-icon color="primary" class="fa fa-edit"></mat-icon>
-                                                            </button>
-                                                            <button mat-button color="warn" matSuffix mat-icon-button aria-label="Clear" (click)="delBasketRedirection(basket)" matTooltip="{{lang.deleteAssignation}}">
-                                                                <mat-icon color="warn" class="fa fa-times text-danger"></mat-icon>
-                                                            </button>
-                                                        </mat-form-field>
-                                                    </p>
-                                                </mat-list-item>
-                                            </ng-container>
-                                        </div>
-
-                                    </mat-list>
+                                        <mat-tab-group>
+                                                <mat-tab label="{{lang.basketsRedirected}}">
+                                                    <mat-list>
+                                                        <ng-container *ngFor="let basket of user.baskets;let i = index">
+                                                            <mat-list-item *ngIf="basket.group_id && basket.userToDisplay != ''">
+                                                                <mat-icon mat-list-icon color="primary" *ngIf="basket.enabled" style="margin-top:-60px;" class="fa fa-paper-plane">
+                                                                </mat-icon>
+                                                                <h4 mat-line [ngStyle]="{'opacity': basket.allowed ? '1' : '0.5'}" [attr.color]="basket.userToDisplay != '' ? 'primary': ''">{{basket.basket_name}}
+                                                                    <span class="label label-primary" style="font-weight:normal">{{basket.group_id}}</span>
+                                                                </h4>
+                                                                <p mat-line [ngStyle]="{'opacity': basket.allowed ? '1' : '0.5'}">
+                                                                    <mat-form-field>
+                                                                        <input type="text" color="warn" matInput disabled value="{{lang.redirectedTo}} {{basket.userToDisplay}}">
+                                                                        <button mat-button color="warn" matSuffix mat-icon-button aria-label="Clear" (click)="delBasketRedirection(basket)" matTooltip="Supprimer la redirection">
+                                                                            <mat-icon color="warn" class="fa fa-times text-danger"></mat-icon>
+                                                                        </button>
+                                                                    </mat-form-field>
+                                                                </p>
+                                                            </mat-list-item>
+                                                        </ng-container>
+                                                    </mat-list>
+                                                </mat-tab>
+                                            </mat-tab-group>
+                
+                                            <mat-tab-group>
+                                                <mat-tab label="{{lang.basketsAssigned}}">
+                                                    <mat-list>
+                                                        <ng-container *ngFor="let basket of user.baskets;let i = index">
+                                                            <mat-list-item *ngIf="!basket.group_id">
+                                                                <mat-icon mat-list-icon color="primary" style="margin-top:-60px;" class="fa fa-reply">
+                                                                </mat-icon>
+                                                                <h4 mat-line [attr.color]="basket.userToDisplay != '' ? 'primary': ''">{{basket.basket_name}}
+                                                                    <span class="label label-primary" style="font-weight:normal">{{basket.group_id}}</span>
+                                                                </h4>
+                                                                <p mat-line>
+                                                                    <mat-form-field *ngIf="basket.userToDisplay == ''" floatLabel="never">
+                                                                        <input matTooltip="{{lang.redirectBasket}}" matTooltipPosition="above" type="text" placeholder="{{lang.redirectBasket}}"
+                                                                            matInput [matAutocomplete]="auto" [formControl]="userCtrl">
+                                                                        <mat-autocomplete #auto="matAutocomplete">
+                                                                            <mat-option *ngFor="let user of filteredUsers | async" [value]="user.id" (click)="reassignBasketRedirection(user.id,basket)">
+                                                                                <p mat-line matTooltip="{{ user.otherInfo }}">
+                                                                                    <span class="col-xm-1">
+                                                                                        <mat-icon color="primary" class="fa fa-user fa-2x" style="margin-right:0px;"></mat-icon>
+                                                                                    </span>
+                                                                                    <span class="col-xm-11">
+                                                                                        {{ user.idToDisplay }}
+                                                                                        <small>{{ user.otherInfo }}</small>
+                                                                                    </span>
+                                                                                </p>
+                                                                            </mat-option>
+                                                                        </mat-autocomplete>
+                                                                    </mat-form-field>
+                                                                    <mat-form-field>
+                                                                        <input type="text" color="warn" matInput disabled value="{{lang.assignBy}} {{basket.userToDisplay}}">
+                                                                        <button mat-button color="warn" matSuffix mat-icon-button aria-label="Clear" (click)="basket.userToDisplay =''" matTooltip="{{lang.reassign}}">
+                                                                            <mat-icon color="primary" class="fa fa-edit"></mat-icon>
+                                                                        </button>
+                                                                        <button mat-button color="warn" matSuffix mat-icon-button aria-label="Clear" (click)="delBasketRedirection(basket)" matTooltip="{{lang.deleteAssignation}}">
+                                                                            <mat-icon color="warn" class="fa fa-times text-danger"></mat-icon>
+                                                                        </button>
+                                                                    </mat-form-field>
+                                                                </p>
+                                                            </mat-list-item>
+                                                        </ng-container>
+                                                    </mat-list>
+                                                </mat-tab>
+                                            </mat-tab-group>
                                 </div>
                                 <div style="clear:both;"></div>
                             </mat-expansion-panel>
diff --git a/apps/maarch_entreprise/Views/user-administration.component.html b/apps/maarch_entreprise/Views/user-administration.component.html
index a3ec0133bf4..09205aae606 100755
--- a/apps/maarch_entreprise/Views/user-administration.component.html
+++ b/apps/maarch_entreprise/Views/user-administration.component.html
@@ -152,21 +152,30 @@
                     <mat-tab *ngIf="!creationMode" label="{{lang.baskets}}">
                         <div class="col-sm-6" style="overflow:hidden;">
                             <mat-list>
-                                <ng-container *ngFor="let basket of user.baskets;let i = index">
-                                    <mat-list-item *ngIf="basket.group_id && basket.userToDisplay == ''">
-                                        <mat-icon mat-list-icon color="primary" *ngIf="basket.enabled" style="margin-top:-70px;">
-                                            <mat-slide-toggle matTooltip="activer / désactiver la bannette" color="primary" [(ngModel)]="basket.allowed" (change)="toggleBasket(basket)"
-                                                [disabled]="basket.userToDisplay != ''"></mat-slide-toggle>
-                                        </mat-icon>
-                                        <h4 mat-line [ngStyle]="{'opacity': basket.allowed ? '1' : '0.5'}" [attr.color]="basket.userToDisplay != '' ? 'primary': ''">{{basket.basket_name}}
-                                            <span class="label label-primary" style="font-weight:normal">{{basket.group_desc}}</span>
-                                        </h4>
-                                        <p mat-line [ngStyle]="{'opacity': basket.allowed ? '1' : '0.5'}">
-                                            <mat-form-field *ngIf="basket.allowed" floatLabel="never">
-                                                <input matTooltip="{{lang.redirectWhenAbscence}}" matTooltipPosition="above" type="text" placeholder="{{ lang.userToRedirect }}"
-                                                    matInput [matAutocomplete]="auto" [formControl]="userCtrl" [disabled]="!basket.allowed">
+                                <mat-list-item>
+                                    <mat-icon mat-list-icon color="primary">
+                                        <mat-checkbox color="primary" (change)="$event ? masterToggleBaskets($event) : null" [checked]="selectionBaskets.hasValue()"
+                                            matTooltip="{{lang.selectAll}}"></mat-checkbox>
+                                    </mat-icon>
+                                    <p mat-line *ngIf="!selectionBaskets.hasValue()" style="opacity: 0.5;font-style: italic;font-size: 80%;margin-top:10px;">
+                                        {{lang.selectAll}}
+                                    </p>
+                                    <p mat-line *ngIf="selectionBaskets.hasValue()" style="margin-top:10px;">
+                                        <button [matMenuTriggerFor]="menuDisBaskets" mat-icon-button matTooltip="activer / désactiver les bannettes sélectionnées">
+                                            <mat-icon class="fa fa-ellipsis-v"></mat-icon>
+                                        </button>
+                                        <mat-menu #menuDisBaskets="matMenu">
+                                            <button mat-menu-item (click)="toggleBasket(true)">{{lang.enable}}</button>
+                                            <button mat-menu-item (click)="toggleBasket(false)">{{lang.disable}}</button>
+                                        </mat-menu>
+                                        <button [matMenuTriggerFor]="menu" mat-icon-button matTooltip="{{ lang.redirectBaskets }}">
+                                            <mat-icon class="fa fa-reply"></mat-icon>
+                                        </button>
+                                        <mat-menu #menu="matMenu">
+                                            <mat-form-field style="padding:10px;width:200px !important;">
+                                                <input (click)="$event.stopPropagation()" type="text" placeholder="{{ lang.users }}" matInput [matAutocomplete]="auto" [formControl]="userCtrl">
                                                 <mat-autocomplete #auto="matAutocomplete">
-                                                    <mat-option *ngFor="let user of filteredUsers | async" [value]="user.id" (click)="addBasketRedirection(user.id,basket)">
+                                                    <mat-option *ngFor="let user of filteredUsers | async" [value]="user.id" (click)="addBasketRedirection(user.id)">
                                                         <p mat-line matTooltip="{{ user.otherInfo }}">
                                                             <span class="col-xm-1">
                                                                 <mat-icon color="primary" class="fa fa-user fa-2x" style="margin-right:0px;"></mat-icon>
@@ -179,81 +188,126 @@
                                                     </mat-option>
                                                 </mat-autocomplete>
                                             </mat-form-field>
-                                            <mat-form-field>
-                                                <input type="text" color="warn" matInput disabled value="">
-                                            </mat-form-field>
-                                        </p>
+                                        </mat-menu>
+                                    </p>
+                                </mat-list-item>
+                                <mat-divider></mat-divider>
+                                <ng-container *ngFor="let basket of user.baskets;let i = index">
+                                    <mat-list-item *ngIf="basket.group_id && basket.userToDisplay == ''" (mouseover)="showActions(basket.basket_id)" (mouseout)="hideActions(basket.basket_id)"
+                                        style="cursor: pointer;">
+                                        <mat-icon mat-list-icon color="primary" *ngIf="basket.enabled">
+                                            <mat-checkbox (click)="$event.stopPropagation()" (change)="$event ? selectionBaskets.toggle(basket.basket_id) : null" [checked]="selectionBaskets.isSelected(basket.basket_id)"
+                                                color="primary"></mat-checkbox>
+                                        </mat-icon>
+                                        <h4 mat-line [attr.color]="basket.userToDisplay != '' ? 'primary': ''" style="display: flex;align-items: center;">
+                                            <span (click)="selectionBaskets.toggle(basket.basket_id);" [ngStyle]="{'opacity': basket.allowed ? '1' : '0.5'}" style="flex: 2;overflow: hidden;text-overflow: ellipsis;">
+                                                {{basket.basket_name}}
+                                                <span class="label label-primary" style="font-weight:normal">{{basket.group_desc}}</span>
+                                            </span>
+
+                                            <span id="{{basket.basket_id}}" style="display:none;flex:1;background: white;text-align: right">
+                                                <i class="fa fa-ellipsis-v" style="opacity: 0.2;"></i>
+                                                <button *ngIf="basket.allowed" color="warn" mat-icon-button matTooltip="{{lang.disableBasket}}" (click)="selectionBaskets.clear();selectionBaskets.select(basket.basket_id);toggleBasket(false)">
+                                                    <mat-icon class="fa fa-ban"></mat-icon>
+                                                </button>
+                                                <button *ngIf="!basket.allowed" color="accent" mat-icon-button matTooltip="{{lang.enableBasket}}" (click)="selectionBaskets.clear();selectionBaskets.select(basket.basket_id);toggleBasket(true)">
+                                                    <mat-icon class="fa fa-check"></mat-icon>
+                                                </button>
+                                                <button [matMenuTriggerFor]="menu2" mat-icon-button matTooltip="{{lang.redirectBasket}}e" (click)="selectionBaskets.clear();selectionBaskets.select(basket.basket_id);">
+                                                    <mat-icon class="fa fa-reply"></mat-icon>
+                                                </button>
+                                                <mat-menu #menu2="matMenu">
+                                                    <mat-form-field style="padding:10px;width:200px !important;">
+                                                        <input (click)="$event.stopPropagation()" type="text" placeholder="{{ lang.users }}" matInput [matAutocomplete]="auto" [formControl]="userCtrl">
+                                                        <mat-autocomplete #auto="matAutocomplete">
+                                                            <mat-option *ngFor="let user of filteredUsers | async" [value]="user.id" (click)="addBasketRedirection(user.id)">
+                                                                <p mat-line matTooltip="{{ user.otherInfo }}">
+                                                                    <span class="col-xm-1">
+                                                                        <mat-icon color="primary" class="fa fa-user fa-2x" style="margin-right:0px;"></mat-icon>
+                                                                    </span>
+                                                                    <span class="col-xm-11">
+                                                                        {{ user.idToDisplay }}
+                                                                        <small>{{ user.otherInfo }}</small>
+                                                                    </span>
+                                                                </p>
+                                                            </mat-option>
+                                                        </mat-autocomplete>
+                                                    </mat-form-field>
+                                                </mat-menu>
+                                            </span>
+                                        </h4>
                                     </mat-list-item>
                                 </ng-container>
                             </mat-list>
                         </div>
                         <div class="col-sm-6" style="overflow:hidden;">
-                            <mat-list>
-                                <h4>{{lang.basketsRedirected}}</h4>
-                                <mat-divider></mat-divider>
-                                <div style="margin-top:40px">
-                                    <ng-container *ngFor="let basket of user.baskets;let i = index">
-                                        <mat-list-item *ngIf="basket.group_id && basket.userToDisplay != ''">
-                                            <mat-icon mat-list-icon color="primary" *ngIf="basket.enabled" style="margin-top:-60px;" class="fa fa-paper-plane">
-                                            </mat-icon>
-                                            <h4 mat-line [ngStyle]="{'opacity': basket.allowed ? '1' : '0.5'}" [attr.color]="basket.userToDisplay != '' ? 'primary': ''">{{basket.basket_name}}
-                                                <span class="label label-primary" style="font-weight:normal">{{basket.group_id}}</span>
-                                            </h4>
-                                            <p mat-line [ngStyle]="{'opacity': basket.allowed ? '1' : '0.5'}">
-                                                <mat-form-field>
-                                                    <input type="text" color="warn" matInput disabled value="{{lang.redirectedTo}} {{basket.userToDisplay}}">
-                                                    <button mat-button color="warn" matSuffix mat-icon-button aria-label="Clear" (click)="delBasketRedirection(basket)" matTooltip="Supprimer la redirection">
-                                                        <mat-icon color="warn" class="fa fa-times text-danger"></mat-icon>
-                                                    </button>
-                                                </mat-form-field>
-                                            </p>
-                                        </mat-list-item>
-                                    </ng-container>
-                                </div>
+                            <mat-tab-group>
+                                <mat-tab label="{{lang.basketsRedirected}}">
+                                    <mat-list>
+                                        <ng-container *ngFor="let basket of user.baskets;let i = index">
+                                            <mat-list-item *ngIf="basket.group_id && basket.userToDisplay != ''">
+                                                <mat-icon mat-list-icon color="primary" *ngIf="basket.enabled" style="margin-top:-60px;" class="fa fa-paper-plane">
+                                                </mat-icon>
+                                                <h4 mat-line [ngStyle]="{'opacity': basket.allowed ? '1' : '0.5'}" [attr.color]="basket.userToDisplay != '' ? 'primary': ''">{{basket.basket_name}}
+                                                    <span class="label label-primary" style="font-weight:normal">{{basket.group_id}}</span>
+                                                </h4>
+                                                <p mat-line [ngStyle]="{'opacity': basket.allowed ? '1' : '0.5'}">
+                                                    <mat-form-field>
+                                                        <input type="text" color="warn" matInput disabled value="{{lang.redirectedTo}} {{basket.userToDisplay}}">
+                                                        <button mat-button color="warn" matSuffix mat-icon-button aria-label="Clear" (click)="delBasketRedirection(basket)" matTooltip="Supprimer la redirection">
+                                                            <mat-icon color="warn" class="fa fa-times text-danger"></mat-icon>
+                                                        </button>
+                                                    </mat-form-field>
+                                                </p>
+                                            </mat-list-item>
+                                        </ng-container>
+                                    </mat-list>
+                                </mat-tab>
+                            </mat-tab-group>
 
-                                <h4>{{lang.basketsAssigned}}</h4>
-                                <mat-divider></mat-divider>
-                                <div style="margin-top:40px">
-                                    <ng-container *ngFor="let basket of user.baskets;let i = index">
-                                        <mat-list-item *ngIf="!basket.group_id">
-                                            <mat-icon mat-list-icon color="primary" style="margin-top:-60px;" class="fa fa-reply">
-                                            </mat-icon>
-                                            <h4 mat-line [attr.color]="basket.userToDisplay != '' ? 'primary': ''">{{basket.basket_name}}
-                                                <span class="label label-primary" style="font-weight:normal">{{basket.group_id}}</span>
-                                            </h4>
-                                            <p mat-line>
-                                                <mat-form-field *ngIf="basket.userToDisplay == ''" floatLabel="never">
-                                                    <input matTooltip="{{lang.redirectBasket}}" matTooltipPosition="above" type="text" placeholder="{{lang.userToRedirect}}"
-                                                        matInput [matAutocomplete]="auto" [formControl]="userCtrl">
-                                                    <mat-autocomplete #auto="matAutocomplete">
-                                                        <mat-option *ngFor="let user of filteredUsers | async" [value]="user.id" (click)="reassignBasketRedirection(user.id,basket)">
-                                                            <p mat-line matTooltip="{{ user.otherInfo }}">
-                                                                <span class="col-xm-1">
-                                                                    <mat-icon color="primary" class="fa fa-user fa-2x" style="margin-right:0px;"></mat-icon>
-                                                                </span>
-                                                                <span class="col-xm-11">
-                                                                    {{ user.idToDisplay }}
-                                                                    <small>{{ user.otherInfo }}</small>
-                                                                </span>
-                                                            </p>
-                                                        </mat-option>
-                                                    </mat-autocomplete>
-                                                </mat-form-field>
-                                                <mat-form-field>
-                                                    <input type="text" color="warn" matInput disabled value="{{lang.assignBy}} {{basket.userToDisplay}}">
-                                                    <button mat-button color="warn" matSuffix mat-icon-button aria-label="Clear" (click)="basket.userToDisplay =''" matTooltip="{{lang.reassign}}">
-                                                        <mat-icon color="primary" class="fa fa-edit"></mat-icon>
-                                                    </button>
-                                                    <button mat-button color="warn" matSuffix mat-icon-button aria-label="Clear" (click)="delBasketRedirection(basket)" matTooltip="{{lang.deleteAssignation}}">
-                                                        <mat-icon color="warn" class="fa fa-times text-danger"></mat-icon>
-                                                    </button>
-                                                </mat-form-field>
-                                            </p>
-                                        </mat-list-item>
-                                    </ng-container>
-                                </div>
-
-                            </mat-list>
+                            <mat-tab-group>
+                                <mat-tab label="{{lang.basketsAssigned}}">
+                                    <mat-list>
+                                        <ng-container *ngFor="let basket of user.baskets;let i = index">
+                                            <mat-list-item *ngIf="!basket.group_id">
+                                                <mat-icon mat-list-icon color="primary" style="margin-top:-60px;" class="fa fa-reply">
+                                                </mat-icon>
+                                                <h4 mat-line [attr.color]="basket.userToDisplay != '' ? 'primary': ''">{{basket.basket_name}}
+                                                    <span class="label label-primary" style="font-weight:normal">{{basket.group_id}}</span>
+                                                </h4>
+                                                <p mat-line>
+                                                    <mat-form-field *ngIf="basket.userToDisplay == ''" floatLabel="never">
+                                                        <input matTooltip="{{lang.redirectBasket}}" matTooltipPosition="above" type="text" placeholder="{{lang.redirectBasket}}"
+                                                            matInput [matAutocomplete]="auto" [formControl]="userCtrl">
+                                                        <mat-autocomplete #auto="matAutocomplete">
+                                                            <mat-option *ngFor="let user of filteredUsers | async" [value]="user.id" (click)="reassignBasketRedirection(user.id,basket)">
+                                                                <p mat-line matTooltip="{{ user.otherInfo }}">
+                                                                    <span class="col-xm-1">
+                                                                        <mat-icon color="primary" class="fa fa-user fa-2x" style="margin-right:0px;"></mat-icon>
+                                                                    </span>
+                                                                    <span class="col-xm-11">
+                                                                        {{ user.idToDisplay }}
+                                                                        <small>{{ user.otherInfo }}</small>
+                                                                    </span>
+                                                                </p>
+                                                            </mat-option>
+                                                        </mat-autocomplete>
+                                                    </mat-form-field>
+                                                    <mat-form-field>
+                                                        <input type="text" color="warn" matInput disabled value="{{lang.assignBy}} {{basket.userToDisplay}}">
+                                                        <button mat-button color="warn" matSuffix mat-icon-button aria-label="Clear" (click)="basket.userToDisplay =''" matTooltip="{{lang.reassign}}">
+                                                            <mat-icon color="primary" class="fa fa-edit"></mat-icon>
+                                                        </button>
+                                                        <button mat-button color="warn" matSuffix mat-icon-button aria-label="Clear" (click)="delBasketRedirection(basket)" matTooltip="{{lang.deleteAssignation}}">
+                                                            <mat-icon color="warn" class="fa fa-times text-danger"></mat-icon>
+                                                        </button>
+                                                    </mat-form-field>
+                                                </p>
+                                            </mat-list-item>
+                                        </ng-container>
+                                    </mat-list>
+                                </mat-tab>
+                            </mat-tab-group>
                         </div>
                     </mat-tab>
                     <mat-tab *ngIf="!creationMode" label="{{lang.signatures}}">
diff --git a/apps/maarch_entreprise/js/angular/app/administration/user-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/user-administration.component.ts
index 495987a114a..4c72d916bb5 100644
--- a/apps/maarch_entreprise/js/angular/app/administration/user-administration.component.ts
+++ b/apps/maarch_entreprise/js/angular/app/administration/user-administration.component.ts
@@ -7,6 +7,7 @@ import { NotificationService } from '../notification.service';
 import { MatSidenav, MatPaginator, MatTableDataSource, MatSort, MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
 
 import { AutoCompletePlugin } from '../../plugins/autocomplete.plugin';
+import { SelectionModel } from '@angular/cdk/collections';
 
 declare function $j(selector: any): any;
 declare const angularGlobals: any;
@@ -64,6 +65,18 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O
         this.dataSource.filter = filterValue;
     }
 
+    //Redirect Baskets
+    selectionBaskets = new SelectionModel<Element>(true, []);
+    masterToggleBaskets(event: any) {
+        if (event.checked) {  
+            this.user.baskets.forEach((basket: any) => {
+                this.selectionBaskets.select(basket.basket_id);   
+            });
+        } else {
+            this.selectionBaskets.clear();
+        }
+    }
+
 
     constructor(changeDetectorRef: ChangeDetectorRef, media: MediaMatcher, public http: HttpClient, private route: ActivatedRoute, private router: Router, private zone: NgZone, private notify: NotificationService, public dialog: MatDialog) {
         super(http, ['users']);
@@ -250,6 +263,14 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O
         }
     }
 
+    showActions(basket:any){
+        $j('#'+basket).show();
+    }
+
+    hideActions(basket:any){
+        $j('#'+basket).hide();
+    }
+
     updateGroup(group: any) {
         this.http.put(this.coreUrl + "rest/users/" + this.serialId + "/groups/" + group.group_id, group)
             .subscribe((data: any) => {
@@ -403,14 +424,21 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O
         }
     }
 
-    addBasketRedirection(newUser:any, basket: any) {
+    addBasketRedirection(newUser:any) {
+        let basketsRedirect:any[] = [];
+        this.user.baskets.forEach((elem: any) => {
+            if (this.selectionBaskets.selected.indexOf(elem.basket_id) != -1 && elem.allowed) {
+                basketsRedirect.push({newUser: newUser,basketId:elem.basket_id,basketOwner:this.user.user_id,virtual:elem.is_virtual})
+            }
+        });
         let r = confirm(this.lang.confirmAction + ' ' + this.lang.redirectBasket);
 
         if (r) {
-            this.http.post(this.coreUrl + "rest/users/" + this.serialId + "/redirectedBaskets", [{"newUser" : newUser, "basketId":basket.basket_id, "basketOwner":this.user.user_id, "virtual": basket.is_virtual}])
+            this.http.post(this.coreUrl + "rest/users/" + this.serialId + "/redirectedBaskets", basketsRedirect)
                 .subscribe((data: any) => {
                     this.userCtrl.setValue('');
                     this.user.baskets = data["baskets"];
+                    this.selectionBaskets.clear();
                     this.notify.success(this.lang.basketUpdated);
                 }, (err) => {
                     this.notify.error(err.error.errors);
@@ -448,9 +476,17 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O
         }
     }
 
-    toggleBasket(basket: any) {
-        this.http.put(this.coreUrl + "rest/users/" + this.serialId + "/baskets", {"basketId" : basket.basket_id, "groupSerialId":basket.groupSerialId, "allowed":basket.allowed})
+    toggleBasket(state:boolean) {
+        let basketsDisable:any[] = [];
+        this.user.baskets.forEach((elem: any) => {
+            if (this.selectionBaskets.selected.indexOf(elem.basket_id) != -1) {
+                elem.allowed = state;
+                basketsDisable.push({"basketId" : elem.basket_id, "groupSerialId":elem.groupSerialId, "allowed":state})
+            }
+        });
+        this.http.put(this.coreUrl + "rest/users/" + this.serialId + "/baskets", basketsDisable)
         .subscribe((data: any) => {
+            this.selectionBaskets.clear();
             this.notify.success(this.lang.basketUpdated);
         }, (err) => {
             this.notify.error(err.error.errors);
diff --git a/apps/maarch_entreprise/js/angular/app/profile.component.ts b/apps/maarch_entreprise/js/angular/app/profile.component.ts
index 0a240d7a0cc..8b5634bf420 100755
--- a/apps/maarch_entreprise/js/angular/app/profile.component.ts
+++ b/apps/maarch_entreprise/js/angular/app/profile.component.ts
@@ -708,4 +708,12 @@ export class ProfileComponent extends AutoCompletePlugin implements OnInit {
         this.selectedIndex = 0;
         this.showPassword = true;
     }
+
+    showActions(basket:any){
+        $j('#'+basket).show();
+    }
+
+    hideActions(basket:any){
+        $j('#'+basket).hide();
+    }
 }
diff --git a/apps/maarch_entreprise/js/angular/lang/lang-en.ts b/apps/maarch_entreprise/js/angular/lang/lang-en.ts
index 1aa8a29023e..90af5057b93 100755
--- a/apps/maarch_entreprise/js/angular/lang/lang-en.ts
+++ b/apps/maarch_entreprise/js/angular/lang/lang-en.ts
@@ -108,6 +108,8 @@ export const LANG_EN = {
     "diffusionModels"                   : "Diffusion models",
     "diffusionModelUpdated"             : "Diffusion model updated",
     "diffusionType"                     : "Diffusion type",
+    "disable"                           : "Disable",
+    "disableBasket"                     : "Disable basket",
     "display"                           : "display",
     "displayAtt"                        : "Display attachments list",
     "dlAttachment"                      : "Download the attachment",
@@ -121,6 +123,8 @@ export const LANG_EN = {
     "eachMonth"                         : "Each month",
     "email"                             : "Email",
     "emailSignatures"                   : "Email signatures",
+    "enable"                            : "Enable",
+    "enableBasket"                      : "Enable basket",
     "entities"                          : "Entities",
     "entityAdded"                       : "Entité added",
     "entityDeleted"                     : "Entité deleted",
@@ -306,6 +310,7 @@ export const LANG_EN = {
     "reactivateUserDeleted"             : "The id filled is linked to a deleted user. Voulez-vous le réactiver ?",
     "recordsPerPage"                    : "result per page",
     "redirectBasket"                    : "Redirect basket",
+    "redirectBaskets"                   : "Redirect selected baskets",
     "redirectConfidentialInfo"          : "This user has confidentials documents linked to this service.<br/>You could link to an other user in this service.",
     "redirectModelInfo"                 : "This user is in diffusion list model of this entity.",
     "redirects"                         : "Redirections",
@@ -404,7 +409,6 @@ export const LANG_EN = {
     "userReplacement"                   : "User replacement",
     "userSuspended"                     : "User suspended",
     "userUpdated"                       : "User updated",
-    "userToRedirect"                    : "User to redirect",
     "validate"                          : "Validate",
     "validateAction"                    : "Validate action(s)",
     "value"                             : "value",
diff --git a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts
index cfcff27f168..8e5deb8a7f8 100755
--- a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts
+++ b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts
@@ -135,6 +135,8 @@ export const LANG_FR = {
     "diffusionModels"                   : "Modèles de diffusion",
     "diffusionModelUpdated"             : "Modèle de diffusion mis à jour",
     "diffusionType"                     : "Type de Modèle",
+    "disable"                           : "Désactiver",
+    "disableBasket"                     : "Désactiver la bannette",
     "display"                           : "affichage",
     "displayAtt"                        : "Afficher la liste des pièces jointes",
     "dlAttachment"                      : "Télécharger la pièce jointe",
@@ -165,6 +167,8 @@ export const LANG_FR = {
     "emailSignatureDeleted"             : "Signature de mail supprimée",
     "emailSignatures"                   : "Signatures de courriel",
     "emailSignatureUpdated"             : "Signature de mail modifiée",
+    "enable"                            : "Activer",
+    "enableBasket"                      : "Activer la bannette",
     "enterValue"                        : "Vous devez entrer une valeur",
     "entities"                          : "Entités",
     "entityAdded"                       : "Entité ajoutée",
@@ -386,6 +390,7 @@ export const LANG_FR = {
     "records"                           : "résultats",
     "recordsPerPage"                    : "résultats par page",
     "redirectBasket"                    : "Rediriger la bannette",
+    "redirectBaskets"                   : "Rediriger les bannettes sélectionnées",
     "redirectConfidentialInfo"          : "Cet utilisateur a des <b>courriers confidentiels</b> associés à ce service.<br/>Il est préférable de les affecter à un autre utilisateur du service.",
     "redirectedTo"                      : "Redirigée à",
     "redirectModelInfo"                 : "Cet utilisateur est présent dans le <b>modèle de diffusion</b> de l'entité.",
@@ -501,7 +506,6 @@ export const LANG_FR = {
     "userReplacement"                   : "Utilisateur de remplacement",
     "users"                             : "Utilisateur(s)",
     "userSuspended"                     : "Utilisateur suspendu",
-    "userToRedirect"                    : "Cliquer ici pour rediriger les bannettes sélectionnées",
     "userUpdated"                       : "Utilisateur modifié",
     "validate"                          : "Valider",
     "validateAction"                    : "Action(s) de qualification",
-- 
GitLab