blob: 3eb2ea461a92e7bc383ff8be979a7a5bdb8e6566 (
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
|
module Update.LoggedIn.AddPayment
( updateAddPayment
) where
import Model.Action.AddPaymentAction exposing (..)
import Model.View.LoggedIn.AddPayment exposing (..)
import Model.Payment exposing (PaymentFrequency(..))
updateAddPayment : AddPaymentAction -> AddPayment -> AddPayment
updateAddPayment action addPayment =
case action of
UpdateName name ->
{ addPayment | name = name }
UpdateCost cost ->
{ addPayment | cost = cost }
AddError nameError costError ->
{ addPayment
| nameError = nameError
, costError = costError
}
ToggleFrequency ->
{ addPayment
| frequency = if addPayment.frequency == Punctual then Monthly else Punctual
}
WaitingServer ->
{ addPayment | waitingServer = True }
|