Compare commits
4 Commits
6c7bb1042c
...
18abd38987
Author | SHA1 | Date | |
---|---|---|---|
18abd38987 | |||
8be0f0ddb7 | |||
43407d7890 | |||
902b636aba |
@ -36,3 +36,4 @@ ssh -nNTvL 5432:fsmi-db.fsmi.org:5432 fsmi-login.fsmi.uni-karlsruhe.de
|
|||||||
- [ ] Make it print nicely
|
- [ ] Make it print nicely
|
||||||
- [ ] Make it possible to edit entries
|
- [ ] Make it possible to edit entries
|
||||||
- [ ] Improve project structure
|
- [ ] Improve project structure
|
||||||
|
- [ ] Figure out/Add documentation about building `entry.js`
|
||||||
|
103
frontend/Calculator.elm
Normal file
103
frontend/Calculator.elm
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
module Calculator exposing (..)
|
||||||
|
|
||||||
|
import Html exposing (..)
|
||||||
|
import Html.Attributes exposing (..)
|
||||||
|
import Html.Events exposing (..)
|
||||||
|
|
||||||
|
import NumberInput
|
||||||
|
import Select
|
||||||
|
|
||||||
|
type Tax = Net | Gross
|
||||||
|
|
||||||
|
ctShow ct = case ct of
|
||||||
|
Gross -> "Brutto"
|
||||||
|
Net -> "Netto"
|
||||||
|
|
||||||
|
type alias Model =
|
||||||
|
{ tax : Select.Model Tax
|
||||||
|
, bundlePrice : NumberInput.Model Float
|
||||||
|
, bundleSize : NumberInput.Model Int
|
||||||
|
}
|
||||||
|
|
||||||
|
init bundlePrice = Model
|
||||||
|
(Select.init ctShow ctShow Net [Net, Gross])
|
||||||
|
(NumberInput.fromFloat bundlePrice)
|
||||||
|
(NumberInput.fromInt 1)
|
||||||
|
|
||||||
|
getResult model taxGroup =
|
||||||
|
case (NumberInput.get model.bundlePrice, NumberInput.get model.bundleSize) of
|
||||||
|
(Just bundlePrice, Just bundleSize) ->
|
||||||
|
Just <| roundTo 2 <|
|
||||||
|
if Select.get model.tax == Gross then
|
||||||
|
(bundlePrice / toFloat bundleSize) / (1 + taxGroup.percentage)
|
||||||
|
else
|
||||||
|
bundlePrice / toFloat bundleSize
|
||||||
|
_ ->
|
||||||
|
Nothing
|
||||||
|
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= SetTax String
|
||||||
|
| SetBundlePrice String
|
||||||
|
| SetBundleSize String
|
||||||
|
|
||||||
|
update msg model = case msg of
|
||||||
|
SetTax key ->
|
||||||
|
{ model | tax = Select.update key model.tax }
|
||||||
|
SetBundlePrice str ->
|
||||||
|
{ model | bundlePrice = NumberInput.update str model.bundlePrice }
|
||||||
|
SetBundleSize str ->
|
||||||
|
{ model | bundleSize = NumberInput.update str model.bundleSize }
|
||||||
|
|
||||||
|
view model taxGroup =
|
||||||
|
let
|
||||||
|
mainPart =
|
||||||
|
[ text "("
|
||||||
|
, input
|
||||||
|
[ class "formula-input", placeholder "Gebindepreis"
|
||||||
|
, value <| NumberInput.show model.bundlePrice
|
||||||
|
, onInput SetBundlePrice
|
||||||
|
]
|
||||||
|
[]
|
||||||
|
, text " ÷ "
|
||||||
|
, input
|
||||||
|
[ class "formula-input", placeholder "Gebindegröße"
|
||||||
|
, value <| NumberInput.show model.bundleSize
|
||||||
|
, onInput SetBundleSize
|
||||||
|
]
|
||||||
|
[]
|
||||||
|
, text ") "
|
||||||
|
]
|
||||||
|
taxPart =
|
||||||
|
[ text " ÷ "
|
||||||
|
, input
|
||||||
|
[ class "formula-input"
|
||||||
|
, disabled True
|
||||||
|
, value <| String.fromFloat <| 1 + taxGroup.percentage
|
||||||
|
]
|
||||||
|
[]
|
||||||
|
]
|
||||||
|
resultPart =
|
||||||
|
[ text " = "
|
||||||
|
, input
|
||||||
|
[ class "formula-input"
|
||||||
|
, disabled True
|
||||||
|
, value <| Maybe.withDefault "?" <| Maybe.map String.fromFloat <| getResult model taxGroup
|
||||||
|
]
|
||||||
|
[]
|
||||||
|
]
|
||||||
|
in
|
||||||
|
fieldset []
|
||||||
|
[ legend [] [ text "Preisrechner" ]
|
||||||
|
, div [] <| List.concat <| List.filterMap identity
|
||||||
|
[ Just mainPart
|
||||||
|
, if Select.get model.tax == Gross then Just taxPart else Nothing
|
||||||
|
, Just resultPart
|
||||||
|
]
|
||||||
|
, div [ class "form-input" ]
|
||||||
|
[ label [ for "calculator-tax" ] [ text "Gebindepreis ist" ]
|
||||||
|
, Select.view SetTax model.tax
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
roundTo places x = toFloat (round <| x * 10 ^ places) / 10 ^ places
|
@ -10,6 +10,7 @@ import Html exposing (..)
|
|||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
import Html.Events exposing (..)
|
import Html.Events exposing (..)
|
||||||
|
|
||||||
|
import Calculator
|
||||||
import NumberInput
|
import NumberInput
|
||||||
import Select
|
import Select
|
||||||
|
|
||||||
@ -69,6 +70,16 @@ type alias TaxGroup =
|
|||||||
, percentage : Float
|
, percentage : Float
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type alias NewItem =
|
||||||
|
{ barcode : String
|
||||||
|
, name : String
|
||||||
|
, salesUnits : Int
|
||||||
|
, group : Group
|
||||||
|
, location : Location
|
||||||
|
, netUnitPrice : Float
|
||||||
|
, taxGroup : TaxGroup
|
||||||
|
}
|
||||||
|
|
||||||
type alias Context =
|
type alias Context =
|
||||||
{ globals : Globals
|
{ globals : Globals
|
||||||
, state : State
|
, state : State
|
||||||
@ -89,6 +100,7 @@ type State
|
|||||||
{ barcode : String
|
{ barcode : String
|
||||||
, name : String
|
, name : String
|
||||||
, salesUnits : NumberInput.Model Int
|
, salesUnits : NumberInput.Model Int
|
||||||
|
, calculator : Calculator.Model
|
||||||
, netUnitPrice : NumberInput.Model Float
|
, netUnitPrice : NumberInput.Model Float
|
||||||
, grossUnitPrice : NumberInput.Model Float
|
, grossUnitPrice : NumberInput.Model Float
|
||||||
, group : Select.Model Group
|
, group : Select.Model Group
|
||||||
@ -104,6 +116,7 @@ type Msg
|
|||||||
| SetBarcode String
|
| SetBarcode String
|
||||||
| SetName String
|
| SetName String
|
||||||
| SetSalesUnits String
|
| SetSalesUnits String
|
||||||
|
| CalculatorMsg Calculator.Msg
|
||||||
| SetNetUnitPrice String
|
| SetNetUnitPrice String
|
||||||
| SetGrossUnitPrice String
|
| SetGrossUnitPrice String
|
||||||
| SetGroup String
|
| SetGroup String
|
||||||
@ -135,11 +148,13 @@ updateState msg globals state = case state of
|
|||||||
case find (\tg -> tg.id == searchResult.taxGroupId) globals.taxGroups of
|
case find (\tg -> tg.id == searchResult.taxGroupId) globals.taxGroups of
|
||||||
Nothing -> (state, Cmd.none)
|
Nothing -> (state, Cmd.none)
|
||||||
Just taxGroup ->
|
Just taxGroup ->
|
||||||
( ItemEditor <| updateGrossUnitPrice
|
( ItemEditor
|
||||||
{ barcode = searchResult.barcode
|
{ barcode = searchResult.barcode
|
||||||
, name = searchResult.name
|
, name = searchResult.name
|
||||||
|
, calculator = Calculator.init searchResult.netUnitPrice
|
||||||
, netUnitPrice = NumberInput.fromFloat searchResult.netUnitPrice
|
, netUnitPrice = NumberInput.fromFloat searchResult.netUnitPrice
|
||||||
, grossUnitPrice = NumberInput.fromFloat 0
|
, grossUnitPrice = NumberInput.fromFloat
|
||||||
|
(suggestedGrossPrice searchResult.netUnitPrice taxGroup.percentage)
|
||||||
, salesUnits = NumberInput.fromInt searchResult.salesUnits
|
, salesUnits = NumberInput.fromInt searchResult.salesUnits
|
||||||
, group = Select.init (.id >> String.fromInt) (.name) { id = searchResult.groupId, name = searchResult.groupName } globals.groups
|
, group = Select.init (.id >> String.fromInt) (.name) { id = searchResult.groupId, name = searchResult.groupName } globals.groups
|
||||||
, location = Select.init (.id >> String.fromInt) (.name) { id = searchResult.locationId, name = searchResult.locationName } globals.locations
|
, location = Select.init (.id >> String.fromInt) (.name) { id = searchResult.locationId, name = searchResult.locationName } globals.locations
|
||||||
@ -156,27 +171,29 @@ updateState msg globals state = case state of
|
|||||||
(ItemEditor { model | name = name }, Cmd.none)
|
(ItemEditor { model | name = name }, Cmd.none)
|
||||||
SetSalesUnits str ->
|
SetSalesUnits str ->
|
||||||
(ItemEditor { model | salesUnits = NumberInput.update str model.salesUnits }, Cmd.none)
|
(ItemEditor { model | salesUnits = NumberInput.update str model.salesUnits }, Cmd.none)
|
||||||
|
CalculatorMsg msg_ ->
|
||||||
|
(ItemEditor { model | calculator = Calculator.update msg_ model.calculator }, Cmd.none)
|
||||||
SetNetUnitPrice str ->
|
SetNetUnitPrice str ->
|
||||||
( ItemEditor <| updateGrossUnitPrice { model | netUnitPrice = NumberInput.update str model.netUnitPrice }
|
( ItemEditor { model | netUnitPrice = NumberInput.update str model.netUnitPrice }
|
||||||
, Cmd.none
|
, Cmd.none
|
||||||
)
|
)
|
||||||
SetGrossUnitPrice str ->
|
SetGrossUnitPrice str ->
|
||||||
(ItemEditor { model | grossUnitPrice = NumberInput.update str model.grossUnitPrice }, Cmd.none)
|
( ItemEditor { model | grossUnitPrice = NumberInput.update str model.grossUnitPrice }
|
||||||
|
, Cmd.none
|
||||||
|
)
|
||||||
SetGroup key ->
|
SetGroup key ->
|
||||||
(ItemEditor { model | group = Select.update key model.group }, Cmd.none)
|
(ItemEditor { model | group = Select.update key model.group }, Cmd.none)
|
||||||
SetLocation key ->
|
SetLocation key ->
|
||||||
(ItemEditor { model | location = Select.update key model.location }, Cmd.none)
|
(ItemEditor { model | location = Select.update key model.location }, Cmd.none)
|
||||||
SetTaxGroup key ->
|
SetTaxGroup key ->
|
||||||
( ItemEditor <| updateGrossUnitPrice { model | taxGroup = Select.update key model.taxGroup }
|
( ItemEditor { model | taxGroup = Select.update key model.taxGroup }
|
||||||
, Cmd.none
|
, Cmd.none
|
||||||
)
|
)
|
||||||
_ ->
|
_ ->
|
||||||
(state, Cmd.none)
|
(state, Cmd.none)
|
||||||
|
|
||||||
updateGrossUnitPrice model =
|
suggestedGrossPrice netPrice percentage =
|
||||||
{ model
|
roundTo 2 <| netPrice * (1 + percentage) + 0.01
|
||||||
| grossUnitPrice = Maybe.withDefault model.grossUnitPrice <| Maybe.map NumberInput.fromFloat <| calculateGarfieldPrice model
|
|
||||||
}
|
|
||||||
|
|
||||||
-- View stuff
|
-- View stuff
|
||||||
|
|
||||||
@ -217,7 +234,12 @@ view { globals, state } = case state of
|
|||||||
, Select.view SetLocation model.location
|
, Select.view SetLocation model.location
|
||||||
]
|
]
|
||||||
, div [ class "form-input" ]
|
, div [ class "form-input" ]
|
||||||
[ label [ for "net-unit-price" ] [ text "Stückpreis (Netto)" ]
|
[ label [ for "tax-group" ] [ text "Steuergruppe" ]
|
||||||
|
, Select.view SetTaxGroup model.taxGroup
|
||||||
|
]
|
||||||
|
, Html.map CalculatorMsg <| Calculator.view model.calculator (Select.get model.taxGroup)
|
||||||
|
, div [ class "form-input" ]
|
||||||
|
[ label [ for "net-unit-price" ] [ text "Einkaufspreis (Netto)" ]
|
||||||
, input
|
, input
|
||||||
[ value <| NumberInput.show model.netUnitPrice
|
[ value <| NumberInput.show model.netUnitPrice
|
||||||
, onInput SetNetUnitPrice
|
, onInput SetNetUnitPrice
|
||||||
@ -226,34 +248,51 @@ view { globals, state } = case state of
|
|||||||
, step "0.01"
|
, step "0.01"
|
||||||
]
|
]
|
||||||
[]
|
[]
|
||||||
|
, viewSetCalculatedPriceButton model
|
||||||
]
|
]
|
||||||
, div [ class "form-input" ]
|
, div [ class "form-input" ]
|
||||||
[ label [ for "tax-group" ] [ text "Steuergruppe" ]
|
[ label [ for "gross-unit-price" ] [ text "Verkaufspreis (Brutto)" ]
|
||||||
, Select.view SetTaxGroup model.taxGroup
|
, input
|
||||||
|
[ value <| NumberInput.show model.grossUnitPrice
|
||||||
|
, onInput SetGrossUnitPrice
|
||||||
|
, type_ "number"
|
||||||
|
, id "gross-unit-price"
|
||||||
|
, step "0.01"
|
||||||
|
]
|
||||||
|
[]
|
||||||
|
, viewSetSuggestedPriceButton model
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
, fieldset []
|
|
||||||
[ legend [] [ text "Neuer Snackeintrag" ]
|
|
||||||
, div [ class "form-input" ]
|
|
||||||
[ label [ for "snack-name" ] [ text "Name" ]
|
|
||||||
, input [ value model.name, disabled True, id "snack-name" ] []
|
|
||||||
]
|
|
||||||
, viewGrossUnitPriceInput model
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
|
|
||||||
viewGrossUnitPriceInput model =
|
viewSetCalculatedPriceButton model =
|
||||||
let
|
case Calculator.getResult model.calculator (Select.get model.taxGroup) of
|
||||||
suggestedPriceStr = case calculateGarfieldPrice model of
|
Nothing ->
|
||||||
Nothing -> "?"
|
button [ disabled True ] [ text "Auf ? setzen" ]
|
||||||
Just suggestedPrice -> String.fromFloat suggestedPrice
|
Just calculatedPrice ->
|
||||||
in
|
button
|
||||||
div [ class "form-input" ]
|
[ onClick <| SetNetUnitPrice <| String.fromFloat calculatedPrice
|
||||||
[ label [ for "gross-unit-price" ]
|
-- Prevent submitting the form
|
||||||
[ text <| "Stückpreis (Brutto), Vorschlag: " ++ suggestedPriceStr
|
, type_ "button"
|
||||||
]
|
]
|
||||||
, input [ onInput SetGrossUnitPrice, value <| NumberInput.show model.grossUnitPrice, id "gross-unit-price", type_ "number", step "0.01" ] []
|
[ text <| "Auf " ++ String.fromFloat calculatedPrice ++ " setzen"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
viewSetSuggestedPriceButton model =
|
||||||
|
case NumberInput.get model.netUnitPrice of
|
||||||
|
Nothing ->
|
||||||
|
button [ disabled True ] [ text "Auf ? setzen" ]
|
||||||
|
Just netUnitPrice ->
|
||||||
|
let
|
||||||
|
grossUnitPrice = suggestedGrossPrice netUnitPrice (Select.get model.taxGroup).percentage
|
||||||
|
in
|
||||||
|
button
|
||||||
|
[ onClick <| SetGrossUnitPrice <| String.fromFloat grossUnitPrice
|
||||||
|
-- Prevent submitting the form
|
||||||
|
, type_ "button"
|
||||||
|
]
|
||||||
|
[ text <| "Auf " ++ String.fromFloat grossUnitPrice ++ " setzen"
|
||||||
|
]
|
||||||
|
|
||||||
searchResultHeaders =
|
searchResultHeaders =
|
||||||
tr []
|
tr []
|
||||||
|
@ -11037,11 +11037,37 @@ var $elm$http$Http$get = function (r) {
|
|||||||
return $elm$http$Http$request(
|
return $elm$http$Http$request(
|
||||||
{body: $elm$http$Http$emptyBody, expect: r.expect, headers: _List_Nil, method: 'GET', timeout: $elm$core$Maybe$Nothing, tracker: $elm$core$Maybe$Nothing, url: r.url});
|
{body: $elm$http$Http$emptyBody, expect: r.expect, headers: _List_Nil, method: 'GET', timeout: $elm$core$Maybe$Nothing, tracker: $elm$core$Maybe$Nothing, url: r.url});
|
||||||
};
|
};
|
||||||
|
var $author$project$Calculator$Gross = {$: 'Gross'};
|
||||||
|
var $author$project$Calculator$Model = F3(
|
||||||
|
function (tax, bundlePrice, bundleSize) {
|
||||||
|
return {bundlePrice: bundlePrice, bundleSize: bundleSize, tax: tax};
|
||||||
|
});
|
||||||
|
var $author$project$Calculator$Net = {$: 'Net'};
|
||||||
|
var $author$project$Calculator$ctShow = function (ct) {
|
||||||
|
if (ct.$ === 'Gross') {
|
||||||
|
return 'Brutto';
|
||||||
|
} else {
|
||||||
|
return 'Netto';
|
||||||
|
}
|
||||||
|
};
|
||||||
var $author$project$Select$Model = F4(
|
var $author$project$Select$Model = F4(
|
||||||
function (identify, show, selected, options) {
|
function (identify, show, selected, options) {
|
||||||
return {identify: identify, options: options, selected: selected, show: show};
|
return {identify: identify, options: options, selected: selected, show: show};
|
||||||
});
|
});
|
||||||
var $author$project$Select$init = $author$project$Select$Model;
|
var $author$project$Select$init = $author$project$Select$Model;
|
||||||
|
var $author$project$Calculator$init = function (bundlePrice) {
|
||||||
|
return A3(
|
||||||
|
$author$project$Calculator$Model,
|
||||||
|
A4(
|
||||||
|
$author$project$Select$init,
|
||||||
|
$author$project$Calculator$ctShow,
|
||||||
|
$author$project$Calculator$ctShow,
|
||||||
|
$author$project$Calculator$Net,
|
||||||
|
_List_fromArray(
|
||||||
|
[$author$project$Calculator$Net, $author$project$Calculator$Gross])),
|
||||||
|
$author$project$NumberInput$fromFloat(bundlePrice),
|
||||||
|
$author$project$NumberInput$fromInt(1));
|
||||||
|
};
|
||||||
var $author$project$Entry$SearchResult = function (barcode) {
|
var $author$project$Entry$SearchResult = function (barcode) {
|
||||||
return function (name) {
|
return function (name) {
|
||||||
return function (netUnitPrice) {
|
return function (netUnitPrice) {
|
||||||
@ -11119,6 +11145,17 @@ var $author$project$Entry$searchResultDecoder = A3(
|
|||||||
'item_barcode',
|
'item_barcode',
|
||||||
$elm$json$Json$Decode$string,
|
$elm$json$Json$Decode$string,
|
||||||
$elm$json$Json$Decode$succeed($author$project$Entry$SearchResult))))))))))));
|
$elm$json$Json$Decode$succeed($author$project$Entry$SearchResult))))))))))));
|
||||||
|
var $elm$core$Basics$pow = _Basics_pow;
|
||||||
|
var $elm$core$Basics$round = _Basics_round;
|
||||||
|
var $author$project$Entry$roundTo = F2(
|
||||||
|
function (places, x) {
|
||||||
|
return $elm$core$Basics$round(
|
||||||
|
x * A2($elm$core$Basics$pow, 10, places)) / A2($elm$core$Basics$pow, 10, places);
|
||||||
|
});
|
||||||
|
var $author$project$Entry$suggestedGrossPrice = F2(
|
||||||
|
function (netPrice, percentage) {
|
||||||
|
return A2($author$project$Entry$roundTo, 2, (netPrice * (1 + percentage)) + 0.01);
|
||||||
|
});
|
||||||
var $author$project$NumberInput$update = F2(
|
var $author$project$NumberInput$update = F2(
|
||||||
function (str, model) {
|
function (str, model) {
|
||||||
return _Utils_update(
|
return _Utils_update(
|
||||||
@ -11152,53 +11189,32 @@ var $author$project$Select$update = F2(
|
|||||||
{selected: x});
|
{selected: x});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var $author$project$NumberInput$get = function ($) {
|
var $author$project$Calculator$update = F2(
|
||||||
return $.value;
|
function (msg, model) {
|
||||||
};
|
switch (msg.$) {
|
||||||
var $author$project$Select$get = function ($) {
|
case 'SetTax':
|
||||||
return $.selected;
|
var key = msg.a;
|
||||||
};
|
return _Utils_update(
|
||||||
var $elm$core$Maybe$map = F2(
|
model,
|
||||||
function (f, maybe) {
|
{
|
||||||
if (maybe.$ === 'Just') {
|
tax: A2($author$project$Select$update, key, model.tax)
|
||||||
var value = maybe.a;
|
});
|
||||||
return $elm$core$Maybe$Just(
|
case 'SetBundlePrice':
|
||||||
f(value));
|
var str = msg.a;
|
||||||
} else {
|
return _Utils_update(
|
||||||
return $elm$core$Maybe$Nothing;
|
model,
|
||||||
|
{
|
||||||
|
bundlePrice: A2($author$project$NumberInput$update, str, model.bundlePrice)
|
||||||
|
});
|
||||||
|
default:
|
||||||
|
var str = msg.a;
|
||||||
|
return _Utils_update(
|
||||||
|
model,
|
||||||
|
{
|
||||||
|
bundleSize: A2($author$project$NumberInput$update, str, model.bundleSize)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var $elm$core$Basics$pow = _Basics_pow;
|
|
||||||
var $elm$core$Basics$round = _Basics_round;
|
|
||||||
var $author$project$Entry$roundTo = F2(
|
|
||||||
function (places, x) {
|
|
||||||
return $elm$core$Basics$round(
|
|
||||||
x * A2($elm$core$Basics$pow, 10, places)) / A2($elm$core$Basics$pow, 10, places);
|
|
||||||
});
|
|
||||||
var $author$project$Entry$calculateGarfieldPrice = function (model) {
|
|
||||||
return A2(
|
|
||||||
$elm$core$Maybe$map,
|
|
||||||
function (netUnitPrice) {
|
|
||||||
return A2(
|
|
||||||
$author$project$Entry$roundTo,
|
|
||||||
2,
|
|
||||||
(netUnitPrice * (1 + $author$project$Select$get(model.taxGroup).percentage)) + 0.01);
|
|
||||||
},
|
|
||||||
$author$project$NumberInput$get(model.netUnitPrice));
|
|
||||||
};
|
|
||||||
var $author$project$Entry$updateGrossUnitPrice = function (model) {
|
|
||||||
return _Utils_update(
|
|
||||||
model,
|
|
||||||
{
|
|
||||||
grossUnitPrice: A2(
|
|
||||||
$elm$core$Maybe$withDefault,
|
|
||||||
model.grossUnitPrice,
|
|
||||||
A2(
|
|
||||||
$elm$core$Maybe$map,
|
|
||||||
$author$project$NumberInput$fromFloat,
|
|
||||||
$author$project$Entry$calculateGarfieldPrice(model)))
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var $author$project$Entry$updateState = F3(
|
var $author$project$Entry$updateState = F3(
|
||||||
function (msg, globals, state) {
|
function (msg, globals, state) {
|
||||||
if (state.$ === 'ItemSearch') {
|
if (state.$ === 'ItemSearch') {
|
||||||
@ -11251,53 +11267,54 @@ var $author$project$Entry$updateState = F3(
|
|||||||
var taxGroup = _v2.a;
|
var taxGroup = _v2.a;
|
||||||
return _Utils_Tuple2(
|
return _Utils_Tuple2(
|
||||||
$author$project$Entry$ItemEditor(
|
$author$project$Entry$ItemEditor(
|
||||||
$author$project$Entry$updateGrossUnitPrice(
|
{
|
||||||
{
|
barcode: searchResult.barcode,
|
||||||
barcode: searchResult.barcode,
|
calculator: $author$project$Calculator$init(searchResult.netUnitPrice),
|
||||||
grossUnitPrice: $author$project$NumberInput$fromFloat(0),
|
grossUnitPrice: $author$project$NumberInput$fromFloat(
|
||||||
group: A4(
|
A2($author$project$Entry$suggestedGrossPrice, searchResult.netUnitPrice, taxGroup.percentage)),
|
||||||
$author$project$Select$init,
|
group: A4(
|
||||||
A2(
|
$author$project$Select$init,
|
||||||
$elm$core$Basics$composeR,
|
A2(
|
||||||
function ($) {
|
$elm$core$Basics$composeR,
|
||||||
return $.id;
|
|
||||||
},
|
|
||||||
$elm$core$String$fromInt),
|
|
||||||
function ($) {
|
function ($) {
|
||||||
return $.name;
|
return $.id;
|
||||||
},
|
},
|
||||||
{id: searchResult.groupId, name: searchResult.groupName},
|
$elm$core$String$fromInt),
|
||||||
globals.groups),
|
function ($) {
|
||||||
location: A4(
|
return $.name;
|
||||||
$author$project$Select$init,
|
},
|
||||||
A2(
|
{id: searchResult.groupId, name: searchResult.groupName},
|
||||||
$elm$core$Basics$composeR,
|
globals.groups),
|
||||||
function ($) {
|
location: A4(
|
||||||
return $.id;
|
$author$project$Select$init,
|
||||||
},
|
A2(
|
||||||
$elm$core$String$fromInt),
|
$elm$core$Basics$composeR,
|
||||||
function ($) {
|
function ($) {
|
||||||
return $.name;
|
return $.id;
|
||||||
},
|
},
|
||||||
{id: searchResult.locationId, name: searchResult.locationName},
|
$elm$core$String$fromInt),
|
||||||
globals.locations),
|
function ($) {
|
||||||
name: searchResult.name,
|
return $.name;
|
||||||
netUnitPrice: $author$project$NumberInput$fromFloat(searchResult.netUnitPrice),
|
},
|
||||||
salesUnits: $author$project$NumberInput$fromInt(searchResult.salesUnits),
|
{id: searchResult.locationId, name: searchResult.locationName},
|
||||||
taxGroup: A4(
|
globals.locations),
|
||||||
$author$project$Select$init,
|
name: searchResult.name,
|
||||||
A2(
|
netUnitPrice: $author$project$NumberInput$fromFloat(searchResult.netUnitPrice),
|
||||||
$elm$core$Basics$composeR,
|
salesUnits: $author$project$NumberInput$fromInt(searchResult.salesUnits),
|
||||||
function ($) {
|
taxGroup: A4(
|
||||||
return $.id;
|
$author$project$Select$init,
|
||||||
},
|
A2(
|
||||||
$elm$core$String$fromInt),
|
$elm$core$Basics$composeR,
|
||||||
function ($) {
|
function ($) {
|
||||||
return $.description;
|
return $.id;
|
||||||
},
|
},
|
||||||
taxGroup,
|
$elm$core$String$fromInt),
|
||||||
globals.taxGroups)
|
function ($) {
|
||||||
})),
|
return $.description;
|
||||||
|
},
|
||||||
|
taxGroup,
|
||||||
|
globals.taxGroups)
|
||||||
|
}),
|
||||||
$elm$core$Platform$Cmd$none);
|
$elm$core$Platform$Cmd$none);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -11334,16 +11351,25 @@ var $author$project$Entry$updateState = F3(
|
|||||||
salesUnits: A2($author$project$NumberInput$update, str, model.salesUnits)
|
salesUnits: A2($author$project$NumberInput$update, str, model.salesUnits)
|
||||||
})),
|
})),
|
||||||
$elm$core$Platform$Cmd$none);
|
$elm$core$Platform$Cmd$none);
|
||||||
|
case 'CalculatorMsg':
|
||||||
|
var msg_ = msg.a;
|
||||||
|
return _Utils_Tuple2(
|
||||||
|
$author$project$Entry$ItemEditor(
|
||||||
|
_Utils_update(
|
||||||
|
model,
|
||||||
|
{
|
||||||
|
calculator: A2($author$project$Calculator$update, msg_, model.calculator)
|
||||||
|
})),
|
||||||
|
$elm$core$Platform$Cmd$none);
|
||||||
case 'SetNetUnitPrice':
|
case 'SetNetUnitPrice':
|
||||||
var str = msg.a;
|
var str = msg.a;
|
||||||
return _Utils_Tuple2(
|
return _Utils_Tuple2(
|
||||||
$author$project$Entry$ItemEditor(
|
$author$project$Entry$ItemEditor(
|
||||||
$author$project$Entry$updateGrossUnitPrice(
|
_Utils_update(
|
||||||
_Utils_update(
|
model,
|
||||||
model,
|
{
|
||||||
{
|
netUnitPrice: A2($author$project$NumberInput$update, str, model.netUnitPrice)
|
||||||
netUnitPrice: A2($author$project$NumberInput$update, str, model.netUnitPrice)
|
})),
|
||||||
}))),
|
|
||||||
$elm$core$Platform$Cmd$none);
|
$elm$core$Platform$Cmd$none);
|
||||||
case 'SetGrossUnitPrice':
|
case 'SetGrossUnitPrice':
|
||||||
var str = msg.a;
|
var str = msg.a;
|
||||||
@ -11379,12 +11405,11 @@ var $author$project$Entry$updateState = F3(
|
|||||||
var key = msg.a;
|
var key = msg.a;
|
||||||
return _Utils_Tuple2(
|
return _Utils_Tuple2(
|
||||||
$author$project$Entry$ItemEditor(
|
$author$project$Entry$ItemEditor(
|
||||||
$author$project$Entry$updateGrossUnitPrice(
|
_Utils_update(
|
||||||
_Utils_update(
|
model,
|
||||||
model,
|
{
|
||||||
{
|
taxGroup: A2($author$project$Select$update, key, model.taxGroup)
|
||||||
taxGroup: A2($author$project$Select$update, key, model.taxGroup)
|
})),
|
||||||
}))),
|
|
||||||
$elm$core$Platform$Cmd$none);
|
$elm$core$Platform$Cmd$none);
|
||||||
default:
|
default:
|
||||||
return _Utils_Tuple2(state, $elm$core$Platform$Cmd$none);
|
return _Utils_Tuple2(state, $elm$core$Platform$Cmd$none);
|
||||||
@ -11402,9 +11427,15 @@ var $author$project$Entry$update = F2(
|
|||||||
{globals: globals, state: state_},
|
{globals: globals, state: state_},
|
||||||
cmd);
|
cmd);
|
||||||
});
|
});
|
||||||
|
var $author$project$Entry$CalculatorMsg = function (a) {
|
||||||
|
return {$: 'CalculatorMsg', a: a};
|
||||||
|
};
|
||||||
var $author$project$Entry$SetBarcode = function (a) {
|
var $author$project$Entry$SetBarcode = function (a) {
|
||||||
return {$: 'SetBarcode', a: a};
|
return {$: 'SetBarcode', a: a};
|
||||||
};
|
};
|
||||||
|
var $author$project$Entry$SetGrossUnitPrice = function (a) {
|
||||||
|
return {$: 'SetGrossUnitPrice', a: a};
|
||||||
|
};
|
||||||
var $author$project$Entry$SetGroup = function (a) {
|
var $author$project$Entry$SetGroup = function (a) {
|
||||||
return {$: 'SetGroup', a: a};
|
return {$: 'SetGroup', a: a};
|
||||||
};
|
};
|
||||||
@ -11439,6 +11470,9 @@ var $elm$html$Html$Attributes$disabled = $elm$html$Html$Attributes$boolProperty(
|
|||||||
var $elm$html$Html$fieldset = _VirtualDom_node('fieldset');
|
var $elm$html$Html$fieldset = _VirtualDom_node('fieldset');
|
||||||
var $elm$html$Html$Attributes$for = $elm$html$Html$Attributes$stringProperty('htmlFor');
|
var $elm$html$Html$Attributes$for = $elm$html$Html$Attributes$stringProperty('htmlFor');
|
||||||
var $elm$html$Html$form = _VirtualDom_node('form');
|
var $elm$html$Html$form = _VirtualDom_node('form');
|
||||||
|
var $author$project$Select$get = function ($) {
|
||||||
|
return $.selected;
|
||||||
|
};
|
||||||
var $elm$html$Html$label = _VirtualDom_node('label');
|
var $elm$html$Html$label = _VirtualDom_node('label');
|
||||||
var $elm$html$Html$legend = _VirtualDom_node('legend');
|
var $elm$html$Html$legend = _VirtualDom_node('legend');
|
||||||
var $elm$html$Html$Events$alwaysPreventDefault = function (msg) {
|
var $elm$html$Html$Events$alwaysPreventDefault = function (msg) {
|
||||||
@ -11535,6 +11569,53 @@ var $elm$html$Html$Attributes$step = function (n) {
|
|||||||
return A2($elm$html$Html$Attributes$stringProperty, 'step', n);
|
return A2($elm$html$Html$Attributes$stringProperty, 'step', n);
|
||||||
};
|
};
|
||||||
var $elm$html$Html$table = _VirtualDom_node('table');
|
var $elm$html$Html$table = _VirtualDom_node('table');
|
||||||
|
var $author$project$Calculator$SetBundlePrice = function (a) {
|
||||||
|
return {$: 'SetBundlePrice', a: a};
|
||||||
|
};
|
||||||
|
var $author$project$Calculator$SetBundleSize = function (a) {
|
||||||
|
return {$: 'SetBundleSize', a: a};
|
||||||
|
};
|
||||||
|
var $author$project$Calculator$SetTax = function (a) {
|
||||||
|
return {$: 'SetTax', a: a};
|
||||||
|
};
|
||||||
|
var $author$project$NumberInput$get = function ($) {
|
||||||
|
return $.value;
|
||||||
|
};
|
||||||
|
var $author$project$Calculator$roundTo = F2(
|
||||||
|
function (places, x) {
|
||||||
|
return $elm$core$Basics$round(
|
||||||
|
x * A2($elm$core$Basics$pow, 10, places)) / A2($elm$core$Basics$pow, 10, places);
|
||||||
|
});
|
||||||
|
var $author$project$Calculator$getResult = F2(
|
||||||
|
function (model, taxGroup) {
|
||||||
|
var _v0 = _Utils_Tuple2(
|
||||||
|
$author$project$NumberInput$get(model.bundlePrice),
|
||||||
|
$author$project$NumberInput$get(model.bundleSize));
|
||||||
|
if ((_v0.a.$ === 'Just') && (_v0.b.$ === 'Just')) {
|
||||||
|
var bundlePrice = _v0.a.a;
|
||||||
|
var bundleSize = _v0.b.a;
|
||||||
|
return $elm$core$Maybe$Just(
|
||||||
|
A2(
|
||||||
|
$author$project$Calculator$roundTo,
|
||||||
|
2,
|
||||||
|
_Utils_eq(
|
||||||
|
$author$project$Select$get(model.tax),
|
||||||
|
$author$project$Calculator$Gross) ? ((bundlePrice / bundleSize) / (1 + taxGroup.percentage)) : (bundlePrice / bundleSize)));
|
||||||
|
} else {
|
||||||
|
return $elm$core$Maybe$Nothing;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var $elm$core$Maybe$map = F2(
|
||||||
|
function (f, maybe) {
|
||||||
|
if (maybe.$ === 'Just') {
|
||||||
|
var value = maybe.a;
|
||||||
|
return $elm$core$Maybe$Just(
|
||||||
|
f(value));
|
||||||
|
} else {
|
||||||
|
return $elm$core$Maybe$Nothing;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var $elm$html$Html$Attributes$placeholder = $elm$html$Html$Attributes$stringProperty('placeholder');
|
||||||
var $elm$html$Html$option = _VirtualDom_node('option');
|
var $elm$html$Html$option = _VirtualDom_node('option');
|
||||||
var $elm$html$Html$select = _VirtualDom_node('select');
|
var $elm$html$Html$select = _VirtualDom_node('select');
|
||||||
var $elm$html$Html$Attributes$selected = $elm$html$Html$Attributes$boolProperty('selected');
|
var $elm$html$Html$Attributes$selected = $elm$html$Html$Attributes$boolProperty('selected');
|
||||||
@ -11566,51 +11647,119 @@ var $author$project$Select$view = F2(
|
|||||||
]),
|
]),
|
||||||
A2($elm$core$List$map, viewOption, model.options));
|
A2($elm$core$List$map, viewOption, model.options));
|
||||||
});
|
});
|
||||||
var $author$project$Entry$SetGrossUnitPrice = function (a) {
|
var $author$project$Calculator$view = F2(
|
||||||
return {$: 'SetGrossUnitPrice', a: a};
|
function (model, taxGroup) {
|
||||||
};
|
var taxPart = _List_fromArray(
|
||||||
var $author$project$Entry$viewGrossUnitPriceInput = function (model) {
|
|
||||||
var suggestedPriceStr = function () {
|
|
||||||
var _v0 = $author$project$Entry$calculateGarfieldPrice(model);
|
|
||||||
if (_v0.$ === 'Nothing') {
|
|
||||||
return '?';
|
|
||||||
} else {
|
|
||||||
var suggestedPrice = _v0.a;
|
|
||||||
return $elm$core$String$fromFloat(suggestedPrice);
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
return A2(
|
|
||||||
$elm$html$Html$div,
|
|
||||||
_List_fromArray(
|
|
||||||
[
|
[
|
||||||
$elm$html$Html$Attributes$class('form-input')
|
$elm$html$Html$text(' ÷ '),
|
||||||
]),
|
|
||||||
_List_fromArray(
|
|
||||||
[
|
|
||||||
A2(
|
|
||||||
$elm$html$Html$label,
|
|
||||||
_List_fromArray(
|
|
||||||
[
|
|
||||||
$elm$html$Html$Attributes$for('gross-unit-price')
|
|
||||||
]),
|
|
||||||
_List_fromArray(
|
|
||||||
[
|
|
||||||
$elm$html$Html$text('Stückpreis (Brutto), Vorschlag: ' + suggestedPriceStr)
|
|
||||||
])),
|
|
||||||
A2(
|
A2(
|
||||||
$elm$html$Html$input,
|
$elm$html$Html$input,
|
||||||
_List_fromArray(
|
_List_fromArray(
|
||||||
[
|
[
|
||||||
$elm$html$Html$Events$onInput($author$project$Entry$SetGrossUnitPrice),
|
$elm$html$Html$Attributes$class('formula-input'),
|
||||||
|
$elm$html$Html$Attributes$disabled(true),
|
||||||
$elm$html$Html$Attributes$value(
|
$elm$html$Html$Attributes$value(
|
||||||
$author$project$NumberInput$show(model.grossUnitPrice)),
|
$elm$core$String$fromFloat(1 + taxGroup.percentage))
|
||||||
$elm$html$Html$Attributes$id('gross-unit-price'),
|
|
||||||
$elm$html$Html$Attributes$type_('number'),
|
|
||||||
$elm$html$Html$Attributes$step('0.01')
|
|
||||||
]),
|
]),
|
||||||
_List_Nil)
|
_List_Nil)
|
||||||
]));
|
]);
|
||||||
};
|
var resultPart = _List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$text(' = '),
|
||||||
|
A2(
|
||||||
|
$elm$html$Html$input,
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$Attributes$class('formula-input'),
|
||||||
|
$elm$html$Html$Attributes$disabled(true),
|
||||||
|
$elm$html$Html$Attributes$value(
|
||||||
|
A2(
|
||||||
|
$elm$core$Maybe$withDefault,
|
||||||
|
'?',
|
||||||
|
A2(
|
||||||
|
$elm$core$Maybe$map,
|
||||||
|
$elm$core$String$fromFloat,
|
||||||
|
A2($author$project$Calculator$getResult, model, taxGroup))))
|
||||||
|
]),
|
||||||
|
_List_Nil)
|
||||||
|
]);
|
||||||
|
var mainPart = _List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$text('('),
|
||||||
|
A2(
|
||||||
|
$elm$html$Html$input,
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$Attributes$class('formula-input'),
|
||||||
|
$elm$html$Html$Attributes$placeholder('Gebindepreis'),
|
||||||
|
$elm$html$Html$Attributes$value(
|
||||||
|
$author$project$NumberInput$show(model.bundlePrice)),
|
||||||
|
$elm$html$Html$Events$onInput($author$project$Calculator$SetBundlePrice)
|
||||||
|
]),
|
||||||
|
_List_Nil),
|
||||||
|
$elm$html$Html$text(' ÷ '),
|
||||||
|
A2(
|
||||||
|
$elm$html$Html$input,
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$Attributes$class('formula-input'),
|
||||||
|
$elm$html$Html$Attributes$placeholder('Gebindegröße'),
|
||||||
|
$elm$html$Html$Attributes$value(
|
||||||
|
$author$project$NumberInput$show(model.bundleSize)),
|
||||||
|
$elm$html$Html$Events$onInput($author$project$Calculator$SetBundleSize)
|
||||||
|
]),
|
||||||
|
_List_Nil),
|
||||||
|
$elm$html$Html$text(') ')
|
||||||
|
]);
|
||||||
|
return A2(
|
||||||
|
$elm$html$Html$fieldset,
|
||||||
|
_List_Nil,
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
A2(
|
||||||
|
$elm$html$Html$legend,
|
||||||
|
_List_Nil,
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$text('Preisrechner')
|
||||||
|
])),
|
||||||
|
A2(
|
||||||
|
$elm$html$Html$div,
|
||||||
|
_List_Nil,
|
||||||
|
$elm$core$List$concat(
|
||||||
|
A2(
|
||||||
|
$elm$core$List$filterMap,
|
||||||
|
$elm$core$Basics$identity,
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$core$Maybe$Just(mainPart),
|
||||||
|
_Utils_eq(
|
||||||
|
$author$project$Select$get(model.tax),
|
||||||
|
$author$project$Calculator$Gross) ? $elm$core$Maybe$Just(taxPart) : $elm$core$Maybe$Nothing,
|
||||||
|
$elm$core$Maybe$Just(resultPart)
|
||||||
|
])))),
|
||||||
|
A2(
|
||||||
|
$elm$html$Html$div,
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$Attributes$class('form-input')
|
||||||
|
]),
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
A2(
|
||||||
|
$elm$html$Html$label,
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$Attributes$for('calculator-tax')
|
||||||
|
]),
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$text('Gebindepreis ist')
|
||||||
|
])),
|
||||||
|
A2($author$project$Select$view, $author$project$Calculator$SetTax, model.tax)
|
||||||
|
]))
|
||||||
|
]));
|
||||||
|
});
|
||||||
var $author$project$Entry$GotoItemEditor = function (a) {
|
var $author$project$Entry$GotoItemEditor = function (a) {
|
||||||
return {$: 'GotoItemEditor', a: a};
|
return {$: 'GotoItemEditor', a: a};
|
||||||
};
|
};
|
||||||
@ -11712,6 +11861,75 @@ var $author$project$Entry$viewSearchResult = function (model) {
|
|||||||
]))
|
]))
|
||||||
]));
|
]));
|
||||||
};
|
};
|
||||||
|
var $author$project$Entry$viewSetCalculatedPriceButton = function (model) {
|
||||||
|
var _v0 = A2(
|
||||||
|
$author$project$Calculator$getResult,
|
||||||
|
model.calculator,
|
||||||
|
$author$project$Select$get(model.taxGroup));
|
||||||
|
if (_v0.$ === 'Nothing') {
|
||||||
|
return A2(
|
||||||
|
$elm$html$Html$button,
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$Attributes$disabled(true)
|
||||||
|
]),
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$text('Auf ? setzen')
|
||||||
|
]));
|
||||||
|
} else {
|
||||||
|
var calculatedPrice = _v0.a;
|
||||||
|
return A2(
|
||||||
|
$elm$html$Html$button,
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$Events$onClick(
|
||||||
|
$author$project$Entry$SetNetUnitPrice(
|
||||||
|
$elm$core$String$fromFloat(calculatedPrice))),
|
||||||
|
$elm$html$Html$Attributes$type_('button')
|
||||||
|
]),
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$text(
|
||||||
|
'Auf ' + ($elm$core$String$fromFloat(calculatedPrice) + ' setzen'))
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var $author$project$Entry$viewSetSuggestedPriceButton = function (model) {
|
||||||
|
var _v0 = $author$project$NumberInput$get(model.netUnitPrice);
|
||||||
|
if (_v0.$ === 'Nothing') {
|
||||||
|
return A2(
|
||||||
|
$elm$html$Html$button,
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$Attributes$disabled(true)
|
||||||
|
]),
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$text('Auf ? setzen')
|
||||||
|
]));
|
||||||
|
} else {
|
||||||
|
var netUnitPrice = _v0.a;
|
||||||
|
var grossUnitPrice = A2(
|
||||||
|
$author$project$Entry$suggestedGrossPrice,
|
||||||
|
netUnitPrice,
|
||||||
|
$author$project$Select$get(model.taxGroup).percentage);
|
||||||
|
return A2(
|
||||||
|
$elm$html$Html$button,
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$Events$onClick(
|
||||||
|
$author$project$Entry$SetGrossUnitPrice(
|
||||||
|
$elm$core$String$fromFloat(grossUnitPrice))),
|
||||||
|
$elm$html$Html$Attributes$type_('button')
|
||||||
|
]),
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$text(
|
||||||
|
'Auf ' + ($elm$core$String$fromFloat(grossUnitPrice) + ' setzen'))
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
};
|
||||||
var $author$project$Entry$view = function (_v0) {
|
var $author$project$Entry$view = function (_v0) {
|
||||||
var globals = _v0.globals;
|
var globals = _v0.globals;
|
||||||
var state = _v0.state;
|
var state = _v0.state;
|
||||||
@ -11923,6 +12141,33 @@ var $author$project$Entry$view = function (_v0) {
|
|||||||
])),
|
])),
|
||||||
A2(
|
A2(
|
||||||
$elm$html$Html$div,
|
$elm$html$Html$div,
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$Attributes$class('form-input')
|
||||||
|
]),
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
A2(
|
||||||
|
$elm$html$Html$label,
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$Attributes$for('tax-group')
|
||||||
|
]),
|
||||||
|
_List_fromArray(
|
||||||
|
[
|
||||||
|
$elm$html$Html$text('Steuergruppe')
|
||||||
|
])),
|
||||||
|
A2($author$project$Select$view, $author$project$Entry$SetTaxGroup, model.taxGroup)
|
||||||
|
])),
|
||||||
|
A2(
|
||||||
|
$elm$html$Html$map,
|
||||||
|
$author$project$Entry$CalculatorMsg,
|
||||||
|
A2(
|
||||||
|
$author$project$Calculator$view,
|
||||||
|
model.calculator,
|
||||||
|
$author$project$Select$get(model.taxGroup))),
|
||||||
|
A2(
|
||||||
|
$elm$html$Html$div,
|
||||||
_List_fromArray(
|
_List_fromArray(
|
||||||
[
|
[
|
||||||
$elm$html$Html$Attributes$class('form-input')
|
$elm$html$Html$Attributes$class('form-input')
|
||||||
@ -11937,7 +12182,7 @@ var $author$project$Entry$view = function (_v0) {
|
|||||||
]),
|
]),
|
||||||
_List_fromArray(
|
_List_fromArray(
|
||||||
[
|
[
|
||||||
$elm$html$Html$text('Stückpreis (Netto)')
|
$elm$html$Html$text('Einkaufspreis (Netto)')
|
||||||
])),
|
])),
|
||||||
A2(
|
A2(
|
||||||
$elm$html$Html$input,
|
$elm$html$Html$input,
|
||||||
@ -11950,7 +12195,8 @@ var $author$project$Entry$view = function (_v0) {
|
|||||||
$elm$html$Html$Attributes$id('net-unit-price'),
|
$elm$html$Html$Attributes$id('net-unit-price'),
|
||||||
$elm$html$Html$Attributes$step('0.01')
|
$elm$html$Html$Attributes$step('0.01')
|
||||||
]),
|
]),
|
||||||
_List_Nil)
|
_List_Nil),
|
||||||
|
$author$project$Entry$viewSetCalculatedPriceButton(model)
|
||||||
])),
|
])),
|
||||||
A2(
|
A2(
|
||||||
$elm$html$Html$div,
|
$elm$html$Html$div,
|
||||||
@ -11964,56 +12210,26 @@ var $author$project$Entry$view = function (_v0) {
|
|||||||
$elm$html$Html$label,
|
$elm$html$Html$label,
|
||||||
_List_fromArray(
|
_List_fromArray(
|
||||||
[
|
[
|
||||||
$elm$html$Html$Attributes$for('tax-group')
|
$elm$html$Html$Attributes$for('gross-unit-price')
|
||||||
]),
|
]),
|
||||||
_List_fromArray(
|
_List_fromArray(
|
||||||
[
|
[
|
||||||
$elm$html$Html$text('Steuergruppe')
|
$elm$html$Html$text('Verkaufspreis (Brutto)')
|
||||||
])),
|
|
||||||
A2($author$project$Select$view, $author$project$Entry$SetTaxGroup, model.taxGroup)
|
|
||||||
]))
|
|
||||||
])),
|
|
||||||
A2(
|
|
||||||
$elm$html$Html$fieldset,
|
|
||||||
_List_Nil,
|
|
||||||
_List_fromArray(
|
|
||||||
[
|
|
||||||
A2(
|
|
||||||
$elm$html$Html$legend,
|
|
||||||
_List_Nil,
|
|
||||||
_List_fromArray(
|
|
||||||
[
|
|
||||||
$elm$html$Html$text('Neuer Snackeintrag')
|
|
||||||
])),
|
|
||||||
A2(
|
|
||||||
$elm$html$Html$div,
|
|
||||||
_List_fromArray(
|
|
||||||
[
|
|
||||||
$elm$html$Html$Attributes$class('form-input')
|
|
||||||
]),
|
|
||||||
_List_fromArray(
|
|
||||||
[
|
|
||||||
A2(
|
|
||||||
$elm$html$Html$label,
|
|
||||||
_List_fromArray(
|
|
||||||
[
|
|
||||||
$elm$html$Html$Attributes$for('snack-name')
|
|
||||||
]),
|
|
||||||
_List_fromArray(
|
|
||||||
[
|
|
||||||
$elm$html$Html$text('Name')
|
|
||||||
])),
|
])),
|
||||||
A2(
|
A2(
|
||||||
$elm$html$Html$input,
|
$elm$html$Html$input,
|
||||||
_List_fromArray(
|
_List_fromArray(
|
||||||
[
|
[
|
||||||
$elm$html$Html$Attributes$value(model.name),
|
$elm$html$Html$Attributes$value(
|
||||||
$elm$html$Html$Attributes$disabled(true),
|
$author$project$NumberInput$show(model.grossUnitPrice)),
|
||||||
$elm$html$Html$Attributes$id('snack-name')
|
$elm$html$Html$Events$onInput($author$project$Entry$SetGrossUnitPrice),
|
||||||
|
$elm$html$Html$Attributes$type_('number'),
|
||||||
|
$elm$html$Html$Attributes$id('gross-unit-price'),
|
||||||
|
$elm$html$Html$Attributes$step('0.01')
|
||||||
]),
|
]),
|
||||||
_List_Nil)
|
_List_Nil),
|
||||||
])),
|
$author$project$Entry$viewSetSuggestedPriceButton(model)
|
||||||
$author$project$Entry$viewGrossUnitPriceInput(model)
|
]))
|
||||||
]))
|
]))
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
@ -12102,4 +12318,4 @@ _Platform_export({'Entry':{'init':$author$project$Entry$main(
|
|||||||
},
|
},
|
||||||
A2($elm$json$Json$Decode$field, 'id', $elm$json$Json$Decode$int));
|
A2($elm$json$Json$Decode$field, 'id', $elm$json$Json$Decode$int));
|
||||||
},
|
},
|
||||||
A2($elm$json$Json$Decode$field, 'percentage', $elm$json$Json$Decode$float))))))({"versions":{"elm":"0.19.1"},"types":{"message":"Entry.Msg","aliases":{"Entry.SearchResult":{"args":[],"type":"{ barcode : String.String, name : String.String, netUnitPrice : Basics.Float, bought : String.String, salesUnits : Basics.Int, available : Basics.Bool, locationName : String.String, locationId : Basics.Int, groupName : String.String, groupId : Basics.Int, taxGroupId : Basics.Int }"}},"unions":{"Entry.Msg":{"args":[],"tags":{"SetSearchTerm":["String.String"],"SubmitSearch":[],"ReceiveSearchResults":["Result.Result Http.Error (List.List Entry.SearchResult)"],"GotoItemEditor":["Entry.SearchResult"],"SetBarcode":["String.String"],"SetName":["String.String"],"SetSalesUnits":["String.String"],"SetNetUnitPrice":["String.String"],"SetGrossUnitPrice":["String.String"],"SetGroup":["String.String"],"SetLocation":["String.String"],"SetTaxGroup":["String.String"]}},"Basics.Bool":{"args":[],"tags":{"True":[],"False":[]}},"Http.Error":{"args":[],"tags":{"BadUrl":["String.String"],"Timeout":[],"NetworkError":[],"BadStatus":["Basics.Int"],"BadBody":["String.String"]}},"Basics.Float":{"args":[],"tags":{"Float":[]}},"Basics.Int":{"args":[],"tags":{"Int":[]}},"List.List":{"args":["a"],"tags":{}},"Result.Result":{"args":["error","value"],"tags":{"Ok":["value"],"Err":["error"]}},"String.String":{"args":[],"tags":{"String":[]}}}}})}});}(this));
|
A2($elm$json$Json$Decode$field, 'percentage', $elm$json$Json$Decode$float))))))({"versions":{"elm":"0.19.1"},"types":{"message":"Entry.Msg","aliases":{"Entry.SearchResult":{"args":[],"type":"{ barcode : String.String, name : String.String, netUnitPrice : Basics.Float, bought : String.String, salesUnits : Basics.Int, available : Basics.Bool, locationName : String.String, locationId : Basics.Int, groupName : String.String, groupId : Basics.Int, taxGroupId : Basics.Int }"}},"unions":{"Entry.Msg":{"args":[],"tags":{"SetSearchTerm":["String.String"],"SubmitSearch":[],"ReceiveSearchResults":["Result.Result Http.Error (List.List Entry.SearchResult)"],"GotoItemEditor":["Entry.SearchResult"],"SetBarcode":["String.String"],"SetName":["String.String"],"SetSalesUnits":["String.String"],"CalculatorMsg":["Calculator.Msg"],"SetNetUnitPrice":["String.String"],"SetGrossUnitPrice":["String.String"],"SetGroup":["String.String"],"SetLocation":["String.String"],"SetTaxGroup":["String.String"]}},"Basics.Bool":{"args":[],"tags":{"True":[],"False":[]}},"Http.Error":{"args":[],"tags":{"BadUrl":["String.String"],"Timeout":[],"NetworkError":[],"BadStatus":["Basics.Int"],"BadBody":["String.String"]}},"Basics.Float":{"args":[],"tags":{"Float":[]}},"Basics.Int":{"args":[],"tags":{"Int":[]}},"List.List":{"args":["a"],"tags":{}},"Calculator.Msg":{"args":[],"tags":{"SetTax":["String.String"],"SetBundlePrice":["String.String"],"SetBundleSize":["String.String"]}},"Result.Result":{"args":["error","value"],"tags":{"Ok":["value"],"Err":["error"]}},"String.String":{"args":[],"tags":{"String":[]}}}}})}});}(this));
|
@ -63,3 +63,6 @@ th {
|
|||||||
.form-input > select {
|
.form-input > select {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
.formula-input {
|
||||||
|
width: 10em;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user