aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--client/src/View/Payment/Add.hs15
-rw-r--r--client/src/View/Payment/Header.hs23
3 files changed, 20 insertions, 19 deletions
diff --git a/README.md b/README.md
index 9f9b64b..dfa417f 100644
--- a/README.md
+++ b/README.md
@@ -60,7 +60,6 @@ See [application.conf](application.conf).
### Payment view
-- Check monthly payment UX
- Edit a payment.
- Possibly remove payment category after payment edit
- Clone a payment.
diff --git a/client/src/View/Payment/Add.hs b/client/src/View/Payment/Add.hs
index bd10e5a..d2d2dc4 100644
--- a/client/src/View/Payment/Add.hs
+++ b/client/src/View/Payment/Add.hs
@@ -37,6 +37,7 @@ import qualified Util.WaitFor as WaitFor
data AddIn t = AddIn
{ _addIn_categories :: [Category]
, _addIn_paymentCategories :: Dynamic t [PaymentCategory]
+ , _addIn_frequency :: Dynamic t Frequency
, _addIn_cancel :: Event t ()
}
@@ -92,16 +93,6 @@ view addIn = do
(const currentDay <$> reset)
confirm)
- frequency <- _selectOut_value <$> (Component.select $ SelectIn
- { _selectIn_label = Msg.get Msg.Payment_Frequency
- , _selectIn_initialValue = Punctual
- , _selectIn_value = R.never
- , _selectIn_values = R.constDyn frequencies
- , _selectIn_reset = reset
- , _selectIn_isValid = const True
- , _selectIn_validate = confirm
- })
-
let setCategory =
R.fmapMaybe id
. R.updated
@@ -122,13 +113,13 @@ view addIn = do
c <- cost
d <- date
cat <- category
- f <- frequency
+ f <- _addIn_frequency addIn
return (CreatePayment
<$> ValidationUtil.nelError n
<*> ValidationUtil.nelError c
<*> ValidationUtil.nelError d
<*> ValidationUtil.nelError cat
- <*> ValidationUtil.nelError f)
+ <*> V.Success f)
(addPayment, cancel, confirm) <- R.divClass "buttons" $ do
rec
diff --git a/client/src/View/Payment/Header.hs b/client/src/View/Payment/Header.hs
index 7a85493..fa21731 100644
--- a/client/src/View/Payment/Header.hs
+++ b/client/src/View/Payment/Header.hs
@@ -51,11 +51,20 @@ data HeaderOut t = HeaderOut
widget :: forall t m. MonadWidget t m => HeaderIn t -> m (HeaderOut t)
widget headerIn =
R.divClass "header" $ do
- addPayment <- payerAndAdd incomes payments users categories paymentCategories currency
- let resetSearchName = fmap (const ()) $ addPayment
- (searchName, searchFrequency) <- searchLine resetSearchName
-
- infos (_headerIn_searchPayments headerIn) users currency
+ rec
+ addPayment <-
+ payerAndAdd
+ incomes
+ payments
+ users
+ categories
+ paymentCategories
+ currency
+ searchFrequency
+ let resetSearchName = fmap (const ()) $ addPayment
+ (searchName, searchFrequency) <- searchLine resetSearchName
+
+ infos (_headerIn_searchPayments headerIn) users currency
return $ HeaderOut
{ _headerOut_searchName = searchName
@@ -80,8 +89,9 @@ payerAndAdd
-> [Category]
-> Dynamic t [PaymentCategory]
-> Currency
+ -> Dynamic t Frequency
-> m (Event t CreatedPayment)
-payerAndAdd incomes payments users categories paymentCategories currency = do
+payerAndAdd incomes payments users categories paymentCategories currency frequency = do
time <- liftIO Time.getCurrentTime
R.divClass "payerAndAdd" $ do
@@ -119,6 +129,7 @@ payerAndAdd incomes payments users categories paymentCategories currency = do
, _modalIn_content = Add.view $ AddIn
{ _addIn_categories = categories
, _addIn_paymentCategories = paymentCategories
+ , _addIn_frequency = frequency
, _addIn_cancel = _modalOut_hide modalOut
}
}