From 006d54bf4ac4dd9e05d62d0007759f28740fd77a Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Fri, 14 Aug 2015 10:29:43 +0200 Subject: One payment is clickable and set to orange for the moment --- src/client/Model/Payment.elm | 10 ++++++++-- src/client/Model/View/Payment/Edition.elm | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/client/Model') diff --git a/src/client/Model/Payment.elm b/src/client/Model/Payment.elm index ff8f157..fa59943 100644 --- a/src/client/Model/Payment.elm +++ b/src/client/Model/Payment.elm @@ -1,6 +1,7 @@ module Model.Payment ( Payments , Payment + , PaymentId , paymentsDecoder ) where @@ -10,24 +11,29 @@ import Json.Decode as Json exposing ((:=)) type alias Payments = List Payment type alias Payment = - { id : String + { id : PaymentId , creation : Date , name : String , cost : Int , userName : String } +type alias PaymentId = String + paymentsDecoder : Json.Decoder Payments paymentsDecoder = Json.list paymentDecoder paymentDecoder : Json.Decoder Payment paymentDecoder = Json.object5 Payment - ("id" := Json.string) + ("id" := paymentIdDecoder) ("creation" := dateDecoder) ("name" := Json.string) ("cost" := Json.int) ("userName" := Json.string) +paymentIdDecoder : Json.Decoder PaymentId +paymentIdDecoder = Json.string + dateDecoder : Json.Decoder Date dateDecoder = Json.customDecoder Json.string Date.fromString diff --git a/src/client/Model/View/Payment/Edition.elm b/src/client/Model/View/Payment/Edition.elm index a650fa8..f58ce43 100644 --- a/src/client/Model/View/Payment/Edition.elm +++ b/src/client/Model/View/Payment/Edition.elm @@ -2,4 +2,6 @@ module Model.View.Payment.Edition ( Edition ) where -type alias Edition = String +import Model.Payment exposing (PaymentId) + +type alias Edition = PaymentId -- cgit v1.2.3