2020-10-06 19:22:40 +03:00
|
|
|
<!--
|
|
|
|
|
|
2023-01-31 10:43:56 +02:00
|
|
|
Copyright © 2016-2023 The Thingsboard Authors
|
2020-10-06 19:22:40 +03:00
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
-->
|
|
|
|
|
<section [formGroup]="alarmScheduleForm" fxLayout="column">
|
|
|
|
|
<mat-form-field class="mat-block" hideRequiredMarker floatLabel="always">
|
|
|
|
|
<mat-label> </mat-label>
|
|
|
|
|
<mat-select formControlName="type" required placeholder="{{ 'device-profile.schedule-type' | translate }}">
|
|
|
|
|
<mat-option *ngFor="let alarmScheduleType of alarmScheduleTypes" [value]="alarmScheduleType">
|
|
|
|
|
{{ alarmScheduleTypeTranslate.get(alarmScheduleType) | translate }}
|
|
|
|
|
</mat-option>
|
|
|
|
|
</mat-select>
|
|
|
|
|
<mat-error *ngIf="alarmScheduleForm.get('type').hasError('required')">
|
|
|
|
|
{{ 'device-profile.schedule-type-required' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<div *ngIf="alarmScheduleForm.get('type').value !== alarmScheduleType.ANY_TIME">
|
|
|
|
|
<tb-timezone-select
|
2021-01-05 16:22:15 +02:00
|
|
|
userTimezoneByDefault
|
2020-10-06 19:22:40 +03:00
|
|
|
required
|
|
|
|
|
formControlName="timezone">
|
|
|
|
|
</tb-timezone-select>
|
|
|
|
|
<section *ngIf="alarmScheduleForm.get('type').value === alarmScheduleType.SPECIFIC_TIME">
|
2022-01-24 11:34:37 +02:00
|
|
|
<tb-alarm-dynamic-value formControlName = 'dynamicValue' helpId = 'device-profile/alarm_specific_schedule_format'></tb-alarm-dynamic-value>
|
2020-10-06 19:22:40 +03:00
|
|
|
<div class="tb-small" style="margin-bottom: 0.5em" translate>device-profile.schedule-days</div>
|
2020-10-12 17:29:27 +03:00
|
|
|
<div fxLayout="column" fxLayout.gt-md="row" fxLayoutGap="16px">
|
2020-10-06 19:22:40 +03:00
|
|
|
<div fxLayout="row" fxLayoutGap="16px">
|
2020-10-12 17:29:27 +03:00
|
|
|
<mat-checkbox *ngFor="let day of firstRowDays" [formControl]="weeklyRepeatControl(day)">
|
|
|
|
|
{{ dayOfWeekTranslationsArray[day] | translate }}
|
2020-10-06 19:22:40 +03:00
|
|
|
</mat-checkbox>
|
|
|
|
|
</div>
|
|
|
|
|
<div fxLayout="row" fxLayoutGap="16px">
|
2020-10-12 17:29:27 +03:00
|
|
|
<mat-checkbox *ngFor="let day of secondRowDays" [formControl]="weeklyRepeatControl(day)">
|
|
|
|
|
{{ dayOfWeekTranslationsArray[day] | translate }}
|
2020-10-06 19:22:40 +03:00
|
|
|
</mat-checkbox>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-10-12 17:29:27 +03:00
|
|
|
<tb-error style="display: block;" [error]="alarmScheduleForm.get('daysOfWeek').hasError('dayOfWeeks')
|
|
|
|
|
? ('device-profile.schedule-days-of-week-required' | translate) : ''"></tb-error>
|
2020-10-06 19:22:40 +03:00
|
|
|
<div class="tb-small" style="margin-bottom: 0.5em" translate>device-profile.schedule-time</div>
|
|
|
|
|
<div fxLayout="row" fxLayout.xs="column" fxLayoutGap.gt-xs="8px">
|
2020-10-09 16:05:23 +03:00
|
|
|
<div fxLayout="row" fxLayoutGap="8px" fxFlex.gt-md>
|
|
|
|
|
<mat-form-field fxFlex.xs fxFlex.sm="150px" fxFlex.md="150px" fxFlex.gt-md>
|
|
|
|
|
<mat-label translate>device-profile.schedule-time-from</mat-label>
|
|
|
|
|
<mat-datetimepicker-toggle [for]="startTimePicker" matPrefix></mat-datetimepicker-toggle>
|
|
|
|
|
<mat-datetimepicker #startTimePicker type="time" openOnFocus="true"></mat-datetimepicker>
|
|
|
|
|
<input required matInput formControlName="startsOn" [matDatetimepicker]="startTimePicker">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-form-field fxFlex.xs fxFlex.sm="150px" fxFlex.md="150px" fxFlex.gt-md>
|
|
|
|
|
<mat-label translate>device-profile.schedule-time-to</mat-label>
|
|
|
|
|
<mat-datetimepicker-toggle [for]="endTimePicker" matPrefix></mat-datetimepicker-toggle>
|
|
|
|
|
<mat-datetimepicker #endTimePicker type="time" openOnFocus="true"></mat-datetimepicker>
|
|
|
|
|
<input required matInput formControlName="endsOn" [matDatetimepicker]="endTimePicker">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
<div fxFlex fxLayoutAlign="center center" style="margin: auto">
|
|
|
|
|
<div style="text-align: center"
|
|
|
|
|
[innerHTML]="getSchedulerRangeText(alarmScheduleForm)">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-10-06 19:22:40 +03:00
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
<section *ngIf="alarmScheduleForm.get('type').value === alarmScheduleType.CUSTOM">
|
2022-06-13 12:17:15 +03:00
|
|
|
<tb-alarm-dynamic-value formControlName = 'dynamicValue' helpId = 'device-profile/alarm_custom_schedule_format'></tb-alarm-dynamic-value>
|
2022-01-11 14:38:07 +02:00
|
|
|
<div class="tb-small" style="margin-bottom: 0.5em" translate>device-profile.schedule-days</div>
|
2020-10-12 17:29:27 +03:00
|
|
|
<div *ngFor="let day of allDays" fxLayout="column" formArrayName="items" fxLayoutGap="1em">
|
|
|
|
|
<div fxLayout.xs="column" fxLayout="row" fxLayoutGap="8px" [formGroupName]="''+day" fxLayoutAlign="start center" fxLayoutAlign.xs="center start">
|
|
|
|
|
<mat-checkbox formControlName="enabled" fxFlex="17" (change)="changeCustomScheduler($event, day)">
|
|
|
|
|
{{ dayOfWeekTranslationsArray[day] | translate }}
|
2020-10-09 16:05:23 +03:00
|
|
|
</mat-checkbox>
|
|
|
|
|
<div fxLayout="row" fxLayoutGap="8px" fxFlex>
|
|
|
|
|
<mat-form-field fxFlex.xs fxFlex.sm="100px" fxFlex.md="100px">
|
|
|
|
|
<mat-label translate>device-profile.schedule-time-from</mat-label>
|
2020-10-12 17:29:27 +03:00
|
|
|
<mat-datetimepicker-toggle [for]="startTimePicker" matPrefix></mat-datetimepicker-toggle>
|
|
|
|
|
<mat-datetimepicker #startTimePicker type="time" openOnFocus="true"></mat-datetimepicker>
|
|
|
|
|
<input required matInput formControlName="startsOn" [matDatetimepicker]="startTimePicker">
|
2020-10-09 16:05:23 +03:00
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-form-field fxFlex.xs fxFlex.sm="100px" fxFlex.md="100px">
|
|
|
|
|
<mat-label translate>device-profile.schedule-time-to</mat-label>
|
2020-10-12 17:29:27 +03:00
|
|
|
<mat-datetimepicker-toggle [for]="endTimePicker" matPrefix></mat-datetimepicker-toggle>
|
|
|
|
|
<mat-datetimepicker #endTimePicker type="time" openOnFocus="true"></mat-datetimepicker>
|
|
|
|
|
<input required matInput formControlName="endsOn" [matDatetimepicker]="endTimePicker">
|
2020-10-09 16:05:23 +03:00
|
|
|
</mat-form-field>
|
2020-10-06 19:22:40 +03:00
|
|
|
</div>
|
2020-10-09 16:05:23 +03:00
|
|
|
<div fxFlex fxLayoutAlign="center center"
|
|
|
|
|
style="text-align: center"
|
2020-10-12 17:29:27 +03:00
|
|
|
[innerHTML]="getSchedulerRangeText(itemsSchedulerForm.at(day))">
|
2020-10-06 19:22:40 +03:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-10-12 17:29:27 +03:00
|
|
|
|
|
|
|
|
<tb-error style="display: block;" [error]="alarmScheduleForm.get('items').hasError('dayOfWeeks')
|
|
|
|
|
? ('device-profile.schedule-days-of-week-required' | translate) : ''"></tb-error>
|
2020-10-06 19:22:40 +03:00
|
|
|
</section>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|