Copy overview page structure from weight tracker
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-06-16 18:20:17 +02:00
parent 354d28d167
commit 70acaf9738
2 changed files with 69 additions and 25 deletions

View File

@@ -1,22 +1,41 @@
@if (consumptionEntries$ | async; as consumptionEntries) { <section>
<p-scrollTop />
<div class="mb-4 flex gap-2 md:justify-between">
<div class="basis-full lg:basis-1/4 md:basis-1/2 p-0">
<p-select styleClass="w-full" [formControl]="selectedRabbit" placeholder="Kaninchen" [showClear]="true"
[options]="(rabbits$ | async)!" optionLabel="name" />
</div>
<div> <div>
<table> <p-button label="Erstellen" routerLink="/weight-entries/create">
<thead> <ng-icon name="matAddSharp"></ng-icon>
<tr> </p-button>
<th>Datum</th> </div>
<th>Distanz</th> </div>
<th>Menge</th> <div>
</tr> @if (filteredWeightEntries$ | async; as weightEntries) {
</thead> <p-dataView [value]="weightEntries"
<tbody> [paginator]="true"
@for (entry of consumptionEntries; track entry.id) { [rows]="rowsPerPageDefaultOption"
<tr> [rowsPerPageOptions]="rowsPerPageOptions"
<td>{{ entry.dateTime | date }}</td> [pageLinks]="0"
<td>{{ entry.distance }} km</td> [showCurrentPageReport]="true"
<td>{{ entry.amount }} l</td> [currentPageReportTemplate]="currentPageReportTemplate"
</tr> layout="list">
<ng-template #list let-entries>
<div class="flex flex-col gap-2">
@for (weightEntry of entries; track weightEntry.id) {
<app-weight-entry-card [weightEntry]="weightEntry"
(entryDeleted)="onEntryDeleted($event)"></app-weight-entry-card>
}
</div>
</ng-template>
</p-dataView>
} @else {
<div class="flex flex-col gap-2">
@for (_ of skeletonsIterationSource; track $index) {
<p-skeleton height="4rem" styleClass="mb-2" />
} }
</tbody>
</table>
</div> </div>
} }
</div>
</section>

View File

@@ -1,12 +1,37 @@
import { AsyncPipe, DatePipe } from '@angular/common'; import { CommonModule } from '@angular/common';
import { HttpClient } from '@angular/common/http';
import { Component, inject } from '@angular/core'; import { Component, inject } from '@angular/core';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
import { RouterLink } from '@angular/router';
import { MessageService } from 'primeng/api';
import { ButtonModule } from 'primeng/button';
import { DataViewModule } from 'primeng/dataview';
import { SelectModule } from 'primeng/select';
import { ScrollTopModule } from 'primeng/scrolltop';
import { SkeletonModule } from 'primeng/skeleton';
import {
BehaviorSubject,
combineLatest,
map,
Observable,
of,
startWith,
tap,
} from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { map, Observable, tap } from 'rxjs';
@Component({ @Component({
selector: 'app-entries', selector: 'app-entries',
imports: [AsyncPipe, DatePipe], imports: [
ButtonModule,
CommonModule,
DataViewModule,
SkeletonModule,
SelectModule,
ReactiveFormsModule,
RouterLink,
ScrollTopModule,
],
templateUrl: './entries.component.html', templateUrl: './entries.component.html',
styleUrl: './entries.component.scss' styleUrl: './entries.component.scss'
}) })