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 { export class Schedule {
readonly next?: ScheduleEntry;
constructor( constructor(
public id: number, readonly id: number,
public enabled: boolean, readonly enabled: boolean,
public title: string, readonly title: string,
public entries: ScheduleEntry[], readonly entries: ScheduleEntry[],
) { ) {
// nothing this.next = entries.filter(e => e.nextFuzzyTimestamp)[0];
} }
static fromJson(json: any): Schedule { static fromJson(json: any): Schedule {

View File

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

View File

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

View File

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

View File

@ -2,6 +2,9 @@
<tr> <tr>
<th>&nbsp;</th> <th>&nbsp;</th>
<th>Bezeichnung</th> <th>Bezeichnung</th>
<th colspan="3">Zeitpunkt</th>
<th colspan="3">Eigenschaft</th>
<th>Massenausführung</th>
<th>&nbsp;</th> <th>&nbsp;</th>
</tr> </tr>
<tr *ngFor="let schedule of schedules; trackBy: Schedule.trackBy"> <tr *ngFor="let schedule of schedules; trackBy: Schedule.trackBy">
@ -15,6 +18,18 @@
{{schedule.title}} {{schedule.title}}
</td> </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)"> <td class="delete" (click)="delete(schedule)">
<fa-icon title="Löschen" [icon]="faTimes"></fa-icon> <fa-icon title="Löschen" [icon]="faTimes"></fa-icon>
</td> </td>