diff --git a/messages/uniworx/categories/courses/tutorial/de-de-formal.msg b/messages/uniworx/categories/courses/tutorial/de-de-formal.msg index 9ed2c42cd..82cd5c5ba 100644 --- a/messages/uniworx/categories/courses/tutorial/de-de-formal.msg +++ b/messages/uniworx/categories/courses/tutorial/de-de-formal.msg @@ -61,4 +61,9 @@ TutorialDayNote day@Text: Anwesenheitsnotiz #{day} TutorialParticipantsDayEdits day@Text: Kursteilnehmer-Tagesnotizen aktualisiert für #{day} CheckEyePermitMissing: Sehtest oder Führerschein fehlen noch -CheckEyePermitIncompatible: Sehtest und Führerschein passen nicht zusammen \ No newline at end of file +CheckEyePermitIncompatible: Sehtest und Führerschein passen nicht zusammen + +GenTutActions: Prüfungsaktionen +GenTutActNone !ident-ok: -- +GenTutActOccAdd: Neuen Prüfungstermin hinzufügen +GenTutActOccEdit: Prüfungstermin bearbeiten \ No newline at end of file diff --git a/messages/uniworx/categories/courses/tutorial/en-eu.msg b/messages/uniworx/categories/courses/tutorial/en-eu.msg index 9ba136306..686b01f58 100644 --- a/messages/uniworx/categories/courses/tutorial/en-eu.msg +++ b/messages/uniworx/categories/courses/tutorial/en-eu.msg @@ -62,4 +62,9 @@ TutorialDayNote day: Attendance note #{day} TutorialParticipantsDayEdits day: course participant day notes updated for #{day} CheckEyePermitMissing: Eye exam or driving permit missing -CheckEyePermitIncompatible: Eye exam and driving permit are incompatible \ No newline at end of file +CheckEyePermitIncompatible: Eye exam and driving permit are incompatible + +GenTutActions: Examination actions +GenTutActNone: -- +GenTutActOccAdd: Add new exam occurence +GenTutActOccEdit: Edit exam occurence \ No newline at end of file diff --git a/src/Handler/Tutorial/Users.hs b/src/Handler/Tutorial/Users.hs index dd9557920..421947221 100644 --- a/src/Handler/Tutorial/Users.hs +++ b/src/Handler/Tutorial/Users.hs @@ -31,6 +31,36 @@ import qualified Database.Esqueleto.Experimental as E -- needs TypeApplications import Handler.Course.Users +data GenTutAction + = GenTutActNone -- Dummy action to hide form in a more natural way + | GenTutActOccAdd + | GenTutActOccEdit + deriving (Eq, Ord, Enum, Bounded, Read, Show, Generic) + deriving anyclass (Universe, Finite) + +nullaryPathPiece ''GenTutAction $ camelToPathPiece' 1 +embedRenderMessage ''UniWorX ''GenTutAction id + +data GenTutActionData + = GenTutActNoneData -- Dummy action to hide form in a more natural way + | GenTutActOccAddData + | GenTutActOccEditData + deriving (Eq, Ord, Read, Show, Generic) + +genTutActionMap ::(_ -> Text) -> Map GenTutAction (AForm Handler GenTutActionData) +genTutActionMap _mr = Map.fromList + [ (GenTutActNone + , pure GenTutActNoneData ) + , (GenTutActOccAdd + , pure GenTutActOccAddData ) + , (GenTutActOccEdit + , pure GenTutActOccEditData) -- TODO + ] + +makeGenTutActionForm :: (_ -> Text) -> Form GenTutActionData +makeGenTutActionForm mr html = flip (renderAForm FormStandard) html $ multiActionA (genTutActionMap mr) (fslI MsgGenTutActions) (Just GenTutActNone) + + data TutorialUserAction = TutorialUserAssignExam | TutorialUserPrintQualification @@ -99,8 +129,7 @@ postTUsersR tid ssh csh tutn = do qualOptions = qualificationsOptionList qualifications lessons = occurringLessons trm $ tutEnt ^. _entityVal . _tutorialTime . _Wrapped' timespan = lessonTimesSpan lessons - $logDebugS "Occurrences" $ tshow timespan - exOccs <- flip foldMapM timespan $ getDayExamOccurrences True ssh $ Just cid + exOccs <- flip foldMapM timespan $ getDayExamOccurrences False ssh $ Just cid -- TODO: change back default to True let acts :: Map TutorialUserAction (AForm Handler TutorialUserActionData) acts = Map.fromList $ @@ -199,6 +228,31 @@ postTUsersR tid ssh csh tutn = do E.where_ $ tutor E.^. TutorTutorial E.==. E.val tutid return user + let mr :: (() -> Text) = const "TODO: message renderer for general tutorial action form" -- getMessageRender + genTutActWgt <- do + ((_gtaRes, gtaWgt), gtaEnctype) <- runFormPost . identifyForm FIDGeneralTutorialAction $ makeGenTutActionForm mr + let gtaAnchor = "general-tutorial-action-form" :: Text + gtaRoute = croute :#: gtaAnchor + gtaForm = wrapForm gtaWgt FormSettings + { formMethod = POST + , formAction = Just . SomeRoute $ gtaRoute + , formEncoding = gtaEnctype + , formAttrs = [] + , formSubmit = FormSubmit + , formAnchor = Just gtaAnchor + } + + ----------------------------------------------- + -- !!!!!TODO: evaluate form result !!!!!!!!! -- + ----------------------------------------------- + + return [whamlet| +
+ ^{gtaForm}
+ |]
let heading = prependCourseTitle tid ssh csh $ CI.original tutorialName
html <- siteLayoutMsg heading $ do
setTitleI heading
diff --git a/src/Utils/Form.hs b/src/Utils/Form.hs
index 39f7bf88c..cc72f86cb 100644
--- a/src/Utils/Form.hs
+++ b/src/Utils/Form.hs
@@ -324,6 +324,7 @@ data FormIdentifier
| FIDAddSupervisor
| FIDFirmUserChangeRequest
| FIDFirmAction
+ | FIDGeneralTutorialAction
| FIDUnreachableUsersAction
deriving (Eq, Ord, Read, Show)
diff --git a/templates/tutorial-participants.hamlet b/templates/tutorial-participants.hamlet
index 8886de37a..21569c580 100644
--- a/templates/tutorial-participants.hamlet
+++ b/templates/tutorial-participants.hamlet
@@ -17,3 +17,5 @@ $# SPDX-License-Identifier: AGPL-3.0-or-later
^{userEmailWidget usr}