/
SingleEdit.elm
62 lines (56 loc) · 1.95 KB
/
SingleEdit.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
module Facilities.SingleEdit exposing (..)
import Html exposing (button, div, h1, Html, input, p, text, textarea)
import Html.Attributes exposing (class, cols, placeholder, name, rows, size, type_, value)
import Html.Events exposing (onClick, onInput)
import Models exposing (Facility)
import Msgs exposing (Msg)
view : Facility -> Html Msg
view model =
div []
[ nav model
, viewFcl model
]
nav : Facility -> Html Msg
nav model =
div []
[ text "Editing..."]
viewFcl : Facility -> Html Msg
viewFcl model =
div []
[ h1 [] [ text model.name ]
, editForm model
]
editForm : Facility -> Html Msg
editForm model =
let _ = Debug.log "model:" model in
div []
[ div [ class "col col-8 px1"]
[ p []
[ text "Opening time: "
, input [ type_ "time", value model.opening.open, onInput (Msgs.ChangeOpenTime model) ] []
, text " - "
, input [ type_ "time", value model.opening.close, onInput (Msgs.ChangeCloseTime model) ] []
]
, p []
[ text "Postal code (Zip code): "
, input [ type_ "text", value model.postcode, onInput (Msgs.ChangePostCode model) ] []
]
, p []
[ text "Address: "
, input [ type_ "text", size 100, value model.address, onInput (Msgs.ChangeAddress model) ] []
]
, p []
[ text "URL: "
, input [ type_ "url", size 100, value model.web_site, onInput (Msgs.ChangeWebSite model) ] []
]
, p []
[ text "Description: "
, textarea [ rows 10, cols 100, value model.description, onInput (Msgs.ChangeDescription model)] []
]
, button [] [ text "Submit"]
]
]
--send : Facility -> Html Msg
--send model =
-- let
-- message = Msgs.ChangeOpenTime