diff options
Diffstat (limited to 'src/client/elm/Model')
-rw-r--r-- | src/client/elm/Model/Payment.elm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/client/elm/Model/Payment.elm b/src/client/elm/Model/Payment.elm index b986148..5109b2f 100644 --- a/src/client/elm/Model/Payment.elm +++ b/src/client/elm/Model/Payment.elm @@ -20,6 +20,7 @@ import Date exposing (..) import Date.Extra.Core exposing (monthToInt, intToMonth) import Json.Decode as Json exposing ((:=)) import String +import List import Form.Validate as Validate exposing (Validation) import Model.User exposing (UserId, userIdDecoder) @@ -115,7 +116,12 @@ paymentSort frequency = Monthly -> List.sortBy (String.toLower << .name) searchSuccess : String -> Payment -> Bool -searchSuccess text { name } = (String.toLower text) `String.contains` (String.toLower name) +searchSuccess search { name, cost } = + let searchSuccessWord word = + ( String.contains (String.toLower word) (String.toLower name) + || String.contains word (toString cost) + ) + in List.all searchSuccessWord (String.words search) validateFrequency : Validation String Frequency validateFrequency = |