From 22653b43ab998d3549ef89295fa9e0318850c960 Mon Sep 17 00:00:00 2001 From: Alex ORLUC <alex.orluc@maarch.org> Date: Fri, 21 Dec 2018 11:52:21 +0100 Subject: [PATCH] FEAT #8956 + #9011 reset redirect basket when unlink user group + add routerlink asigned baskets v2 --- .../user/user-administration.component.ts | 3 +- .../app/basket/basket-home.component.html | 26 ++++++++++-- .../app/basket/basket-home.component.ts | 1 + .../list/filters/filters-list.component.ts | 40 ++++++++++++++----- 4 files changed, 53 insertions(+), 17 deletions(-) diff --git a/src/frontend/app/administration/user/user-administration.component.ts b/src/frontend/app/administration/user/user-administration.component.ts index 158ceb5b9d3..a71e52d7cae 100755 --- a/src/frontend/app/administration/user/user-administration.component.ts +++ b/src/frontend/app/administration/user/user-administration.component.ts @@ -258,7 +258,6 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O this.http.post(this.coreUrl + "rest/users/" + this.serialId + "/groups", groupReq) .subscribe((data: any) => { this.user.groups = data.groups; - //this.user.allGroups = data.allGroups; this.user.baskets = data.baskets; this.notify.success(this.lang.groupAdded); }, (err) => { @@ -268,8 +267,8 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O this.http.delete(this.coreUrl + "rest/users/" + this.serialId + "/groups/" + group.group_id) .subscribe((data: any) => { this.user.groups = data.groups; - //this.user.allGroups = data.allGroups; this.user.baskets = data.baskets; + this.user.redirectedBaskets = data.redirectedBaskets; this.notify.success(this.lang.groupDeleted); }, (err) => { this.notify.error(err.error.errors); diff --git a/src/frontend/app/basket/basket-home.component.html b/src/frontend/app/basket/basket-home.component.html index 96cd3d65645..1b090657685 100755 --- a/src/frontend/app/basket/basket-home.component.html +++ b/src/frontend/app/basket/basket-home.component.html @@ -13,7 +13,7 @@ <mat-icon *ngIf="regroupedBasket.baskets[0]" color="primary" mat-list-icon class="fa fa-users"></mat-icon> <span *ngIf="regroupedBasket.baskets[0]" color="primary" style="font-weight:bold;">{{regroupedBasket.groupDesc}}</span> <mat-divider *ngIf="regroupedBasket.baskets[0]"></mat-divider> <mat-nav-list> - <ng-container *ngFor="let basket of regroupedBasket.baskets | filterList:listFilter.value"> + <ng-container *ngFor="let basket of regroupedBasket.baskets | filterList:listFilter.value:'basket_name'"> <a mat-list-item *ngIf="basket.redirected" disableRipple="true" style="cursor:not-allowed;"> <mat-icon [ngStyle]="{'color': basket.color}" *ngIf="basket.redirected && !mobileMode" mat-list-icon class="fa fa-share"></mat-icon> <span *ngIf="basket.resourceNumber==0" class="badge" style="min-width:auto;">{{basket.resourceNumber}}</span> @@ -31,7 +31,15 @@ </p> </a> <!-- TODO NEW BASKET LIST--> - <!-- <a mat-list-item *ngIf="!basket.redirected" (click)="closePanelLeft();" routerLink="/basketList/{{regroupedBasket.groupSerialId}}/baskets/{{basket.basket_id}}" style="cursor:pointer;" [ngStyle]="{'opacity': basket.resourceNumber==0 ? '0.5' : '1'}"> + <!-- <a mat-list-item *ngIf="basket.redirected" disableRipple="true" style="cursor:not-allowed;"> + <mat-icon [ngStyle]="{'color': basket.color}" *ngIf="basket.redirected && !mobileMode" mat-list-icon class="fa fa-share"></mat-icon> + <span *ngIf="basket.resourceNumber==0" class="badge" style="min-width:auto;">{{basket.resourceNumber}}</span> + <span *ngIf="basket.resourceNumber!=0" bgcolor="warn" class="badge" style="min-width:auto;">{{basket.resourceNumber}}</span> + <p mat-line title="{{basket.basket_name}}" [ngStyle]="{'color': basket.color}"> + {{basket.basket_name}}<br/><small color="primary">({{lang.redirectedTo}} {{basket.redirectedUser}})</small> + </p> + </a> + <a mat-list-item *ngIf="!basket.redirected" (click)="closePanelLeft();" routerLink="/basketList/users/{{basket.owner_user_id}}/groups/{{regroupedBasket.groupSerialId}}/baskets/{{basket.basket_id}}" style="cursor:pointer;" [ngStyle]="{'opacity': basket.resourceNumber==0 ? '0.5' : '1', 'height': mobileMode ? '50px' : '38px'}"> <mat-icon [ngStyle]="{'color': basket.color}" *ngIf="!mobileMode" mat-list-icon class="fa fa-inbox"></mat-icon> <span *ngIf="basket.resourceNumber==0" class="badge" style="min-width:auto;">{{basket.resourceNumber}}</span> <span *ngIf="basket.resourceNumber!=0" bgcolor="warn" class="badge" style="min-width:auto;">{{basket.resourceNumber}}</span> @@ -46,14 +54,24 @@ <span color="primary" style="font-weight:bold;">{{lang.othersBaskets}}</span> <mat-divider></mat-divider> <mat-nav-list> - <a mat-list-item *ngFor="let basket of homeData.assignedBaskets | filterList:listFilter.value"> + <a mat-list-item *ngFor="let basket of homeData.assignedBaskets | filterList:listFilter.value:'basket_name'"> <mat-icon *ngIf="!mobileMode" style="color:#666" mat-list-icon class="fa fa-inbox"></mat-icon> <span *ngIf="basket.resourceNumber==0" class="badge" style="min-width:auto;">{{basket.resourceNumber}}</span> <span *ngIf="basket.resourceNumber!=0" bgcolor="warn" class="badge" style="min-width:auto;">{{basket.resourceNumber}}</span> <p mat-line (click)="goToRedirect(basket.basket_id, basket.ownerLogin, basket.uselessGroupId)" title="{{basket.basket_name}}" style="color:#666"> - {{basket.basket_name}}<br/><small color="primary">({{basket.userToDisplay}})</small> + {{basket.basket_name}}<br/><small color="primary">({{basket.userToDisplay}} - {{basket.group_desc}})</small> </p> </a> + <!-- TODO NEW BASKET LIST--> + <!-- <a mat-list-item *ngFor="let basket of homeData.assignedBaskets | filterList:listFilter.value:'basket_name'" routerLink="/basketList/users/{{basket.owner_user_id}}/groups/{{basket.group_id}}/baskets/{{basket.basket_id}}"> + <mat-icon *ngIf="!mobileMode" style="color:#666" mat-list-icon class="fa fa-inbox"></mat-icon> + <span *ngIf="basket.resourceNumber==0" class="badge" style="min-width:auto;">{{basket.resourceNumber}}</span> + <span *ngIf="basket.resourceNumber!=0" bgcolor="warn" class="badge" style="min-width:auto;">{{basket.resourceNumber}}</span> + <p mat-line title="{{basket.basket_name}}" style="color:#666"> + {{basket.basket_name}}<br/><small color="primary">({{basket.userToDisplay}} - {{basket.group_desc}})</small> + </p> + </a> --> + </mat-nav-list> </ng-container> </mat-expansion-panel> diff --git a/src/frontend/app/basket/basket-home.component.ts b/src/frontend/app/basket/basket-home.component.ts index de4d5656ec1..61fd13a1b75 100755 --- a/src/frontend/app/basket/basket-home.component.ts +++ b/src/frontend/app/basket/basket-home.component.ts @@ -26,6 +26,7 @@ export class BasketHomeComponent implements OnInit { ngOnInit(): void { this.coreUrl = angularGlobals.coreUrl; + console.log(this.homeData); } goTo(basketId:any, groupId:any) { diff --git a/src/frontend/app/list/filters/filters-list.component.ts b/src/frontend/app/list/filters/filters-list.component.ts index 56468984a2a..b7fbe85a246 100644 --- a/src/frontend/app/list/filters/filters-list.component.ts +++ b/src/frontend/app/list/filters/filters-list.component.ts @@ -18,11 +18,15 @@ export class FiltersListComponent implements OnInit { lang: any = LANG; prioritiesList: any[] = []; + inPrioritiesProperty = false; categoriesList: any[] = []; + inCategoriesProperty = false; entitiesList: any[] = []; + inEntitiesProperty = false; statusesList: any[] = []; + inStatusesProperty = false; - loading: boolean = true; + loading: boolean = false; @Input('listProperties') listProperties: any; @@ -39,12 +43,7 @@ export class FiltersListComponent implements OnInit { constructor(public http: HttpClient, private filtersListService: FiltersListService) { } ngOnInit(): void { - if (this.listProperties.reference.length > 0) { - this.referencePan.open(); - } - if (this.listProperties.subject.length > 0) { - this.subjectPan.open(); - } + this.loading = true; this.http.get("../../rest/priorities") .subscribe((data: any) => { this.prioritiesList = data.priorities; @@ -53,7 +52,7 @@ export class FiltersListComponent implements OnInit { this.listProperties.priorities.forEach((listPropertyPrio: any) => { if (element.id === listPropertyPrio.id) { element.selected = true; - this.prioritiesPan.open(); + this.inPrioritiesProperty = true; } }); }); @@ -66,25 +65,44 @@ export class FiltersListComponent implements OnInit { this.listProperties.categories.forEach((listPropertyCat: any) => { if (element.id === listPropertyCat.id) { element.selected = true; - this.categoriesPan.open(); + this.inCategoriesProperty = true; } }); }); this.http.get("../../rest/statuses") .subscribe((data: any) => { - console.log(data); this.statusesList = data.statuses; this.statusesList.forEach(element => { element.selected = false; this.listProperties.statuses.forEach((listPropertyStatus: any) => { if (element.id === listPropertyStatus.id) { element.selected = true; - this.statusesPan.open(); + this.inStatusesProperty = true; } }); }); + this.loading = false; + + setTimeout(() => { + if (this.listProperties.reference.length > 0) { + this.referencePan.open(); + } + if (this.listProperties.subject.length > 0) { + this.subjectPan.open(); + } + if (this.inPrioritiesProperty) { + this.prioritiesPan.open(); + } + if (this.inCategoriesProperty) { + this.categoriesPan.open(); + } + if (this.inStatusesProperty) { + this.statusesPan.open(); + } + }, 200); + }); }); }); -- GitLab