module Web.View.WidgetOwnerships.Edit where
import Web.View.Prelude
import Web.Routes ()
data EditView = EditView
{ ownership :: !WidgetOwnership
, widgets :: ![Widget]
, hubs :: ![Hub]
}
instance View EditView where
html EditView { .. } = [hsx|
Edit Ownership
{renderForm ownership hubs}
|]
renderForm :: WidgetOwnership -> [Hub] -> Html
renderForm ownership hubs = formFor ownership [hsx|
{(selectField #ownershipType ownershipTypes){ fieldLabel = "Ownership Type" }}
{dateTimeField #effectiveUntil}
{textareaField #notes}
{submitButton}
|]
where
ownershipTypes :: [(Text, Text)]
ownershipTypes = [("local","local"), ("delegated","delegated"), ("global","global")]
renderHubOption :: Hub -> Html
renderHubOption h = [hsx||]