2018-07-14 18:23:41 +02:00
@ extends ( 'layout.default' )
@ if ( $mode == 'edit' )
2020-08-31 20:32:50 +02:00
@ section ( 'title' , $__t ( 'Edit recipe ingredient' ))
2018-07-14 18:23:41 +02:00
@ else
2020-08-31 20:32:50 +02:00
@ section ( 'title' , $__t ( 'Add recipe ingredient' ))
2018-07-14 18:23:41 +02:00
@ endif
@ section ( 'viewJsName' , 'recipeposform' )
@ section ( 'content' )
2020-12-23 19:56:37 +01:00
< script >
Grocy . DefaultMinAmount = '{{$DEFAULT_MIN_AMOUNT}}' ;
</ script >
2020-04-19 08:51:02 -04:00
< div class = "row" >
< div class = "col" >
2020-11-08 19:00:12 +01:00
< div class = "title-related-links" >
< h2 class = "title" >@ yield ( 'title' ) </ h2 >
< h2 >
< span class = "text-muted small" > {{ $__t ( 'Recipe' ) }} < strong > {{ $recipe -> name }} </ strong ></ span >
</ h2 >
</ div >
2020-04-19 08:51:02 -04:00
</ div >
</ div >
2020-10-31 18:37:10 +01:00
2020-11-08 15:09:10 +01:00
< hr class = "my-2" >
2020-10-31 18:37:10 +01:00
2018-07-14 18:23:41 +02:00
< div class = "row" >
2018-07-14 22:49:42 +02:00
< div class = "col-xs-12 col-md-6 col-xl-5 pb-3" >
2018-07-14 18:23:41 +02:00
< script >
Grocy . EditMode = '{{ $mode }}' ;
Grocy . EditObjectParentId = {{ $recipe -> id }};
2019-09-16 09:35:20 +02:00
Grocy . EditObject = { !! json_encode ( $recipePos ) !! };
Grocy . QuantityUnits = { !! json_encode ( $quantityUnits ) !! };
Grocy . QuantityUnitConversionsResolved = { !! json_encode ( $quantityUnitConversionsResolved ) !! };
2018-07-14 18:23:41 +02:00
</ script >
@ if ( $mode == 'edit' )
2020-08-31 20:32:50 +02:00
< script >
Grocy . EditObjectId = {{ $recipePos -> id }};
</ script >
2018-07-14 18:23:41 +02:00
@ endif
2020-08-31 20:32:50 +02:00
< form id = "recipe-pos-form"
novalidate >
2018-07-14 18:23:41 +02:00
@ include ( 'components.productpicker' , array (
2020-08-31 20:32:50 +02:00
'products' => $products ,
'nextInputSelector' => '#amount'
2018-07-14 18:23:41 +02:00
))
2020-12-21 20:13:49 +01:00
< div class = "form-group mb-2 @if(!GROCY_FEATURE_FLAG_STOCK) d-none @endif" >
2020-11-09 21:30:22 +01:00
< div class = "custom-control custom-checkbox" >
< input @ if ( $mode == 'edit'
&&
$recipePos -> only_check_single_unit_in_stock == 1 ) checked @ endif class = "form-check-input custom-control-input" type = "checkbox" id = "only_check_single_unit_in_stock" name = "only_check_single_unit_in_stock" value = "1" >
< label class = "form-check-label custom-control-label"
2020-12-19 14:03:28 +01:00
for = "only_check_single_unit_in_stock" > {{ $__t ( 'Only check if any amount is in stock' ) }} & nbsp ; < i class = "fas fa-question-circle text-muted"
data - toggle = "tooltip"
title = "{{ $__t ('A different amount/unit can then be used below while for stock fulfillment checking it is sufficient when any amount of the product in stock') }}" ></ i ></ label >
2018-08-09 17:24:04 +02:00
</ div >
2018-07-14 18:23:41 +02:00
</ div >
2020-02-01 08:59:37 +01:00
@ php if ( $mode == 'edit' ) { $value = $recipePos -> amount ; } else { $value = 1 ; } @ endphp
@ php if ( $mode == 'edit' ) { $initialQuId = $recipePos -> qu_id ; } else { $initialQuId = '' ; } @ endphp
@ include ( 'components.productamountpicker' , array (
2020-08-31 20:32:50 +02:00
'value' => $value ,
'initialQuId' => $initialQuId ,
2020-12-19 14:03:28 +01:00
'additionalGroupCssClasses' => 'mb-2'
2020-02-01 08:59:37 +01:00
))
2019-05-04 14:50:15 +02:00
< div class = "form-group" >
2020-11-15 15:23:47 +01:00
< label for = "variable_amount" > {{ $__t ( 'Variable amount' ) }} & nbsp ; < i class = "fas fa-question-circle text-muted"
2020-11-08 19:00:12 +01:00
data - toggle = "tooltip"
title = "{{ $__t ('When this is not empty, it will be shown instead of the amount entered above while the amount there will still be used for stock fulfillment checking') }}" ></ i ></ label >
2020-08-31 20:32:50 +02:00
< input type = "text"
class = "form-control"
id = "variable_amount"
name = "variable_amount"
value = "@if( $mode == 'edit'){{ $recipePos->variable_amount }}@endif" >
2019-05-04 14:50:15 +02:00
</ div >
2020-12-21 20:13:49 +01:00
< div class = "form-group @if(!GROCY_FEATURE_FLAG_STOCK) d-none @endif" >
2020-11-08 19:00:12 +01:00
< div class = "custom-control custom-checkbox" >
< input @ if ( $mode == 'edit'
&&
( $recipePos -> not_check_stock_fulfillment == 1 || FindObjectInArrayByPropertyValue ( $products , 'id' , $recipePos -> product_id ) -> not_check_stock_fulfillment_for_recipes == 1 )) checked @ endif class = "form-check-input custom-control-input" type = "checkbox" id = "not_check_stock_fulfillment" name = "not_check_stock_fulfillment" value = "1" >
< label class = "form-check-label custom-control-label"
for = "not_check_stock_fulfillment" > {{ $__t ( 'Disable stock fulfillment checking for this ingredient' ) }} </ label >
</ div >
2018-11-02 19:53:01 +01:00
</ div >
2018-10-25 22:45:44 +02:00
< div class = "form-group" >
2020-11-15 15:23:47 +01:00
< label for = "ingredient_group" > {{ $__t ( 'Group' ) }} & nbsp ; < i class = "fas fa-question-circle text-muted"
2020-11-08 19:00:12 +01:00
data - toggle = "tooltip"
title = "{{ $__t ('This will be used as a headline to group ingredients together') }}" ></ i ></ label >
2020-08-31 20:32:50 +02:00
< input type = "text"
class = "form-control"
id = "ingredient_group"
name = "ingredient_group"
value = "@if( $mode == 'edit'){{ $recipePos->ingredient_group }}@endif" >
2018-10-25 22:45:44 +02:00
</ div >
2018-07-14 18:23:41 +02:00
< div class = "form-group" >
2019-05-01 20:19:18 +02:00
< label for = "note" > {{ $__t ( 'Note' ) }} </ label >
2020-08-31 20:32:50 +02:00
< textarea class = "form-control"
rows = "2"
id = "note"
name = "note" >@ if ( $mode == 'edit' ){{ $recipePos -> note }} @ endif </ textarea >
2018-07-14 18:23:41 +02:00
</ div >
2019-09-19 21:30:24 +02:00
@ if ( GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING )
@ php if ( $mode == 'edit' ) { $value = $recipePos -> price_factor ; } else { $value = 1 ; } @ endphp
@ include ( 'components.numberpicker' , array (
2020-08-31 20:32:50 +02:00
'id' => 'price_factor' ,
'label' => 'Price factor' ,
2020-12-23 19:56:37 +01:00
'min' => $DEFAULT_MIN_AMOUNT ,
2020-10-20 13:08:54 -05:00
'decimals' => $userSettings [ 'stock_decimal_places_amounts' ],
2020-08-31 20:32:50 +02:00
'value' => '' ,
'hint' => $__t ( 'The resulting price of this ingredient will be multiplied by this factor' ),
'isRequired' => true ,
2020-11-15 14:15:09 +01:00
'value' => $value ,
'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount'
2019-09-19 21:30:24 +02:00
))
@ else
2020-08-31 20:32:50 +02:00
< input type = "hidden"
name = "price_factor"
id = "price"
value = "1" >
2019-09-19 21:30:24 +02:00
@ endif
2020-08-31 20:32:50 +02:00
< button id = "save-recipe-pos-button"
class = "btn btn-success" > {{ $__t ( 'Save' ) }} </ button >
2018-07-14 18:23:41 +02:00
</ form >
</ div >
2019-12-21 05:36:02 -06:00
< div class = "col-xs-12 col-md-6 col-xl-4 hide-when-embedded" >
2018-07-14 18:23:41 +02:00
@ include ( 'components.productcard' )
</ div >
</ div >
@ stop