diff options
Diffstat (limited to 'src/client/elm/LoggedIn/Home/View')
-rw-r--r-- | src/client/elm/LoggedIn/Home/View/Date.elm | 59 | ||||
-rw-r--r-- | src/client/elm/LoggedIn/Home/View/Monthly.elm | 4 | ||||
-rw-r--r-- | src/client/elm/LoggedIn/Home/View/Price.elm | 37 | ||||
-rw-r--r-- | src/client/elm/LoggedIn/Home/View/Table.elm | 6 |
4 files changed, 5 insertions, 101 deletions
diff --git a/src/client/elm/LoggedIn/Home/View/Date.elm b/src/client/elm/LoggedIn/Home/View/Date.elm deleted file mode 100644 index 2cc55fe..0000000 --- a/src/client/elm/LoggedIn/Home/View/Date.elm +++ /dev/null @@ -1,59 +0,0 @@ -module LoggedIn.Home.View.Date - ( renderShortDate - , renderLongDate - ) where - -import Date exposing (..) -import String - -import Model.Translations exposing (..) - -renderShortDate : Date -> Translations -> String -renderShortDate date translations = - let params = - [ String.pad 2 '0' (toString (Date.day date)) - , String.pad 2 '0' (toString (getMonthNumber (Date.month date))) - , toString (Date.year date) - ] - in getParamMessage params "ShortDate" translations - -renderLongDate : Date -> Translations -> String -renderLongDate date translations = - let params = - [ toString (Date.day date) - , (getMessage (getMonthKey (Date.month date)) translations) - , toString (Date.year date) - ] - in getParamMessage params "LongDate" translations - -getMonthNumber : Month -> Int -getMonthNumber month = - case month of - Jan -> 1 - Feb -> 2 - Mar -> 3 - Apr -> 4 - May -> 5 - Jun -> 6 - Jul -> 7 - Aug -> 8 - Sep -> 9 - Oct -> 10 - Nov -> 11 - Dec -> 12 - -getMonthKey : Month -> String -getMonthKey month = - case month of - Jan -> "January" - Feb -> "February" - Mar -> "March" - Apr -> "April" - May -> "May" - Jun -> "June" - Jul -> "July" - Aug -> "August" - Sep -> "September" - Oct -> "October" - Nov -> "November" - Dec -> "December" diff --git a/src/client/elm/LoggedIn/Home/View/Monthly.elm b/src/client/elm/LoggedIn/Home/View/Monthly.elm index aa0e3a5..c001331 100644 --- a/src/client/elm/LoggedIn/Home/View/Monthly.elm +++ b/src/client/elm/LoggedIn/Home/View/Monthly.elm @@ -12,7 +12,7 @@ import LoggedIn.Action as LoggedInAction import LoggedIn.Home.Action as HomeAction import LoggedIn.Home.Model as HomeModel -import LoggedIn.Home.View.Price exposing (price) +import LoggedIn.View.Price exposing (price) import LoggedIn.Home.View.Expand exposing (..) import Model.Payment as Payment exposing (Payments, Payment, monthly) @@ -84,7 +84,7 @@ paymentLine loggedData homeModel payment = [ text (price loggedData.conf payment.cost) ] , div [ class "cell delete" - , onClick Mailbox.address (Action.UpdateLoggedIn <| LoggedInAction.DeletePayment payment Payment.Monthly) + , onClick Mailbox.address (Action.UpdateLoggedIn <| LoggedInAction.DeletePayment payment.id) ] [ button [] [ renderIcon "times" ] ] diff --git a/src/client/elm/LoggedIn/Home/View/Price.elm b/src/client/elm/LoggedIn/Home/View/Price.elm deleted file mode 100644 index 2e208f9..0000000 --- a/src/client/elm/LoggedIn/Home/View/Price.elm +++ /dev/null @@ -1,37 +0,0 @@ -module LoggedIn.Home.View.Price - ( price - ) where - -import String exposing (..) - -import Model.Conf exposing (Conf) - -price : Conf -> Int -> String -price conf amount = - ( formatInt amount - ++ " " - ++ conf.currency - ) - -formatInt : Int -> String -formatInt n = - abs n - |> toString - |> toList - |> List.reverse - |> group 3 - |> List.intersperse [' '] - |> List.concat - |> List.reverse - |> fromList - |> append (if n < 0 then "-" else "") - -group : Int -> List a -> List (List a) -group n xs = - if List.length xs <= n - then - [xs] - else - let take = List.take n xs - drop = List.drop n xs - in take :: (group n drop) diff --git a/src/client/elm/LoggedIn/Home/View/Table.elm b/src/client/elm/LoggedIn/Home/View/Table.elm index 1d69fb9..71aa4e5 100644 --- a/src/client/elm/LoggedIn/Home/View/Table.elm +++ b/src/client/elm/LoggedIn/Home/View/Table.elm @@ -16,8 +16,8 @@ import LoggedIn.Action as LoggedInAction import LoggedIn.Home.Action as HomeAction import LoggedIn.Home.Model as HomeModel -import LoggedIn.Home.View.Date exposing (..) -import LoggedIn.Home.View.Price exposing (price) +import LoggedIn.View.Date exposing (..) +import LoggedIn.View.Price exposing (price) import Model.User exposing (getUserName) import Model.Payment as Payment exposing (..) @@ -90,7 +90,7 @@ paymentLine loggedData homeModel payment = div [ class "cell delete" ] [ button - [ onClick Mailbox.address (Action.UpdateLoggedIn <| LoggedInAction.DeletePayment payment Punctual)] + [ onClick Mailbox.address (Action.UpdateLoggedIn <| LoggedInAction.DeletePayment payment.id)] [ renderIcon "times" ] ] else |