aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/LoggedIn/Home
diff options
context:
space:
mode:
authorJoris2016-06-26 17:30:03 +0200
committerJoris2016-06-26 17:30:03 +0200
commit885dfd7708e338a3220c85b7f22a3ac267aad3f7 (patch)
treeff259354eb9fd97fc0bab2775296830dcced5693 /src/client/elm/LoggedIn/Home
parentcfade71c343eb29c8873011f5878a39aed8257b2 (diff)
Add the clone functionality on payments
Diffstat (limited to 'src/client/elm/LoggedIn/Home')
-rw-r--r--src/client/elm/LoggedIn/Home/Header/View.elm18
-rw-r--r--src/client/elm/LoggedIn/Home/View/Table.elm13
2 files changed, 24 insertions, 7 deletions
diff --git a/src/client/elm/LoggedIn/Home/Header/View.elm b/src/client/elm/LoggedIn/Home/Header/View.elm
index 9468a04..753a120 100644
--- a/src/client/elm/LoggedIn/Home/Header/View.elm
+++ b/src/client/elm/LoggedIn/Home/Header/View.elm
@@ -8,6 +8,7 @@ import Html.Events exposing (..)
import Html.App as Html
import String
import Dict
+import Date
import Form exposing (Form)
import View.Form as Form
@@ -24,7 +25,8 @@ import Model.Conf exposing (Conf)
import Model.Payment as Payment exposing (Payments, Frequency(..))
import Model.Translations exposing (getMessage)
-import Dialog.AddPayment.View as AddPayment
+import Dialog.Model as DialogModel
+import Dialog.AddPaymentButton.View as AddPaymentButton
import LoggedIn.Home.View.ExceedingPayers as ExceedingPayers
import LoggedIn.View.Format as Format
@@ -43,11 +45,15 @@ view loggedData { search } payments frequency =
searchLine : LoggedData -> Form String Home.Search -> Frequency -> Html Msg
searchLine loggedData search frequency =
- Html.div
- [ class "searchLine" ]
- [ searchForm loggedData search
- , AddPayment.view loggedData frequency
- ]
+ let currentDate = Date.fromTime loggedData.currentTime
+ in Html.div
+ [ class "searchLine" ]
+ [ searchForm loggedData search
+ , AddPaymentButton.view
+ loggedData
+ (DialogModel.addPaymentInitial loggedData.translations currentDate frequency)
+ (text (getMessage "AddPayment" loggedData.translations))
+ ]
searchForm : LoggedData -> Form String Home.Search -> Html Msg
searchForm loggedData search =
diff --git a/src/client/elm/LoggedIn/Home/View/Table.elm b/src/client/elm/LoggedIn/Home/View/Table.elm
index 282f00a..d2087bb 100644
--- a/src/client/elm/LoggedIn/Home/View/Table.elm
+++ b/src/client/elm/LoggedIn/Home/View/Table.elm
@@ -29,6 +29,8 @@ import Model.Payment as Payment exposing (..)
import Model.Translations exposing (getMessage)
import Dialog
+import Dialog.Model as DialogModel
+import Dialog.AddPaymentButton.View as AddPaymentButton
view : LoggedData -> HomeModel.Model -> Payments -> Frequency -> Html Msg
view loggedData homeModel payments frequency =
@@ -61,6 +63,7 @@ headerLine loggedData frequency =
Punctual -> div [ class "cell date" ] [ text <| getMessage "Date" loggedData.translations ]
Monthly -> text ""
, div [ class "cell" ] []
+ , div [ class "cell" ] []
]
paymentLine : LoggedData -> HomeModel.Model -> Frequency -> Payment -> Html Msg
@@ -96,7 +99,15 @@ paymentLine loggedData homeModel frequency payment =
Monthly ->
text ""
, div
- [ class "cell delete" ]
+ [ class "cell button" ]
+ [ let currentDate = Date.fromTime loggedData.currentTime
+ in AddPaymentButton.view
+ loggedData
+ (DialogModel.clonePaymentInitial loggedData.translations currentDate payment)
+ (FontAwesome.clone Color.chestnutRose 18)
+ ]
+ , div
+ [ class "cell button" ]
[ if loggedData.me /= payment.userId
then
text ""