Hinweise zu Event-section
This commit is contained in:
@@ -8,6 +8,7 @@ import { deleteParticipant } from "../action";
|
||||
import { checkMoodleResults, handleParticipantFinished } from "../../../../../helper/events";
|
||||
import { AxiosError } from "axios";
|
||||
import toast from "react-hot-toast";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
interface ParticipantModalProps {
|
||||
participantForm: UseFormReturn<Participant>;
|
||||
@@ -15,6 +16,7 @@ interface ParticipantModalProps {
|
||||
}
|
||||
|
||||
export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps) => {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<dialog className="modal" ref={ref}>
|
||||
<div className="modal-box">
|
||||
@@ -41,9 +43,14 @@ export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps
|
||||
name="finisherMoodleCurseCompleted"
|
||||
label="Abschluss-Moodle-Kurs abgeschlossen"
|
||||
/>
|
||||
<div>
|
||||
<div>
|
||||
<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">
|
||||
<Button
|
||||
className="btn-sm"
|
||||
@@ -62,8 +69,9 @@ export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps
|
||||
} else {
|
||||
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
|
||||
@@ -74,7 +82,7 @@ export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps
|
||||
if (!participantForm.watch("id")) return;
|
||||
|
||||
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;
|
||||
if (
|
||||
error.response?.data &&
|
||||
@@ -86,6 +94,9 @@ export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps
|
||||
toast.error("Unbekannter Fehler beim ausführen des Workflows");
|
||||
}
|
||||
});
|
||||
if (!result) return;
|
||||
toast(result.data.message);
|
||||
router.refresh();
|
||||
}}
|
||||
>
|
||||
Moodle-Kurs aktualisieren
|
||||
|
||||
Reference in New Issue
Block a user