aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/LoggedIn
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/LoggedIn')
-rw-r--r--src/client/elm/LoggedIn/Home/Header/View.elm6
-rw-r--r--src/client/elm/LoggedIn/Home/View/ExceedingPayers.elm2
-rw-r--r--src/client/elm/LoggedIn/Home/View/Table.elm24
-rw-r--r--src/client/elm/LoggedIn/Income/View.elm14
-rw-r--r--src/client/elm/LoggedIn/Income/View/Table.elm22
-rw-r--r--src/client/elm/LoggedIn/Msg.elm14
-rw-r--r--src/client/elm/LoggedIn/Stat/View.elm2
-rw-r--r--src/client/elm/LoggedIn/Update.elm49
8 files changed, 36 insertions, 97 deletions
diff --git a/src/client/elm/LoggedIn/Home/Header/View.elm b/src/client/elm/LoggedIn/Home/Header/View.elm
index e6b2444..b67fb3b 100644
--- a/src/client/elm/LoggedIn/Home/Header/View.elm
+++ b/src/client/elm/LoggedIn/Home/Header/View.elm
@@ -46,7 +46,7 @@ view loggedData { search } payments frequency =
loggedData
(AddPayment.initialAdd loggedData.translations currentDate frequency)
"AddPayment"
- (text (getMessage "AddPayment" loggedData.translations))
+ (text (getMessage loggedData.translations "AddPayment"))
Nothing
]
, Html.div
@@ -78,7 +78,7 @@ infos loggedData payments =
[ class "infos" ]
[ span
[ class "total" ]
- [ text <| getParamMessage [ count, sum ] "Worth" loggedData.translations ]
+ [ text <| getParamMessage [ count, sum ] loggedData.translations "Worth" ]
, span
[ class "partition" ]
[ text <| paymentsPartition loggedData payments ]
@@ -95,7 +95,7 @@ paymentsPartition loggedData payments =
|> List.sortBy fst
|> List.reverse
|> List.map (\(sum, user) ->
- getParamMessage [ user.name, Format.price loggedData.conf sum ] "By" loggedData.translations
+ getParamMessage [ user.name, Format.price loggedData.conf sum ] loggedData.translations "By"
)
)
diff --git a/src/client/elm/LoggedIn/Home/View/ExceedingPayers.elm b/src/client/elm/LoggedIn/Home/View/ExceedingPayers.elm
index 15f5cf5..6f2439c 100644
--- a/src/client/elm/LoggedIn/Home/View/ExceedingPayers.elm
+++ b/src/client/elm/LoggedIn/Home/View/ExceedingPayers.elm
@@ -24,7 +24,7 @@ view loggedData =
in div
[ class "exceedingPayers" ]
( if List.isEmpty exceedingPayers
- then [ text <| getMessage "PaymentsAreBalanced" loggedData.translations ]
+ then [ text <| getMessage loggedData.translations "PaymentsAreBalanced" ]
else (List.map (exceedingPayer loggedData) exceedingPayers)
)
diff --git a/src/client/elm/LoggedIn/Home/View/Table.elm b/src/client/elm/LoggedIn/Home/View/Table.elm
index 6c12f31..6423bf9 100644
--- a/src/client/elm/LoggedIn/Home/View/Table.elm
+++ b/src/client/elm/LoggedIn/Home/View/Table.elm
@@ -48,7 +48,7 @@ view loggedData homeModel payments frequency =
then
div
[ class "emptyTableMsg" ]
- [ text <| getMessage "NoPayment" loggedData.translations ]
+ [ text <| getMessage loggedData.translations "NoPayment" ]
else
text ""
]
@@ -57,11 +57,11 @@ headerLine : LoggedData -> Frequency -> Html Msg
headerLine loggedData frequency =
div
[ class "header" ]
- [ div [ class "cell category" ] [ text <| getMessage "Name" loggedData.translations ]
- , div [ class "cell cost" ] [ text <| getMessage "Cost" loggedData.translations ]
- , div [ class "cell user" ] [ text <| getMessage "Payer" loggedData.translations ]
+ [ div [ class "cell category" ] [ text <| getMessage loggedData.translations "Name" ]
+ , div [ class "cell cost" ] [ text <| getMessage loggedData.translations "Cost" ]
+ , div [ class "cell user" ] [ text <| getMessage loggedData.translations "Payer" ]
, case frequency of
- Punctual -> div [ class "cell date" ] [ text <| getMessage "Date" loggedData.translations ]
+ Punctual -> div [ class "cell date" ] [ text <| getMessage loggedData.translations "Date" ]
Monthly -> text ""
, div [ class "cell" ] []
, div [ class "cell" ] []
@@ -108,7 +108,7 @@ paymentLine loggedData homeModel frequency payment =
(AddPayment.initialClone loggedData.translations currentDate payment)
"ClonePayment"
(FontAwesome.clone Color.chestnutRose 18)
- (Just (getMessage "Clone" loggedData.translations))
+ (Just (getMessage loggedData.translations "Clone"))
]
, div
[ class "cell button" ]
@@ -121,7 +121,7 @@ paymentLine loggedData homeModel frequency payment =
(AddPayment.initialEdit loggedData.translations payment)
"EditPayment"
(FontAwesome.pencil Color.chestnutRose 18)
- (Just (getMessage "Edit" loggedData.translations))
+ (Just (getMessage loggedData.translations "Edit"))
]
, div
[ class "cell button" ]
@@ -131,14 +131,14 @@ paymentLine loggedData homeModel frequency payment =
else
let dialogConfig =
{ className = "deletePaymentDialog"
- , title = getMessage "ConfirmPaymentDelete" loggedData.translations
+ , title = getMessage loggedData.translations "ConfirmPaymentDelete"
, body = always <| text ""
- , confirm = getMessage "Confirm" loggedData.translations
- , confirmMsg = always <| Msg.Dialog <| Dialog.UpdateAndClose <| Msg.UpdateLoggedIn <| LoggedInMsg.DeletePayment payment.id
- , undo = getMessage "Undo" loggedData.translations
+ , confirm = getMessage loggedData.translations "Confirm"
+ , confirmMsg = always <| Msg.Dialog <| Dialog.UpdateAndClose <| Msg.DeletePayment payment.id
+ , undo = getMessage loggedData.translations "Undo"
}
in button
- ( Tooltip.show Msg.Tooltip (getMessage "Delete" loggedData.translations)
+ ( Tooltip.show Msg.Tooltip (getMessage loggedData.translations "Delete")
++ [ onClick (Msg.Dialog <| Dialog.Open dialogConfig) ]
)
[ FontAwesome.trash Color.chestnutRose 18 ]
diff --git a/src/client/elm/LoggedIn/Income/View.elm b/src/client/elm/LoggedIn/Income/View.elm
index 5a2c18e..2c5bcaf 100644
--- a/src/client/elm/LoggedIn/Income/View.elm
+++ b/src/client/elm/LoggedIn/Income/View.elm
@@ -50,13 +50,13 @@ view loggedData incomeModel =
Nothing -> text ""
, div
[ class "textual monthlyNetIncomes" ]
- [ h1 [] [ text <| getMessage "MonthlyNetIncomes" loggedData.translations ]
+ [ h1 [] [ text <| getMessage loggedData.translations "MonthlyNetIncomes" ]
, AddIncome.button
"addIncome"
loggedData
(AddIncome.initialAdd loggedData.translations (Date.fromTime loggedData.currentTime))
"AddIncome"
- (text (getMessage "AddIncome" loggedData.translations))
+ (text (getMessage loggedData.translations "AddIncome"))
Nothing
]
, Table.view loggedData incomeModel
@@ -67,7 +67,7 @@ cumulativeIncomesView loggedData since =
let longDate = Date.longView (Date.fromTime since) loggedData.translations
in div
[ class "textual" ]
- [ h1 [] [ text <| getParamMessage [longDate] "CumulativeIncomesSince" loggedData.translations ]
+ [ h1 [] [ text <| getParamMessage [longDate] loggedData.translations "CumulativeIncomesSince" ]
, ul
[]
( Dict.toList loggedData.users
@@ -95,11 +95,11 @@ incomeView loggedData (incomeId, income) =
, text <| Format.price loggedData.conf income.amount
, let dialogConfig =
{ className = "deleteIncomeDialog"
- , title = getMessage "ConfirmIncomeDelete" loggedData.translations
+ , title = getMessage loggedData.translations "ConfirmIncomeDelete"
, body = always <| text ""
- , confirm = getMessage "Confirm" loggedData.translations
- , confirmMsg = always <| Msg.Dialog <| Dialog.UpdateAndClose <| Msg.UpdateLoggedIn <| LoggedInMsg.DeleteIncome incomeId
- , undo = getMessage "Undo" loggedData.translations
+ , confirm = getMessage loggedData.translations "Confirm"
+ , confirmMsg = always <| Msg.Dialog <| Dialog.UpdateAndClose <| Msg.DeleteIncome incomeId
+ , undo = getMessage loggedData.translations "Undo"
}
in button
[ onClick (Msg.Dialog <| Dialog.Open dialogConfig) ]
diff --git a/src/client/elm/LoggedIn/Income/View/Table.elm b/src/client/elm/LoggedIn/Income/View/Table.elm
index cf82772..dcf6d78 100644
--- a/src/client/elm/LoggedIn/Income/View/Table.elm
+++ b/src/client/elm/LoggedIn/Income/View/Table.elm
@@ -49,7 +49,7 @@ view loggedData incomeModel =
then
div
[ class "emptyTableMsg" ]
- [ text <| getMessage "NoPayment" loggedData.translations ]
+ [ text <| getMessage loggedData.translations "NoPayment" ]
else
text ""
]
@@ -58,9 +58,9 @@ headerLine : LoggedData -> Html Msg
headerLine loggedData =
div
[ class "header" ]
- [ div [ class "cell name" ] [ text <| getMessage "Name" loggedData.translations ]
- , div [ class "cell income" ] [ text <| getMessage "Income" loggedData.translations ]
- , div [ class "cell date" ] [ text <| getMessage "Date" loggedData.translations ]
+ [ div [ class "cell name" ] [ text <| getMessage loggedData.translations "Name" ]
+ , div [ class "cell income" ] [ text <| getMessage loggedData.translations "Income" ]
+ , div [ class "cell date" ] [ text <| getMessage loggedData.translations "Date" ]
, div [ class "cell" ] []
, div [ class "cell" ] []
, div [ class "cell" ] []
@@ -92,7 +92,7 @@ paymentLine loggedData incomeModel (incomeId, income) =
(AddIncome.initialClone loggedData.translations currentDate income)
"CloneIncome"
(FontAwesome.clone Color.chestnutRose 18)
- (Just (getMessage "Clone" loggedData.translations))
+ (Just (getMessage loggedData.translations "Clone"))
]
, div
[ class "cell button" ]
@@ -106,7 +106,7 @@ paymentLine loggedData incomeModel (incomeId, income) =
(AddIncome.initialEdit loggedData.translations incomeId income)
"EditIncome"
(FontAwesome.pencil Color.chestnutRose 18)
- (Just (getMessage "Edit" loggedData.translations))
+ (Just (getMessage loggedData.translations "Edit"))
]
, div
[ class "cell button" ]
@@ -116,14 +116,14 @@ paymentLine loggedData incomeModel (incomeId, income) =
else
let dialogConfig =
{ className = "deleteIncomeDialog"
- , title = getMessage "ConfirmIncomeDelete" loggedData.translations
+ , title = getMessage loggedData.translations "ConfirmIncomeDelete"
, body = always <| text ""
- , confirm = getMessage "Confirm" loggedData.translations
- , confirmMsg = always <| Msg.Dialog <| Dialog.UpdateAndClose <| Msg.UpdateLoggedIn <| LoggedInMsg.DeleteIncome incomeId
- , undo = getMessage "Undo" loggedData.translations
+ , confirm = getMessage loggedData.translations "Confirm"
+ , confirmMsg = always <| Msg.Dialog <| Dialog.UpdateAndClose <| Msg.DeleteIncome incomeId
+ , undo = getMessage loggedData.translations "Undo"
}
in button
- ( Tooltip.show Msg.Tooltip (getMessage "Delete" loggedData.translations)
+ ( Tooltip.show Msg.Tooltip (getMessage loggedData.translations "Delete")
++ [ onClick (Msg.Dialog <| Dialog.Open dialogConfig) ]
)
[ FontAwesome.trash Color.chestnutRose 18 ]
diff --git a/src/client/elm/LoggedIn/Msg.elm b/src/client/elm/LoggedIn/Msg.elm
index 9bb87b9..ff275e2 100644
--- a/src/client/elm/LoggedIn/Msg.elm
+++ b/src/client/elm/LoggedIn/Msg.elm
@@ -4,7 +4,7 @@ module LoggedIn.Msg exposing
import Date exposing (Date)
-import Model.Payment exposing (Payment, PaymentId, Frequency)
+import Model.Payment exposing (PaymentId, Frequency)
import Model.Income exposing (IncomeId)
import LoggedIn.Home.Msg as HomeMsg
@@ -14,21 +14,9 @@ type Msg =
NoOp
| HomeMsg HomeMsg.Msg
| IncomeMsg IncomeMsg.Msg
-
- | CreatePayment String Int Date Frequency
| ValidateCreatePayment PaymentId String Int Date Frequency
-
- | EditPayment PaymentId String Int Date Frequency
| ValidateEditPayment PaymentId String Int Date Frequency
-
- | DeletePayment PaymentId
| ValidateDeletePayment PaymentId
-
- | CreateIncome Int Date
| ValidateCreateIncome IncomeId Int Date
-
- | EditIncome IncomeId Int Date
| ValidateEditIncome IncomeId Int Date
-
- | DeleteIncome IncomeId
| ValidateDeleteIncome IncomeId
diff --git a/src/client/elm/LoggedIn/Stat/View.elm b/src/client/elm/LoggedIn/Stat/View.elm
index a6faf5c..946005a 100644
--- a/src/client/elm/LoggedIn/Stat/View.elm
+++ b/src/client/elm/LoggedIn/Stat/View.elm
@@ -27,7 +27,7 @@ view loggedData =
monthPaymentMean = getMonthPaymentMean loggedData paymentsByMonth
in div
[ class "stat textual" ]
- [ h1 [] [ text (getParamMessage [ Format.price loggedData.conf monthPaymentMean ] "ByMonthsAndMean" loggedData.translations) ]
+ [ h1 [] [ text (getParamMessage [ Format.price loggedData.conf monthPaymentMean ] loggedData.translations "ByMonthsAndMean") ]
, ul
[]
( List.map (monthDetail loggedData) paymentsByMonth)
diff --git a/src/client/elm/LoggedIn/Update.elm b/src/client/elm/LoggedIn/Update.elm
index 68e840e..06cd623 100644
--- a/src/client/elm/LoggedIn/Update.elm
+++ b/src/client/elm/LoggedIn/Update.elm
@@ -13,7 +13,6 @@ import Platform.Cmd exposing (Cmd)
import Form
import Model exposing (Model)
-import Model.Translations exposing (getMessage)
import Model.Payment as Payment exposing (Payment, Frequency(..))
import Model.Income as Income exposing (Income)
@@ -59,14 +58,6 @@ update model msg loggedIn =
, Cmd.map LoggedInMsg.IncomeMsg cmd
)
- LoggedInMsg.CreatePayment name cost date frequency ->
- ( loggedIn
- , Server.createPayment name cost date frequency
- |> Task.perform
- (always LoggedInMsg.NoOp)
- (\paymentId -> LoggedInMsg.ValidateCreatePayment paymentId name cost date frequency)
- )
-
LoggedInMsg.ValidateCreatePayment paymentId name cost date frequency ->
update model (LoggedInMsg.HomeMsg <| HomeMsg.SearchMsg (Form.Reset (HomeModel.searchInitial frequency))) loggedIn
:> update model (LoggedInMsg.HomeMsg <| HomeMsg.UpdatePage 1)
@@ -77,28 +68,12 @@ update model msg loggedIn =
)
)
- LoggedInMsg.EditPayment paymentId name cost date frequency ->
- ( loggedIn
- , Server.editPayment paymentId name cost date frequency
- |> Task.perform
- (always LoggedInMsg.NoOp)
- (always <| LoggedInMsg.ValidateEditPayment paymentId name cost date frequency)
- )
-
LoggedInMsg.ValidateEditPayment paymentId name cost date frequency ->
let updatedPayment = Payment paymentId name cost date loggedIn.me frequency
in ( { loggedIn | payments = Payment.edit updatedPayment loggedIn.payments }
, Cmd.none
)
- LoggedInMsg.DeletePayment paymentId ->
- ( loggedIn
- , Server.deletePayment paymentId
- |> Task.perform
- (always LoggedInMsg.NoOp)
- (always (LoggedInMsg.ValidateDeletePayment paymentId))
- )
-
LoggedInMsg.ValidateDeletePayment paymentId ->
let payments = Payment.delete paymentId loggedIn.payments
frequency =
@@ -122,14 +97,6 @@ update model msg loggedIn =
, Cmd.none
)
- LoggedInMsg.CreateIncome amount date ->
- ( loggedIn
- , Server.createIncome amount date
- |> Task.perform
- (always LoggedInMsg.NoOp)
- (\incomeId -> (LoggedInMsg.ValidateCreateIncome incomeId amount date))
- )
-
LoggedInMsg.ValidateCreateIncome incomeId amount date ->
let newIncome = { userId = loggedIn.me, amount = amount, time = Date.toTime date }
loggedInIncome = loggedIn.income
@@ -140,14 +107,6 @@ update model msg loggedIn =
, Cmd.none
)
- LoggedInMsg.EditIncome incomeId amount date ->
- ( loggedIn
- , Server.editIncome incomeId amount date
- |> Task.perform
- (always LoggedInMsg.NoOp)
- (always <| LoggedInMsg.ValidateEditIncome incomeId amount date)
- )
-
LoggedInMsg.ValidateEditIncome incomeId amount date ->
let updatedIncome = Income loggedIn.me (Date.toTime date) amount
updateIncome mbIncome =
@@ -158,14 +117,6 @@ update model msg loggedIn =
, Cmd.none
)
- LoggedInMsg.DeleteIncome incomeId ->
- ( loggedIn
- , Server.deleteIncome incomeId
- |> Task.perform
- (always LoggedInMsg.NoOp)
- (always <| LoggedInMsg.ValidateDeleteIncome incomeId)
- )
-
LoggedInMsg.ValidateDeleteIncome incomeId ->
( { loggedIn | incomes = Dict.remove incomeId loggedIn.incomes }
, Cmd.none