aboutsummaryrefslogtreecommitdiff
path: root/src/client/LoggedIn/Category
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/LoggedIn/Category')
-rw-r--r--src/client/LoggedIn/Category/Model.elm36
-rw-r--r--src/client/LoggedIn/Category/Msg.elm9
-rw-r--r--src/client/LoggedIn/Category/Table.elm (renamed from src/client/LoggedIn/Category/Table/View.elm)13
-rw-r--r--src/client/LoggedIn/Category/Update.elm24
-rw-r--r--src/client/LoggedIn/Category/View.elm9
5 files changed, 10 insertions, 81 deletions
diff --git a/src/client/LoggedIn/Category/Model.elm b/src/client/LoggedIn/Category/Model.elm
deleted file mode 100644
index 7092fc4..0000000
--- a/src/client/LoggedIn/Category/Model.elm
+++ /dev/null
@@ -1,36 +0,0 @@
-module LoggedIn.Category.Model exposing
- ( Model
- , AddCategory
- , init
- , initForm
- , validation
- )
-
-import Date exposing (Date)
-
-import Form exposing (Form)
-import Form.Validate as Validate exposing (Validation)
-import Validation
-
-type alias Model =
- { addCategory : Form String AddCategory
- }
-
-type alias AddCategory =
- { amount : Int
- , date : Date
- }
-
-init : Model
-init =
- { addCategory = initForm
- }
-
-initForm : Form String AddCategory
-initForm = Form.initial [] validation
-
-validation : Validation String AddCategory
-validation =
- Validate.map2 AddCategory
- (Validate.field "amount" (Validate.int |> Validate.andThen (Validate.minInt 1)))
- (Validate.field "date" Validation.date)
diff --git a/src/client/LoggedIn/Category/Msg.elm b/src/client/LoggedIn/Category/Msg.elm
deleted file mode 100644
index 3184297..0000000
--- a/src/client/LoggedIn/Category/Msg.elm
+++ /dev/null
@@ -1,9 +0,0 @@
-module LoggedIn.Category.Msg exposing
- ( Msg(..)
- )
-
-import Form exposing (Form)
-
-type Msg =
- NoOp
- | AddCategoryMsg Form.Msg
diff --git a/src/client/LoggedIn/Category/Table/View.elm b/src/client/LoggedIn/Category/Table.elm
index fa7a7b1..9405e57 100644
--- a/src/client/LoggedIn/Category/Table/View.elm
+++ b/src/client/LoggedIn/Category/Table.elm
@@ -1,4 +1,4 @@
-module LoggedIn.Category.Table.View exposing
+module LoggedIn.Category.Table exposing
( view
)
@@ -25,7 +25,6 @@ import LoggedData exposing (LoggedData)
import LoggedIn.Msg as LoggedInMsg
-import LoggedIn.Category.Model as Category
import View.Date as Date
import LoggedIn.View.Format as Format
@@ -34,8 +33,8 @@ import Model.Category as Category exposing (CategoryId, Category)
import Model.PaymentCategory as PaymentCategory
import Model.Translations exposing (getMessage)
-view : LoggedData -> Category.Model -> Html Msg
-view loggedData categoryModel =
+view : LoggedData -> Html Msg
+view loggedData =
let categories =
loggedData.categories
|> Dict.toList
@@ -44,7 +43,7 @@ view loggedData categoryModel =
[ class "table" ]
[ div
[ class "lines" ]
- ( headerLine loggedData :: List.map (paymentLine loggedData categoryModel) categories)
+ ( headerLine loggedData :: List.map (paymentLine loggedData) categories)
, if List.isEmpty (Dict.toList loggedData.categories)
then
div
@@ -65,8 +64,8 @@ headerLine loggedData =
, div [ class "cell" ] []
]
-paymentLine : LoggedData -> Category.Model -> (CategoryId, Category) -> Html Msg
-paymentLine loggedData categoryModel (categoryId, category) =
+paymentLine : LoggedData -> (CategoryId, Category) -> Html Msg
+paymentLine loggedData (categoryId, category) =
div
[ class "row" ]
[ div
diff --git a/src/client/LoggedIn/Category/Update.elm b/src/client/LoggedIn/Category/Update.elm
deleted file mode 100644
index 1072ef0..0000000
--- a/src/client/LoggedIn/Category/Update.elm
+++ /dev/null
@@ -1,24 +0,0 @@
-module LoggedIn.Category.Update exposing
- ( update
- )
-
-import Form exposing (Form)
-
-import LoggedData exposing (LoggedData)
-
-import LoggedIn.Category.Model as Category
-import LoggedIn.Category.Msg as Category
-
-update : LoggedData -> Category.Msg -> Category.Model -> (Category.Model, Cmd Category.Msg)
-update loggedData msg model =
- case msg of
-
- Category.NoOp ->
- ( model
- , Cmd.none
- )
-
- Category.AddCategoryMsg formMsg ->
- ( { model | addCategory = Form.update Category.validation formMsg model.addCategory }
- , Cmd.none
- )
diff --git a/src/client/LoggedIn/Category/View.elm b/src/client/LoggedIn/Category/View.elm
index 4e04fa2..bba51b7 100644
--- a/src/client/LoggedIn/Category/View.elm
+++ b/src/client/LoggedIn/Category/View.elm
@@ -12,13 +12,12 @@ import Msg exposing (Msg)
import Dialog.AddCategory.Model as AddCategory
import Dialog.AddCategory.View as AddCategory
-import LoggedIn.Category.Model as Category
-import LoggedIn.Category.Table.View as Table
+import LoggedIn.Category.Table as Table
import Model.Translations exposing (getMessage, getParamMessage)
-view : LoggedData -> Category.Model -> Html Msg
-view loggedData categoryModel =
+view : LoggedData -> Html Msg
+view loggedData =
div
[ class "categories" ]
[ div
@@ -31,5 +30,5 @@ view loggedData categoryModel =
(text (getMessage loggedData.translations "AddCategory"))
Nothing
]
- , Table.view loggedData categoryModel
+ , Table.view loggedData
]