module Web.View.StewardshipRoles.New where
import Web.View.Prelude
import Web.Routes ()
data NewView = NewView
{ role :: !StewardshipRole
, hubs :: ![Hub]
}
instance View NewView where
html NewView { .. } = [hsx|
Grant Stewardship Role
{renderForm role hubs}
|]
renderForm :: StewardshipRole -> [Hub] -> Html
renderForm role hubs = formFor role [hsx|
{(selectField #hubId (hubOptions hubs)){ fieldLabel = "Hub" }}
{(textField #roleName){ helpText = "e.g. Hub Lead, Policy Steward, Triage Owner" }}
{(textField #assignedTo){ helpText = "Person name or identifier" }}
{(textareaField #notes){ fieldLabel = "Notes (optional)" }}
{submitButton}
|]
hubOptions :: [Hub] -> [(Text, Id Hub)]
hubOptions = map (\h -> (h.name, h.id))