Make entry for submittable

This commit is contained in:
2023-08-21 14:45:45 +02:00
parent 8cb62dbacb
commit cb41e61c47
4 changed files with 76 additions and 23 deletions
+1 -1
View File
@@ -96,7 +96,7 @@ view model taxGroup =
]
, div [ class "form-input" ]
[ label [ for "calculator-tax" ] [ text "Gebindepreis ist" ]
, Select.view SetTax model.tax
, Select.view [] SetTax model.tax
]
]
+10 -7
View File
@@ -210,32 +210,32 @@ view { globals, state } = case state of
]
]
ItemEditor model ->
Html.form []
Html.form [ method "POST", action "/entry/add-to-cart" ]
[ fieldset []
[ legend [] [ text "Neuer Inventareintrag" ]
, div [ class "form-input" ]
[ label [ for "barcode" ] [ text "Barcode" ]
, input [ onInput SetBarcode, value model.barcode, disabled True, id "barcode" ] []
, input [ onInput SetBarcode, value model.barcode, disabled True, name "barcode", id "barcode" ] []
]
, div [ class "form-input" ]
[ label [ for "name" ] [ text "Name" ]
, input [ onInput SetName, value model.name, id "name" ] []
, input [ onInput SetName, value model.name, name "name", id "name" ] []
]
, div [ class "form-input" ]
[ label [ for "sales-units" ] [ text "Stückzahl" ]
, input [ onInput SetSalesUnits, value <| NumberInput.show model.salesUnits, id "sales-units", type_ "number" ] []
, input [ onInput SetSalesUnits, value <| NumberInput.show model.salesUnits, name "sales-units", id "sales-units", type_ "number" ] []
]
, div [ class "form-input" ]
[ label [ for "group" ] [ text "Gruppe" ]
, Select.view SetGroup model.group
, Select.view [ name "group", id "group" ] SetGroup model.group
]
, div [ class "form-input" ]
[ label [ for "location" ] [ text "Raum" ]
, Select.view SetLocation model.location
, Select.view [ name "location", id "location" ] SetLocation model.location
]
, div [ class "form-input" ]
[ label [ for "tax-group" ] [ text "Steuergruppe" ]
, Select.view SetTaxGroup model.taxGroup
, Select.view [ name "tax-group", id "tax-group" ] SetTaxGroup model.taxGroup
]
, Html.map CalculatorMsg <| Calculator.view model.calculator (Select.get model.taxGroup)
, div [ class "form-input" ]
@@ -244,6 +244,7 @@ view { globals, state } = case state of
[ value <| NumberInput.show model.netUnitPrice
, onInput SetNetUnitPrice
, type_ "number"
, name "net-unit-price"
, id "net-unit-price"
, step "0.01"
]
@@ -256,12 +257,14 @@ view { globals, state } = case state of
[ value <| NumberInput.show model.grossUnitPrice
, onInput SetGrossUnitPrice
, type_ "number"
, name "gross-unit-price"
, id "gross-unit-price"
, step "0.01"
]
[]
, viewSetSuggestedPriceButton model
]
, button [] [ text "In den Warenkorb" ]
]
]
+4 -4
View File
@@ -1,6 +1,6 @@
module Select exposing (..)
import Html exposing (Html, option, select, text)
import Html exposing (Attribute, Html, option, select, text)
import Html.Attributes exposing (selected, value)
import Html.Events exposing (onInput)
@@ -20,15 +20,15 @@ update key model =
Nothing -> model
Just x -> { model | selected = x }
view : (String -> m) -> Model a -> Html m
view msg model =
view : List (Attribute m) -> (String -> m) -> Model a -> Html m
view attributes msg model =
let
viewOption x =
option
[ selected <| model.identify model.selected == model.identify x, value <| model.identify x ]
[ text <| model.show x ]
in
select [ onInput msg ] <| List.map viewOption model.options
select ([ onInput msg ] ++ attributes) <| List.map viewOption model.options
get : Model a -> a
get = .selected