diff options
Diffstat (limited to 'src/client/View/Payments/Monthly.elm')
| -rw-r--r-- | src/client/View/Payments/Monthly.elm | 27 | 
1 files changed, 18 insertions, 9 deletions
| diff --git a/src/client/View/Payments/Monthly.elm b/src/client/View/Payments/Monthly.elm index e115dbf..944314c 100644 --- a/src/client/View/Payments/Monthly.elm +++ b/src/client/View/Payments/Monthly.elm @@ -14,7 +14,9 @@ import Model exposing (Model)  import Model.View.Payment.Monthly exposing (Monthly)  import Model.Payment exposing (Payments, Payment)  import Model.View.LoggedView exposing (LoggedView) -import Model.Translations exposing (getMessage, getVarMessage) +import Model.Translations exposing (getMessage, getParamMessage) + +import ServerCommunication as SC exposing (serverCommunications)  import View.Icon exposing (renderIcon) @@ -28,7 +30,7 @@ monthlyPayments model loggedView =            div              [ class ("monthlyPayments" ++ if monthly.visibleDetail then " detail" else "") ]              [ monthlyCount model monthly -            , if monthly.visibleDetail then paymentsTable model monthly else text "" +            , if monthly.visibleDetail then paymentsTable model loggedView monthly else text ""              ]  monthlyCount : Model -> Monthly -> Html @@ -39,7 +41,7 @@ monthlyCount model monthly =          [ class "count"          , onClick actions.address (UpdateLoggedView << UpdateMonthly <| ToggleDetail)          ] -        [ text (getVarMessage [toString count] key model.translations) +        [ text (getParamMessage [toString count] key model.translations)          , div              [ class "expand" ]              [ if monthly.visibleDetail @@ -48,16 +50,23 @@ monthlyCount model monthly =              ]          ] -paymentsTable : Model -> Monthly -> Html -paymentsTable model monthly = +paymentsTable : Model -> LoggedView -> Monthly -> Html +paymentsTable model loggedView monthly =    div      [ class "table" ] -    ( List.map (paymentLine model) monthly.payments ) +    ( List.map (paymentLine model loggedView) monthly.payments ) -paymentLine : Model -> Payment -> Html -paymentLine model payment = +paymentLine : Model -> LoggedView -> Payment -> Html +paymentLine model loggedView payment =    a -    [ class "row" ] +    [ class ("row" ++ (if loggedView.paymentEdition == Just payment.id then " edition" else "")) +    , onClick actions.address (UpdateLoggedView (ToggleEdit payment.id)) +    ]      [ div [ class "cell" ] [ text (payment.name) ]      , div [ class "cell" ] [ text (toString payment.cost ++ " " ++ getMessage "MoneySymbol" model.translations) ] +    , div +        [ class "cell delete" +        , onClick serverCommunications.address (SC.DeleteMonthlyPayment payment.id) +        ] +        [ renderIcon "times" ]      ] | 
