Hinweise zu Event-section

This commit is contained in:
PxlLoewe
2025-06-24 23:19:45 -07:00
parent 86dcf15605
commit aaa2dccee7

View File

@@ -8,6 +8,7 @@ import { deleteParticipant } from "../action";
import { checkMoodleResults, handleParticipantFinished } from "../../../../../helper/events"; import { checkMoodleResults, handleParticipantFinished } from "../../../../../helper/events";
import { AxiosError } from "axios"; import { AxiosError } from "axios";
import toast from "react-hot-toast"; import toast from "react-hot-toast";
import { useRouter } from "next/navigation";
interface ParticipantModalProps { interface ParticipantModalProps {
participantForm: UseFormReturn<Participant>; participantForm: UseFormReturn<Participant>;
@@ -15,6 +16,7 @@ interface ParticipantModalProps {
} }
export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps) => { export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps) => {
const router = useRouter();
return ( return (
<dialog className="modal" ref={ref}> <dialog className="modal" ref={ref}>
<div className="modal-box"> <div className="modal-box">
@@ -41,9 +43,14 @@ export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps
name="finisherMoodleCurseCompleted" name="finisherMoodleCurseCompleted"
label="Abschluss-Moodle-Kurs abgeschlossen" label="Abschluss-Moodle-Kurs abgeschlossen"
/> />
<div>
<div> <div>
<h3 className="text-xl">Debug</h3> <h3 className="text-xl">Debug</h3>
<p className="text-gray-500 text-sm">
Diese Aktionen Versenden u.A. Mail! Aktivitäts-log für Teilnhemer aktualisiert nicht
nach ausfühlen
</p>
</div>
<div className="flex gap-3"> <div className="flex gap-3">
<Button <Button
className="btn-sm" className="btn-sm"
@@ -62,8 +69,9 @@ export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps
} else { } else {
toast.error("Unbekannter Fehler beim ausführen des Workflows"); toast.error("Unbekannter Fehler beim ausführen des Workflows");
} }
toast.success("Workflow erfolgreich ausgeführt");
}); });
toast.success("Workflow erfolgreich ausgeführt");
router.refresh();
}} }}
> >
Event-abgeschlossen Workflow ausführen Event-abgeschlossen Workflow ausführen
@@ -74,7 +82,7 @@ export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps
if (!participantForm.watch("id")) return; if (!participantForm.watch("id")) return;
const participant = participantForm.getValues(); const participant = participantForm.getValues();
await checkMoodleResults(participant.id.toString()).catch((e) => { const result = await checkMoodleResults(participant.id.toString()).catch((e) => {
const error = e as AxiosError; const error = e as AxiosError;
if ( if (
error.response?.data && error.response?.data &&
@@ -86,6 +94,9 @@ export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps
toast.error("Unbekannter Fehler beim ausführen des Workflows"); toast.error("Unbekannter Fehler beim ausführen des Workflows");
} }
}); });
if (!result) return;
toast(result.data.message);
router.refresh();
}} }}
> >
Moodle-Kurs aktualisieren Moodle-Kurs aktualisieren