notification template ui changes
This commit is contained in:
parent
ea371cb1a1
commit
a8ee89fbc4
|
@ -63,7 +63,7 @@ public class NotificationTemplateController {
|
||||||
public QueryResult<NotificationTemplate> query(@RequestBody NotificationTemplateLookup lookup) throws MyApplicationException, MyForbiddenException {
|
public QueryResult<NotificationTemplate> query(@RequestBody NotificationTemplateLookup lookup) throws MyApplicationException, MyForbiddenException {
|
||||||
logger.debug("querying {}", NotificationTemplate.class.getSimpleName());
|
logger.debug("querying {}", NotificationTemplate.class.getSimpleName());
|
||||||
|
|
||||||
this.censorFactory.censor(NotificationTemplateCensor.class).censor(lookup.getProject());
|
//this.censorFactory.censor(NotificationTemplateCensor.class).censor(lookup.getProject()); TODO
|
||||||
|
|
||||||
NotificationTemplateQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrPermission);
|
NotificationTemplateQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrPermission);
|
||||||
List<NotificationTemplateEntity> data = query.collectAs(lookup.getProject());
|
List<NotificationTemplateEntity> data = query.collectAs(lookup.getProject());
|
||||||
|
@ -80,10 +80,10 @@ public class NotificationTemplateController {
|
||||||
public NotificationTemplate get(@PathVariable UUID id, FieldSet fieldSet, Locale locale) throws MyApplicationException, MyForbiddenException, MyNotFoundException {
|
public NotificationTemplate get(@PathVariable UUID id, FieldSet fieldSet, Locale locale) throws MyApplicationException, MyForbiddenException, MyNotFoundException {
|
||||||
logger.debug(new MapLogEntry("retrieving" + NotificationTemplate.class.getSimpleName()).And("id", id).And("fields", fieldSet));
|
logger.debug(new MapLogEntry("retrieving" + NotificationTemplate.class.getSimpleName()).And("id", id).And("fields", fieldSet));
|
||||||
|
|
||||||
this.censorFactory.censor(NotificationTemplateCensor.class).censor(fieldSet);
|
// this.censorFactory.censor(NotificationTemplateCensor.class).censor(fieldSet); TODO
|
||||||
|
|
||||||
NotificationTemplateQuery query = this.queryFactory.query(NotificationTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrPermission).ids(id);
|
NotificationTemplateQuery query = this.queryFactory.query(NotificationTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrPermission).ids(id);
|
||||||
NotificationTemplate model = this.builderFactory.builder(NotificationTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
NotificationTemplate model = this.builderFactory.builder(NotificationTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(fieldSet, query.first());
|
||||||
if (model == null)
|
if (model == null)
|
||||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, NotificationTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, NotificationTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ permissions:
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
|
|
||||||
# ViewPage Permissions
|
# Notification Template Permissions
|
||||||
BrowseNotificationTemplate:
|
BrowseNotificationTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
|
|
@ -142,7 +142,7 @@ permissions:
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
|
|
||||||
# ViewPage Permissions
|
# Notification Template Permissions
|
||||||
BrowseNotificationTemplate:
|
BrowseNotificationTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class NotificationTemplateBuilder extends BaseBuilder<NotificationTemplat
|
||||||
Map<UUID, Tenant> tenantMap = this.collectTenants(tenantFields, data);
|
Map<UUID, Tenant> tenantMap = this.collectTenants(tenantFields, data);
|
||||||
|
|
||||||
FieldSet languageFields = fields.extractPrefixed(this.asPrefix(NotificationTemplate._language));
|
FieldSet languageFields = fields.extractPrefixed(this.asPrefix(NotificationTemplate._language));
|
||||||
Map<UUID, Language> languageMap = this.collectLanguages(tenantFields, data);
|
Map<UUID, Language> languageMap = this.collectLanguages(languageFields, data);
|
||||||
|
|
||||||
List<NotificationTemplate> models = new ArrayList<>();
|
List<NotificationTemplate> models = new ArrayList<>();
|
||||||
for(NotificationTemplateEntity d : data){
|
for(NotificationTemplateEntity d : data){
|
||||||
|
|
|
@ -3,6 +3,9 @@ package gr.cite.notification.model.censorship;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.notification.authorization.Permission;
|
import gr.cite.notification.authorization.Permission;
|
||||||
import gr.cite.notification.convention.ConventionService;
|
import gr.cite.notification.convention.ConventionService;
|
||||||
|
import gr.cite.notification.model.NotificationTemplate;
|
||||||
|
import gr.cite.notification.model.censorship.notificationtemplate.NotificationTemplateValueCensor;
|
||||||
|
import gr.cite.tools.data.censor.CensorFactory;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
import gr.cite.tools.logging.DataLogEntry;
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
@ -16,17 +19,21 @@ import org.springframework.stereotype.Component;
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class NotificationTemplateCensor extends BaseCensor {
|
public class NotificationTemplateCensor extends BaseCensor {
|
||||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(NotificationTemplateCensor.class));
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(NotificationTemplateCensor.class));
|
||||||
private final AuthorizationService authService;
|
protected final AuthorizationService authService;
|
||||||
|
protected final CensorFactory censorFactory;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public NotificationTemplateCensor(ConventionService conventionService, AuthorizationService authService) {
|
public NotificationTemplateCensor(ConventionService conventionService, AuthorizationService authService, CensorFactory censorFactory) {
|
||||||
super(conventionService);
|
super(conventionService);
|
||||||
this.authService = authService;
|
this.authService = authService;
|
||||||
|
this.censorFactory = censorFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void censor(FieldSet fields) {
|
public void censor(FieldSet fields) {
|
||||||
logger.debug(new DataLogEntry("censoring fields", fields));
|
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||||
if (this.isEmpty(fields)) return;
|
if (this.isEmpty(fields)) return;
|
||||||
this.authService.authorizeForce(Permission.BrowseNotificationTemplate);
|
this.authService.authorizeForce(Permission.BrowseNotificationTemplate);
|
||||||
|
FieldSet valueFields = fields.extractPrefixed(this.asIndexerPrefix(NotificationTemplate._value));
|
||||||
|
this.censorFactory.censor(NotificationTemplateValueCensor.class).censor(valueFields);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package gr.cite.notification.model.persist.notificationtemplate;
|
package gr.cite.notification.model.persist.notificationtemplate;
|
||||||
|
|
||||||
import gr.cite.notification.common.enums.NotificationDataType;
|
import gr.cite.notification.common.enums.NotificationDataType;
|
||||||
|
import gr.cite.notification.common.validation.ValidEnum;
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
@ -11,8 +12,7 @@ public class FieldInfoPersist {
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
@NotNull
|
@ValidEnum
|
||||||
@NotEmpty
|
|
||||||
private NotificationDataType type;
|
private NotificationDataType type;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.util.List;
|
||||||
|
|
||||||
public class FieldOptionsPersist {
|
public class FieldOptionsPersist {
|
||||||
|
|
||||||
@NotNull(message = "{validation.empty}")
|
|
||||||
@Valid
|
@Valid
|
||||||
private List<String> mandatory;
|
private List<String> mandatory;
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,7 @@ public class NotificationTemplateQuery extends QueryBase<NotificationTemplateEnt
|
||||||
else if (item.match(NotificationTemplate._kind)) return NotificationTemplateEntity._kind;
|
else if (item.match(NotificationTemplate._kind)) return NotificationTemplateEntity._kind;
|
||||||
else if (item.match(NotificationTemplate._notificationType)) return NotificationTemplateEntity._notificationType;
|
else if (item.match(NotificationTemplate._notificationType)) return NotificationTemplateEntity._notificationType;
|
||||||
else if (item.prefix(NotificationTemplate._value)) return NotificationTemplateEntity._value;
|
else if (item.prefix(NotificationTemplate._value)) return NotificationTemplateEntity._value;
|
||||||
|
else if (item.match(NotificationTemplate._language)) return NotificationTemplateEntity._language;
|
||||||
else if (item.prefix(NotificationTemplate._language)) return NotificationTemplateEntity._language;
|
else if (item.prefix(NotificationTemplate._language)) return NotificationTemplateEntity._language;
|
||||||
else if (item.match(NotificationTemplate._createdAt)) return NotificationTemplateEntity._createdAt;
|
else if (item.match(NotificationTemplate._createdAt)) return NotificationTemplateEntity._createdAt;
|
||||||
else if (item.match(NotificationTemplate._updatedAt)) return NotificationTemplateEntity._updatedAt;
|
else if (item.match(NotificationTemplate._updatedAt)) return NotificationTemplateEntity._updatedAt;
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class NotificationServiceTemplateImpl implements NotificationTemplateServ
|
||||||
public NotificationTemplate persist(NotificationTemplatePersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException {
|
public NotificationTemplate persist(NotificationTemplatePersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException {
|
||||||
logger.debug(new MapLogEntry("persisting notification template").And("model", model).And("fields", fields));
|
logger.debug(new MapLogEntry("persisting notification template").And("model", model).And("fields", fields));
|
||||||
|
|
||||||
this.authorizationService.authorizeForce(Permission.EditNotificationTemplate);
|
// this.authorizationService.authorizeForce(Permission.EditNotificationTemplate); TODO
|
||||||
|
|
||||||
Boolean isUpdate = this.conventionService.isValidGuid(model.getId());
|
Boolean isUpdate = this.conventionService.isValidGuid(model.getId());
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,13 @@ export interface NotificationTemplateValue {
|
||||||
|
|
||||||
export interface NotificationFieldOptions {
|
export interface NotificationFieldOptions {
|
||||||
mandatory?: string[];
|
mandatory?: string[];
|
||||||
options?: NotificationFieldInfo[];
|
optional?: NotificationFieldInfo[];
|
||||||
formatting?: { [key: string]: string };
|
formatting?: { [key: string]: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NotificationFieldInfo {
|
export interface NotificationFieldInfo {
|
||||||
key: string;
|
key: string;
|
||||||
dataType: NotificationDataType,
|
type: NotificationDataType,
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,12 +69,12 @@ export interface NotificationTemplateValuePersist {
|
||||||
|
|
||||||
export interface NotificationFieldOptionsPersist {
|
export interface NotificationFieldOptionsPersist {
|
||||||
mandatory?: string[];
|
mandatory?: string[];
|
||||||
options?: NotificationFieldInfoPersist[];
|
optional?: NotificationFieldInfoPersist[];
|
||||||
formatting?: { [key: string]: string };
|
formatting?: { [key: string]: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NotificationFieldInfoPersist {
|
export interface NotificationFieldInfoPersist {
|
||||||
key: string;
|
key: string;
|
||||||
dataType: NotificationDataType,
|
type: NotificationDataType,
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
|
@ -108,6 +108,15 @@ export class ConfigurationService extends BaseComponent {
|
||||||
return this._userSettingsVersion;
|
return this._userSettingsVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _notificationServiceAddress: string;
|
||||||
|
get notificationServiceAddress(): string {
|
||||||
|
return this._notificationServiceAddress || './';
|
||||||
|
}
|
||||||
|
|
||||||
|
private _notificationServiceEnabled: boolean;
|
||||||
|
get notificationServiceEnabled(): boolean {
|
||||||
|
return this._notificationServiceEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
public loadConfiguration(): Promise<any> {
|
public loadConfiguration(): Promise<any> {
|
||||||
return new Promise((r, e) => {
|
return new Promise((r, e) => {
|
||||||
|
@ -165,6 +174,10 @@ export class ConfigurationService extends BaseComponent {
|
||||||
}
|
}
|
||||||
this._maxFileSizeInMB = config.maxFileSizeInMB;
|
this._maxFileSizeInMB = config.maxFileSizeInMB;
|
||||||
this._userSettingsVersion = config.userSettingsVersion;
|
this._userSettingsVersion = config.userSettingsVersion;
|
||||||
|
if (config.notification_service) {
|
||||||
|
this._notificationServiceEnabled = config.notification_service.enabled;
|
||||||
|
this._notificationServiceAddress = config.notification_service.address;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,15 +7,15 @@ import { Observable, throwError } from 'rxjs';
|
||||||
import { catchError } from 'rxjs/operators';
|
import { catchError } from 'rxjs/operators';
|
||||||
import { NotificationTemplate, NotificationTemplatePersist } from '@app/core/model/notification-template/notification-template';
|
import { NotificationTemplate, NotificationTemplatePersist } from '@app/core/model/notification-template/notification-template';
|
||||||
import { BaseHttpV2Service } from '../http/base-http-v2.service';
|
import { BaseHttpV2Service } from '../http/base-http-v2.service';
|
||||||
|
import { ConfigurationService } from '../configuration/configuration.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class NotificationTemplateService {
|
export class NotificationTemplateService {
|
||||||
|
|
||||||
constructor(private http: BaseHttpV2Service) {
|
constructor(private http: BaseHttpV2Service, private configurationService: ConfigurationService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO ADD CONIFG URL
|
private get apiBase(): string { return `${this.configurationService.notificationServiceAddress}notification-template`; }
|
||||||
private get apiBase(): string { return `http://localhost:8081/api/notification-template`; }
|
|
||||||
|
|
||||||
query(q: NotificationTemplateLookup): Observable<QueryResult<NotificationTemplate>> {
|
query(q: NotificationTemplateLookup): Observable<QueryResult<NotificationTemplate>> {
|
||||||
const url = `${this.apiBase}/query`;
|
const url = `${this.apiBase}/query`;
|
||||||
|
|
|
@ -33,12 +33,12 @@
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<mat-form-field class="w-100">
|
<mat-form-field class="w-100">
|
||||||
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.LANGUAGE' | translate}}</mat-label>
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.LANGUAGE' | translate}}</mat-label>
|
||||||
<mat-select (selectionChange)="selectedLangChanged($event.value)" name="language" [formControl]="formGroup.get('language')">
|
<mat-select [(value)]="languageCode" (selectionChange)="selectedLangChanged($event.value)" name="language" required>
|
||||||
<mat-option *ngFor="let languageCode of availableLanguageCodes" [value]="languageCode">
|
<mat-option *ngFor="let languageCode of availableLanguageCodes" [value]="languageCode">
|
||||||
{{languageCode}}
|
{{languageCode}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<mat-error *ngIf="formGroup.get('language').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="formGroup.get('languageId').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
|
@ -71,18 +71,18 @@
|
||||||
<mat-form-field class="col-md-12">
|
<mat-form-field class="col-md-12">
|
||||||
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.SUBJECT-TEXT' | translate}}</mat-label>
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.SUBJECT-TEXT' | translate}}</mat-label>
|
||||||
<input matInput [formControl]="formGroup.get('value').get('subjectText')">
|
<input matInput [formControl]="formGroup.get('value').get('subjectText')">
|
||||||
<mat-error *ngIf="formGroup.get('value').get('subjectText').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="formGroup.get('value').get('subjectText').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<mat-form-field class="col-md-12">
|
<mat-form-field class="col-md-12">
|
||||||
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.SUBJECT-KEY' | translate}}</mat-label>
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.SUBJECT-KEY' | translate}}</mat-label>
|
||||||
<input matInput [formControl]="formGroup.get('value').get('subjectKey')">
|
<input matInput [formControl]="formGroup.get('value').get('subjectKey')">
|
||||||
<mat-error *ngIf="formGroup.get('value').get('subjectKey').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="formGroup.get('value').get('subjectKey').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h4 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.SUBJECT-FIELD-OPTIONS' | translate}}
|
<h4 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.SUBJECT-FIELD-OPTIONS' | translate}}
|
||||||
<mat-checkbox (change)="subjectFieldOptionsSelectionChanged($event)"></mat-checkbox>
|
<mat-checkbox [checked]="subjectFieldOptionsEnabled" (change)="subjectFieldOptionsSelectionChanged($event)"></mat-checkbox>
|
||||||
</h4>
|
</h4>
|
||||||
<div *ngIf="subjectFieldOptionsEnabled == true">
|
<div *ngIf="subjectFieldOptionsEnabled == true">
|
||||||
<div class="col-6" >
|
<div class="col-6" >
|
||||||
|
@ -108,30 +108,30 @@
|
||||||
</div>
|
</div>
|
||||||
<h4 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.OPTIONAL-TITLE' | translate}}</h4>
|
<h4 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.OPTIONAL-TITLE' | translate}}</h4>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="row" *ngFor="let subjectOptions of formGroup.get('value').get('subjectFieldOptions').get('options')['controls']; let i = index">
|
<div class="row" *ngFor="let subjectOptions of formGroup.get('value').get('subjectFieldOptions').get('optional')['controls']; let i = index">
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<mat-form-field class="col-auto">
|
<mat-form-field class="col-auto">
|
||||||
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.KEY' | translate}}</mat-label>
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.KEY' | translate}}</mat-label>
|
||||||
<input matInput [formControl]="subjectOptions.get('key')">
|
<input matInput [formControl]="subjectOptions.get('key')">
|
||||||
<mat-error *ngIf="subjectOptions.get('key').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="subjectOptions.get('key').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<mat-form-field class="col-auto">
|
<mat-form-field class="col-auto">
|
||||||
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.DATA-TYPE' | translate}}</mat-label>
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.DATA-TYPE' | translate}}</mat-label>
|
||||||
<mat-select name="channel" [formControl]="subjectOptions.get('dataType')">
|
<mat-select name="channel" [formControl]="subjectOptions.get('type')">
|
||||||
<mat-option *ngFor="let type of notificationDataTypeEnum" [value]="type">
|
<mat-option *ngFor="let type of notificationDataTypeEnum" [value]="type">
|
||||||
{{enumUtils.toNotificationTemplateDataTypeString(type)}}
|
{{enumUtils.toNotificationTemplateDataTypeString(type)}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<mat-error *ngIf="subjectOptions.get('dataType').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="subjectOptions.get('type').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<mat-form-field class="col">
|
<mat-form-field class="col">
|
||||||
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.VALUE' | translate}}</mat-label>
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.VALUE' | translate}}</mat-label>
|
||||||
<input matInput [formControl]="subjectOptions.get('value')">
|
<input matInput [formControl]="subjectOptions.get('value')">
|
||||||
<mat-error *ngIf="subjectOptions.get('value').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="subjectOptions.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<button mat-icon-button (click)="removeOptionalItem(formGroup.get('value').get('subjectFieldOptions'),i)" [disabled]="formGroup.disabled">
|
<button mat-icon-button (click)="removeOptionalItem(formGroup.get('value').get('subjectFieldOptions'),i)" [disabled]="formGroup.disabled">
|
||||||
|
@ -148,26 +148,68 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<h4 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.FORMATTING' | translate}}</h4>
|
||||||
|
<div class="row" *ngFor="let item of formGroup.get('value').get('subjectFieldOptions').get('mandatory').value; let i = index">
|
||||||
|
<mat-form-field class="col-md-4">
|
||||||
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.KEY' | translate}}</mat-label>
|
||||||
|
<input matInput [value]="insertFormattingItem(item, null)" [disabled] = "true">
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field class="col-md-4">
|
||||||
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.VALUE' | translate}}</mat-label>
|
||||||
|
<input matInput>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
<div class="row" *ngFor="let item of formGroup.get('value').get('subjectFieldOptions').get('optional')['controls']; let i = index">
|
||||||
|
<div *ngIf="item.valid">
|
||||||
|
<mat-form-field class="col-md-4">
|
||||||
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.KEY' | translate}}</mat-label>
|
||||||
|
<input matInput [value]="insertFormattingItem(item.value.key, null)" [disabled] = "true">
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field class="col-md-4">
|
||||||
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.VALUE' | translate}}</mat-label>
|
||||||
|
<input matInput>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Body -->
|
<!-- Body -->
|
||||||
<div class="row">
|
<div>
|
||||||
<h3 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.BODY-SECTION' | translate}}</h3>
|
<h3 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.BODY-SECTION' | translate}}</h3>
|
||||||
<mat-form-field class="col-md-12">
|
|
||||||
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.BODY-TEXT' | translate}}</mat-label>
|
|
||||||
<input matInput [formControl]="formGroup.get('value').get('bodyText')">
|
|
||||||
<mat-error *ngIf="formGroup.get('value').get('bodyText').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<mat-form-field class="col-md-12">
|
<mat-form-field class="col-md-12">
|
||||||
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.BODY-KEY' | translate}}</mat-label>
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.BODY-KEY' | translate}}</mat-label>
|
||||||
<input matInput [formControl]="formGroup.get('value').get('bodyKey')">
|
<input matInput [formControl]="formGroup.get('value').get('bodyKey')">
|
||||||
<mat-error *ngIf="formGroup.get('value').get('bodyKey').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="formGroup.get('value').get('bodyKey').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.BODY-TEXT' | translate}}</mat-label>
|
||||||
|
<editor class="w-100" [init]="{
|
||||||
|
base_url: '/tinymce',
|
||||||
|
suffix: '.min',
|
||||||
|
height: 800,
|
||||||
|
menubar: true,
|
||||||
|
plugins: [
|
||||||
|
'advlist autolink lists link image charmap print preview anchor',
|
||||||
|
'searchreplace visualblocks fullscreen fullpage',
|
||||||
|
'insertdatetime media table paste code help wordcount importcss ',
|
||||||
|
'codesample toc visualchars'
|
||||||
|
],
|
||||||
|
extended_valid_elements: '*[*]',
|
||||||
|
forced_root_block: '',
|
||||||
|
valid_children: '+body[script],ol[li|div|p|a|ol|table],h2[span],h3[span]',
|
||||||
|
save_enablewhendirty: false,
|
||||||
|
toolbar:
|
||||||
|
'undo redo | formatselect | bold italic backcolor | \
|
||||||
|
alignleft aligncenter alignright alignjustify | \
|
||||||
|
bullist numlist outdent indent | code codesample | searchreplace | preview | removeformat | help'
|
||||||
|
}" [formControl]="formGroup.get('value').get('bodyText')"></editor>
|
||||||
|
<mat-error *ngIf="formGroup.get('value').get('bodyText').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h4 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.BODY-FIELD-OPTIONS' | translate}}
|
<h4 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.BODY-FIELD-OPTIONS' | translate}}
|
||||||
<mat-checkbox (change)="bodyFieldOptionsSelectionChanged($event)"></mat-checkbox>
|
<mat-checkbox [checked]="bodyFieldOptionsEnabled" (change)="bodyFieldOptionsSelectionChanged($event)"></mat-checkbox>
|
||||||
</h4>
|
</h4>
|
||||||
<div *ngIf="bodyFieldOptionsEnabled == true">
|
<div *ngIf="bodyFieldOptionsEnabled == true">
|
||||||
<div class="col-6" >
|
<div class="col-6" >
|
||||||
|
@ -193,30 +235,30 @@
|
||||||
</div>
|
</div>
|
||||||
<h4 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.OPTIONAL-TITLE' | translate}}</h4>
|
<h4 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.OPTIONAL-TITLE' | translate}}</h4>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="row" *ngFor="let bodyOptions of formGroup.get('value').get('bodyFieldOptions').get('options')['controls']; let i = index">
|
<div class="row" *ngFor="let bodyOptions of formGroup.get('value').get('bodyFieldOptions').get('optional')['controls']; let i = index">
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<mat-form-field class="col-auto">
|
<mat-form-field class="col-auto">
|
||||||
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.KEY' | translate}}</mat-label>
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.KEY' | translate}}</mat-label>
|
||||||
<input matInput [formControl]="bodyOptions.get('key')">
|
<input matInput [formControl]="bodyOptions.get('key')">
|
||||||
<mat-error *ngIf="bodyOptions.get('key').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="bodyOptions.get('key').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<mat-form-field class="col-auto">
|
<mat-form-field class="col-auto">
|
||||||
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.DATA-TYPE' | translate}}</mat-label>
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.DATA-TYPE' | translate}}</mat-label>
|
||||||
<mat-select name="channel" [formControl]="bodyOptions.get('dataType')">
|
<mat-select name="channel" [formControl]="bodyOptions.get('type')">
|
||||||
<mat-option *ngFor="let type of notificationDataTypeEnum" [value]="type">
|
<mat-option *ngFor="let type of notificationDataTypeEnum" [value]="type">
|
||||||
{{enumUtils.toNotificationTemplateDataTypeString(type)}}
|
{{enumUtils.toNotificationTemplateDataTypeString(type)}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<mat-error *ngIf="bodyOptions.get('dataType').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="bodyOptions.get('type').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<mat-form-field class="col">
|
<mat-form-field class="col">
|
||||||
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.VALUE' | translate}}</mat-label>
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.VALUE' | translate}}</mat-label>
|
||||||
<input matInput [formControl]="bodyOptions.get('value')">
|
<input matInput [formControl]="bodyOptions.get('value')">
|
||||||
<mat-error *ngIf="bodyOptions.get('value').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="bodyOptions.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<button mat-icon-button (click)="removeOptionalItem(formGroup.get('value').get('bodyFieldOptions'),i)" [disabled]="formGroup.disabled">
|
<button mat-icon-button (click)="removeOptionalItem(formGroup.get('value').get('bodyFieldOptions'),i)" [disabled]="formGroup.disabled">
|
||||||
|
@ -232,7 +274,30 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<h4 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.FORMATTING' | translate}}</h4>
|
||||||
|
<div class="row" *ngFor="let item of formGroup.get('value').get('subjectFieldOptions').get('mandatory').value; let i = index">
|
||||||
|
<mat-form-field class="col-md-4">
|
||||||
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.KEY' | translate}}</mat-label>
|
||||||
|
<input matInput [value]="insertFormattingItem(item, null)" [disabled] = "true">
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field class="col-md-4">
|
||||||
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.VALUE' | translate}}</mat-label>
|
||||||
|
<input matInput>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
<div class="row" *ngFor="let item of formGroup.get('value').get('subjectFieldOptions').get('optional')['controls']; let i = index">
|
||||||
|
<div *ngIf="item.valid">
|
||||||
|
<mat-form-field class="col-md-4">
|
||||||
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.KEY' | translate}}</mat-label>
|
||||||
|
<input matInput [value]="insertFormattingItem(item.value.key, null)" [disabled] = "true">
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field class="col-md-4">
|
||||||
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.VALUE' | translate}}</mat-label>
|
||||||
|
<input matInput>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--Extra Options -->
|
<!--Extra Options -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -246,7 +311,7 @@
|
||||||
<mat-form-field class="col-md-12">
|
<mat-form-field class="col-md-12">
|
||||||
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.PRIORITY-KEY' | translate}}</mat-label>
|
<mat-label>{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.PRIORITY-KEY' | translate}}</mat-label>
|
||||||
<input matInput [formControl]="formGroup.get('value').get('priorityKey')">
|
<input matInput [formControl]="formGroup.get('value').get('priorityKey')">
|
||||||
<mat-error *ngIf="formGroup.get('value').get('priorityKey').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="formGroup.get('value').get('priorityKey').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4" >
|
<div class="col-4" >
|
||||||
|
@ -278,7 +343,7 @@
|
||||||
{{enumUtils.toEmailOverrideModeString(emailOverrideMode)}}
|
{{enumUtils.toEmailOverrideModeString(emailOverrideMode)}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<mat-error *ngIf="formGroup.get('value').get('ccMode').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="formGroup.get('value').get('ccMode').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -311,7 +376,7 @@
|
||||||
{{enumUtils.toEmailOverrideModeString(emailOverrideMode)}}
|
{{enumUtils.toEmailOverrideModeString(emailOverrideMode)}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<mat-error *ngIf="formGroup.get('value').get('bccMode').hasError('required')">{{'COMMONS.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="formGroup.get('value').get('bccMode').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="col-4" >
|
<!-- <div class="col-4" >
|
||||||
|
|
|
@ -46,7 +46,6 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
|
||||||
isDeleted = false;
|
isDeleted = false;
|
||||||
formGroup: UntypedFormGroup = null;
|
formGroup: UntypedFormGroup = null;
|
||||||
availableLanguageCodes: string[] = [];
|
availableLanguageCodes: string[] = [];
|
||||||
selectedLangId: Guid = null;
|
|
||||||
subjectMandatoryFields: string[] = [];
|
subjectMandatoryFields: string[] = [];
|
||||||
bodyMandatoryFields: string[] = [];
|
bodyMandatoryFields: string[] = [];
|
||||||
subjectFieldOptionsEnabled: Boolean = false;
|
subjectFieldOptionsEnabled: Boolean = false;
|
||||||
|
@ -54,6 +53,8 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
|
||||||
ccValues: string[] = [];
|
ccValues: string[] = [];
|
||||||
bccValues: string[] = [];
|
bccValues: string[] = [];
|
||||||
extraDataKeys: string[] = [];
|
extraDataKeys: string[] = [];
|
||||||
|
languageCode: string;
|
||||||
|
formatting: { [key: string]: string } = {};
|
||||||
public notificationTemplateKindEnum = this.enumUtils.getEnumValues(NotificationTemplateKind);
|
public notificationTemplateKindEnum = this.enumUtils.getEnumValues(NotificationTemplateKind);
|
||||||
public notificationTemplateChannelEnum = this.enumUtils.getEnumValues(NotificationTemplateChannel);
|
public notificationTemplateChannelEnum = this.enumUtils.getEnumValues(NotificationTemplateChannel);
|
||||||
public notificationDataTypeEnum = this.enumUtils.getEnumValues(NotificationDataType);
|
public notificationDataTypeEnum = this.enumUtils.getEnumValues(NotificationDataType);
|
||||||
|
@ -126,12 +127,21 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
|
||||||
if(data){
|
if(data){
|
||||||
if(data.value && data.value.subjectFieldOptions){
|
if(data.value && data.value.subjectFieldOptions){
|
||||||
this.subjectFieldOptionsEnabled = true;
|
this.subjectFieldOptionsEnabled = true;
|
||||||
|
this.subjectMandatoryFields = data.value.subjectFieldOptions.mandatory;
|
||||||
}
|
}
|
||||||
|
if(data.value && data.value.bodyFieldOptions){
|
||||||
|
this.bodyFieldOptionsEnabled = true;
|
||||||
|
this.bodyMandatoryFields = data.value.bodyFieldOptions.mandatory;
|
||||||
|
}
|
||||||
|
this.ccValues = this.editorModel.value.cc;
|
||||||
|
this.bccValues = this.editorModel.value.bcc;
|
||||||
|
this.extraDataKeys = this.editorModel.value.extraDataKeys;
|
||||||
|
this.languageCode = data.language.code;
|
||||||
}
|
}
|
||||||
this.isDeleted = data ? data.isActive === IsActive.Inactive : false;
|
this.isDeleted = data ? data.isActive === IsActive.Inactive : false;
|
||||||
this.buildForm();
|
this.buildForm();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error('Could not parse Tenant item: ' + data + error);
|
this.logger.error('Could not parse Notification Template item: ' + data + error);
|
||||||
this.uiNotificationService.snackBarNotification(this.language.instant('COMMONS.ERRORS.DEFAULT'), SnackBarNotificationLevel.Error);
|
this.uiNotificationService.snackBarNotification(this.language.instant('COMMONS.ERRORS.DEFAULT'), SnackBarNotificationLevel.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,8 +223,9 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.selectedLangId = data.id
|
this.formGroup.get('languageId').patchValue(data.id);
|
||||||
console.log(this.formGroup);}
|
console.log(this.formGroup);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,33 +246,6 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// subject mandatory
|
|
||||||
|
|
||||||
addSubjectMandatory(event: MatChipInputEvent): void {
|
|
||||||
const value = (event.value || '').trim();
|
|
||||||
|
|
||||||
if (value) this.subjectMandatoryFields.push(value)
|
|
||||||
event.chipInput!.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
removeSubjectMandatory(field: string): void {
|
|
||||||
const index = this.subjectMandatoryFields.indexOf(field);
|
|
||||||
|
|
||||||
if (index >= 0) this.subjectMandatoryFields.splice(index, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
editSubjectMandatory(field: string, event: MatChipEditedEvent) {
|
|
||||||
const value = event.value.trim();
|
|
||||||
|
|
||||||
if (!value) {
|
|
||||||
this.removeSubjectMandatory(field);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const index = this.subjectMandatoryFields.indexOf(field);
|
|
||||||
if (index >= 0) this.subjectMandatoryFields[index] = value
|
|
||||||
}
|
|
||||||
|
|
||||||
// chip lists
|
// chip lists
|
||||||
|
|
||||||
addChipListValues(type: string, event: MatChipInputEvent){
|
addChipListValues(type: string, event: MatChipInputEvent){
|
||||||
|
@ -340,11 +324,18 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
|
||||||
|
|
||||||
addOptionalItem(formGroup: UntypedFormGroup) {
|
addOptionalItem(formGroup: UntypedFormGroup) {
|
||||||
const fieldInfo: NotificationFieldInfoEditorModel = new NotificationFieldInfoEditorModel();
|
const fieldInfo: NotificationFieldInfoEditorModel = new NotificationFieldInfoEditorModel();
|
||||||
(formGroup.get('options') as FormArray).push(fieldInfo.buildForm());
|
(formGroup.get('optional') as FormArray).push(fieldInfo.buildForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
removeOptionalItem(formGroup: UntypedFormGroup, optionalIndex: number): void {
|
removeOptionalItem(formGroup: UntypedFormGroup, optionalIndex: number): void {
|
||||||
(formGroup.get('options') as FormArray).removeAt(optionalIndex);
|
(formGroup.get('optional') as FormArray).removeAt(optionalIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
insertFormattingItem(key: string, value: string){
|
||||||
|
this.formatting[key] = value;
|
||||||
|
// this.formGroup.get('value').get('subjectFieldOptions').get('formatting').patchValue(this.formatting); TODO
|
||||||
|
|
||||||
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ export class NotificationTemplateEditorModel extends BaseEditorModel implements
|
||||||
this.channel = item.channel;
|
this.channel = item.channel;
|
||||||
this.notificationType = item.notificationType;
|
this.notificationType = item.notificationType;
|
||||||
this.kind = item.kind;
|
this.kind = item.kind;
|
||||||
if(item.language) //TODO this.language = item.language;
|
if(item.language && item.language.id) this.languageId = item.language.id;
|
||||||
if (item.value) { this.value = new NotificationTemplateValueEditorModel().fromModel(item.value); }
|
if (item.value) { this.value = new NotificationTemplateValueEditorModel().fromModel(item.value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ export class NotificationTemplateEditorModel extends BaseEditorModel implements
|
||||||
channel: [{ value: this.channel, disabled: disabled }, context.getValidation('channel').validators],
|
channel: [{ value: this.channel, disabled: disabled }, context.getValidation('channel').validators],
|
||||||
notificationType: [{ value: this.notificationType, disabled: disabled }, context.getValidation('notificationType').validators],
|
notificationType: [{ value: this.notificationType, disabled: disabled }, context.getValidation('notificationType').validators],
|
||||||
kind: [{ value: this.kind, disabled: disabled }, context.getValidation('kind').validators],
|
kind: [{ value: this.kind, disabled: disabled }, context.getValidation('kind').validators],
|
||||||
language: [{ value: this.languageId, disabled: disabled }, context.getValidation('language').validators],
|
languageId: [{ value: this.languageId, disabled: disabled }, context.getValidation('languageId').validators],
|
||||||
value: this.value.buildForm({
|
value: this.value.buildForm({
|
||||||
rootPath: `value.`
|
rootPath: `value.`
|
||||||
}),
|
}),
|
||||||
|
@ -59,7 +59,7 @@ export class NotificationTemplateEditorModel extends BaseEditorModel implements
|
||||||
baseValidationArray.push({ key: 'channel', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'channel')] });
|
baseValidationArray.push({ key: 'channel', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'channel')] });
|
||||||
baseValidationArray.push({ key: 'notificationType', validators: [BackendErrorValidator(this.validationErrorModel, 'notificationType')] });
|
baseValidationArray.push({ key: 'notificationType', validators: [BackendErrorValidator(this.validationErrorModel, 'notificationType')] });
|
||||||
baseValidationArray.push({ key: 'kind', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'kind')] });
|
baseValidationArray.push({ key: 'kind', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'kind')] });
|
||||||
baseValidationArray.push({ key: 'language', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'language')] });
|
baseValidationArray.push({ key: 'languageId', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'languageId')] });
|
||||||
baseValidationArray.push({ key: 'value', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'value')] });
|
baseValidationArray.push({ key: 'value', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'value')] });
|
||||||
baseValidationArray.push({ key: 'hash', validators: [] });
|
baseValidationArray.push({ key: 'hash', validators: [] });
|
||||||
|
|
||||||
|
@ -149,16 +149,16 @@ export class NotificationTemplateValueEditorModel implements NotificationTemplat
|
||||||
|
|
||||||
const baseContext: ValidationContext = new ValidationContext();
|
const baseContext: ValidationContext = new ValidationContext();
|
||||||
const baseValidationArray: Validation[] = new Array<Validation>();
|
const baseValidationArray: Validation[] = new Array<Validation>();
|
||||||
baseValidationArray.push({ key: 'subjectText', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}subjectText`)] });
|
baseValidationArray.push({ key: 'subjectText', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}subjectText`)] });
|
||||||
baseValidationArray.push({ key: 'subjectKey', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}subjectKey`)] });
|
baseValidationArray.push({ key: 'subjectKey', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}subjectKey`)] });
|
||||||
baseValidationArray.push({ key: 'bodyText', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}bodyText`)] });
|
baseValidationArray.push({ key: 'bodyText', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}bodyText`)] });
|
||||||
baseValidationArray.push({ key: 'bodyKey', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}bodyKey`)] });
|
baseValidationArray.push({ key: 'bodyKey', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}bodyKey`)] });
|
||||||
baseValidationArray.push({ key: 'priorityKey', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}priorityKey`)] });
|
baseValidationArray.push({ key: 'priorityKey', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}priorityKey`)] });
|
||||||
baseValidationArray.push({ key: 'allowAttachments', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}allowAttachments`)] });
|
baseValidationArray.push({ key: 'allowAttachments', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}allowAttachments`)] });
|
||||||
baseValidationArray.push({ key: 'cc', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}cc`)] });
|
baseValidationArray.push({ key: 'cc', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}cc`)] });
|
||||||
baseValidationArray.push({ key: 'ccMode', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}ccMode`)] });
|
baseValidationArray.push({ key: 'ccMode', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}ccMode`)] });
|
||||||
baseValidationArray.push({ key: 'bcc', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}bcc`)] });
|
baseValidationArray.push({ key: 'bcc', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}bcc`)] });
|
||||||
baseValidationArray.push({ key: 'bccMode', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}bccMode`)] });
|
baseValidationArray.push({ key: 'bccMode', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}bccMode`)] });
|
||||||
baseValidationArray.push({ key: 'extraDataKeys', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}extraDataKeys`)] });
|
baseValidationArray.push({ key: 'extraDataKeys', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}extraDataKeys`)] });
|
||||||
|
|
||||||
baseContext.validation = baseValidationArray;
|
baseContext.validation = baseValidationArray;
|
||||||
|
@ -168,7 +168,7 @@ export class NotificationTemplateValueEditorModel implements NotificationTemplat
|
||||||
|
|
||||||
export class NotificationFieldOptionsEditorModel implements NotificationFieldOptionsPersist {
|
export class NotificationFieldOptionsEditorModel implements NotificationFieldOptionsPersist {
|
||||||
mandatory?: string[] = [];
|
mandatory?: string[] = [];
|
||||||
options?: NotificationFieldInfoEditorModel[] = [];
|
optional?: NotificationFieldInfoEditorModel[] = [];
|
||||||
formatting?: { [key: string]: string };
|
formatting?: { [key: string]: string };
|
||||||
|
|
||||||
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
||||||
|
@ -180,7 +180,7 @@ export class NotificationFieldOptionsEditorModel implements NotificationFieldOpt
|
||||||
public fromModel(item: NotificationFieldOptions): NotificationFieldOptionsEditorModel {
|
public fromModel(item: NotificationFieldOptions): NotificationFieldOptionsEditorModel {
|
||||||
if (item) {
|
if (item) {
|
||||||
this.mandatory = item.mandatory;
|
this.mandatory = item.mandatory;
|
||||||
if(item.options) { item.options.map(x => this.options.push(new NotificationFieldInfoEditorModel().fromModel(x))); }
|
if(item.optional) { item.optional.map(x => this.optional.push(new NotificationFieldInfoEditorModel().fromModel(x))); }
|
||||||
this.formatting = item.formatting;
|
this.formatting = item.formatting;
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
@ -202,13 +202,13 @@ export class NotificationFieldOptionsEditorModel implements NotificationFieldOpt
|
||||||
return this.formBuilder.group({
|
return this.formBuilder.group({
|
||||||
mandatory: [{ value: this.mandatory, disabled: disabled }, context.getValidation('mandatory').validators],
|
mandatory: [{ value: this.mandatory, disabled: disabled }, context.getValidation('mandatory').validators],
|
||||||
formatting: [{ value: this.formatting, disabled: disabled }, context.getValidation('formatting').validators],
|
formatting: [{ value: this.formatting, disabled: disabled }, context.getValidation('formatting').validators],
|
||||||
options: this.formBuilder.array(
|
optional: this.formBuilder.array(
|
||||||
(this.options ?? []).map(
|
(this.optional ?? []).map(
|
||||||
(item, index) => new NotificationFieldInfoEditorModel(
|
(item, index) => new NotificationFieldInfoEditorModel(
|
||||||
this.validationErrorModel
|
this.validationErrorModel
|
||||||
).fromModel(item).buildForm({
|
).fromModel(item).buildForm({
|
||||||
rootPath: `options[${index}].`
|
rootPath: `optional[${index}].`
|
||||||
}), context.getValidation('options')
|
}), context.getValidation('optional')
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
@ -224,7 +224,7 @@ export class NotificationFieldOptionsEditorModel implements NotificationFieldOpt
|
||||||
const baseContext: ValidationContext = new ValidationContext();
|
const baseContext: ValidationContext = new ValidationContext();
|
||||||
const baseValidationArray: Validation[] = new Array<Validation>();
|
const baseValidationArray: Validation[] = new Array<Validation>();
|
||||||
baseValidationArray.push({ key: 'mandatory', validators: [BackendErrorValidator(validationErrorModel,`${rootPath}mandatory`)] });
|
baseValidationArray.push({ key: 'mandatory', validators: [BackendErrorValidator(validationErrorModel,`${rootPath}mandatory`)] });
|
||||||
baseValidationArray.push({ key: 'options', validators: [BackendErrorValidator(validationErrorModel,`${rootPath}options`)] });
|
baseValidationArray.push({ key: 'optional', validators: [BackendErrorValidator(validationErrorModel,`${rootPath}optional`)] });
|
||||||
baseValidationArray.push({ key: 'formatting', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}formatting`)] });
|
baseValidationArray.push({ key: 'formatting', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}formatting`)] });
|
||||||
baseContext.validation = baseValidationArray;
|
baseContext.validation = baseValidationArray;
|
||||||
return baseContext;
|
return baseContext;
|
||||||
|
@ -234,7 +234,7 @@ export class NotificationFieldOptionsEditorModel implements NotificationFieldOpt
|
||||||
|
|
||||||
export class NotificationFieldInfoEditorModel implements NotificationFieldInfoPersist {
|
export class NotificationFieldInfoEditorModel implements NotificationFieldInfoPersist {
|
||||||
key: string;
|
key: string;
|
||||||
dataType: NotificationDataType;
|
type: NotificationDataType;
|
||||||
value: string;
|
value: string;
|
||||||
|
|
||||||
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
||||||
|
@ -245,7 +245,7 @@ export class NotificationFieldInfoEditorModel implements NotificationFieldInfoPe
|
||||||
public fromModel(item: NotificationFieldInfo): NotificationFieldInfoEditorModel {
|
public fromModel(item: NotificationFieldInfo): NotificationFieldInfoEditorModel {
|
||||||
if (item) {
|
if (item) {
|
||||||
this.key = item.key;
|
this.key = item.key;
|
||||||
this.dataType = item.dataType;
|
this.type = item.type;
|
||||||
this.value = item.value;
|
this.value = item.value;
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
@ -265,7 +265,7 @@ export class NotificationFieldInfoEditorModel implements NotificationFieldInfoPe
|
||||||
}
|
}
|
||||||
return this.formBuilder.group({
|
return this.formBuilder.group({
|
||||||
key: [{ value: this.key, disabled: disabled }, context.getValidation('key').validators],
|
key: [{ value: this.key, disabled: disabled }, context.getValidation('key').validators],
|
||||||
dataType: [{ value: this.dataType, disabled: disabled }, context.getValidation('dataType').validators],
|
type: [{ value: this.type, disabled: disabled }, context.getValidation('type').validators],
|
||||||
value: [{ value: this.value, disabled: disabled }, context.getValidation('value').validators],
|
value: [{ value: this.value, disabled: disabled }, context.getValidation('value').validators],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ export class NotificationFieldInfoEditorModel implements NotificationFieldInfoPe
|
||||||
const baseValidationArray: Validation[] = new Array<Validation>();
|
const baseValidationArray: Validation[] = new Array<Validation>();
|
||||||
|
|
||||||
baseValidationArray.push({ key: 'key', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}key`)] });
|
baseValidationArray.push({ key: 'key', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}key`)] });
|
||||||
baseValidationArray.push({ key: 'dataType', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}dataType`)] });
|
baseValidationArray.push({ key: 'type', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}type`)] });
|
||||||
baseValidationArray.push({ key: 'value', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}value`)] });
|
baseValidationArray.push({ key: 'value', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}value`)] });
|
||||||
|
|
||||||
baseContext.validation = baseValidationArray;
|
baseContext.validation = baseValidationArray;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
||||||
import { NotificationTemplate } from '@app/core/model/notification-template/notification-template';
|
import { Language } from '@app/core/model/language/language';
|
||||||
|
import { NotificationFieldInfo, NotificationFieldOptions, NotificationTemplate, NotificationTemplateValue } from '@app/core/model/notification-template/notification-template';
|
||||||
import { NotificationTemplateService } from '@app/core/services/notification-template/notification-template.service';
|
import { NotificationTemplateService } from '@app/core/services/notification-template/notification-template.service';
|
||||||
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
|
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
|
||||||
import { BaseEditorResolver } from '@common/base/base-editor.resolver';
|
import { BaseEditorResolver } from '@common/base/base-editor.resolver';
|
||||||
|
@ -22,7 +23,34 @@ export class NotificationTemplateEditorResolver extends BaseEditorResolver {
|
||||||
nameof<NotificationTemplate>(x => x.channel),
|
nameof<NotificationTemplate>(x => x.channel),
|
||||||
nameof<NotificationTemplate>(x => x.notificationType),
|
nameof<NotificationTemplate>(x => x.notificationType),
|
||||||
nameof<NotificationTemplate>(x => x.kind),
|
nameof<NotificationTemplate>(x => x.kind),
|
||||||
nameof<NotificationTemplate>(x => x.language),
|
|
||||||
|
[nameof<NotificationTemplate>(x => x.language),nameof<Language>(x => x.id)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.language),nameof<Language>(x => x.code)].join('.'),
|
||||||
|
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.subjectText)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.subjectKey)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.subjectFieldOptions), nameof<NotificationFieldOptions>(x => x.mandatory)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.subjectFieldOptions), nameof<NotificationFieldOptions>(x => x.optional)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.subjectFieldOptions), nameof<NotificationFieldOptions>(x => x.optional), nameof<NotificationFieldInfo>(x => x.key)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.subjectFieldOptions), nameof<NotificationFieldOptions>(x => x.optional), nameof<NotificationFieldInfo>(x => x.type)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.subjectFieldOptions), nameof<NotificationFieldOptions>(x => x.optional), nameof<NotificationFieldInfo>(x => x.value)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.subjectFieldOptions), nameof<NotificationFieldOptions>(x => x.formatting)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bodyText)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bodyKey)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bodyFieldOptions), nameof<NotificationFieldOptions>(x => x.mandatory)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bodyFieldOptions), nameof<NotificationFieldOptions>(x => x.optional)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bodyFieldOptions), nameof<NotificationFieldOptions>(x => x.optional), nameof<NotificationFieldInfo>(x => x.key)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bodyFieldOptions), nameof<NotificationFieldOptions>(x => x.optional), nameof<NotificationFieldInfo>(x => x.type)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bodyFieldOptions), nameof<NotificationFieldOptions>(x => x.optional), nameof<NotificationFieldInfo>(x => x.value)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bodyFieldOptions), nameof<NotificationFieldOptions>(x => x.formatting)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.priorityKey)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.allowAttachments)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.cc)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.ccMode)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bcc)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.bccMode)].join('.'),
|
||||||
|
[nameof<NotificationTemplate>(x => x.value),nameof<NotificationTemplateValue>(x => x.extraDataKeys)].join('.'),
|
||||||
|
|
||||||
nameof<NotificationTemplate>(x => x.createdAt),
|
nameof<NotificationTemplate>(x => x.createdAt),
|
||||||
nameof<NotificationTemplate>(x => x.updatedAt),
|
nameof<NotificationTemplate>(x => x.updatedAt),
|
||||||
nameof<NotificationTemplate>(x => x.hash),
|
nameof<NotificationTemplate>(x => x.hash),
|
||||||
|
@ -38,7 +66,7 @@ export class NotificationTemplateEditorResolver extends BaseEditorResolver {
|
||||||
const id = route.paramMap.get('id');
|
const id = route.paramMap.get('id');
|
||||||
|
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
return this.notificationTemplateService.getSingle(Guid.parse(id), fields).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.language.code)), takeUntil(this._destroyed));
|
return this.notificationTemplateService.getSingle(Guid.parse(id), fields).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.notificationType.toString())), takeUntil(this._destroyed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,22 @@
|
||||||
{{'NOTIFICATION-TEMPLATE-LISTING.FILTER.IS-ACTIVE' | translate}}
|
{{'NOTIFICATION-TEMPLATE-LISTING.FILTER.IS-ACTIVE' | translate}}
|
||||||
</mat-slide-toggle>
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<mat-label>{{'NOTIFICATION-TEMPLATE-LISTING.FILTER.KIND' | translate}}
|
||||||
|
<mat-select multiple [(ngModel)]="internalFilters.kinds">
|
||||||
|
<mat-option *ngFor="let kind of notificationTemplateKindEnumValues" [value]="kind">{{enumUtils.toNotificationTemplateKindString(kind)}}</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<mat-label>{{'NOTIFICATION-TEMPLATE-LISTING.FILTER.CHANNEL' | translate}}
|
||||||
|
<mat-select multiple [(ngModel)]="internalFilters.channels">
|
||||||
|
<mat-option *ngFor="let channel of notificationTemplateChannelEnumValues" [value]="channel">{{enumUtils.toNotificationTemplateChannelString(channel)}}</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem">
|
<div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem">
|
||||||
<button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()">
|
<button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()">
|
||||||
{{'NOTIFICATION-TEMPLATE-LISTING.FILTER.CANCEL' | translate}}
|
{{'NOTIFICATION-TEMPLATE-LISTING.FILTER.CANCEL' | translate}}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
||||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||||
|
import { NotificationTemplateChannel } from '@app/core/common/enum/notification-template-channel';
|
||||||
|
import { NotificationTemplateKind } from '@app/core/common/enum/notification-template-kind';
|
||||||
import { NotificationTemplateFilter } from '@app/core/query/notification-template.lookup';
|
import { NotificationTemplateFilter } from '@app/core/query/notification-template.lookup';
|
||||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
import { BaseComponent } from '@common/base/base.component';
|
||||||
|
@ -14,9 +16,11 @@ export class NotificationTemplateListingFiltersComponent extends BaseComponent i
|
||||||
|
|
||||||
@Input() readonly filter: NotificationTemplateFilter;
|
@Input() readonly filter: NotificationTemplateFilter;
|
||||||
@Output() filterChange = new EventEmitter<NotificationTemplateFilter>();
|
@Output() filterChange = new EventEmitter<NotificationTemplateFilter>();
|
||||||
|
notificationTemplateKindEnumValues = this.enumUtils.getEnumValues<NotificationTemplateKind>(NotificationTemplateKind)
|
||||||
|
notificationTemplateChannelEnumValues = this.enumUtils.getEnumValues<NotificationTemplateChannel>(NotificationTemplateChannel);
|
||||||
|
|
||||||
// * State
|
// * State
|
||||||
internalFilters: TenantListingFilters = this._getEmptyFilters();
|
internalFilters: NotificationTemplateListingFilters = this._getEmptyFilters();
|
||||||
|
|
||||||
protected appliedFilterCount: number = 0;
|
protected appliedFilterCount: number = 0;
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -45,35 +49,41 @@ export class NotificationTemplateListingFiltersComponent extends BaseComponent i
|
||||||
}
|
}
|
||||||
|
|
||||||
protected applyFilters(): void {
|
protected applyFilters(): void {
|
||||||
const { isActive } = this.internalFilters ?? {}
|
const { isActive, kinds, channels } = this.internalFilters ?? {}
|
||||||
this.filterChange.emit({
|
this.filterChange.emit({
|
||||||
...this.filter,
|
...this.filter,
|
||||||
// like,
|
// like,
|
||||||
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive]
|
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive],
|
||||||
|
kinds,
|
||||||
|
channels
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private _parseToInternalFilters(inputFilter: NotificationTemplateFilter): TenantListingFilters {
|
private _parseToInternalFilters(inputFilter: NotificationTemplateFilter): NotificationTemplateListingFilters {
|
||||||
if (!inputFilter) {
|
if (!inputFilter) {
|
||||||
return this._getEmptyFilters();
|
return this._getEmptyFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
let { excludedIds, ids, isActive } = inputFilter;
|
let { isActive, kinds, channels } = inputFilter;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length,
|
isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length,
|
||||||
|
kinds: kinds,
|
||||||
|
channels: channels
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getEmptyFilters(): TenantListingFilters {
|
private _getEmptyFilters(): NotificationTemplateListingFilters {
|
||||||
return {
|
return {
|
||||||
isActive: true
|
isActive: true,
|
||||||
|
kinds: null,
|
||||||
|
channels: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _computeAppliedFilters(filters: TenantListingFilters): number {
|
private _computeAppliedFilters(filters: NotificationTemplateListingFilters): number {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
if (filters?.isActive) {
|
if (filters?.isActive) {
|
||||||
count++
|
count++
|
||||||
|
@ -86,6 +96,8 @@ export class NotificationTemplateListingFiltersComponent extends BaseComponent i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TenantListingFilters {
|
interface NotificationTemplateListingFilters {
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
|
kinds: NotificationTemplateKind[];
|
||||||
|
channels: NotificationTemplateChannel[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,9 @@ import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||||
import { NotificationTemplate } from '@app/core/model/notification-template/notification-template';
|
import { NotificationTemplate } from '@app/core/model/notification-template/notification-template';
|
||||||
import { NotificationTemplateLookup } from '@app/core/query/notification-template.lookup';
|
import { NotificationTemplateLookup } from '@app/core/query/notification-template.lookup';
|
||||||
import { NotificationTemplateService } from '@app/core/services/notification-template/notification-template.service';
|
import { NotificationTemplateService } from '@app/core/services/notification-template/notification-template.service';
|
||||||
|
import { NotificationTemplateChannelPipe } from '@common/formatting/pipes/notification-template-channel.pipe';
|
||||||
|
import { NotificationTemplateKindPipe } from '@common/formatting/pipes/notification-template-kind.pipe';
|
||||||
|
import { Language } from '@app/core/model/language/language';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './NOTIFICATION-TEMPLATE-LISTING.component.html',
|
templateUrl: './NOTIFICATION-TEMPLATE-LISTING.component.html',
|
||||||
|
@ -37,7 +40,7 @@ export class NotificationTemplateListingComponent extends BaseListingComponent<N
|
||||||
|
|
||||||
private readonly lookupFields: string[] = [
|
private readonly lookupFields: string[] = [
|
||||||
nameof<NotificationTemplate>(x => x.id),
|
nameof<NotificationTemplate>(x => x.id),
|
||||||
nameof<NotificationTemplate>(x => x.language.code),
|
nameof<NotificationTemplate>(x => x.kind),
|
||||||
nameof<NotificationTemplate>(x => x.channel),
|
nameof<NotificationTemplate>(x => x.channel),
|
||||||
nameof<NotificationTemplate>(x => x.updatedAt),
|
nameof<NotificationTemplate>(x => x.updatedAt),
|
||||||
nameof<NotificationTemplate>(x => x.createdAt),
|
nameof<NotificationTemplate>(x => x.createdAt),
|
||||||
|
@ -87,13 +90,16 @@ export class NotificationTemplateListingComponent extends BaseListingComponent<N
|
||||||
|
|
||||||
protected setupColumns() {
|
protected setupColumns() {
|
||||||
this.gridColumns.push(...[{
|
this.gridColumns.push(...[{
|
||||||
prop: nameof<NotificationTemplate>(x => x.language.code),
|
prop: nameof<NotificationTemplate>(x => x.kind),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
languageName: 'NOTIFICATION-TEMPLATE-LISTING.FIELDS.LANGUAGE'
|
languageName: 'NOTIFICATION-TEMPLATE-LISTING.FIELDS.KIND',
|
||||||
}, {
|
pipe: this.pipeService.getPipe<NotificationTemplateKindPipe>(NotificationTemplateKindPipe)
|
||||||
|
},
|
||||||
|
{
|
||||||
prop: nameof<NotificationTemplate>(x => x.channel),
|
prop: nameof<NotificationTemplate>(x => x.channel),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
languageName: 'NOTIFICATION-TEMPLATE-LISTING.FIELDS.CHANNEL',
|
languageName: 'NOTIFICATION-TEMPLATE-LISTING.FIELDS.CHANNEL',
|
||||||
|
pipe: this.pipeService.getPipe<NotificationTemplateChannelPipe>(NotificationTemplateChannelPipe)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: nameof<NotificationTemplate>(x => x.createdAt),
|
prop: nameof<NotificationTemplate>(x => x.createdAt),
|
||||||
|
|
|
@ -16,6 +16,7 @@ import { NotificationTemplateRoutingModule } from './notification-template.routi
|
||||||
import { NotificationTemplateEditorComponent } from './editor/notification-template-editor.component';
|
import { NotificationTemplateEditorComponent } from './editor/notification-template-editor.component';
|
||||||
import { NotificationTemplateListingFiltersComponent } from './listing/filters/notification-template-listing-filters.component';
|
import { NotificationTemplateListingFiltersComponent } from './listing/filters/notification-template-listing-filters.component';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { EditorModule } from '@tinymce/tinymce-angular';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -32,7 +33,8 @@ import { MatIconModule } from '@angular/material/icon';
|
||||||
UserSettingsModule,
|
UserSettingsModule,
|
||||||
CommonFormattingModule,
|
CommonFormattingModule,
|
||||||
RichTextEditorModule,
|
RichTextEditorModule,
|
||||||
MatIconModule
|
MatIconModule,
|
||||||
|
EditorModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
NotificationTemplateEditorComponent,
|
NotificationTemplateEditorComponent,
|
||||||
|
|
|
@ -1219,8 +1219,8 @@
|
||||||
"TITLE": "Notification Templates",
|
"TITLE": "Notification Templates",
|
||||||
"CREATE": "Create Notification Template",
|
"CREATE": "Create Notification Template",
|
||||||
"FIELDS": {
|
"FIELDS": {
|
||||||
"NAME": "Name",
|
|
||||||
"LANGUAGE":"Language",
|
"LANGUAGE":"Language",
|
||||||
|
"KIND":"Kind",
|
||||||
"CHANNEL":"Channel",
|
"CHANNEL":"Channel",
|
||||||
"UPDATED-AT": "Updated",
|
"UPDATED-AT": "Updated",
|
||||||
"CREATED-AT": "Created",
|
"CREATED-AT": "Created",
|
||||||
|
@ -1229,7 +1229,8 @@
|
||||||
"FILTER": {
|
"FILTER": {
|
||||||
"TITLE": "Filters",
|
"TITLE": "Filters",
|
||||||
"IS-ACTIVE": "Is Active",
|
"IS-ACTIVE": "Is Active",
|
||||||
"STATUS": "Status",
|
"KIND":"Kind",
|
||||||
|
"CHANNEL":"Channel",
|
||||||
"CANCEL": "Cancel",
|
"CANCEL": "Cancel",
|
||||||
"APPLY-FILTERS": "Apply filters"
|
"APPLY-FILTERS": "Apply filters"
|
||||||
},
|
},
|
||||||
|
@ -1321,7 +1322,8 @@
|
||||||
"CC-MODE": "CC Mode",
|
"CC-MODE": "CC Mode",
|
||||||
"BCC": "BCC",
|
"BCC": "BCC",
|
||||||
"BCC-MODE": "BCC Mode",
|
"BCC-MODE": "BCC Mode",
|
||||||
"EXTRA-DATA-KEYS": "EXTRA-DATA-KEYS"
|
"EXTRA-DATA-KEYS": "EXTRA-DATA-KEYS",
|
||||||
|
"FORMATTING": "Formatting"
|
||||||
},
|
},
|
||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
"SAVE": "Save",
|
"SAVE": "Save",
|
||||||
|
|
|
@ -7,6 +7,8 @@ import { LowercaseFirstLetterPipe } from '@common/formatting/pipes/lowercase-fir
|
||||||
import { IsActiveTypePipe } from './pipes/is-active-type.pipe';
|
import { IsActiveTypePipe } from './pipes/is-active-type.pipe';
|
||||||
import { ReferenceTypePipe } from './pipes/reference-type.pipe';
|
import { ReferenceTypePipe } from './pipes/reference-type.pipe';
|
||||||
import { ReferenceSourceTypePipe } from './pipes/reference-source-type.pipe';
|
import { ReferenceSourceTypePipe } from './pipes/reference-source-type.pipe';
|
||||||
|
import { NotificationTemplateChannelPipe } from './pipes/notification-template-channel.pipe';
|
||||||
|
import { NotificationTemplateKindPipe } from './pipes/notification-template-kind.pipe';
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -25,7 +27,9 @@ import { ReferenceSourceTypePipe } from './pipes/reference-source-type.pipe';
|
||||||
DataTableDateOnlyFormatPipe,
|
DataTableDateOnlyFormatPipe,
|
||||||
IsActiveTypePipe,
|
IsActiveTypePipe,
|
||||||
ReferenceTypePipe,
|
ReferenceTypePipe,
|
||||||
ReferenceSourceTypePipe
|
ReferenceSourceTypePipe,
|
||||||
|
NotificationTemplateChannelPipe,
|
||||||
|
NotificationTemplateKindPipe
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
DateFormatPipe,
|
DateFormatPipe,
|
||||||
|
@ -38,7 +42,9 @@ import { ReferenceSourceTypePipe } from './pipes/reference-source-type.pipe';
|
||||||
DataTableDateOnlyFormatPipe,
|
DataTableDateOnlyFormatPipe,
|
||||||
IsActiveTypePipe,
|
IsActiveTypePipe,
|
||||||
ReferenceTypePipe,
|
ReferenceTypePipe,
|
||||||
ReferenceSourceTypePipe
|
ReferenceSourceTypePipe,
|
||||||
|
NotificationTemplateChannelPipe,
|
||||||
|
NotificationTemplateKindPipe
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
DateFormatPipe,
|
DateFormatPipe,
|
||||||
|
@ -51,7 +57,9 @@ import { ReferenceSourceTypePipe } from './pipes/reference-source-type.pipe';
|
||||||
DataTableDateOnlyFormatPipe,
|
DataTableDateOnlyFormatPipe,
|
||||||
IsActiveTypePipe,
|
IsActiveTypePipe,
|
||||||
ReferenceTypePipe,
|
ReferenceTypePipe,
|
||||||
ReferenceSourceTypePipe
|
ReferenceSourceTypePipe,
|
||||||
|
NotificationTemplateChannelPipe,
|
||||||
|
NotificationTemplateKindPipe
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class CommonFormattingModule { }
|
export class CommonFormattingModule { }
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Pipe, PipeTransform } from '@angular/core';
|
||||||
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
|
|
||||||
|
@Pipe({ name: 'NotificationTemplateChannelFormat' })
|
||||||
|
export class NotificationTemplateChannelPipe implements PipeTransform {
|
||||||
|
constructor(private enumUtils: EnumUtils) { }
|
||||||
|
|
||||||
|
public transform(value): any {
|
||||||
|
return this.enumUtils.toNotificationTemplateChannelString(value);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Pipe, PipeTransform } from '@angular/core';
|
||||||
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||||
|
|
||||||
|
@Pipe({ name: 'NotificationTemplateKindFormat' })
|
||||||
|
export class NotificationTemplateKindPipe implements PipeTransform {
|
||||||
|
constructor(private enumUtils: EnumUtils) { }
|
||||||
|
|
||||||
|
public transform(value): any {
|
||||||
|
return this.enumUtils.toNotificationTemplateKindString(value);
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,6 +26,7 @@ export abstract class BaseInterceptor implements HttpInterceptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (req.params instanceof BaseHttpParams && req.params.interceptorContext && Array.isArray(req.params.interceptorContext.interceptAllRequests) && req.params.interceptorContext.interceptAllRequests.includes(this.type))
|
return (req.params instanceof BaseHttpParams && req.params.interceptorContext && Array.isArray(req.params.interceptorContext.interceptAllRequests) && req.params.interceptorContext.interceptAllRequests.includes(this.type))
|
||||||
|| req.url.startsWith(this.configurationService.server);
|
|| req.url.startsWith(this.configurationService.server)
|
||||||
|
|| req.url.startsWith(this.configurationService.notificationServiceAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue