added suer to p-log, HUB_URL in hub-server, dynamic badges in email

This commit is contained in:
PxlLoewe
2025-03-12 17:44:53 -07:00
parent b1992f64d3
commit b573d7cd5a
11 changed files with 79 additions and 41 deletions

View File

@@ -123,7 +123,7 @@ export const AppointmentModal = ({
</span>
);
} else {
return <span>Abwarten</span>;
return <span>?</span>;
}
},
},
@@ -149,7 +149,7 @@ export const AppointmentModal = ({
onClick={async () => {
await upsertParticipant({
eventId: event!.id,
userId: participantForm.watch("userId"),
userId: row.original.userId,
attended: true,
appointmentCancelled: false,
});
@@ -160,32 +160,33 @@ export const AppointmentModal = ({
Anwesend
</button>
)}
{!row.original.attended && event?.hasPresenceEvents && (
<button
type="button"
onSubmit={() => {}}
onClick={async () => {
await upsertParticipant({
eventId: event!.id,
userId: participantForm.watch("userId"),
attended: false,
appointmentCancelled: true,
statusLog: [
...(row.original.statusLog as any),
{
event: "Gefehlt",
timestamp: new Date().toISOString(),
user: `${session?.user?.firstname} (${session?.user?.lastname} - ${session?.user?.publicId})`,
},
],
});
participantTableRef.current?.refresh();
}}
className="btn btn-outline btn-error btn-sm"
>
nicht da
</button>
)}
{!row.original.appointmentCancelled &&
event?.hasPresenceEvents && (
<button
type="button"
onSubmit={() => {}}
onClick={async () => {
await upsertParticipant({
eventId: event!.id,
userId: row.original.userId,
attended: false,
appointmentCancelled: true,
statusLog: [
...(row.original.statusLog as any),
{
event: "Gefehlt an Event",
timestamp: new Date().toISOString(),
user: `${session?.user?.firstname} ${session?.user?.lastname} - ${session?.user?.publicId}`,
},
],
});
participantTableRef.current?.refresh();
}}
className="btn btn-outline btn-error btn-sm"
>
abwesend
</button>
)}
</div>
);
},

View File

@@ -1,6 +1,6 @@
import { Switch } from "../../../../_components/ui/Switch";
import { Button } from "../../../../_components/ui/Button";
import { Participant, Prisma } from "@repo/db";
import { Participant, ParticipantLog, Prisma } from "@repo/db";
import { UseFormReturn } from "react-hook-form";
import { upsertParticipant } from "../../../events/actions";
import { RefObject } from "react";
@@ -59,7 +59,7 @@ export const ParticipantModal = ({
<h3 className="text-xl">Termine</h3>
<p className="w-full flex justify-between">
<span>Termin ausgewählt</span>
<span>Termin ausgewählt am</span>
<span>
{new Date(
participantForm.watch("enscriptionDate"),
@@ -69,9 +69,12 @@ export const ParticipantModal = ({
</div>
<div className="flex flex-col">
<h3 className="text-xl">Verlauf</h3>
{participantForm.watch("statusLog")?.map((s) => (
{(
participantForm.watch("statusLog") as unknown as ParticipantLog[]
)?.map((s) => (
<div className="flex justify-between" key={(s as any).timestamp}>
<p>{(s as any).event}</p>
<p>{s.event}</p>
<p>{s.user}</p>
<p>{new Date((s as any).timestamp).toLocaleString()}</p>
</div>
))}

View File

@@ -214,6 +214,7 @@ const ModalBtn = ({
appointmentDate:
selectedAppointment.appointmentDate,
},
user: `${user?.firstname} ${user?.lastname} - ${user?.publicId}`,
event: "Termin abgesagt",
timestamp: new Date(),
},

View File

@@ -12,7 +12,8 @@
"**/*.tsx",
"next-env.d.ts",
"next.config.js",
".next/types/**/*.ts"
".next/types/**/*.ts",
"types/.d.ts"
],
"exclude": ["node_modules"]
}

View File

@@ -1,4 +1,5 @@
import { Prisma } from "@prisma/client";
import { JsonArray, JsonObject } from "@prisma/client/runtime/library";
declare module "@prisma/client" {
export type InputJsonValue =
@@ -8,4 +9,6 @@ declare module "@prisma/client" {
| null
| JsonObject
| JsonArray;
export type JsonValue = any; // Erzwingt Flexibilität
}