aboutsummaryrefslogtreecommitdiff
path: root/src/client/Dialog/AddCategory/Model.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/Dialog/AddCategory/Model.elm')
-rw-r--r--src/client/Dialog/AddCategory/Model.elm54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/client/Dialog/AddCategory/Model.elm b/src/client/Dialog/AddCategory/Model.elm
deleted file mode 100644
index 3b70482..0000000
--- a/src/client/Dialog/AddCategory/Model.elm
+++ /dev/null
@@ -1,54 +0,0 @@
-module Dialog.AddCategory.Model exposing
- ( Model
- , init
- , initialAdd
- , initialClone
- , initialEdit
- , validation
- )
-
-import Date exposing (Date)
-import Dict
-
-import Form exposing (Form)
-import Form.Field as Field exposing (Field)
-import Form.Validate as Validate exposing (Validation)
-
-import Model.Category exposing (Categories, Category, CategoryId)
-import Model.Translations exposing (Translations)
-import Validation
-import View.Date as Date
-
-type alias Model =
- { id : Maybe CategoryId
- , name : String
- , color : String
- }
-
-init : Form String Model
-init = Form.initial [] validation
-
-initialAdd : Translations -> List (String, Field)
-initialAdd translations =
- [ ("color", Field.string "#000000")
- ]
-
-initialClone : Translations -> Category -> List (String, Field)
-initialClone translations category =
- [ ("name", Field.string category.name)
- , ("color", Field.string category.color)
- ]
-
-initialEdit : Translations -> CategoryId -> Category -> List (String, Field)
-initialEdit translations categoryId category =
- [ ("id", Field.string (toString categoryId))
- , ("name", Field.string category.name)
- , ("color", Field.string category.color)
- ]
-
-validation : Validation String Model
-validation =
- Validate.map3 Model
- (Validate.field "id" (Validate.maybe Validate.int))
- (Validate.field "name" (Validate.string |> Validate.andThen Validate.nonEmpty))
- (Validate.field "color" Validation.color)