|
|
@ -17,7 +17,7 @@ |
|
|
import { Component, ElementRef, forwardRef, Input, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; |
|
|
import { Component, ElementRef, forwardRef, Input, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; |
|
|
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms'; |
|
|
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms'; |
|
|
import { Observable, of } from 'rxjs'; |
|
|
import { Observable, of } from 'rxjs'; |
|
|
import { catchError, debounceTime, distinctUntilChanged, map, share, switchMap, tap } from 'rxjs/operators'; |
|
|
import { catchError, debounceTime, map, share, switchMap, tap } from 'rxjs/operators'; |
|
|
import { Store } from '@ngrx/store'; |
|
|
import { Store } from '@ngrx/store'; |
|
|
import { AppState } from '@core/core.state'; |
|
|
import { AppState } from '@core/core.state'; |
|
|
import { TranslateService } from '@ngx-translate/core'; |
|
|
import { TranslateService } from '@ngx-translate/core'; |
|
|
@ -66,6 +66,10 @@ export class TemplateAutocompleteComponent implements ControlValueAccessor, OnIn |
|
|
@coerceBoolean() |
|
|
@coerceBoolean() |
|
|
allowCreate = false; |
|
|
allowCreate = false; |
|
|
|
|
|
|
|
|
|
|
|
@Input() |
|
|
|
|
|
@coerceBoolean() |
|
|
|
|
|
allowEdit = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Input() |
|
|
@Input() |
|
|
disabled: boolean; |
|
|
disabled: boolean; |
|
|
@ -196,18 +200,34 @@ export class TemplateAutocompleteComponent implements ControlValueAccessor, OnIn |
|
|
}, 0); |
|
|
}, 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
editTemplate($event: Event) { |
|
|
|
|
|
if ($event) { |
|
|
|
|
|
$event.stopPropagation(); |
|
|
|
|
|
} |
|
|
|
|
|
this.notificationService.getNotificationTemplateById(this.modelValue.id).subscribe( |
|
|
|
|
|
(template) => { |
|
|
|
|
|
this.openNotificationTemplateDialog({template}); |
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
createTemplate($event: Event, button: MatButton) { |
|
|
createTemplate($event: Event, button: MatButton) { |
|
|
if ($event) { |
|
|
if ($event) { |
|
|
$event.stopPropagation(); |
|
|
$event.stopPropagation(); |
|
|
} |
|
|
} |
|
|
button._elementRef.nativeElement.blur(); |
|
|
button._elementRef.nativeElement.blur(); |
|
|
|
|
|
this.openNotificationTemplateDialog({ |
|
|
|
|
|
isAdd: true, |
|
|
|
|
|
predefinedType: this.notificationTypes |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private openNotificationTemplateDialog(dialogData?: TemplateNotificationDialogData) { |
|
|
this.dialog.open<TemplateNotificationDialogComponent, TemplateNotificationDialogData, |
|
|
this.dialog.open<TemplateNotificationDialogComponent, TemplateNotificationDialogData, |
|
|
NotificationTemplate>(TemplateNotificationDialogComponent, { |
|
|
NotificationTemplate>(TemplateNotificationDialogComponent, { |
|
|
disableClose: true, |
|
|
disableClose: true, |
|
|
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], |
|
|
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], |
|
|
data: { |
|
|
data: dialogData |
|
|
predefinedType: this.notificationTypes |
|
|
|
|
|
} |
|
|
|
|
|
}).afterClosed() |
|
|
}).afterClosed() |
|
|
.subscribe((res) => { |
|
|
.subscribe((res) => { |
|
|
if (res) { |
|
|
if (res) { |
|
|
|