UI: Improvement notification components styles
This commit is contained in:
parent
82719b89ef
commit
eddb06b536
@ -100,6 +100,23 @@
|
|||||||
{{ 'notification.create-new' | translate }}
|
{{ 'notification.create-new' | translate }}
|
||||||
</button>
|
</button>
|
||||||
</tb-entity-list>
|
</tb-entity-list>
|
||||||
|
<section formGroupName="additionalConfig" class="additional-config-group">
|
||||||
|
<mat-slide-toggle formControlName="enabled" class="toggle">
|
||||||
|
{{ 'notification.scheduler-later' | translate }}
|
||||||
|
</mat-slide-toggle>
|
||||||
|
<div *ngIf="notificationRequestForm.get('additionalConfig.enabled').value" fxLayout="column">
|
||||||
|
<tb-timezone-select userTimezoneByDefault
|
||||||
|
required
|
||||||
|
formControlName="timezone">
|
||||||
|
</tb-timezone-select>
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label translate>notification.time</mat-label>
|
||||||
|
<mat-datetimepicker-toggle [for]="startTimePicker" matPrefix></mat-datetimepicker-toggle>
|
||||||
|
<mat-datetimepicker #startTimePicker type="datetime" openOnFocus="true"></mat-datetimepicker>
|
||||||
|
<input required matInput fxFlex formControlName="time" [min]="minDate()" [max]="maxDate()" [matDatetimepicker]="startTimePicker">
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
</form>
|
</form>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
<mat-step optional *ngIf="!notificationRequestForm.get('useTemplate').value &&
|
<mat-step optional *ngIf="!notificationRequestForm.get('useTemplate').value &&
|
||||||
@ -222,21 +239,50 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</form>
|
</form>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
<mat-step [stepControl]="notificationRequestAdditionalConfigForm">
|
<mat-step>
|
||||||
<ng-template matStepLabel>{{ 'notification.review' | translate }}</ng-template>
|
<ng-template matStepLabel>{{ 'notification.review' | translate }}</ng-template>
|
||||||
<mat-progress-spinner color="warn" mode="indeterminate"
|
<mat-progress-spinner color="warn" mode="indeterminate"
|
||||||
strokeWidth="5" *ngIf="(isLoading$ | async) && !preview">
|
strokeWidth="5" *ngIf="(isLoading$ | async) && !preview">
|
||||||
</mat-progress-spinner>
|
</mat-progress-spinner>
|
||||||
<div *ngIf="preview" style="padding-bottom: 16px">
|
<div *ngIf="preview" style="padding-bottom: 16px">
|
||||||
<section class="preview-group notification" *ngIf="preview.processedTemplates.PUSH.enabled">
|
<section class="preview-group notification" *ngIf="preview.processedTemplates.PUSH?.enabled">
|
||||||
<div fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="start center">
|
<div fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="start center">
|
||||||
<mat-icon svgIcon="mdi:bell-badge"></mat-icon>
|
<mat-icon svgIcon="mdi:bell-badge"></mat-icon>
|
||||||
<div class="group-title">Web notification preview</div>
|
<div class="group-title" translate>notification.delivery-method-type.push-preview</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="web-preview">
|
<div class="web-preview">
|
||||||
<tb-notification preview [notification]="preview.processedTemplates.PUSH"></tb-notification>
|
<tb-notification preview [notification]="preview.processedTemplates.PUSH"></tb-notification>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="preview-group notification" *ngIf="preview.processedTemplates.EMAIL?.enabled">
|
||||||
|
<div fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="start center">
|
||||||
|
<mat-icon svgIcon="mdi:email"></mat-icon>
|
||||||
|
<div class="group-title" translate>notification.delivery-method-type.email-preview</div>
|
||||||
|
</div>
|
||||||
|
<div class="notification-content">
|
||||||
|
<div class="subject">{{ preview.processedTemplates.EMAIL.subject }}</div>
|
||||||
|
<mat-divider></mat-divider>
|
||||||
|
<div class="html-content" [innerHTML]="(preview.processedTemplates.EMAIL.body | safe: 'html')"></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="preview-group notification" *ngIf="preview.processedTemplates.SMS?.enabled">
|
||||||
|
<div fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="start center">
|
||||||
|
<mat-icon svgIcon="mdi:message-processing"></mat-icon>
|
||||||
|
<div class="group-title" translate>notification.delivery-method-type.sms-preview</div>
|
||||||
|
</div>
|
||||||
|
<div class="notification-content">
|
||||||
|
{{ preview.processedTemplates.SMS.body }}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="preview-group notification" *ngIf="preview.processedTemplates.SLACK?.enabled">
|
||||||
|
<div fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="start center">
|
||||||
|
<mat-icon svgIcon="mdi:slack"></mat-icon>
|
||||||
|
<div class="group-title" translate>notification.delivery-method-type.slack-preview</div>
|
||||||
|
</div>
|
||||||
|
<div class="notification-content">
|
||||||
|
{{ preview.processedTemplates.SLACK.body }}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
<section class="preview-group">
|
<section class="preview-group">
|
||||||
<div fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="start center">
|
<div fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="start center">
|
||||||
<mat-icon>supervisor_account</mat-icon>
|
<mat-icon>supervisor_account</mat-icon>
|
||||||
@ -248,23 +294,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<form [formGroup]="notificationRequestAdditionalConfigForm" class="additional-config-group">
|
|
||||||
<mat-slide-toggle formControlName="enabled" class="toggle">
|
|
||||||
{{ 'notification.scheduler-later' | translate }}
|
|
||||||
</mat-slide-toggle>
|
|
||||||
<div *ngIf="notificationRequestAdditionalConfigForm.get('enabled').value" fxLayout="column">
|
|
||||||
<tb-timezone-select userTimezoneByDefault
|
|
||||||
required
|
|
||||||
formControlName="timezone">
|
|
||||||
</tb-timezone-select>
|
|
||||||
<mat-form-field>
|
|
||||||
<mat-label translate>notification.time</mat-label>
|
|
||||||
<mat-datetimepicker-toggle [for]="startTimePicker" matPrefix></mat-datetimepicker-toggle>
|
|
||||||
<mat-datetimepicker #startTimePicker type="datetime" openOnFocus="true"></mat-datetimepicker>
|
|
||||||
<input required matInput fxFlex formControlName="time" [min]="minDate()" [max]="maxDate()" [matDatetimepicker]="startTimePicker">
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
</mat-horizontal-stepper>
|
</mat-horizontal-stepper>
|
||||||
|
|||||||
@ -114,6 +114,26 @@
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.notification-content {
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.12);
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #fff;
|
||||||
|
padding: 12px 16px;
|
||||||
|
|
||||||
|
.subject {
|
||||||
|
padding-bottom: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 0.25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.html-content {
|
||||||
|
margin-top: 12px;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media #{$mat-gt-xs} {
|
@media #{$mat-gt-xs} {
|
||||||
@ -240,4 +260,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.preview-group {
|
||||||
|
.notification-content {
|
||||||
|
.html-content,
|
||||||
|
.html-content * {
|
||||||
|
all: revert;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,7 +65,6 @@ export class RequestNotificationDialogComponent extends
|
|||||||
notificationType = NotificationType;
|
notificationType = NotificationType;
|
||||||
|
|
||||||
notificationRequestForm: FormGroup;
|
notificationRequestForm: FormGroup;
|
||||||
notificationRequestAdditionalConfigForm: FormGroup;
|
|
||||||
|
|
||||||
notificationDeliveryMethods = Object.keys(NotificationDeliveryMethod) as NotificationDeliveryMethod[];
|
notificationDeliveryMethods = Object.keys(NotificationDeliveryMethod) as NotificationDeliveryMethod[];
|
||||||
notificationDeliveryMethodTranslateMap = NotificationDeliveryMethodTranslateMap;
|
notificationDeliveryMethodTranslateMap = NotificationDeliveryMethodTranslateMap;
|
||||||
@ -92,7 +91,12 @@ export class RequestNotificationDialogComponent extends
|
|||||||
useTemplate: [true],
|
useTemplate: [true],
|
||||||
templateId: [null, Validators.required],
|
templateId: [null, Validators.required],
|
||||||
targets: [null, Validators.required],
|
targets: [null, Validators.required],
|
||||||
template: this.templateNotificationForm
|
template: this.templateNotificationForm,
|
||||||
|
additionalConfig: this.fb.group({
|
||||||
|
enabled: [false],
|
||||||
|
timezone: [{value: '', disabled: true}, Validators.required],
|
||||||
|
time: [{value: 0, disabled: true}, Validators.required]
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
this.notificationRequestForm.get('template').disable({emitEvent: false});
|
this.notificationRequestForm.get('template').disable({emitEvent: false});
|
||||||
@ -111,21 +115,15 @@ export class RequestNotificationDialogComponent extends
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.notificationRequestAdditionalConfigForm = this.fb.group({
|
this.notificationRequestForm.get('additionalConfig.enabled').valueChanges.pipe(
|
||||||
enabled: [false],
|
|
||||||
timezone: [{value: '', disabled: true}, Validators.required],
|
|
||||||
time: [{value: 0, disabled: true}, Validators.required]
|
|
||||||
});
|
|
||||||
|
|
||||||
this.notificationRequestAdditionalConfigForm.get('enabled').valueChanges.pipe(
|
|
||||||
takeUntil(this.destroy$)
|
takeUntil(this.destroy$)
|
||||||
).subscribe(value => {
|
).subscribe(value => {
|
||||||
if (value) {
|
if (value) {
|
||||||
this.notificationRequestAdditionalConfigForm.get('timezone').enable({emitEvent: false});
|
this.notificationRequestForm.get('additionalConfig.timezone').enable({emitEvent: false});
|
||||||
this.notificationRequestAdditionalConfigForm.get('time').enable({emitEvent: false});
|
this.notificationRequestForm.get('additionalConfig.time').enable({emitEvent: false});
|
||||||
} else {
|
} else {
|
||||||
this.notificationRequestAdditionalConfigForm.get('timezone').disable({emitEvent: false});
|
this.notificationRequestForm.get('additionalConfig.timezone').disable({emitEvent: false});
|
||||||
this.notificationRequestAdditionalConfigForm.get('time').disable({emitEvent: false});
|
this.notificationRequestForm.get('additionalConfig.time').disable({emitEvent: false});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -208,8 +206,8 @@ export class RequestNotificationDialogComponent extends
|
|||||||
delete formValue.useTemplate;
|
delete formValue.useTemplate;
|
||||||
delete formValue.template;
|
delete formValue.template;
|
||||||
let delay = 0;
|
let delay = 0;
|
||||||
if (this.notificationRequestAdditionalConfigForm.value.enabled) {
|
if (formValue.additionalConfig.enabled) {
|
||||||
delay = (this.notificationRequestAdditionalConfigForm.value.time.valueOf() - this.minDate().valueOf()) / 1000;
|
delay = (this.notificationRequestForm.value.additionalConfig.time.valueOf() - this.minDate().valueOf()) / 1000;
|
||||||
}
|
}
|
||||||
formValue.additionalConfig = {
|
formValue.additionalConfig = {
|
||||||
sendingDelayInSec: delay > 0 ? delay : 0
|
sendingDelayInSec: delay > 0 ? delay : 0
|
||||||
@ -230,7 +228,7 @@ export class RequestNotificationDialogComponent extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
minDate(): Date {
|
minDate(): Date {
|
||||||
return new Date(getCurrentTime(this.notificationRequestAdditionalConfigForm.get('timezone').value).format('lll'));
|
return new Date(getCurrentTime(this.notificationRequestForm.get('additionalConfig.timezone').value).format('lll'));
|
||||||
}
|
}
|
||||||
|
|
||||||
maxDate(): Date {
|
maxDate(): Date {
|
||||||
|
|||||||
@ -207,10 +207,6 @@
|
|||||||
<button mat-stroked-button *ngIf="selectedIndex > 0"
|
<button mat-stroked-button *ngIf="selectedIndex > 0"
|
||||||
(click)="backStep()">{{ 'action.back' | translate }}</button>
|
(click)="backStep()">{{ 'action.back' | translate }}</button>
|
||||||
<span fxFlex></span>
|
<span fxFlex></span>
|
||||||
<button *ngIf="selectedIndex > 0"
|
|
||||||
mat-button mat-stroked-button color="primary">
|
|
||||||
{{ 'notification.send-test-notification' | translate }}
|
|
||||||
</button>
|
|
||||||
<button mat-raised-button
|
<button mat-raised-button
|
||||||
color="primary"
|
color="primary"
|
||||||
(click)="nextStep()">{{ nextStepLabel() | translate }}</button>
|
(click)="nextStep()">{{ nextStepLabel() | translate }}</button>
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
@import "../../../../../../theme";
|
@import "../../../../../../theme";
|
||||||
|
|
||||||
:host-context(.tb-fullscreen-dialog .mat-dialog-container) {
|
:host-context(.tb-fullscreen-dialog .mat-dialog-container) {
|
||||||
width: 720px;
|
width: 830px;
|
||||||
max-height: 100vh;
|
max-height: 100vh;
|
||||||
|
|
||||||
.tb-form-fields {
|
.tb-form-fields {
|
||||||
|
|||||||
@ -57,7 +57,7 @@
|
|||||||
<input matInput formControlName="lastName"/>
|
<input matInput formControlName="lastName"/>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<tb-phone-input [required]="false"
|
<tb-phone-input [required]="false"
|
||||||
[label]="'contact.phone'"
|
label="{{ 'contact.phone' | translate }}"
|
||||||
[enableFlagsSelect]="true"
|
[enableFlagsSelect]="true"
|
||||||
formControlName="phone">
|
formControlName="phone">
|
||||||
</tb-phone-input>
|
</tb-phone-input>
|
||||||
|
|||||||
@ -93,7 +93,7 @@
|
|||||||
<input matInput formControlName="lastName">
|
<input matInput formControlName="lastName">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<tb-phone-input [required]="false"
|
<tb-phone-input [required]="false"
|
||||||
[label]="'contact.phone'"
|
label="{{ 'contact.phone' | translate }}"
|
||||||
[enableFlagsSelect]="true"
|
[enableFlagsSelect]="true"
|
||||||
formControlName="phone">
|
formControlName="phone">
|
||||||
</tb-phone-input>
|
</tb-phone-input>
|
||||||
|
|||||||
@ -2726,9 +2726,13 @@
|
|||||||
"delivery-method": "Delivery method",
|
"delivery-method": "Delivery method",
|
||||||
"delivery-method-type": {
|
"delivery-method-type": {
|
||||||
"email": "Email",
|
"email": "Email",
|
||||||
|
"email-preview": "Email notification preview",
|
||||||
"push": "Web",
|
"push": "Web",
|
||||||
|
"push-preview": "Web notification preview",
|
||||||
"slack": "Slack",
|
"slack": "Slack",
|
||||||
"sms": "SMS"
|
"slack-preview": "Slack notification preview",
|
||||||
|
"sms": "SMS",
|
||||||
|
"sms-preview": "SMS notification preview"
|
||||||
},
|
},
|
||||||
"delivery-methods": "Delivery methods",
|
"delivery-methods": "Delivery methods",
|
||||||
"description": "Description",
|
"description": "Description",
|
||||||
@ -2794,7 +2798,6 @@
|
|||||||
"search-targets": "Search recipients",
|
"search-targets": "Search recipients",
|
||||||
"search-templates": "Search templates",
|
"search-templates": "Search templates",
|
||||||
"send-notification": "Send notification",
|
"send-notification": "Send notification",
|
||||||
"send-test-notification": "Send test notification",
|
|
||||||
"sent": "Sent",
|
"sent": "Sent",
|
||||||
"settings": "Notification settings",
|
"settings": "Notification settings",
|
||||||
"slack": "Slack",
|
"slack": "Slack",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user