aboutsummaryrefslogtreecommitdiff
path: root/src/client/View
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/View')
-rw-r--r--src/client/View/Date.elm4
-rw-r--r--src/client/View/Payments/Add.elm6
-rw-r--r--src/client/View/Payments/Monthly.elm27
-rw-r--r--src/client/View/Payments/Table.elm4
4 files changed, 27 insertions, 14 deletions
diff --git a/src/client/View/Date.elm b/src/client/View/Date.elm
index c239713..81c5112 100644
--- a/src/client/View/Date.elm
+++ b/src/client/View/Date.elm
@@ -15,7 +15,7 @@ renderShortDate date translations =
, String.pad 2 '0' (toString (getMonthNumber (Date.month date)))
, toString (Date.year date)
]
- in getVarMessage params "ShortDate" translations
+ in getParamMessage params "ShortDate" translations
renderLongDate : Date -> Translations -> String
renderLongDate date translations =
@@ -24,7 +24,7 @@ renderLongDate date translations =
, (getMessage (getMonthKey (Date.month date)) translations)
, toString (Date.year date)
]
- in getVarMessage params "LongDate" translations
+ in getParamMessage params "LongDate" translations
getMonthNumber : Month -> Int
getMonthNumber month =
diff --git a/src/client/View/Payments/Add.elm b/src/client/View/Payments/Add.elm
index 21406b2..deffb95 100644
--- a/src/client/View/Payments/Add.elm
+++ b/src/client/View/Payments/Add.elm
@@ -31,7 +31,11 @@ addPayment model loggedView =
[ class "add"
, case (validateName loggedView.add.name model.translations, validateCost loggedView.add.cost model.translations) of
(Ok name, Ok cost) ->
- onSubmitPrevDefault serverCommunications.address (SC.AddPayment loggedView.me name cost loggedView.add.frequency)
+ let action =
+ case loggedView.add.frequency of
+ Punctual -> SC.AddPayment loggedView.me name cost
+ Monthly -> SC.AddMonthlyPayment name cost
+ in onSubmitPrevDefault serverCommunications.address action
(resName, resCost) ->
onSubmitPrevDefault actions.address (UpdateLoggedView <| UpdateAdd <| AddError (toMaybeError resName) (toMaybeError resCost))
]
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" ]
]
diff --git a/src/client/View/Payments/Table.elm b/src/client/View/Payments/Table.elm
index 4642f65..1646186 100644
--- a/src/client/View/Payments/Table.elm
+++ b/src/client/View/Payments/Table.elm
@@ -53,7 +53,7 @@ paymentLines model loggedView =
paymentLine : Model -> LoggedView -> Payment -> Html
paymentLine model loggedView payment =
a
- [ class ("row " ++ (if loggedView.paymentEdition == Just payment.id then "edition" else ""))
+ [ class ("row" ++ (if loggedView.paymentEdition == Just payment.id then " edition" else ""))
, onClick actions.address (UpdateLoggedView (ToggleEdit payment.id))
]
[ div [ class "cell category" ] [ text payment.name ]
@@ -77,7 +77,7 @@ paymentLine model loggedView payment =
, if loggedView.me == payment.userId
then
div
- [ class "cell remove"
+ [ class "cell delete"
, onClick serverCommunications.address (SC.DeletePayment payment.id payment.userId payment.cost loggedView.currentPage)
]
[ renderIcon "times" ]