Skip to content
Snippets Groups Projects
Commit 57d26c50 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FIX #20690 TIME 0:25 get messagesModel and users after model selected

parent 6ef3da3c
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@
<div class="col-sm-12">
<plugin-select-search [showLabel]="true" [class]="''" [label]="'lang.natureIxbusParapheur' | translate"
[placeholderLabel]="'lang.natureIxbusParapheur' | translate" [formControlSelect]="selectNature"
[datas]="natures" (afterSelected)="ixbusDatas.nature = selectNature.value;changeModel(selectNature.value)"
[datas]="natures" (afterSelected)="ixbusDatas.nature = selectNature.value; changeModel(selectNature.value)"
style="width:100%;" [required]="true">
</plugin-select-search>
</div>
......
......@@ -4,6 +4,10 @@ import { HttpClient } from '@angular/common/http';
import { FormControl } from '@angular/forms';
import { LocalStorageService } from '@service/local-storage.service';
import { HeaderService } from '@service/header.service';
import { catchError, tap } from 'rxjs/operators';
import { NotificationService } from '@service/notification/notification.service';
import { of } from 'rxjs';
import { FunctionsService } from '@service/functions.service';
@Component({
selector: 'app-ixbus-paraph',
......@@ -42,7 +46,9 @@ export class IxbusParaphComponent implements OnInit {
public translate: TranslateService,
public http: HttpClient,
public headerService: HeaderService,
private localStorage: LocalStorageService
public functions: FunctionsService,
private localStorage: LocalStorageService,
private notifications: NotificationService
) { }
ngOnInit(): void {
......@@ -58,15 +64,26 @@ export class IxbusParaphComponent implements OnInit {
}
changeModel(natureId: string) {
this.messagesModel = [];
this.additionalsInfos.ixbus.messagesModel[natureId].forEach((element: any) => {
this.messagesModel.push({id: element.identifiant, label: element.nom});
});
this.users = [];
this.additionalsInfos.ixbus.users[natureId].forEach((element: any) => {
this.users.push({id: element.identifiant, label: element.prenom + ' ' + element.nom});
});
this.http.get(`../rest/ixbus/natureDetails/${natureId}`).pipe(
tap((data: any) => {
if (!this.functions.empty(data.messageModels)) {
this.messagesModel = data.messageModels.map((message: any) => ({
id: message.identifiant,
label: message.nom
}));
}
if (!this.functions.empty(data.users)) {
this.users = data.users.map((user: any) => ({
id: user.identifiant,
label: `${user.prenom} ${user.nom}`
}));
}
}),
catchError((err: any) => {
this.notifications.handleSoftErrors(err);
return of(false);
})
).subscribe();
}
isValidParaph() {
......
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