2018-04-11 19:49:35 +02:00
@ extends ( 'layout.default' )
2018-04-12 21:13:38 +02:00
@ if ( $mode == 'edit' )
2020-08-31 20:32:50 +02:00
@ section ( 'title' , $__t ( 'Edit product' ))
2018-04-12 21:13:38 +02:00
@ else
2020-08-31 20:32:50 +02:00
@ section ( 'title' , $__t ( 'Create product' ))
2018-04-12 21:13:38 +02:00
@ endif
@ section ( 'viewJsName' , 'productform' )
2018-04-11 19:49:35 +02:00
@ section ( 'content' )
2018-07-10 20:37:13 +02:00
< div class = "row" >
2020-04-19 08:51:02 -04:00
< div class = "col" >
< h2 class = "title" >@ yield ( 'title' ) </ h2 >
</ 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
2020-04-19 08:51:02 -04:00
< div class = "row" >
2018-07-10 20:37:13 +02:00
< div class = "col-lg-6 col-xs-12" >
2020-08-31 20:32:50 +02:00
< script >
Grocy . EditMode = '{{ $mode }}' ;
</ script >
2018-07-10 20:37:13 +02:00
@ if ( $mode == 'edit' )
2020-08-31 20:32:50 +02:00
< script >
Grocy . EditObjectId = {{ $product -> id }};
</ script >
@ if ( ! empty ( $product -> picture_file_name ))
< script >
Grocy . ProductPictureFileName = '{{ $product->picture_file_name }}' ;
</ script >
@ endif
2018-07-10 20:37:13 +02:00
@ endif
2020-08-31 20:32:50 +02:00
< form id = "product-form"
novalidate >
2018-07-10 20:37:13 +02:00
< div class = "form-group" >
2019-05-01 20:19:18 +02:00
< label for = "name" > {{ $__t ( 'Name' ) }} </ label >
2020-08-31 20:32:50 +02:00
< input type = "text"
class = "form-control"
required
id = "name"
name = "name"
value = "@if( $mode == 'edit'){{ $product->name }}@endif" >
2019-05-01 20:19:18 +02:00
< div class = "invalid-feedback" > {{ $__t ( 'A name is required' ) }} </ div >
2018-07-10 20:37:13 +02:00
</ div >
2020-08-17 14:47:33 -05:00
< div class = "form-group" >
2020-11-08 19:00:12 +01:00
< div class = "custom-control custom-checkbox" >
2020-08-31 20:32:50 +02:00
< input @ if ( $mode == 'create'
)
checked
@ elseif ( $mode == 'edit'
&&
2020-11-08 19:00:12 +01:00
$product -> active == 1 ) checked @ endif class = "form-check-input custom-control-input" type = "checkbox" id = "active" name = "active" value = "1" >
< label class = "form-check-label custom-control-label"
2020-08-31 20:32:50 +02:00
for = "active" > {{ $__t ( 'Active' ) }} </ label >
2020-08-17 14:47:33 -05:00
</ div >
</ div >
2019-09-14 17:34:36 +02:00
@ php $prefillById = '' ; if ( $mode == 'edit' ) { $prefillById = $product -> parent_product_id ; } @ endphp
@ php
2020-08-31 20:32:50 +02:00
$hint = '' ;
if ( $isSubProductOfOthers )
{
$hint = $__t ( 'Not possible because this product is already used as a parent product in another product' );
}
2019-09-14 17:34:36 +02:00
@ endphp
@ include ( 'components.productpicker' , array (
2020-08-31 20:32:50 +02:00
'products' => $products ,
'prefillById' => $prefillById ,
'disallowAllProductWorkflows' => true ,
'isRequired' => false ,
'label' => 'Parent product' ,
'disabled' => $isSubProductOfOthers ,
'hint' => $hint
2019-09-14 17:34:36 +02:00
))
2020-11-10 21:59:19 +01:00
@ php $hint = '' ; @ endphp
2019-09-14 17:34:36 +02:00
2018-07-10 20:37:13 +02:00
< div class = "form-group" >
2019-05-01 20:19:18 +02:00
< label for = "description" > {{ $__t ( 'Description' ) }} </ label >
2020-08-31 20:32:50 +02:00
< textarea class = "form-control wysiwyg-editor"
id = "description"
name = "description" >@ if ( $mode == 'edit' ){{ $product -> description }} @ endif </ textarea >
2018-07-10 20:37:13 +02:00
</ div >
2019-09-19 17:46:52 +02:00
@ if ( GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING )
2018-07-10 20:37:13 +02:00
< div class = "form-group" >
2019-10-12 13:27:15 +01:00
< label for = "location_id" > {{ $__t ( 'Default location' ) }} </ label >
2020-08-31 20:32:50 +02:00
< select required
2020-11-16 19:10:29 +01:00
class = "custom-control custom-select"
2020-08-31 20:32:50 +02:00
id = "location_id"
name = "location_id" >
2018-10-20 14:55:49 +02:00
< option ></ option >
2018-07-10 20:37:13 +02:00
@ foreach ( $locations as $location )
2020-08-31 20:32:50 +02:00
< option @ if ( $mode == 'edit'
&&
$location -> id == $product -> location_id ) selected = "selected" @ endif value = "{{ $location->id }}" > {{ $location -> name }} </ option >
2018-07-10 20:37:13 +02:00
@ endforeach
</ select >
2019-05-01 20:19:18 +02:00
< div class = "invalid-feedback" > {{ $__t ( 'A location is required' ) }} </ div >
2018-07-10 20:37:13 +02:00
</ div >
2019-09-19 17:46:52 +02:00
@ else
2020-08-31 20:32:50 +02:00
< input type = "hidden"
name = "location_id"
id = "location_id"
value = "1" >
2019-09-19 17:46:52 +02:00
@ endif
2018-07-10 20:37:13 +02:00
2020-04-26 10:28:02 -05:00
@ php $prefillById = '' ; if ( $mode == 'edit' ) { $prefillById = $product -> shopping_location_id ; } @ endphp
2020-03-27 13:27:40 -05:00
@ if ( GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING )
@ include ( 'components.shoppinglocationpicker' , array (
2020-08-31 20:32:50 +02:00
'label' => 'Default store' ,
'prefillById' => $prefillById ,
'shoppinglocations' => $shoppinglocations
2020-03-27 13:27:40 -05:00
))
@ else
2020-08-31 20:32:50 +02:00
< input type = "hidden"
name = "shopping_location_id"
id = "shopping_location_id"
value = "1" >
2020-03-27 13:27:40 -05:00
@ endif
2018-09-08 12:04:31 +02:00
@ php if ( $mode == 'edit' ) { $value = $product -> min_stock_amount ; } else { $value = 0 ; } @ endphp
@ include ( 'components.numberpicker' , array (
2020-08-31 20:32:50 +02:00
'id' => 'min_stock_amount' ,
'label' => 'Minimum stock amount' ,
2020-11-16 19:10:29 +01:00
'min' => '0.' ,
2020-10-20 13:08:54 -05:00
'decimals' => $userSettings [ 'stock_decimal_places_amounts' ],
2020-08-31 20:32:50 +02:00
'value' => $value ,
2020-11-15 14:15:09 +01:00
'additionalGroupCssClasses' => 'mb-1' ,
'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount'
2018-09-08 12:04:31 +02:00
))
2019-09-26 10:36:49 +02:00
< div class = "form-group" >
2020-11-08 19:00:12 +01:00
< div class = "custom-control custom-checkbox" >
2020-08-31 20:32:50 +02:00
< input @ if ( $mode == 'edit'
&&
2020-11-08 19:00:12 +01:00
$product -> cumulate_min_stock_amount_of_sub_products == 1 ) checked @ endif class = "form-check-input custom-control-input" type = "checkbox" id = "cumulate_min_stock_amount_of_sub_products" name = "cumulate_min_stock_amount_of_sub_products" value = "1" >
< label class = "form-check-label custom-control-label"
2020-08-31 20:32:50 +02:00
for = "cumulate_min_stock_amount_of_sub_products" > {{ $__t ( 'Accumulate sub products min. stock amount' ) }}
2020-11-15 15:23:47 +01:00
& nbsp ; < i class = "fas fa-question-circle text-muted"
2020-11-08 19:00:12 +01:00
data - toggle = "tooltip"
2020-11-15 19:53:44 +01:00
title = "{{ $__t ('If enabled, the min. stock amount of sub products will be accumulated into this product, means the sub product will never be " missing ", only this product') }}" ></ i >
2019-09-26 10:36:49 +02:00
</ label >
</ div >
</ div >
2020-04-12 15:59:08 +02:00
@ if ( GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING )
2020-11-15 19:53:44 +01:00
< div class = "form-group" >
< label class = "d-block my-0"
for = "location_id" > {{ $__t ( 'Due date type' ) }}
< i class = "fas fa-question-circle text-muted"
data - toggle = "tooltip"
title = "{{ $__t ('Based on the selected type, the highlighting on the stock overview page will be different') }}" ></ i >
</ label >
< div class = "custom-control custom-radio mt-n2" >
< input class = "custom-control-input"
type = "radio"
name = "due_type"
id = "due-type-bestbefore"
value = "1"
@ if ( $mode == 'edit'
&&
$product -> due_type == 1 ) checked @ else checked @ endif >
< label class = "custom-control-label"
for = "due-type-bestbefore" > {{ $__t ( 'Best before date' ) }}
< i class = "fas fa-question-circle text-muted"
data - toggle = "tooltip"
title = "{{ $__t ('Means that the product is maybe still safe to be consumed after its due date is reached') }}" ></ i >
</ label >
</ div >
< div class = "custom-control custom-radio mt-n2" >
< input class = "custom-control-input"
type = "radio"
name = "due_type"
id = "due-type-expiration"
value = "2"
@ if ( $mode == 'edit'
&&
$product -> due_type == 2 ) checked @ endif >
< label class = "custom-control-label"
for = "due-type-expiration" > {{ $__t ( 'Expiration date' ) }}
< i class = "fas fa-question-circle text-muted"
data - toggle = "tooltip"
title = "{{ $__t ('Means that the product is not safe to be consumed after its due date is reached') }}" ></ i >
</ label >
</ div >
</ div >
2018-09-08 12:04:31 +02:00
@ php if ( $mode == 'edit' ) { $value = $product -> default_best_before_days ; } else { $value = 0 ; } @ endphp
@ include ( 'components.numberpicker' , array (
2020-08-31 20:32:50 +02:00
'id' => 'default_best_before_days' ,
2020-11-15 19:53:44 +01:00
'label' => 'Default due days' ,
2020-08-31 20:32:50 +02:00
'min' => - 1 ,
'value' => $value ,
2020-12-07 19:48:33 +01:00
'hint' => $__t ( 'For purchases this amount of days will be added to today for the due date suggestion' ) . ' (' . $__t ( '-1 means that this product will be never overdue' ) . ')'
2018-09-08 12:04:31 +02:00
))
2018-07-10 20:37:13 +02:00
2020-04-12 15:59:08 +02:00
@ if ( GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING )
2018-11-17 19:39:37 +01:00
@ php if ( $mode == 'edit' ) { $value = $product -> default_best_before_days_after_open ; } else { $value = 0 ; } @ endphp
@ include ( 'components.numberpicker' , array (
2020-08-31 20:32:50 +02:00
'id' => 'default_best_before_days_after_open' ,
2020-11-15 19:53:44 +01:00
'label' => 'Default due days after opened' ,
2020-08-31 20:32:50 +02:00
'min' => 0 ,
'value' => $value ,
2020-12-07 19:48:33 +01:00
'hint' => $__t ( 'When this product was marked as opened, the due date will be replaced by today + this amount of days (a value of 0 disables this)' )
2018-11-17 19:39:37 +01:00
))
2020-11-15 16:05:25 +01:00
@ else
< input type = "hidden"
name = "default_best_before_days_after_open"
id = "default_best_before_days_after_open"
value = "1" >
2020-04-12 15:59:08 +02:00
@ endif
2020-11-15 16:05:25 +01:00
@ else
< input type = "hidden"
name = "default_best_before_days"
id = "default_best_before_days"
value = "1" >
2020-11-15 19:53:44 +01:00
< input type = "hidden"
name = "due_type"
id = "due_type"
value = "1" >
2020-04-12 15:59:08 +02:00
@ endif
2018-11-17 19:39:37 +01:00
2018-09-24 13:02:52 +02:00
< div class = "form-group" >
2019-05-01 20:19:18 +02:00
< label for = "product_group_id" > {{ $__t ( 'Product group' ) }} </ label >
2020-11-16 19:10:29 +01:00
< select class = "custom-control custom-select"
2020-08-31 20:32:50 +02:00
id = "product_group_id"
name = "product_group_id" >
2018-09-24 13:02:52 +02:00
< option ></ option >
@ foreach ( $productgroups as $productgroup )
2020-08-31 20:32:50 +02:00
< option @ if ( $mode == 'edit'
&&
$productgroup -> id == $product -> product_group_id ) selected = "selected" @ endif value = "{{ $productgroup->id }}" > {{ $productgroup -> name }} </ option >
2018-09-24 13:02:52 +02:00
@ endforeach
</ select >
</ div >
2018-07-10 20:37:13 +02:00
< div class = "form-group" >
2020-11-13 17:30:57 +01:00
< label for = "qu_id_stock" > {{ $__t ( 'Quantity unit stock' ) }} </ label >
2020-11-15 15:23:47 +01:00
< i class = "fas fa-question-circle text-muted"
2020-11-13 17:30:57 +01:00
data - toggle = "tooltip"
title = "{{ $__t ('Quantity unit stock cannot be changed after first purchase') }}" ></ i >
2020-08-31 20:32:50 +02:00
< select required
2020-11-16 19:10:29 +01:00
class = "custom-control custom-select input-group-qu"
2020-11-13 17:30:57 +01:00
id = "qu_id_stock"
name = "qu_id_stock"
@ if ( $mode == 'edit'
)
disabled
@ endif >
2018-10-20 14:55:49 +02:00
< option ></ option >
2018-07-10 20:37:13 +02:00
@ foreach ( $quantityunits as $quantityunit )
2020-08-31 20:32:50 +02:00
< option @ if ( $mode == 'edit'
&&
2020-11-13 17:30:57 +01:00
$quantityunit -> id == $product -> qu_id_stock ) selected = "selected" @ endif value = "{{ $quantityunit->id }}" data - plural - form = "{{ $quantityunit->name_plural }}" > {{ $quantityunit -> name }} </ option >
2018-07-10 20:37:13 +02:00
@ endforeach
</ select >
2019-05-01 20:19:18 +02:00
< div class = "invalid-feedback" > {{ $__t ( 'A quantity unit is required' ) }} </ div >
2018-07-10 20:37:13 +02:00
</ div >
< div class = "form-group" >
2020-11-13 17:30:57 +01:00
< label for = "qu_id_purchase" > {{ $__t ( 'Default quantity unit purchase' ) }} </ label >
2020-11-15 15:23:47 +01:00
< i class = "fas fa-question-circle text-muted"
2020-08-31 20:32:50 +02:00
data - toggle = "tooltip"
2020-11-13 17:58:46 +01:00
title = "{{ $__t ('This is the default quantity unit used when adding this product to the shopping list') }}" ></ i >
2020-08-31 20:32:50 +02:00
< select required
2020-11-16 19:10:29 +01:00
class = "custom-control custom-select input-group-qu"
2020-11-13 17:30:57 +01:00
id = "qu_id_purchase"
name = "qu_id_purchase" >
2018-10-20 14:55:49 +02:00
< option ></ option >
2018-07-10 20:37:13 +02:00
@ foreach ( $quantityunits as $quantityunit )
2020-08-31 20:32:50 +02:00
< option @ if ( $mode == 'edit'
&&
2020-11-13 17:30:57 +01:00
$quantityunit -> id == $product -> qu_id_purchase ) selected = "selected" @ endif value = "{{ $quantityunit->id }}" > {{ $quantityunit -> name }} </ option >
2018-07-10 20:37:13 +02:00
@ endforeach
</ select >
2019-05-01 20:19:18 +02:00
< div class = "invalid-feedback" > {{ $__t ( 'A quantity unit is required' ) }} </ div >
2018-07-10 20:37:13 +02:00
</ div >
2018-09-08 12:04:31 +02:00
@ php if ( $mode == 'edit' ) { $value = $product -> qu_factor_purchase_to_stock ; } else { $value = 1 ; } @ endphp
@ include ( 'components.numberpicker' , array (
2020-08-31 20:32:50 +02:00
'id' => 'qu_factor_purchase_to_stock' ,
'label' => 'Factor purchase to stock quantity unit' ,
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' => $value ,
2020-11-15 14:15:09 +01:00
'additionalCssClasses' => 'input-group-qu locale-number-input locale-number-quantity-amount' ,
2020-08-31 20:32:50 +02:00
'additionalHtmlElements' => '<p id="qu-conversion-info"
2020-11-10 22:01:23 +01:00
class="form-text text-info d-none"></p>'
2018-09-08 12:04:31 +02:00
))
2018-07-10 20:37:13 +02:00
2019-09-26 13:14:24 +02:00
< div class = "form-group mb-1" >
2020-11-08 19:00:12 +01:00
< div class = "custom-control custom-checkbox" >
2020-08-31 20:32:50 +02:00
< input @ if ( $mode == 'edit'
&&
2020-11-08 19:00:12 +01:00
$product -> enable_tare_weight_handling == 1 ) checked @ endif class = "form-check-input custom-control-input" type = "checkbox" id = "enable_tare_weight_handling" name = "enable_tare_weight_handling" value = "1" >
< label class = "form-check-label custom-control-label"
2020-08-31 20:32:50 +02:00
for = "enable_tare_weight_handling" > {{ $__t ( 'Enable tare weight handling' ) }}
2020-11-15 15:23:47 +01:00
& nbsp ; < i class = "fas fa-question-circle text-muted"
2020-11-08 19:00:12 +01:00
data - toggle = "tooltip"
title = "{{ $__t ('This is useful e.g. for flour in jars - on purchase/consume/inventory you always weigh the whole jar, the amount to be posted is then automatically calculated based on what is in stock and the tare weight defined below') }}" ></ i >
2019-03-05 17:51:50 +01:00
</ label >
</ div >
</ div >
@ php if ( $mode == 'edit' ) { $value = $product -> tare_weight ; } else { $value = 0 ; } @ endphp
@ php if (( $mode == 'edit' && $product -> enable_tare_weight_handling == 0 ) || $mode == 'create' ) { $additionalAttributes = 'disabled' ; } else { $additionalAttributes = '' ; } @ endphp
@ include ( 'components.numberpicker' , array (
2020-08-31 20:32:50 +02:00
'id' => 'tare_weight' ,
'label' => 'Tare weight' ,
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' => $value ,
'additionalAttributes' => $additionalAttributes ,
2020-11-15 14:15:09 +01:00
'contextInfoId' => 'tare_weight_qu_info' ,
'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount'
2019-03-05 17:51:50 +01:00
))
2019-09-20 20:17:54 +02:00
@ php $additionalAttributes = '' @ endphp
2019-03-05 17:51:50 +01:00
2019-04-06 15:42:40 +02:00
@ if ( GROCY_FEATURE_FLAG_RECIPES )
< div class = "form-group" >
2020-11-08 19:00:12 +01:00
< div class = "custom-control custom-checkbox" >
2020-08-31 20:32:50 +02:00
< input @ if ( $mode == 'edit'
&&
2020-11-08 19:00:12 +01:00
$product -> not_check_stock_fulfillment_for_recipes == 1 ) checked @ endif class = "form-check-input custom-control-input" type = "checkbox" id = "not_check_stock_fulfillment_for_recipes" name = "not_check_stock_fulfillment_for_recipes" value = "1" >
< label class = "form-check-label custom-control-label"
2020-08-31 20:32:50 +02:00
for = "not_check_stock_fulfillment_for_recipes" > {{ $__t ( 'Disable stock fulfillment checking for this ingredient' ) }}
2020-11-15 15:23:47 +01:00
& 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 the default setting when adding this product as a recipe ingredient') }}" ></ i >
2019-04-06 15:42:40 +02:00
</ label >
</ div >
</ div >
2020-11-15 16:05:25 +01:00
@ else
< input type = "hidden"
name = "not_check_stock_fulfillment_for_recipes"
id = "not_check_stock_fulfillment_for_recipes"
value = "0" >
@ endif
2019-09-20 20:06:24 +02:00
2019-09-21 13:08:42 +02:00
@ php if ( $mode == 'edit' ) { $value = $product -> calories ; } else { $value = 0 ; } @ endphp
2019-09-20 20:06:24 +02:00
@ include ( 'components.numberpicker' , array (
2020-08-31 20:32:50 +02:00
'id' => 'calories' ,
'label' => 'Energy (kcal)' ,
2020-10-21 18:14:24 +02:00
'min' => '0.' . str_repeat ( '0' , $userSettings [ 'stock_decimal_places_amounts' ]),
2020-10-20 13:08:54 -05:00
'decimals' => $userSettings [ 'stock_decimal_places_amounts' ],
2020-08-31 20:32:50 +02:00
'value' => $value ,
'hint' => $__t ( 'Per stock quantity unit' ),
2020-11-15 14:15:09 +01:00
'isRequired' => false ,
'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount'
2019-09-20 20:06:24 +02:00
))
2019-04-06 15:42:40 +02:00
2020-01-26 20:01:30 +01:00
@ if ( GROCY_FEATURE_FLAG_STOCK_PRODUCT_FREEZING )
@ php if ( $mode == 'edit' ) { $value = $product -> default_best_before_days_after_freezing ; } else { $value = 0 ; } @ endphp
@ include ( 'components.numberpicker' , array (
2020-08-31 20:32:50 +02:00
'id' => 'default_best_before_days_after_freezing' ,
2020-11-15 19:53:44 +01:00
'label' => 'Default due days after freezing' ,
2020-08-31 20:32:50 +02:00
'min' => - 1 ,
'value' => $value ,
2020-12-19 17:32:47 +01:00
'hint' => $__t ( 'On moving this product to a freezer location (so when freezing it), the due date will be replaced by today + this amount of days' ) . ' (' . $__t ( '-1 means that this product will be never overdue' ) . ')'
2020-01-26 20:01:30 +01:00
))
@ php if ( $mode == 'edit' ) { $value = $product -> default_best_before_days_after_thawing ; } else { $value = 0 ; } @ endphp
@ include ( 'components.numberpicker' , array (
2020-08-31 20:32:50 +02:00
'id' => 'default_best_before_days_after_thawing' ,
2020-11-15 19:53:44 +01:00
'label' => 'Default due days after thawing' ,
2020-12-19 17:32:47 +01:00
'min' => 0 ,
2020-08-31 20:32:50 +02:00
'value' => $value ,
2020-11-15 19:53:44 +01:00
'hint' => $__t ( 'On moving this product from a freezer location (so when thawing it), the due date will be replaced by today + this amount of days' )
2020-01-26 20:01:30 +01:00
))
@ else
2020-08-31 20:32:50 +02:00
< input type = "hidden"
name = "default_best_before_days_after_freezing"
value = "0" >
< input type = "hidden"
name = "default_best_before_days_after_thawing"
value = "0" >
2020-01-26 20:01:30 +01:00
@ endif
2020-11-15 09:57:45 +01:00
@ php if ( $mode == 'edit' ) { $value = $product -> quick_consume_amount ; } else { $value = 1 ; } @ endphp
@ include ( 'components.numberpicker' , array (
'id' => 'quick_consume_amount' ,
'label' => 'Quick consume amount' ,
2020-12-23 19:56:37 +01:00
'min' => $DEFAULT_MIN_AMOUNT ,
2020-11-16 19:10:29 +01:00
'decimals' => $userSettings [ 'stock_decimal_places_amounts' ],
2020-11-15 09:57:45 +01:00
'value' => $value ,
'hint' => $__t ( 'This amount is used for the "quick consume/open buttons" on the stock overview page (related to quantity unit stock)' ),
2020-11-15 14:15:09 +01:00
'contextInfoId' => 'quick_consume_qu_info' ,
'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount'
2020-11-15 09:57:45 +01:00
))
2019-04-22 22:16:35 +02:00
@ include ( 'components.userfieldsform' , array (
2020-08-31 20:32:50 +02:00
'userfields' => $userfields ,
'entity' => 'products'
2019-04-22 22:16:35 +02:00
))
2020-12-21 20:43:10 +01:00
< div class = "form-group" >
< div class = "custom-control custom-checkbox" >
2020-12-22 19:10:02 +01:00
< input @ if ( $mode == 'edit'
2020-12-21 20:43:10 +01:00
&&
$product -> hide_on_stock_overview == 1 ) checked @ endif class = "form-check-input custom-control-input" type = "checkbox" id = "hide_on_stock_overview" name = "hide_on_stock_overview" value = "1" >
< label class = "form-check-label custom-control-label"
for = "hide_on_stock_overview" > {{ $__t ( 'Never show on stock overview' ) }} & nbsp ; < i class = "fas fa-question-circle text-muted"
data - toggle = "tooltip"
title = "{{ $__t ('The stock overview page lists all products which are currently in-stock or below their min. stock amount - enable this to hide this product there always') }}" ></ i >
</ label >
</ div >
</ div >
2020-11-14 11:05:36 +01:00
< small id = "save-hint"
class = "my-2 form-text text-muted @if( $mode == 'edit') d-none @endif" > {{ $__t ( 'Save & continue to add quantity unit conversions & barcodes' ) }} </ small >
2020-11-08 19:00:12 +01:00
2020-11-08 22:13:36 +01:00
< button id = "save-product-button"
class = "save-product-button btn btn-success mb-2"
2020-11-08 19:00:12 +01:00
data - location = "continue" > {{ $__t ( 'Save & continue' ) }} </ button >
< button class = "save-product-button btn btn-info mb-2"
data - location = "return" > {{ $__t ( 'Save & return to products' ) }} </ button >
2018-07-10 20:37:13 +02:00
</ form >
2019-04-22 22:16:35 +02:00
2018-07-10 20:37:13 +02:00
</ div >
2018-10-01 20:20:50 +02:00
2020-11-08 19:00:12 +01:00
< div class = "col-lg-6 col-xs-12 @if( $mode == 'create') d-none @endif" >
2020-12-21 20:13:49 +01:00
< div class = "row @if(!GROCY_FEATURE_FLAG_STOCK) d-none @endif" >
2020-11-08 19:00:12 +01:00
< div class = "col" >
< div class = "title-related-links" >
< h4 >
2020-11-10 18:11:33 +01:00
{{ $__t ( 'Barcodes' ) }}
2020-11-08 19:00:12 +01:00
</ h4 >
< button class = "btn btn-outline-dark d-md-none mt-2 float-right order-1 order-md-3"
type = "button"
data - toggle = "collapse"
data - target = "#related-links" >
< i class = "fas fa-ellipsis-v" ></ i >
</ button >
2020-11-12 13:08:50 +01:00
@ if ( $mode == "edit" )
2020-11-08 19:00:12 +01:00
< div class = "related-links collapse d-md-flex order-2 width-xs-sm-100"
id = "related-links" >
< a class = "btn btn-outline-primary btn-sm m-1 mt-md-0 mb-md-0 float-right show-as-dialog-link"
2020-11-10 18:11:33 +01:00
href = "{{ $U ('/productbarcodes/new?embedded&product=' . $product->id ) }}" >
2020-11-08 19:00:12 +01:00
{{ $__t ( 'Add' ) }}
2020-08-31 20:32:50 +02:00
</ a >
2020-11-08 19:00:12 +01:00
</ div >
2020-11-12 13:08:50 +01:00
@ endif
2020-11-08 19:00:12 +01:00
</ div >
2020-11-10 18:11:33 +01:00
< h5 id = "barcode-headline-info"
2020-11-08 19:00:12 +01:00
class = "text-muted font-italic" ></ h5 >
2020-11-10 18:11:33 +01:00
< table id = "barcode-table"
2020-11-08 19:00:12 +01:00
class = "table table-sm table-striped nowrap w-100" >
< thead >
< tr >
2020-11-11 22:28:05 +01:00
< th class = "border-right" >< a class = "text-muted change-table-columns-visibility-button"
data - toggle = "tooltip"
2020-11-11 21:11:17 +01:00
data - toggle = "tooltip"
2020-12-16 18:18:03 +01:00
title = "{{ $__t ('Table options') }}"
2020-11-11 21:11:17 +01:00
data - table - selector = "#barcode-table"
href = "#" >< i class = "fas fa-eye" ></ i ></ a >
</ th >
2020-11-10 18:11:33 +01:00
< th > {{ $__t ( 'Barcode' ) }} </ th >
2020-12-21 09:54:20 +01:00
< th class = "@if(!GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) d-none @endif" > {{ $__t ( 'Store' ) }} </ th >
2020-11-10 18:11:33 +01:00
< th > {{ $__t ( 'Quantity unit' ) }} </ th >
< th > {{ $__t ( 'Amount' ) }} </ th >
2020-12-19 10:51:07 +01:00
< th class = "@if(!GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) d-none @endif" > {{ $__t ( 'Last price' ) }} </ th >
2020-12-19 17:20:54 +01:00
< th > {{ $__t ( 'Note' ) }} </ th >
2020-11-17 19:11:02 +01:00
@ include ( 'components.userfields_thead' , array (
'userfields' => $productBarcodeUserfields
))
2020-11-08 19:00:12 +01:00
</ tr >
</ thead >
< tbody class = "d-none" >
@ if ( $mode == "edit" )
2020-11-10 18:11:33 +01:00
@ foreach ( $barcodes as $barcode )
@ if ( $barcode -> product_id == $product -> id || $barcode -> product_id == null )
2020-11-08 19:00:12 +01:00
< tr >
< td class = "fit-content border-right" >
2020-11-10 18:11:33 +01:00
< a class = "btn btn-sm btn-info show-as-dialog-link @if( $barcode->product_id == null) disabled @endif"
href = "{{ $U ('/productbarcodes/' . $barcode->id . '?embedded&product=' . $product->id ) }}" >
2020-11-08 19:00:12 +01:00
< i class = "fas fa-edit" ></ i >
</ a >
2020-11-10 18:11:33 +01:00
< a class = "btn btn-sm btn-danger barcode-delete-button @if( $barcode->product_id == null) disabled @endif"
2020-11-08 19:00:12 +01:00
href = "#"
2020-11-10 18:11:33 +01:00
data - barcode - id = "{{ $barcode->id }}"
data - barcode = "{{ $barcode->barcode }}"
data - product - barcode = "{{ $product->barcode }}"
data - product - id = "{{ $product->id }}" >
2020-11-08 19:00:12 +01:00
< i class = "fas fa-trash" ></ i >
</ a >
</ td >
< td >
2020-11-10 18:11:33 +01:00
{{ $barcode -> barcode }}
2020-11-08 19:00:12 +01:00
</ td >
2020-12-21 09:54:20 +01:00
< td class = "@if(!GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) d-none @endif"
id = "barcode-shopping-location" >
2020-11-10 18:11:33 +01:00
@ if ( FindObjectInArrayByPropertyValue ( $shoppinglocations , 'id' , $barcode -> shopping_location_id ) !== null )
{{ FindObjectInArrayByPropertyValue ( $shoppinglocations , 'id' , $barcode -> shopping_location_id ) -> name }}
@ endif
2020-11-08 19:00:12 +01:00
</ td >
2020-11-10 18:11:33 +01:00
< td >
@ if ( ! empty ( $barcode -> qu_id ))
2020-11-16 19:10:29 +01:00
{{ FindObjectInArrayByPropertyValue ( $quantityunits , 'id' , $barcode -> qu_id ) -> name }}
2020-11-08 19:00:12 +01:00
@ endif
</ td >
2020-11-10 18:11:33 +01:00
< td >
@ if ( ! empty ( $barcode -> amount ))
2020-11-16 19:10:29 +01:00
< span class = "locale-number locale-number-quantity-amount" > {{ $barcode -> amount }} </ span >
2020-11-10 18:11:33 +01:00
@ endif
2020-11-08 19:00:12 +01:00
</ td >
2020-12-19 10:51:07 +01:00
< td class = "@if(!GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) d-none @endif" >
< span class = "locale-number locale-number-currency" > {{ $barcode -> last_price }} </ span >
</ td >
2020-12-19 17:20:54 +01:00
< td >
{{ $barcode -> note }}
</ td >
2020-11-17 19:11:02 +01:00
@ include ( 'components.userfields_tbody' , array (
'userfields' => $productBarcodeUserfields ,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue ( $productBarcodeUserfieldValues , 'object_id' , $barcode -> id )
))
2020-11-08 19:00:12 +01:00
</ tr >
2020-08-31 20:32:50 +02:00
@ endif
2020-11-08 19:00:12 +01:00
@ endforeach
@ endif
</ tbody >
</ table >
</ div >
</ div >
2020-12-21 20:13:49 +01:00
< div class = "row @if(GROCY_FEATURE_FLAG_STOCK) mt-5 @endif" >
2020-11-08 19:00:12 +01:00
< div class = "col" >
< div class = "title-related-links" >
< h4 >
2020-11-10 18:11:33 +01:00
{{ $__t ( 'QU conversions' ) }}
2020-11-08 19:00:12 +01:00
</ h4 >
< button class = "btn btn-outline-dark d-md-none mt-2 float-right order-1 order-md-3"
type = "button"
data - toggle = "collapse"
data - target = "#related-links" >
< i class = "fas fa-ellipsis-v" ></ i >
</ button >
2020-11-12 13:08:50 +01:00
@ if ( $mode == "edit" )
2020-11-08 19:00:12 +01:00
< div class = "related-links collapse d-md-flex order-2 width-xs-sm-100"
id = "related-links" >
< a class = "btn btn-outline-primary btn-sm m-1 mt-md-0 mb-md-0 float-right show-as-dialog-link"
2020-11-10 18:11:33 +01:00
href = "{{ $U ('/quantityunitconversion/new?embedded&product=' . $product->id ) }}" >
2020-11-08 19:00:12 +01:00
{{ $__t ( 'Add' ) }}
2020-08-31 20:32:50 +02:00
</ a >
2020-11-08 19:00:12 +01:00
</ div >
2020-11-12 13:08:50 +01:00
@ endif
2020-11-08 19:00:12 +01:00
</ div >
2020-11-10 18:11:33 +01:00
< h5 id = "qu-conversion-headline-info"
2020-11-08 19:00:12 +01:00
class = "text-muted font-italic" ></ h5 >
2020-11-15 14:58:35 +01:00
< table id = "qu-conversions-table-products"
2020-11-08 19:00:12 +01:00
class = "table table-sm table-striped nowrap w-100" >
< thead >
< tr >
2020-11-11 22:28:05 +01:00
< th class = "border-right" >< a class = "text-muted change-table-columns-visibility-button"
2020-11-11 21:11:17 +01:00
data - toggle = "tooltip"
2020-12-16 18:18:03 +01:00
title = "{{ $__t ('Table options') }}"
2020-11-15 14:59:54 +01:00
data - table - selector = "#qu-conversions-table-products"
2020-11-11 21:11:17 +01:00
href = "#" >< i class = "fas fa-eye" ></ i ></ a >
</ th >
2020-11-10 18:11:33 +01:00
< th > {{ $__t ( 'Quantity unit from' ) }} </ th >
< th > {{ $__t ( 'Quantity unit to' ) }} </ th >
< th > {{ $__t ( 'Factor' ) }} </ th >
2020-12-16 18:18:03 +01:00
< th > {{ $__t ( 'Group' )}} </ th >
2020-11-10 18:11:33 +01:00
< th ></ th >
2020-11-08 19:00:12 +01:00
</ tr >
</ thead >
< tbody class = "d-none" >
@ if ( $mode == "edit" )
2020-11-10 18:11:33 +01:00
@ foreach ( $quConversions as $quConversion )
@ if ( $quConversion -> product_id == $product -> id || $quConversion -> product_id == null && ( $quConversion -> product_id != null || $quConversion -> from_qu_id == $product -> qu_id_purchase || $quConversion -> from_qu_id == $product -> qu_id_stock || $quConversion -> to_qu_id == $product -> qu_id_purchase || $quConversion -> to_qu_id == $product -> qu_id_stock ))
2020-11-08 19:00:12 +01:00
< tr >
< td class = "fit-content border-right" >
2020-11-10 18:11:33 +01:00
< a class = "btn btn-sm btn-info show-as-dialog-link @if( $quConversion->product_id == null) disabled @endif"
href = "{{ $U ('/quantityunitconversion/' . $quConversion->id . '?embedded&product=' . $product->id ) }}" >
2020-11-08 19:00:12 +01:00
< i class = "fas fa-edit" ></ i >
</ a >
2020-11-10 18:11:33 +01:00
< a class = "btn btn-sm btn-danger qu-conversion-delete-button @if( $quConversion->product_id == null) disabled @endif"
2020-11-08 19:00:12 +01:00
href = "#"
2020-11-10 18:11:33 +01:00
data - qu - conversion - id = "{{ $quConversion->id }}" >
2020-11-08 19:00:12 +01:00
< i class = "fas fa-trash" ></ i >
</ a >
</ td >
< td >
2020-11-10 18:11:33 +01:00
{{ FindObjectInArrayByPropertyValue ( $quantityunits , 'id' , $quConversion -> from_qu_id ) -> name }}
2020-11-08 19:00:12 +01:00
</ td >
< td >
2020-11-10 18:11:33 +01:00
{{ FindObjectInArrayByPropertyValue ( $quantityunits , 'id' , $quConversion -> to_qu_id ) -> name }}
2020-11-08 19:00:12 +01:00
</ td >
2020-11-10 18:11:33 +01:00
< td >
< span class = "locale-number locale-number-quantity-amount" > {{ $quConversion -> factor }} </ span >
</ td >
< td class = "d-none" >
@ if ( $quConversion -> product_id != null )
{{ $__t ( 'Product overrides' ) }}
@ else
{{ $__t ( 'Default conversions' ) }}
2020-11-08 19:00:12 +01:00
@ endif
</ td >
2020-11-10 18:11:33 +01:00
< td class = "font-italic" >
2020-11-17 19:11:02 +01:00
{ !! $__t ( 'This means 1 %1$s is the same as %2$s %3$s' , FindObjectInArrayByPropertyValue ( $quantityunits , 'id' , $quConversion -> from_qu_id ) -> name , '<span class="locale-number locale-number-quantity-amount">' . $quConversion -> factor . '</span>' , FindObjectInArrayByPropertyValue ( $quantityunits , 'id' , $quConversion -> to_qu_id ) -> name ) !! }
2020-11-10 18:11:33 +01:00
</ td >
2020-11-08 19:00:12 +01:00
</ tr >
2020-08-17 14:47:33 -05:00
@ endif
2020-11-08 19:00:12 +01:00
@ endforeach
@ endif
</ tbody >
</ table >
</ div >
</ div >
< div class = "row mt-5" >
< div class = "col" >
< div class = "title-related-links" >
< h4 >
{{ $__t ( 'Picture' ) }}
</ h4 >
< div class = "form-group w-75 m-0" >
< div class = "input-group" >
< div class = "custom-file" >
< input type = "file"
class = "custom-file-input"
id = "product-picture"
accept = "image/*" >
2020-11-12 13:08:50 +01:00
@ if ( $mode == "edit" )
2020-11-08 19:00:12 +01:00
< label id = "product-picture-label"
class = "custom-file-label @if(empty( $product->picture_file_name )) d-none @endif"
for = "product-picture" >
{{ $product -> picture_file_name }}
</ label >
< label id = "product-picture-label-none"
class = "custom-file-label @if(!empty( $product->picture_file_name )) d-none @endif"
for = "product-picture" >
{{ $__t ( 'No file selected' ) }}
</ label >
2020-11-12 13:08:50 +01:00
@ endif
2020-11-08 19:00:12 +01:00
</ div >
< div class = "input-group-append" >
< span class = "input-group-text" >< i class = "fas fa-trash"
id = "delete-current-product-picture-button" ></ i ></ span >
</ div >
</ div >
</ div >
</ div >
2020-11-12 13:08:50 +01:00
@ if ( $mode == "edit" && ! empty ( $product -> picture_file_name ))
2020-11-08 19:00:12 +01:00
< img id = "current-product-picture"
2020-08-31 20:32:50 +02:00
data - src = "{{ $U ('/api/files/productpictures/' . base64_encode( $product->picture_file_name ) . '?force_serve_as=picture&best_fit_width=400') }}"
2020-11-08 19:00:12 +01:00
class = "img-fluid img-thumbnail mt-2 lazy mb-5" >
< p id = "delete-current-product-picture-on-save-hint"
2020-12-20 22:08:50 +01:00
class = "form-text text-muted font-italic d-none mb-5" > {{ $__t ( 'The current picture will be deleted on save' ) }} </ p >
2020-11-08 19:00:12 +01:00
@ else
< p id = "no-current-product-picture-hint"
class = "form-text text-muted font-italic mb-5" > {{ $__t ( 'No picture available' ) }} </ p >
@ endif
</ div >
2019-09-15 16:40:54 +02:00
</ div >
2018-10-01 20:20:50 +02:00
</ div >
2017-04-15 23:16:20 +02:00
</ div >
2018-04-11 19:49:35 +02:00
@ stop