New Angular based web version #1
@@ -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>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Datum</th>
|
||||
<th>Distanz</th>
|
||||
<th>Menge</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (entry of consumptionEntries; track entry.id) {
|
||||
<tr>
|
||||
<td>{{ entry.dateTime | date }}</td>
|
||||
<td>{{ entry.distance }} km</td>
|
||||
<td>{{ entry.amount }} l</td>
|
||||
</tr>
|
||||
<p-button label="Erstellen" routerLink="/weight-entries/create">
|
||||
<ng-icon name="matAddSharp"></ng-icon>
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
@if (filteredWeightEntries$ | async; as weightEntries) {
|
||||
<p-dataView [value]="weightEntries"
|
||||
[paginator]="true"
|
||||
[rows]="rowsPerPageDefaultOption"
|
||||
[rowsPerPageOptions]="rowsPerPageOptions"
|
||||
[pageLinks]="0"
|
||||
[showCurrentPageReport]="true"
|
||||
[currentPageReportTemplate]="currentPageReportTemplate"
|
||||
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>
|
||||
</section>
|
||||
|
||||
@@ -1,12 +1,37 @@
|
||||
import { AsyncPipe, DatePipe } from '@angular/common';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { CommonModule } from '@angular/common';
|
||||
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 { map, Observable, tap } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-entries',
|
||||
imports: [AsyncPipe, DatePipe],
|
||||
imports: [
|
||||
ButtonModule,
|
||||
CommonModule,
|
||||
DataViewModule,
|
||||
SkeletonModule,
|
||||
SelectModule,
|
||||
ReactiveFormsModule,
|
||||
RouterLink,
|
||||
ScrollTopModule,
|
||||
],
|
||||
templateUrl: './entries.component.html',
|
||||
styleUrl: './entries.component.scss'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user