aboutsummaryrefslogtreecommitdiff
path: root/src/client/View/Payments/Add.elm
blob: f2230be4216e4ec04830444950df9f05dd0f34ec (plain)
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
module View.Payments.Add
  ( addPayment
  ) where

import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)

import ServerCommunication as SC
import ServerCommunication exposing (serverCommunications)

import Update exposing (..)
import Update.Payment exposing (..)

addPayment : String -> String -> Html
addPayment name cost =
  div
    [ class "add" ]
    [ text "Name"
    , input
        [ value name
        , on "input" targetValue (Signal.message actions.address << UpdatePayment << UpdateName)
        ]
        []
    , text "Cost"
    , input
        [ value cost
        , on "input" targetValue (Signal.message actions.address << UpdatePayment << UpdateCost)
        ]
        []
    , button
        [ onClick serverCommunications.address (SC.AddPayment name cost) ]
        [ text "Add" ]
    ]