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

FEAT #14002 TIME 0:15 fix issuing site empty value

parent 18f99ea4
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
<plugin-select-search
*ngIf="!loading"
[label]="'lang.issuingSite' | translate" [placeholderLabel]="'lang.issuingSite' | translate"
[formControlSelect]="control" [datas]="issuingSiteList"
[formControlSelect]="control" [showResetOption]="showResetOption" [datas]="issuingSiteList"
(afterSelected)="afterSelected.emit($event);setAddress($event)" style="width:100%;">
</plugin-select-search>
<mat-card *ngIf="issuingSiteAddress !== null" color="primary">
......
......@@ -28,8 +28,11 @@ export class IssuingSiteInputComponent implements OnInit {
* FormControl used when autocomplete is used in form and must be catched in a form control.
*/
@Input() control: FormControl = new FormControl('');
@Input() registedMailType: string = null;
@Input() showResetOption: boolean = false;
@Output() afterSelected = new EventEmitter<string>();
......@@ -75,15 +78,19 @@ export class IssuingSiteInputComponent implements OnInit {
}
setAddress(id: any) {
this.http.get(`../rest/registeredMail/sites/${id}`).pipe(
tap((data: any) => {
this.issuingSiteAddress = data['site'];
}),
catchError((err: any) => {
this.notify.handleSoftErrors(err);
return of(false);
})
).subscribe();
if (id === null) {
this.issuingSiteAddress = null;
} else {
this.http.get(`../rest/registeredMail/sites/${id}`).pipe(
tap((data: any) => {
this.issuingSiteAddress = data['site'];
}),
catchError((err: any) => {
this.notify.handleSoftErrors(err);
return of(false);
})
).subscribe();
}
}
goTo() {
......
......@@ -208,7 +208,7 @@
</app-contact-autocomplete>
</ng-container>
<ng-container *ngIf="field.identifier === 'registeredMail_issuingSite'">
<app-issuing-site-input #appIssuingSiteInput [registedMailType]="arrFormControl['registeredMail_type'].value" [control]="arrFormControl[field.identifier]" (afterSelected)="launchEvent($event, field)" style="width:100%;">
<app-issuing-site-input #appIssuingSiteInput [registedMailType]="arrFormControl['registeredMail_type'].value" [control]="arrFormControl[field.identifier]" [showResetOption]="adminMode || !field.mandatory" (afterSelected)="launchEvent($event, field)" style="width:100%;">
</app-issuing-site-input>
</ng-container>
<ng-container *ngIf="field.identifier === 'registeredMail_recipient'">
......
......@@ -198,7 +198,7 @@ export class RegisteredMailImportComponent implements OnInit {
}
getLabel(id: string, value: any) {
if (id === 'registeredMail_issuingSite') {
if (id === 'registeredMail_issuingSite' && !this.functionsService.empty(value)) {
const sites = this.contactColumns.filter((col: any) => col.id === 'registeredMail_issuingSite')[0].values;
return sites.filter((site: any) => site.id === value)[0].label;
} else if ([true, false].indexOf(value) > -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