This commit is contained in:
Artem Dzhereleiko 2025-07-28 17:55:30 +03:00
parent db1eb1682f
commit 7acf8de9f8
2 changed files with 6 additions and 13 deletions

View File

@ -63,7 +63,7 @@
<ng-template #searchNotEmpty> <ng-template #searchNotEmpty>
<span>{{ 'notification.no-template-matching' | translate : {template: truncate.transform(searchText, true, 6, &apos;...&apos;)} }}</span> <span>{{ 'notification.no-template-matching' | translate : {template: truncate.transform(searchText, true, 6, &apos;...&apos;)} }}</span>
<span *ngIf="allowCreate"> <span *ngIf="allowCreate">
<a translate (click)="createTemplateBySearchText($event, searchText)">notification.create-new-template</a> <a translate (click)="createTemplateByName($event, searchText)">notification.create-new-template</a>
</span> </span>
</ng-template> </ng-template>
</div> </div>

View File

@ -212,23 +212,16 @@ export class TemplateAutocompleteComponent implements ControlValueAccessor, OnIn
} }
createTemplate($event: Event, button: MatButton) { createTemplate($event: Event, button: MatButton) {
if ($event) { $event?.stopPropagation();
$event.stopPropagation();
}
button._elementRef.nativeElement.blur(); button._elementRef.nativeElement.blur();
this.openNotificationTemplateDialog({ this.createTemplateByName($event);
isAdd: true,
predefinedType: this.notificationTypes
});
}
createTemplateBySearchText($event: Event, searchText: string) {
if ($event) {
$event.stopPropagation();
} }
createTemplateByName($event: Event, name?: string) {
$event?.stopPropagation();
this.openNotificationTemplateDialog({ this.openNotificationTemplateDialog({
isAdd: true, isAdd: true,
predefinedType: this.notificationTypes, predefinedType: this.notificationTypes,
name: searchText name
}); });
} }