mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 02:48:26 +00:00
Adopt UI to allow multiple notification tasks
This commit is contained in:
93
modules/webapp/src/main/elm/Comp/NotificationList.elm
Normal file
93
modules/webapp/src/main/elm/Comp/NotificationList.elm
Normal file
@ -0,0 +1,93 @@
|
||||
module Comp.NotificationList exposing
|
||||
( Action(..)
|
||||
, Model
|
||||
, Msg
|
||||
, init
|
||||
, update
|
||||
, view
|
||||
)
|
||||
|
||||
import Api.Model.NotificationSettings exposing (NotificationSettings)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
import Util.Html
|
||||
|
||||
|
||||
type alias Model =
|
||||
{}
|
||||
|
||||
|
||||
type Msg
|
||||
= EditSettings NotificationSettings
|
||||
|
||||
|
||||
type Action
|
||||
= NoAction
|
||||
| EditAction NotificationSettings
|
||||
|
||||
|
||||
init : Model
|
||||
init =
|
||||
{}
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Action )
|
||||
update msg model =
|
||||
case msg of
|
||||
EditSettings settings ->
|
||||
( model, EditAction settings )
|
||||
|
||||
|
||||
view : Model -> List NotificationSettings -> Html Msg
|
||||
view _ items =
|
||||
div []
|
||||
[ table [ class "ui very basic table" ]
|
||||
[ thead []
|
||||
[ th [ class "collapsing" ] []
|
||||
, th [ class "collapsing" ]
|
||||
[ i [ class "check icon" ] []
|
||||
]
|
||||
, th [] [ text "Connection" ]
|
||||
, th [] [ text "Recipients" ]
|
||||
, th [] [ text "Schedule" ]
|
||||
, th [] [ text "Remind Days" ]
|
||||
]
|
||||
, tbody []
|
||||
(List.map viewItem items)
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
viewItem : NotificationSettings -> Html Msg
|
||||
viewItem item =
|
||||
tr []
|
||||
[ td [ class "collapsing" ]
|
||||
[ a
|
||||
[ href "#"
|
||||
, class "ui basic small blue label"
|
||||
, onClick (EditSettings item)
|
||||
]
|
||||
[ i [ class "edit icon" ] []
|
||||
, text "Edit"
|
||||
]
|
||||
]
|
||||
, td [ class "collapsing" ]
|
||||
[ Util.Html.checkbox item.enabled
|
||||
]
|
||||
, td []
|
||||
[ text item.smtpConnection
|
||||
]
|
||||
, td []
|
||||
[ String.join ", " item.recipients |> text
|
||||
]
|
||||
, td []
|
||||
[ code []
|
||||
[ text item.schedule
|
||||
]
|
||||
]
|
||||
, td []
|
||||
[ String.fromInt item.remindDays
|
||||
|> text
|
||||
]
|
||||
]
|
Reference in New Issue
Block a user