From bf17dc54c9b695ba9e7907c7bbb9f63480a1b460 Mon Sep 17 00:00:00 2001 From: itskovacs Date: Sat, 4 Oct 2025 13:15:41 +0200 Subject: [PATCH] :sparkles: Trip: pretty print, :lipstick: Trip: enhance place UI in table --- .../app/components/trip/trip.component.html | 154 +++++++++++++++--- .../app/components/trip/trip.component.scss | 5 + src/src/app/shared/order-by.pipe.ts | 16 ++ 3 files changed, 153 insertions(+), 22 deletions(-) create mode 100644 src/src/app/shared/order-by.pipe.ts diff --git a/src/src/app/components/trip/trip.component.html b/src/src/app/components/trip/trip.component.html index 594cf96..bb27f6f 100644 --- a/src/src/app/components/trip/trip.component.html +++ b/src/src/app/components/trip/trip.component.html @@ -1,4 +1,4 @@ -
+
@@ -32,7 +32,8 @@
@if (trip?.archived) { -
+
Archived
@@ -41,9 +42,9 @@
} -
+
+ class="p-4 shadow self-start rounded-md max-w-screen">
@@ -64,7 +65,7 @@ text /> - +
@@ -134,12 +135,14 @@ {{ tripitem.text }}
} - @if (tripTableSelectedColumns.includes('place')) { + @if (tripTableSelectedColumns.includes('place')) { @if (tripitem.place) { -
- {{ - tripitem.place.name }} +
+
+ +
+ {{ tripitem.place.name }}
} @else {-} } @@ -148,7 +151,7 @@
{{ + class="absolute left-0 top-1/2 -translate-y-1/2 size-9 rounded-full object-cover" /> {{ tripitem.comment }}
} @else { @@ -195,12 +198,14 @@ {{ tripitem.text }}
} - @if (tripTableSelectedColumns.includes('place')) { + @if (tripTableSelectedColumns.includes('place')) { @if (tripitem.place) { -
- {{ - tripitem.place.name }} +
+
+ +
+ {{ tripitem.place.name }}
} @else {-} } @@ -372,8 +377,7 @@
-
-
+
@if (!selectedItem) { @@ -519,17 +523,18 @@ @if (isMapFullscreen) { -
+
-
+
+ class="fixed bottom-4 left-2 bg-white shadow rounded dark:bg-surface-900 min-w-32 max-w-48 max-h-96 overflow-y-auto" + [class.prettyprint]="isPrinting">

Days

@for (day of trip?.days; track day.id) { @@ -708,4 +713,109 @@ }
- \ No newline at end of file + + +@if (isPrinting) { + +} \ No newline at end of file diff --git a/src/src/app/components/trip/trip.component.scss b/src/src/app/components/trip/trip.component.scss index f22b193..a38b049 100644 --- a/src/src/app/components/trip/trip.component.scss +++ b/src/src/app/components/trip/trip.component.scss @@ -1,4 +1,9 @@ @media print { + .prettyprint { + display: none; + visibility: hidden; + } + .print-striped-rows tr:nth-child(even) { background-color: #f9f9f9 !important; } diff --git a/src/src/app/shared/order-by.pipe.ts b/src/src/app/shared/order-by.pipe.ts new file mode 100644 index 0000000..33e4a90 --- /dev/null +++ b/src/src/app/shared/order-by.pipe.ts @@ -0,0 +1,16 @@ +import { Pipe, PipeTransform } from "@angular/core"; +@Pipe({ + name: "orderBy", + pure: true, + standalone: true, +}) +export class orderByPipe implements PipeTransform { + transform(items: any[], field: string): any[] { + if (!items || items.length === 0) { + return items; + } + return items + .slice() + .sort((a, b) => (a[field] < b[field] ? -1 : a[field] > b[field] ? 1 : 0)); + } +}