UI sorting

This commit is contained in:
Patrick Haßel 2023-07-05 23:31:07 +02:00
parent 0a126f554b
commit 449e58b8ec
6 changed files with 30 additions and 17 deletions

View File

@ -25,4 +25,14 @@ export class BulkEntry {
); );
} }
static compareName(a: BulkEntry, b: BulkEntry) {
if (!a.property) {
return +1;
}
if (!b.property) {
return -1;
}
return a.property.title.localeCompare(b.property.title);
}
} }

View File

@ -2,15 +2,19 @@
<h1> <h1>
<app-text [initial]="bulk.name" (valueChange)="set(bulk, 'name', $event)"></app-text> <app-text [initial]="bulk.name" (valueChange)="set(bulk, 'name', $event)"></app-text>
</h1> </h1>
<p>
<button (click)="create()">+ Hinzufügen</button>
</p>
<table> <table>
<tr> <tr>
<th>Eigenschaft</th> <th>Eigenschaft</th>
<th>Wert</th> <th>Wert</th>
<th>&nbsp;</th> <th>&nbsp;</th>
<th>&nbsp;</th>
</tr> </tr>
<ng-container *ngIf="bulk"> <ng-container *ngIf="bulk">
<tr *ngFor="let entry of bulk.entries"> <tr *ngFor="let entry of bulk.entries.sort(BulkEntry.compareName)">
<td> <td>
<app-search [searchService]="propertyService" [allowEmpty]="false" [initial]="entry.property?.id" (valueChange)="setEntry(entry, 'property', $event)"></app-search> <app-search [searchService]="propertyService" [allowEmpty]="false" [initial]="entry.property?.id" (valueChange)="setEntry(entry, 'property', $event)"></app-search>
</td> </td>
@ -52,7 +56,4 @@
</ng-container> </ng-container>
</table> </table>
<p>
<button (click)="create()">+ Hinzufügen</button>
</p>
</ng-container> </ng-container>

View File

@ -13,6 +13,8 @@ import {faTimesCircle} from "@fortawesome/free-regular-svg-icons";
}) })
export class BulkEditorComponent implements OnInit { export class BulkEditorComponent implements OnInit {
protected readonly BulkEntry = BulkEntry;
readonly faTimes = faTimesCircle; readonly faTimes = faTimesCircle;
bulk!: Bulk; bulk!: Bulk;

View File

@ -1,3 +1,7 @@
<p>
<button (click)="create()">+ Hinzufügen</button>
</p>
<table> <table>
<tr> <tr>
<th>&nbsp;</th> <th>&nbsp;</th>
@ -26,7 +30,3 @@
</tr> </tr>
</table> </table>
<p>
<button (click)="create()">+ Hinzufügen</button>
</p>

View File

@ -7,6 +7,10 @@
</td> </td>
</ng-template> </ng-template>
<p>
<button (click)="create()">+ Hinzufügen</button>
</p>
<table> <table>
<tr class="header"> <tr class="header">
<ng-container *ngTemplateOutlet="boolean;context:{schedule: schedule, value: schedule.enabled, key:'enabled'}"></ng-container> <ng-container *ngTemplateOutlet="boolean;context:{schedule: schedule, value: schedule.enabled, key:'enabled'}"></ng-container>
@ -144,8 +148,4 @@
</tr> </tr>
</table> </table>
<p>
<button (click)="create()">+ Hinzufügen</button>
</p>
</ng-container> </ng-container>

View File

@ -1,3 +1,7 @@
<p>
<button (click)="create()">+ Hinzufügen</button>
</p>
<table> <table>
<tr> <tr>
<th>&nbsp;</th> <th>&nbsp;</th>
@ -43,7 +47,3 @@
</tr> </tr>
</table> </table>
<p>
<button (click)="create()">+ Hinzufügen</button>
</p>