diff --git a/ApiCore-Frontend/src/app/(app)/apiaries/[id]/page.tsx b/ApiCore-Frontend/src/app/(app)/apiaries/[id]/page.tsx index b736ee6..3ed7324 100644 --- a/ApiCore-Frontend/src/app/(app)/apiaries/[id]/page.tsx +++ b/ApiCore-Frontend/src/app/(app)/apiaries/[id]/page.tsx @@ -4,6 +4,7 @@ import Link from "next/link"; import { useParams } from "next/navigation"; import { useQuery } from "@tanstack/react-query"; import { fetchApiary } from "@/lib/apiaries/api"; +import { QrCodeDialog } from "@/components/qr-code-dialog"; import { Button } from "@/components/ui/button"; import { ApiaryEditCard } from "./apiary-edit-card"; @@ -27,6 +28,9 @@ export default function ApiaryDetailPage() { return (
+
+ +
+ } + /> + + + {label} + + {isLoading ?

Lädt…

: null} + {isError ? ( +

+ QR-Code konnte nicht geladen werden. +

+ ) : null} + {objectUrl ? ( + // eslint-disable-next-line @next/next/no-img-element -- blob: object URL, next/image cannot handle this + QR-Code + ) : null} +
+ + ); +} diff --git a/ApiCore-Frontend/src/lib/qr/api.ts b/ApiCore-Frontend/src/lib/qr/api.ts new file mode 100644 index 0000000..5741f9f --- /dev/null +++ b/ApiCore-Frontend/src/lib/qr/api.ts @@ -0,0 +1,13 @@ +import { apiFetchBlob } from "@/lib/auth/api-client"; + +export type QrEntityType = + | "colonies" + | "apiaries" + | "queens" + | "honey-batches" + | "storage-containers"; + +export async function fetchQrCodeSvg(entityType: QrEntityType, id: string): Promise { + const { blob } = await apiFetchBlob(`/qr/${entityType}/${id}.svg`, `${entityType}.svg`); + return blob; +} diff --git a/TASKS.md b/TASKS.md index 282e0be..1c8d6e2 100644 --- a/TASKS.md +++ b/TASKS.md @@ -180,7 +180,7 @@ Reihenfolge = Bau-Reihenfolge. Gleiche Haken-Regel wie MVP: erst setzen, wenn Li - Endpunkte: `GET /api/v1/qr/:entityType/:id.svg` für `entityType` ∈ `colonies|apiaries|queens|honey-batches|storage-containers` - Frontend: "QR-Code"-Button/Dialog auf den jeweiligen Detailseiten, druckfreundliche Ansicht - [x] Backend-Modul fertig, getestet, grün, committet -- [ ] Frontend-Views fertig, getestet, grün, committet +- [x] Frontend-Views fertig, getestet, grün, committet ### 23. Abfüllungen und Produkte