2023-01-17 18:26:25 +02:00
|
|
|
<!--
|
|
|
|
|
|
|
|
|
|
Copyright © 2016-2022 The Thingsboard Authors
|
|
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
|
|
|
|
|
-->
|
|
|
|
|
<mat-toolbar color="primary">
|
2023-01-30 10:23:36 +02:00
|
|
|
<h2>{{ dialogTitle | translate }}</h2>
|
2023-01-17 18:26:25 +02:00
|
|
|
<span fxFlex></span>
|
|
|
|
|
<button mat-icon-button
|
|
|
|
|
(click)="cancel()"
|
|
|
|
|
type="button">
|
|
|
|
|
<mat-icon class="material-icons">close</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
</mat-toolbar>
|
|
|
|
|
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async">
|
|
|
|
|
</mat-progress-bar>
|
|
|
|
|
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
|
|
|
|
|
<div mat-dialog-content>
|
|
|
|
|
<mat-horizontal-stepper [linear]="true" labelPosition="end" #createNotification
|
|
|
|
|
[orientation]="(stepperOrientation | async)"
|
|
|
|
|
(selectionChange)="changeStep($event)">
|
|
|
|
|
<ng-template matStepperIcon="edit">
|
|
|
|
|
<mat-icon>check</mat-icon>
|
|
|
|
|
</ng-template>
|
|
|
|
|
<mat-step [stepControl]="notificationRequestForm">
|
|
|
|
|
<ng-template matStepLabel>{{ 'notification.compose' | translate }}</ng-template>
|
|
|
|
|
<form [formGroup]="notificationRequestForm" style="padding-bottom: 16px;">
|
|
|
|
|
<tb-template-autocomplete
|
|
|
|
|
required
|
2023-01-23 12:47:00 +02:00
|
|
|
[notificationTypes]="notificationType.GENERAL"
|
2023-01-17 18:26:25 +02:00
|
|
|
formControlName="templateId">
|
|
|
|
|
</tb-template-autocomplete>
|
|
|
|
|
<tb-entity-list
|
|
|
|
|
required
|
|
|
|
|
formControlName="targets"
|
2023-02-01 15:58:00 +02:00
|
|
|
labelText="{{ 'notification.targets' | translate }}"
|
|
|
|
|
placeholderText="{{ 'notification.target' | translate }}"
|
|
|
|
|
requiredText="{{ 'notification.targets-required' | translate }}"
|
2023-01-17 18:26:25 +02:00
|
|
|
[entityType]="entityType.NOTIFICATION_TARGET">
|
|
|
|
|
</tb-entity-list>
|
2023-01-31 18:18:55 +02:00
|
|
|
<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()" [matDatetimepicker]="startTimePicker">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
2023-01-17 18:26:25 +02:00
|
|
|
</form>
|
|
|
|
|
</mat-step>
|
|
|
|
|
<mat-step>
|
|
|
|
|
<ng-template matStepLabel>{{ 'notification.review' | translate }}</ng-template>
|
|
|
|
|
<mat-progress-spinner color="warn" mode="indeterminate"
|
|
|
|
|
strokeWidth="5" *ngIf="(isLoading$ | async) && !preview">
|
|
|
|
|
</mat-progress-spinner>
|
|
|
|
|
<div *ngIf="preview">
|
2023-01-20 18:08:30 +02:00
|
|
|
<section class="preview-group notification" *ngIf="preview.processedTemplates.PUSH.enabled">
|
|
|
|
|
<div fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="start center">
|
|
|
|
|
<mat-icon svgIcon="mdi:bell-badge"></mat-icon>
|
|
|
|
|
<div class="group-title">Web notification preview</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="web-preview">
|
|
|
|
|
<tb-notification preview [notification]="preview.processedTemplates.PUSH"></tb-notification>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
2023-01-17 18:26:25 +02:00
|
|
|
<section class="preview-group">
|
|
|
|
|
<div fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="start center">
|
|
|
|
|
<mat-icon>supervisor_account</mat-icon>
|
2023-01-20 18:08:30 +02:00
|
|
|
<div class="group-title">{{ 'notification.recipients-count' | translate : {count: preview.totalRecipientsCount} }}</div>
|
2023-01-17 18:26:25 +02:00
|
|
|
</div>
|
2023-01-20 18:08:30 +02:00
|
|
|
<div class="details-recipients" *ngIf="notificationRequestForm.get('targets').value.length > 1">
|
2023-01-18 13:03:37 +02:00
|
|
|
<div *ngFor="let detail of preview.recipientsCountByTarget | keyvalue" class="details-recipient">
|
|
|
|
|
<span class="number">{{ detail.value }}</span>{{ detail.key }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-01-17 18:26:25 +02:00
|
|
|
</section>
|
|
|
|
|
</div>
|
|
|
|
|
</mat-step>
|
|
|
|
|
</mat-horizontal-stepper>
|
|
|
|
|
</div>
|
|
|
|
|
<mat-divider></mat-divider>
|
|
|
|
|
<div mat-dialog-actions fxLayout="row">
|
|
|
|
|
<button mat-stroked-button *ngIf="selectedIndex > 0"
|
|
|
|
|
(click)="backStep()">{{ 'action.back' | translate }}</button>
|
|
|
|
|
<span fxFlex></span>
|
|
|
|
|
<button mat-raised-button
|
|
|
|
|
color="primary"
|
|
|
|
|
(click)="nextStep()">{{ nextStepLabel() | translate }}</button>
|
|
|
|
|
</div>
|