feat(allocations): show staff descriptions

This commit is contained in:
Gregor Kleen 2020-09-25 12:02:59 +02:00
parent ff17a4a4ca
commit b359468593

View File

@ -243,6 +243,15 @@ makeCourseForm miButtonAction template = identifyForm FIDcourse . validateFormDB
allocationOptions <- mkOptionList <$> mapM mkAllocationOption (availableAllocations ++ activeAllocations)
let
explainedAllocationOptions = return allocationOptions `explainOptionList` \allocId -> hoistMaybe . listToMaybe $ do
(Entity allocId' Allocation{..}, _) <- availableAllocations'
guard $ allocId' == allocId
toWidget <$> hoistMaybe allocationStaffDescription
doExplain = has (folded . _entityVal . _allocationStaffDescription . _Just) $ availableAllocations ++ activeAllocations
allocField | doExplain = explainedSelectionField Nothing explainedAllocationOptions
| otherwise = selectField' Nothing $ return allocationOptions
userAdmin = not $ null adminSchools
mayChange = Just False /= fmap (|| userAdmin) currentAllocationAvailable
@ -254,7 +263,7 @@ makeCourseForm miButtonAction template = identifyForm FIDcourse . validateFormDB
| otherwise
= aforcedJust
in AllocationCourseForm
<$> ainp (selectField' Nothing $ return allocationOptions) (fslI MsgCourseAllocation) (fmap acfAllocation $ template >>= cfAllocation)
<$> ainp allocField (fslI MsgCourseAllocation) (fmap acfAllocation $ template >>= cfAllocation)
<*> ainp (natFieldI MsgCourseAllocationMinCapacityMustBeNonNegative) (fslI MsgCourseAllocationMinCapacity & setTooltip MsgCourseAllocationMinCapacityTip) (fmap acfMinCapacity $ template >>= cfAllocation)
<*> apopt checkBoxField (fslI MsgCourseDeregisterNoShow & setTooltip MsgCourseDeregisterNoShowTip) ((<|> Just True) . fmap acfDeregisterNoShow $ template >>= cfAllocation)