Showing 'next' in schedule-list

This commit is contained in:
Patrick Haßel 2022-10-25 15:34:59 +02:00
parent 8d6617ece1
commit 9bc0111c01
5 changed files with 56 additions and 39 deletions

View File

@ -3,13 +3,15 @@ import {ScheduleEntry} from "./entry/ScheduleEntry";
export class Schedule {
readonly next?: ScheduleEntry;
constructor(
public id: number,
public enabled: boolean,
public title: string,
public entries: ScheduleEntry[],
readonly id: number,
readonly enabled: boolean,
readonly title: string,
readonly entries: ScheduleEntry[],
) {
// nothing
this.next = entries.filter(e => e.nextFuzzyTimestamp)[0];
}
static fromJson(json: any): Schedule {

View File

@ -10,28 +10,28 @@ function getDaySeconds(date: Date): number {
export class ScheduleEntry {
private constructor(
public id: number,
public position: number,
public enabled: boolean,
public monday: boolean,
public tuesday: boolean,
public wednesday: boolean,
public thursday: boolean,
public friday: boolean,
public saturday: boolean,
public sunday: boolean,
public type: string,
public zenith: number,
public hour: number,
public minute: number,
public second: number,
public fuzzySeconds: number,
public lastClearTimestamp: Timestamp | null,
public nextClearTimestamp: Timestamp | null,
public nextFuzzyTimestamp: Timestamp | null,
public property: Property | null,
public value: number,
public bulk: Bulk | null,
readonly id: number,
readonly position: number,
readonly enabled: boolean,
readonly monday: boolean,
readonly tuesday: boolean,
readonly wednesday: boolean,
readonly thursday: boolean,
readonly friday: boolean,
readonly saturday: boolean,
readonly sunday: boolean,
readonly type: string,
readonly zenith: number,
readonly hour: number,
readonly minute: number,
readonly second: number,
readonly fuzzySeconds: number,
readonly lastClearTimestamp: Timestamp | null,
readonly nextClearTimestamp: Timestamp | null,
readonly nextFuzzyTimestamp: Timestamp | null,
readonly property: Property | null,
readonly value: number,
readonly bulk: Bulk | null,
) {
// nothing
}

View File

@ -8,7 +8,7 @@
</div>
<div class="item" routerLink="/BulkList" routerLinkActive="itemActive">
Massenverarbeitung
Massenausführungen
</div>
<div class="item itemSecondary" routerLink="/PropertyList" routerLinkActive="itemActive">

View File

@ -29,7 +29,7 @@
<th>Unschärfe</th>
<th colspan="6">Nächste Ausführung</th>
<th colspan="2">Eingeschaft setzen</th>
<th>Massenverarbeitung</th>
<th>Massenausführung</th>
<th class="noBorderFirst">&nbsp;</th>
<th class="noBorderMiddle">&nbsp;</th>
<th class="noBorderLast">&nbsp;</th>
@ -45,7 +45,7 @@
<ng-container *ngTemplateOutlet="boolean;context:{entry: entry, value: entry.sunday, key:'sunday'}"></ng-container>
<td>
<select [(ngModel)]="entry.type" (ngModelChange)="set(entry, 'type', entry.type)">
<select [ngModel]="entry.type" (ngModelChange)="set(entry, 'type', entry.type)">
<option value="TIME">Uhrzeit</option>
<option value="SUNRISE">Sonnenaufgang</option>
<option value="SUNSET">Sonnenuntergang</option>
@ -54,7 +54,7 @@
<ng-container *ngIf="entry.type === 'SUNRISE' || entry.type === 'SUNSET'">
<td>
<select [(ngModel)]="entry.zenith" (ngModelChange)="set(entry, 'zenith', entry.zenith)">
<select [ngModel]="entry.zenith" (ngModelChange)="set(entry, 'zenith', entry.zenith)">
<option value="87">
[&nbsp;87°]
<ng-container *ngIf="entry.type === 'SUNRISE'">Nach Sonnenaufgang</ng-container>
@ -78,13 +78,13 @@
<ng-container *ngIf="entry.type === 'TIME'">
<td class="first">
<select [(ngModel)]="entry.hour" (ngModelChange)="set(entry, 'hour', entry.hour)">
<select [ngModel]="entry.hour" (ngModelChange)="set(entry, 'hour', entry.hour)">
<option *ngFor="let _ of [].constructor(24); let value = index" [ngValue]="value">{{value}}</option>
</select>
</td>
<td class="middle">:</td>
<td class="last">
<select [(ngModel)]="entry.minute" (ngModelChange)="set(entry, 'minute', entry.minute)">
<select [ngModel]="entry.minute" (ngModelChange)="set(entry, 'minute', entry.minute)">
<option *ngFor="let _ of [].constructor(60); let value = index" [ngValue]="value">{{value | number:'2.0'}}</option>
</select>
</td>
@ -92,7 +92,7 @@
<td *ngIf="entry.type !== 'TIME'" colspan="3" class="empty"></td>
<td>
<select [(ngModel)]="entry.fuzzySeconds" (ngModelChange)="set(entry, 'fuzzySeconds', entry.fuzzySeconds)">
<select [ngModel]="entry.fuzzySeconds" (ngModelChange)="set(entry, 'fuzzySeconds', entry.fuzzySeconds)">
<option [ngValue]="0">Keine</option>
<option [ngValue]="60">1 Minute</option>
<option [ngValue]="300">5 Minuten</option>
@ -137,7 +137,7 @@
{{entry.value ? "An" : "Aus"}}
</td>
<td *ngSwitchCase="'SHUTTER'" [class.true]="entry.value === 0" [class.false]="entry.value === 100" [class.tristate]="0 < entry.value && entry.value < 100">
<select [(ngModel)]="entry.value" (ngModelChange)="set(entry, 'value', entry.value)">
<select [ngModel]="entry.value" (ngModelChange)="set(entry, 'value', entry.value)">
<option [ngValue]="0">100% Offen</option>
<option [ngValue]="35">&nbsp;50%</option>
<option [ngValue]="55">&nbsp;75%</option>
@ -147,22 +147,22 @@
</select>
</td>
<td *ngSwitchCase="'BRIGHTNESS_PERCENT'" [class.true]="entry.value" [class.false]="!entry.value" [class.tristate]="0 < entry.value && entry.value < 100">
<select [(ngModel)]="entry.value" (ngModelChange)="set(entry, 'value', entry.value)">
<select [ngModel]="entry.value" (ngModelChange)="set(entry, 'value', entry.value)">
<option *ngFor="let _ of [].constructor(21); let value = index" [ngValue]="value * 5">{{value * 5}}%</option>
</select>
</td>
<td *ngSwitchCase="'COLOR_TEMPERATURE'" [class.true]="entry.value" [class.false]="!entry.value" [class.tristate]="0 < entry.value && entry.value < 100">
<select [(ngModel)]="entry.value" (ngModelChange)="set(entry, 'value', entry.value)">
<select [ngModel]="entry.value" (ngModelChange)="set(entry, 'value', entry.value)">
<option *ngFor="let _ of [].constructor(21); let value = index" [ngValue]="value * 5">{{value * 5}}%</option>
</select>
</td>
<td *ngSwitchCase="'LUX'" [class.true]="entry.value" [class.false]="!entry.value" [class.tristate]="0 < entry.value && entry.value < 100">
<select [(ngModel)]="entry.value" (ngModelChange)="set(entry, 'value', entry.value)">
<select [ngModel]="entry.value" (ngModelChange)="set(entry, 'value', entry.value)">
<option *ngFor="let _ of [].constructor(21); let value = index" [ngValue]="value * 5">{{value * 5}}%</option>
</select>
</td>
<td *ngSwitchCase="'SCENE'">
<select [(ngModel)]="entry.value" (ngModelChange)="set(entry, 'value', entry.value)">
<select [ngModel]="entry.value" (ngModelChange)="set(entry, 'value', entry.value)">
<option *ngFor="let scene of scenes" [ngValue]="scene.number">#{{scene.number | number:'2.0-0'}} {{scene.title}}</option>
</select>
</td>

View File

@ -2,6 +2,9 @@
<tr>
<th>&nbsp;</th>
<th>Bezeichnung</th>
<th colspan="3">Zeitpunkt</th>
<th colspan="3">Eigenschaft</th>
<th>Massenausführung</th>
<th>&nbsp;</th>
</tr>
<tr *ngFor="let schedule of schedules; trackBy: Schedule.trackBy">
@ -15,6 +18,18 @@
{{schedule.title}}
</td>
<td class="number first" [class.empty]="!schedule.next?.nextClearTimestamp">{{schedule.next?.nextClearTimestamp.dayName}}</td>
<td class="number middle" [class.empty]="!schedule.next?.nextClearTimestamp">:&nbsp;</td>
<td class="number last" [class.empty]="!schedule.next?.nextClearTimestamp">{{schedule.next?.nextClearTimestamp.timeString}}</td>
<td class="number first" [class.empty]="!schedule.next?.property">{{schedule.next?.property?.title}}</td>
<td class="number middle" [class.empty]="!schedule.next?.property">&nbsp;=&nbsp;</td>
<td class="number last" [class.empty]="!schedule.next?.property">{{schedule.next?.value}}</td>
<td [class.empty]="!schedule.next?.bulk">
{{schedule.next?.bulk?.name}}
</td>
<td class="delete" (click)="delete(schedule)">
<fa-icon title="Löschen" [icon]="faTimes"></fa-icon>
</td>