Skip to content
Snippets Groups Projects
Commit 65b0e1a0 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

add if no param redirect

parent 975b9d85
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
<button mat-raised-button (click)="loadDestUser()">Vers un utilisateur</button> <button mat-raised-button (click)="loadDestUser()">Vers un utilisateur</button>
</div> </div>
</div> </div>
<div *ngIf="redirectMode == 'none' && !loading">
<div class="alert-message alert-message-danger" role="alert" style="margin-top: 30px;">Aucun paramétrage disponible</div>
</div>
<div *ngIf="redirectMode == 'entity'" class="row" style="display: flex;"> <div *ngIf="redirectMode == 'entity'" class="row" style="display: flex;">
<div class="redirectContent" style="flex:2"> <div class="redirectContent" style="flex:2">
<h2>Rediriger vers :</h2> <h2>Rediriger vers :</h2>
...@@ -65,7 +68,7 @@ ...@@ -65,7 +68,7 @@
<div *ngIf="keepDestForRedirection && oldUser != null" class="alert-message alert-message-info" role="alert" style="margin-top: 30px;"><b>{{oldUser.labelToDisplay}}</b> sera automatiquement mise <b>en copie</b></div> <div *ngIf="keepDestForRedirection && oldUser != null" class="alert-message alert-message-info" role="alert" style="margin-top: 30px;"><b>{{oldUser.labelToDisplay}}</b> sera automatiquement mise <b>en copie</b></div>
</div> </div>
<div class="row" *ngIf="redirectMode != ''"> <div class="row" *ngIf="redirectMode != '' && redirectMode != 'none'">
<app-note-editor #noteEditor [resIds]="data.selectedRes"></app-note-editor> <app-note-editor #noteEditor [resIds]="data.selectedRes"></app-note-editor>
</div> </div>
</div> </div>
......
...@@ -45,6 +45,7 @@ export class RedirectActionComponent implements OnInit { ...@@ -45,6 +45,7 @@ export class RedirectActionComponent implements OnInit {
constructor(public http: HttpClient, private notify: NotificationService, public dialogRef: MatDialogRef<RedirectActionComponent>, @Inject(MAT_DIALOG_DATA) public data: any) { } constructor(public http: HttpClient, private notify: NotificationService, public dialogRef: MatDialogRef<RedirectActionComponent>, @Inject(MAT_DIALOG_DATA) public data: any) { }
ngOnInit(): void { ngOnInit(): void {
let noEntity = true;
this.loading = true; this.loading = true;
this.http.get("../../rest/resourcesList/users/" + this.data.currentBasketInfo.ownerId + "/groups/" + this.data.currentBasketInfo.groupId + "/baskets/" + this.data.currentBasketInfo.basketId + "/actions/" + this.data.action.id + "/getRedirect/entity") this.http.get("../../rest/resourcesList/users/" + this.data.currentBasketInfo.ownerId + "/groups/" + this.data.currentBasketInfo.groupId + "/baskets/" + this.data.currentBasketInfo.basketId + "/actions/" + this.data.action.id + "/getRedirect/entity")
.subscribe((data: any) => { .subscribe((data: any) => {
...@@ -56,15 +57,21 @@ export class RedirectActionComponent implements OnInit { ...@@ -56,15 +57,21 @@ export class RedirectActionComponent implements OnInit {
if (entity.state.selected) { if (entity.state.selected) {
this.currentEntity = entity; this.currentEntity = entity;
} }
if (entity.allowed) {
noEntity = false;
}
}); });
this.http.get("../../rest/resourcesList/users/" + this.data.currentBasketInfo.ownerId + "/groups/" + this.data.currentBasketInfo.groupId + "/baskets/" + this.data.currentBasketInfo.basketId + "/actions/" + this.data.action.id + "/getRedirect/users") this.http.get("../../rest/resourcesList/users/" + this.data.currentBasketInfo.ownerId + "/groups/" + this.data.currentBasketInfo.groupId + "/baskets/" + this.data.currentBasketInfo.basketId + "/actions/" + this.data.action.id + "/getRedirect/users")
.subscribe((data: any) => { .subscribe((data: any) => {
this.userListRedirect = data.users; this.userListRedirect = data.users;
this.keepDestForRedirection = data.keepDestForRedirection; this.keepDestForRedirection = data.keepDestForRedirection;
if (this.userListRedirect.length == 0 && this.entities.length > 0) { if (this.userListRedirect.length == 0 && noEntity) {
this.redirectMode = 'none';
this.loading = false;
} else if (this.userListRedirect.length == 0 && !noEntity) {
this.loadEntities(); this.loadEntities();
} else if (this.userListRedirect.length > 0 && this.entities.length == 0) { } else if (this.userListRedirect.length > 0 && noEntity) {
this.loadDestUser(); this.loadDestUser();
} else { } else {
this.loading = false; this.loading = false;
......
...@@ -118,7 +118,7 @@ export class DiffusionsListComponent implements OnInit { ...@@ -118,7 +118,7 @@ export class DiffusionsListComponent implements OnInit {
injectListinstanceToKeep() { injectListinstanceToKeep() {
this.http.get("../../rest/resources/" + this.injectDatas.resId + "/listInstance").subscribe((data: any) => { this.http.get("../../rest/resources/" + this.injectDatas.resId + "/listInstance").subscribe((data: any) => {
data.listInstance.forEach((element: any) => { data.listInstance.forEach((element: any) => {
if (element.item_mode = 'cc') { if (element.item_mode == 'cc') {
element.item_mode = 'copy'; element.item_mode = 'copy';
} }
if (this.keepRoles.indexOf(element.item_mode) > -1 && this.diffList[element.item_mode].items.map((e: any) => { return e.item_id; }).indexOf(element.item_id) == -1) { if (this.keepRoles.indexOf(element.item_mode) > -1 && this.diffList[element.item_mode].items.map((e: any) => { return e.item_id; }).indexOf(element.item_id) == -1) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment