forked from fahrPool/fahrPool
feat: show Foto-Galerie on Auftrag detail page
This commit is contained in:
parent
3e544be8ce
commit
9406ab31d7
|
|
@ -3,6 +3,8 @@ import Link from "next/link";
|
|||
import { loadAuftrag, findeFolgeauftrag } from "@/lib/auftraege/queries";
|
||||
import { loadProfile } from "@/lib/auth/profile";
|
||||
import { PFLICHT_FOTO_POSITIONEN } from "@/lib/auftraege/foto-positionen";
|
||||
import { loadAuftragFotos } from "@/lib/auftraege/fotos";
|
||||
import { FotoGalerie } from "@/components/auftraege/FotoGalerie";
|
||||
import { uebernehmen, fahrtBeginnen, schadenFotoNachtragen, fahrtBeenden, stornieren } from "./actions";
|
||||
import { Card } from "@/components/ui/Card";
|
||||
import { StatusBadge } from "@/components/ui/StatusBadge";
|
||||
|
|
@ -33,7 +35,10 @@ export default async function AuftragDetailPage({
|
|||
// beide aktuell denselben Rollenkreis (admin) ueberschneiden koennten.
|
||||
const kannStornieren =
|
||||
profileResult.profile.role === "admin" || profileResult.profile.role === "disponent";
|
||||
const folgeauftrag = auftrag.status === "abgeschlossen" ? await findeFolgeauftrag(auftrag.id) : null;
|
||||
const [folgeauftrag, fotos] = await Promise.all([
|
||||
auftrag.status === "abgeschlossen" ? findeFolgeauftrag(auftrag.id) : Promise.resolve(null),
|
||||
loadAuftragFotos(auftrag.id),
|
||||
]);
|
||||
|
||||
const uebernehmenAction = uebernehmen.bind(null, auftrag.id);
|
||||
const fahrtBeginnenAction = fahrtBeginnen.bind(null, auftrag.id);
|
||||
|
|
@ -79,6 +84,13 @@ export default async function AuftragDetailPage({
|
|||
</dl>
|
||||
</Card>
|
||||
|
||||
{fotos.length > 0 && (
|
||||
<Card className="mb-6">
|
||||
<h2 className="mb-4 text-lg font-semibold text-asphalt-grey">Fotos</h2>
|
||||
<FotoGalerie fotos={fotos} />
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{auftrag.status === "offen" && (
|
||||
<Card className="mb-6">
|
||||
<form action={uebernehmenAction}>
|
||||
|
|
|
|||
Loading…
Reference in New Issue