diff options
Diffstat (limited to 'src/client/elm/Update')
-rw-r--r-- | src/client/elm/Update/LoggedIn.elm | 34 | ||||
-rw-r--r-- | src/client/elm/Update/LoggedIn/Account.elm | 16 | ||||
-rw-r--r-- | src/client/elm/Update/LoggedIn/Add.elm | 10 | ||||
-rw-r--r-- | src/client/elm/Update/LoggedIn/Monthly.elm | 8 | ||||
-rw-r--r-- | src/client/elm/Update/SignIn.elm | 2 |
5 files changed, 35 insertions, 35 deletions
diff --git a/src/client/elm/Update/LoggedIn.elm b/src/client/elm/Update/LoggedIn.elm index e477094..5292c25 100644 --- a/src/client/elm/Update/LoggedIn.elm +++ b/src/client/elm/Update/LoggedIn.elm @@ -31,38 +31,38 @@ updateLoggedIn : Model -> LoggedAction -> LoggedInView -> LoggedInView updateLoggedIn model action loggedInView = case action of UpdateAdd addPaymentAction -> - { loggedInView | add <- updateAddPayment addPaymentAction loggedInView.add } + { loggedInView | add = updateAddPayment addPaymentAction loggedInView.add } UpdatePayments payments -> - { loggedInView | payments <- payments } + { loggedInView | payments = payments } AddPayment userId name cost payments -> { loggedInView - | payments <- payments - , currentPage <- 1 - , add <- initAddPayment Punctual - , account <- UA.updateAccount (UA.UpdatePayer userId model.currentTime cost) loggedInView.account - , paymentsCount <- loggedInView.paymentsCount + 1 + | payments = payments + , currentPage = 1 + , add = initAddPayment Punctual + , account = UA.updateAccount (UA.UpdatePayer userId model.currentTime cost) loggedInView.account + , paymentsCount = loggedInView.paymentsCount + 1 } AddMonthlyPayment id name cost -> { loggedInView - | add <- initAddPayment Monthly - , monthly <- + | add = initAddPayment Monthly + , monthly = let payment = Payment id (Date.fromTime model.currentTime) name cost loggedInView.account.me in UM.updateMonthly (UM.AddPayment payment) loggedInView.monthly } ToggleEdit id -> - { loggedInView | paymentEdition <- if loggedInView.paymentEdition == Just id then Nothing else Just id } + { loggedInView | paymentEdition = if loggedInView.paymentEdition == Just id then Nothing else Just id } DeletePayment payment payments -> { loggedInView - | payments <- payments - , account <- UA.updateAccount (UA.UpdatePayer payment.userId (Date.toTime payment.creation) -payment.cost) loggedInView.account - , paymentsCount <- loggedInView.paymentsCount - 1 + | payments = payments + , account = UA.updateAccount (UA.UpdatePayer payment.userId (Date.toTime payment.creation) -payment.cost) loggedInView.account + , paymentsCount = loggedInView.paymentsCount - 1 } UpdatePage page payments -> { loggedInView - | currentPage <- page - , payments <- payments + | currentPage = page + , payments = payments } UpdateMonthly monthlyAction -> - { loggedInView | monthly <- UM.updateMonthly monthlyAction loggedInView.monthly } + { loggedInView | monthly = UM.updateMonthly monthlyAction loggedInView.monthly } UpdateAccount accountAction -> - { loggedInView | account <- UA.updateAccount accountAction loggedInView.account } + { loggedInView | account = UA.updateAccount accountAction loggedInView.account } diff --git a/src/client/elm/Update/LoggedIn/Account.elm b/src/client/elm/Update/LoggedIn/Account.elm index cf4c834..c7a66dd 100644 --- a/src/client/elm/Update/LoggedIn/Account.elm +++ b/src/client/elm/Update/LoggedIn/Account.elm @@ -25,11 +25,11 @@ updateAccount : AccountAction -> Account -> Account updateAccount action account = case action of ToggleDetail -> - { account | visibleDetail <- not account.visibleDetail } + { account | visibleDetail = not account.visibleDetail } UpdatePayer userId creation amountDiff -> - { account | payers <- updatePayers account.payers userId creation amountDiff } + { account | payers = updatePayers account.payers userId creation amountDiff } ToggleIncomeEdition -> - { account | incomeEdition <- + { account | incomeEdition = if isJust account.incomeEdition then Nothing else Just (initIncomeEdition (Maybe.withDefault 0 (getCurrentIncome account))) @@ -37,28 +37,28 @@ updateAccount action account = UpdateIncomeEdition income -> case account.incomeEdition of Just incomeEdition -> - { account | incomeEdition <- Just { incomeEdition | income <- income } } + { account | incomeEdition = Just { incomeEdition | income = income } } Nothing -> account UpdateEditionError error -> case account.incomeEdition of Just incomeEdition -> - { account | incomeEdition <- Just { incomeEdition | error <- Just error } } + { account | incomeEdition = Just { incomeEdition | error = Just error } } Nothing -> account UpdateIncome currentTime amount -> { account - | payers <- + | payers = account.payers |> Dict.update account.me (\mbPayer -> case mbPayer of Just payer -> Just { payer - | incomes <- payer.incomes ++ [{ creation = currentTime, amount = amount }] + | incomes = payer.incomes ++ [{ creation = currentTime, amount = amount }] } Nothing -> Nothing ) - , incomeEdition <- Nothing + , incomeEdition = Nothing } diff --git a/src/client/elm/Update/LoggedIn/Add.elm b/src/client/elm/Update/LoggedIn/Add.elm index 1f28997..92bdb7e 100644 --- a/src/client/elm/Update/LoggedIn/Add.elm +++ b/src/client/elm/Update/LoggedIn/Add.elm @@ -15,15 +15,15 @@ updateAddPayment : AddPaymentAction -> AddPayment -> AddPayment updateAddPayment action addPayment = case action of UpdateName name -> - { addPayment | name <- name } + { addPayment | name = name } UpdateCost cost -> - { addPayment | cost <- cost } + { addPayment | cost = cost } AddError nameError costError -> { addPayment - | nameError <- nameError - , costError <- costError + | nameError = nameError + , costError = costError } ToggleFrequency -> { addPayment - | frequency <- if addPayment.frequency == Punctual then Monthly else Punctual + | frequency = if addPayment.frequency == Punctual then Monthly else Punctual } diff --git a/src/client/elm/Update/LoggedIn/Monthly.elm b/src/client/elm/Update/LoggedIn/Monthly.elm index 1379323..275b3e8 100644 --- a/src/client/elm/Update/LoggedIn/Monthly.elm +++ b/src/client/elm/Update/LoggedIn/Monthly.elm @@ -15,13 +15,13 @@ updateMonthly : MonthlyAction -> Monthly -> Monthly updateMonthly action monthly = case action of ToggleDetail -> - { monthly | visibleDetail <- not monthly.visibleDetail } + { monthly | visibleDetail = not monthly.visibleDetail } AddPayment payment -> { monthly - | payments <- payment :: monthly.payments - , visibleDetail <- True + | payments = payment :: monthly.payments + , visibleDetail = True } DeletePayment id -> { monthly - | payments <- List.filter (\payment -> payment.id /= id) monthly.payments + | payments = List.filter (\payment -> payment.id /= id) monthly.payments } diff --git a/src/client/elm/Update/SignIn.elm b/src/client/elm/Update/SignIn.elm index cabe4cb..961fb16 100644 --- a/src/client/elm/Update/SignIn.elm +++ b/src/client/elm/Update/SignIn.elm @@ -12,4 +12,4 @@ updateSignIn : SignInAction -> SignInView -> SignInView updateSignIn action signInView = case action of ErrorLogin message -> - { signInView | result <- Just (Err message) } + { signInView | result = Just (Err message) } |