Revert "chore(lms): wip actions for lms table"
This reverts commit a6ddbe7f08.
WORK IN PROGRESS TRANSFERRED TO BRANCH INSTEAD
This commit is contained in:
parent
a6ddbe7f08
commit
52e6646f39
@ -45,5 +45,3 @@ LmsErrorNoRefreshElearning: Fehler: E-Lernen wird nicht automatisch gestartet, d
|
|||||||
MailSubjectQualificationRenewal qname@Text: Ihre Qualifikation #{qname} muss demnächst erneuert werden
|
MailSubjectQualificationRenewal qname@Text: Ihre Qualifikation #{qname} muss demnächst erneuert werden
|
||||||
MailSubjectQualificationExpiry qname@Text: Ihre Qualifikation #{qname} läuft demnächst ab
|
MailSubjectQualificationExpiry qname@Text: Ihre Qualifikation #{qname} läuft demnächst ab
|
||||||
MailLmsRenewalBody: Sie müssen diese Qualifikaton demnächst durch einen E-Learning Kurs erneuern.
|
MailLmsRenewalBody: Sie müssen diese Qualifikaton demnächst durch einen E-Learning Kurs erneuern.
|
||||||
LmsActNotify: Benachrichtigung E-Lernen erneut versenden
|
|
||||||
LmsActRenewPin: Neue zufällig E-Lernen PIN setzen
|
|
||||||
@ -45,5 +45,3 @@ LmsErrorNoRefreshElearning: Error: E-learning will not be started automatically
|
|||||||
MailSubjectQualificationRenewal qname@Text: Your qualification #{qname} must be renewed shortly
|
MailSubjectQualificationRenewal qname@Text: Your qualification #{qname} must be renewed shortly
|
||||||
MailSubjectQualificationExpiry qname@Text: Your qualification #{qname} expires soon
|
MailSubjectQualificationExpiry qname@Text: Your qualification #{qname} expires soon
|
||||||
MailLmsRenewalBody: You will soon need to renew this qualficiation by completing an e-learning course.
|
MailLmsRenewalBody: You will soon need to renew this qualficiation by completing an e-learning course.
|
||||||
LmsActNotify: Send e-learning notification again
|
|
||||||
LmsActRenewPin: Randomly replace e-learning PIN
|
|
||||||
@ -149,6 +149,20 @@ mkLmsAllTable = do
|
|||||||
]
|
]
|
||||||
dbtStyle = def { dbsFilterLayout = defaultDBSFilterLayout }
|
dbtStyle = def { dbsFilterLayout = defaultDBSFilterLayout }
|
||||||
dbtParams = def
|
dbtParams = def
|
||||||
|
{- = DBParamsForm
|
||||||
|
{ dbParamsFormMethod = POST
|
||||||
|
, dbParamsFormAction = Just $ SomeRoute currentRoute
|
||||||
|
, dbParamsFormAttrs = []
|
||||||
|
, dbParamsFormSubmit = FormSubmit
|
||||||
|
, dbParamsFormAdditional
|
||||||
|
= renderAForm FormStandard
|
||||||
|
$ (, mempty) . First . Just
|
||||||
|
<$> multiActionA acts (fslI MsgTableAction) Nothing
|
||||||
|
, dbParamsFormEvaluate = liftHandler . runFormPost
|
||||||
|
, dbParamsFormResult = id
|
||||||
|
, dbParamsFormIdent = def
|
||||||
|
}
|
||||||
|
-}
|
||||||
dbtIdent :: Text
|
dbtIdent :: Text
|
||||||
dbtIdent = "qualification-overview"
|
dbtIdent = "qualification-overview"
|
||||||
dbtCsvEncode = noCsvEncode
|
dbtCsvEncode = noCsvEncode
|
||||||
@ -196,25 +210,9 @@ instance HasEntity LmsTableData User where
|
|||||||
instance HasUser LmsTableData where
|
instance HasUser LmsTableData where
|
||||||
hasUser = resultUser . _entityVal
|
hasUser = resultUser . _entityVal
|
||||||
|
|
||||||
data LmsTableAction = LmsActNotify
|
mkLmsTable :: Entity Qualification -> DB (Any, Widget)
|
||||||
| LmsActRenewPin
|
|
||||||
deriving (Eq, Ord, Enum, Bounded, Read, Show, Generic, Typeable)
|
|
||||||
|
|
||||||
instance Universe LmsTableAction
|
|
||||||
instance Finite LmsTableAction
|
|
||||||
nullaryPathPiece ''LmsTableAction $ camelToPathPiece' 2
|
|
||||||
embedRenderMessage ''UniWorX ''LmsTableAction id
|
|
||||||
|
|
||||||
-- Not yet needed, since there is no additional data for now:
|
|
||||||
data LmsTableActionData = LmsActNotifyData
|
|
||||||
| LmsActRenewPinData
|
|
||||||
deriving (Eq, Ord, Read, Show, Generic, Typeable)
|
|
||||||
|
|
||||||
|
|
||||||
mkLmsTable :: Entity Qualification -> DB (FormResult (LmsTableActionData, Set UserId), Widget)
|
|
||||||
mkLmsTable (Entity qid quali) = do
|
mkLmsTable (Entity qid quali) = do
|
||||||
now <- liftIO getCurrentTime
|
now <- liftIO getCurrentTime
|
||||||
currentRoute <- fromMaybe (error "mkLmsAllTable called from 404-handler") <$> liftHandler getCurrentRoute
|
|
||||||
let
|
let
|
||||||
nowaday = utctDay now
|
nowaday = utctDay now
|
||||||
mbRenewal = addGregorianDurationClip <$> qualificationRefreshWithin quali <*> Just nowaday
|
mbRenewal = addGregorianDurationClip <$> qualificationRefreshWithin quali <*> Just nowaday
|
||||||
@ -280,39 +278,16 @@ mkLmsTable (Entity qid quali) = do
|
|||||||
else prismAForm (singletonFilter "renewal-due" . maybePrism _PathPiece) mPrev $ aopt checkBoxField (fslI MsgFilterLmsRenewal)
|
else prismAForm (singletonFilter "renewal-due" . maybePrism _PathPiece) mPrev $ aopt checkBoxField (fslI MsgFilterLmsRenewal)
|
||||||
]
|
]
|
||||||
dbtStyle = def { dbsFilterLayout = defaultDBSFilterLayout }
|
dbtStyle = def { dbsFilterLayout = defaultDBSFilterLayout }
|
||||||
|
dbtParams = def
|
||||||
dbtIdent :: Text
|
dbtIdent :: Text
|
||||||
dbtIdent = "qualification"
|
dbtIdent = "qualification"
|
||||||
dbtCsvEncode = noCsvEncode
|
dbtCsvEncode = noCsvEncode
|
||||||
dbtCsvDecode = Nothing
|
dbtCsvDecode = Nothing
|
||||||
dbtExtraReps = []
|
dbtExtraReps = []
|
||||||
dbtParams = DBParamsForm
|
|
||||||
{ dbParamsFormMethod = POST
|
|
||||||
, dbParamsFormAction = Just $ SomeRoute currentRoute
|
|
||||||
, dbParamsFormAttrs = []
|
|
||||||
, dbParamsFormSubmit = FormSubmit
|
|
||||||
, dbParamsFormAdditional
|
|
||||||
= renderAForm FormStandard
|
|
||||||
$ (, mempty) . First . Just
|
|
||||||
<$> multiActionA acts (fslI MsgTableAction) Nothing
|
|
||||||
, dbParamsFormEvaluate = liftHandler . runFormPost
|
|
||||||
, dbParamsFormResult = id
|
|
||||||
, dbParamsFormIdent = def
|
|
||||||
}
|
|
||||||
|
|
||||||
acts :: Map LmsTableAction (AForm Handler LmsTableActionData)
|
|
||||||
acts = mconcat
|
|
||||||
[ singletonMap LmsActNotify $ pure LmsActNotifyData
|
|
||||||
, singletonMap LmsActRenewPin $ pure LmsActRenewPinData
|
|
||||||
]
|
|
||||||
postprocess :: FormResult (First LmsTableActionData, DBFormResult UserId Bool (DBRow (Entity User))) -> FormResult (LmsTableActionData, Set UserId)
|
|
||||||
postprocess inp = do
|
|
||||||
(First (Just act), usrMap) <- inp
|
|
||||||
let usrSet = Map.keysSet . Map.filter id $ getDBFormResult (const False) usrMap
|
|
||||||
return (act, usrSet)
|
|
||||||
|
|
||||||
resultDBTableValidator = def
|
resultDBTableValidator = def
|
||||||
-- & defaultSorting [SortAscBy csvLmsIdent]
|
-- & defaultSorting [SortAscBy csvLmsIdent]
|
||||||
over _1 postprocess <$> dbTable resultDBTableValidator resultDBTable
|
dbTable resultDBTableValidator resultDBTable
|
||||||
|
|
||||||
getLmsR, postLmsR :: SchoolId -> QualificationShorthand -> Handler Html
|
getLmsR, postLmsR :: SchoolId -> QualificationShorthand -> Handler Html
|
||||||
getLmsR = postLmsR
|
getLmsR = postLmsR
|
||||||
|
|||||||
Reference in New Issue
Block a user