Move around gross unit price input
This commit is contained in:
		
							parent
							
								
									f15a20589b
								
							
						
					
					
						commit
						89422aad2a
					
				| @ -69,6 +69,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 | ||||||
| @ -135,11 +145,12 @@ 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 | ||||||
|             , 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 | ||||||
| @ -157,26 +168,26 @@ updateState msg globals state = case state of | |||||||
|     SetSalesUnits str -> |     SetSalesUnits str -> | ||||||
|       (ItemEditor { model | salesUnits = NumberInput.update str model.salesUnits }, Cmd.none) |       (ItemEditor { model | salesUnits = NumberInput.update str model.salesUnits }, 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 +228,7 @@ 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 "net-unit-price" ] [ text "Einkaufspreis (Netto)" ] | ||||||
|           , input |           , input | ||||||
|             [ value <| NumberInput.show model.netUnitPrice |             [ value <| NumberInput.show model.netUnitPrice | ||||||
|             , onInput SetNetUnitPrice |             , onInput SetNetUnitPrice | ||||||
| @ -231,29 +242,36 @@ view { globals, state } = case state of | |||||||
|           [ label [ for "tax-group" ] [ text "Steuergruppe" ] |           [ label [ for "tax-group" ] [ text "Steuergruppe" ] | ||||||
|           , Select.view SetTaxGroup model.taxGroup |           , Select.view SetTaxGroup model.taxGroup | ||||||
|           ] |           ] | ||||||
|         ] |  | ||||||
|       , fieldset [] |  | ||||||
|         [ legend [] [ text "Neuer Snackeintrag" ] |  | ||||||
|         , div [ class "form-input" ] |         , div [ class "form-input" ] | ||||||
|           [ label [ for "snack-name" ] [ text "Name" ] |           [ label [ for "gross-unit-price" ] [ text "Verkaufspreis (Brutto)" ] | ||||||
|           , input [ value model.name, disabled True, id "snack-name" ] [] |           , input | ||||||
|  |             [ value <| NumberInput.show model.grossUnitPrice | ||||||
|  |             , onInput SetGrossUnitPrice | ||||||
|  |             , type_ "number" | ||||||
|  |             , id "gross-unit-price" | ||||||
|  |             , step "0.01" | ||||||
|  |             ] | ||||||
|  |             [] | ||||||
|  |           , viewSetSuggestedPriceButton model | ||||||
|           ] |           ] | ||||||
|         , viewGrossUnitPriceInput model |  | ||||||
|         ] |         ] | ||||||
|       ] |       ] | ||||||
| 
 | 
 | ||||||
| viewGrossUnitPriceInput model = | viewSetSuggestedPriceButton model = | ||||||
|   let |   case NumberInput.get model.netUnitPrice of | ||||||
|     suggestedPriceStr = case calculateGarfieldPrice model of |     Nothing -> | ||||||
|       Nothing -> "?" |       button [ disabled True ] [ text "Auf ? setzen" ] | ||||||
|       Just suggestedPrice -> String.fromFloat suggestedPrice |     Just netUnitPrice -> | ||||||
|   in |       let | ||||||
|     div [ class "form-input" ] |         grossUnitPrice = suggestedGrossPrice netUnitPrice (Select.get model.taxGroup).percentage | ||||||
|       [ label [ for "gross-unit-price" ] |       in | ||||||
|         [ text <| "Stückpreis (Brutto), Vorschlag: " ++ suggestedPriceStr |         button | ||||||
|         ] |           [ onClick <| SetGrossUnitPrice <| String.fromFloat grossUnitPrice | ||||||
|       , input [ onInput SetGrossUnitPrice, value <| NumberInput.show model.grossUnitPrice, id "gross-unit-price", type_ "number", step "0.01" ] [] |           -- Prevent submitting the form | ||||||
|       ] |           , type_ "button" | ||||||
|  |           ] | ||||||
|  |           [ text <| "Auf " ++ String.fromFloat grossUnitPrice ++ " setzen" | ||||||
|  |           ] | ||||||
| 
 | 
 | ||||||
| searchResultHeaders = | searchResultHeaders = | ||||||
|   tr [] |   tr [] | ||||||
|  | |||||||
| @ -11119,6 +11119,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 +11163,6 @@ var $author$project$Select$update = F2( | |||||||
| 				{selected: x}); | 				{selected: x}); | ||||||
| 		} | 		} | ||||||
| 	}); | 	}); | ||||||
| var $author$project$NumberInput$get = function ($) { |  | ||||||
| 	return $.value; |  | ||||||
| }; |  | ||||||
| var $author$project$Select$get = function ($) { |  | ||||||
| 	return $.selected; |  | ||||||
| }; |  | ||||||
| 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$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 +11215,53 @@ 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, | 										grossUnitPrice: $author$project$NumberInput$fromFloat( | ||||||
| 											grossUnitPrice: $author$project$NumberInput$fromFloat(0), | 											A2($author$project$Entry$suggestedGrossPrice, searchResult.netUnitPrice, taxGroup.percentage)), | ||||||
| 											group: A4( | 										group: A4( | ||||||
| 												$author$project$Select$init, | 											$author$project$Select$init, | ||||||
| 												A2( | 											A2( | ||||||
| 													$elm$core$Basics$composeR, | 												$elm$core$Basics$composeR, | ||||||
| 													function ($) { |  | ||||||
| 														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: | ||||||
| @ -11338,12 +11302,11 @@ var $author$project$Entry$updateState = F3( | |||||||
| 					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 +11342,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); | ||||||
| @ -11405,6 +11367,9 @@ var $author$project$Entry$update = F2( | |||||||
| 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}; | ||||||
| }; | }; | ||||||
| @ -11566,51 +11531,6 @@ 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) { |  | ||||||
| 	return {$: 'SetGrossUnitPrice', a: a}; |  | ||||||
| }; |  | ||||||
| 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') |  | ||||||
| 			]), |  | ||||||
| 		_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( |  | ||||||
| 				$elm$html$Html$input, |  | ||||||
| 				_List_fromArray( |  | ||||||
| 					[ |  | ||||||
| 						$elm$html$Html$Events$onInput($author$project$Entry$SetGrossUnitPrice), |  | ||||||
| 						$elm$html$Html$Attributes$value( |  | ||||||
| 						$author$project$NumberInput$show(model.grossUnitPrice)), |  | ||||||
| 						$elm$html$Html$Attributes$id('gross-unit-price'), |  | ||||||
| 						$elm$html$Html$Attributes$type_('number'), |  | ||||||
| 						$elm$html$Html$Attributes$step('0.01') |  | ||||||
| 					]), |  | ||||||
| 				_List_Nil) |  | ||||||
| 			])); |  | ||||||
| }; |  | ||||||
| var $author$project$Entry$GotoItemEditor = function (a) { | var $author$project$Entry$GotoItemEditor = function (a) { | ||||||
| 	return {$: 'GotoItemEditor', a: a}; | 	return {$: 'GotoItemEditor', a: a}; | ||||||
| }; | }; | ||||||
| @ -11712,6 +11632,47 @@ var $author$project$Entry$viewSearchResult = function (model) { | |||||||
| 					])) | 					])) | ||||||
| 			])); | 			])); | ||||||
| }; | }; | ||||||
|  | var $author$project$NumberInput$get = function ($) { | ||||||
|  | 	return $.value; | ||||||
|  | }; | ||||||
|  | var $author$project$Select$get = function ($) { | ||||||
|  | 	return $.selected; | ||||||
|  | }; | ||||||
|  | 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; | ||||||
| @ -11937,7 +11898,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, | ||||||
| @ -11971,19 +11932,6 @@ var $author$project$Entry$view = function (_v0) { | |||||||
| 											$elm$html$Html$text('Steuergruppe') | 											$elm$html$Html$text('Steuergruppe') | ||||||
| 										])), | 										])), | ||||||
| 									A2($author$project$Select$view, $author$project$Entry$SetTaxGroup, model.taxGroup) | 									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( | 							A2( | ||||||
| 							$elm$html$Html$div, | 							$elm$html$Html$div, | ||||||
| @ -11997,23 +11945,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('snack-name') | 											$elm$html$Html$Attributes$for('gross-unit-price') | ||||||
| 										]), | 										]), | ||||||
| 									_List_fromArray( | 									_List_fromArray( | ||||||
| 										[ | 										[ | ||||||
| 											$elm$html$Html$text('Name') | 											$elm$html$Html$text('Verkaufspreis (Brutto)') | ||||||
| 										])), | 										])), | ||||||
| 									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) | 								])) | ||||||
| 						])) | 						])) | ||||||
| 				])); | 				])); | ||||||
| 	} | 	} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user