@extends('layout.default') @if($mode == 'edit') @section('title', $__t('Edit product')) @else @section('title', $__t('Create product')) @endif @section('viewJsName', 'productform') @section('content')

@yield('title')


@if($mode == 'edit') @if(!empty($product->picture_file_name)) @endif @endif
{{ $__t('A name is required') }}
active == 1) checked @endif class="form-check-input custom-control-input" type="checkbox" id="active" name="active" value="1">
@php $prefillById = ''; if($mode=='edit') { $prefillById = $product->parent_product_id; } @endphp @php $hint = ''; if ($isSubProductOfOthers) { $hint = $__t('Not possible because this product is already used as a parent product in another product'); } @endphp @include('components.productpicker', array( 'products' => $products, 'prefillById' => $prefillById, 'disallowAllProductWorkflows' => true, 'isRequired' => false, 'label' => 'Parent product', 'disabled' => $isSubProductOfOthers, 'hint' => $hint )) @php $hint = ''; @endphp
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
{{ $__t('A location is required') }}
@else @endif @php $prefillById = ''; if($mode=='edit') { $prefillById = $product->shopping_location_id; } @endphp @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) @include('components.shoppinglocationpicker', array( 'label' => 'Default store', 'prefillById' => $prefillById, 'shoppinglocations' => $shoppinglocations )) @else @endif @php if($mode == 'edit') { $value = $product->min_stock_amount; } else { $value = 0; } @endphp @include('components.numberpicker', array( 'id' => 'min_stock_amount', 'label' => 'Minimum stock amount', 'min' => '0.', 'decimals' => $userSettings['stock_decimal_places_amounts'], 'value' => $value, 'additionalGroupCssClasses' => 'mb-1', 'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount' ))
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">
@if(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
due_type == 1) checked @else checked @endif>
due_type == 2) checked @endif>
@php if($mode == 'edit') { $value = $product->default_best_before_days; } else { $value = 0; } @endphp @include('components.numberpicker', array( 'id' => 'default_best_before_days', 'label' => 'Default due days', 'min' => -1, 'value' => $value, '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') . ')' )) @if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING) @php if($mode == 'edit') { $value = $product->default_best_before_days_after_open; } else { $value = 0; } @endphp @include('components.numberpicker', array( 'id' => 'default_best_before_days_after_open', 'label' => 'Default due days after opened', 'min' => 0, 'value' => $value, 'hint' => $__t('When this product was marked as opened, the due date will be replaced by today + this amount of days, but only if the resulting date is not after the original due date (a value of 0 disables this)') )) @else @endif @else @endif @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( 'id' => 'default_best_before_days_after_freezing', 'label' => 'Default due days after freezing', 'min' => -1, 'value' => $value, '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') . ')' )) @php if($mode == 'edit') { $value = $product->default_best_before_days_after_thawing; } else { $value = 0; } @endphp @include('components.numberpicker', array( 'id' => 'default_best_before_days_after_thawing', 'label' => 'Default due days after thawing', 'min' => 0, 'value' => $value, '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') ))
should_not_be_frozen == 1) checked @endif class="form-check-input custom-control-input" type="checkbox" id="should_not_be_frozen" name="should_not_be_frozen" value="1">
@else @endif
{{ $__t('A quantity unit is required') }}
{{ $__t('A quantity unit is required') }}
@php if($mode == 'edit') { $value = $product->qu_factor_purchase_to_stock; } else { $value = 1; } @endphp @include('components.numberpicker', array( 'id' => 'qu_factor_purchase_to_stock', 'label' => 'Factor purchase to stock quantity unit', 'min' => $DEFAULT_MIN_AMOUNT, 'decimals' => $userSettings['stock_decimal_places_amounts'], 'value' => $value, 'additionalCssClasses' => 'input-group-qu locale-number-input locale-number-quantity-amount', 'additionalHtmlElements' => '

' ))
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">
@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( 'id' => 'tare_weight', 'label' => 'Tare weight', 'min' => 0, 'decimals' => $userSettings['stock_decimal_places_amounts'], 'value' => $value, 'additionalAttributes' => $additionalAttributes, 'contextInfoId' => 'tare_weight_qu_info', 'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount' )) @php $additionalAttributes = '' @endphp @if(GROCY_FEATURE_FLAG_RECIPES)
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">
@else @endif @php if($mode == 'edit') { $value = $product->calories; } else { $value = 0; } @endphp @include('components.numberpicker', array( 'id' => 'calories', 'label' => 'Energy (kcal)', 'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts']), 'decimals' => $userSettings['stock_decimal_places_amounts'], 'value' => $value, 'hint' => $__t('Per stock quantity unit'), 'isRequired' => false, 'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount' )) @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', 'min' => $DEFAULT_MIN_AMOUNT, 'decimals' => $userSettings['stock_decimal_places_amounts'], 'value' => $value, 'hint' => $__t('This amount is used for the "quick consume/open buttons" on the stock overview page (related to quantity unit stock)'), 'contextInfoId' => 'quick_consume_qu_info', 'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount' )) @include('components.userfieldsform', array( 'userfields' => $userfields, 'entity' => 'products' )) @if(GROCY_FEATURE_FLAG_LABEL_PRINTER)
allow_label_per_unit == 1) checked @endif class="form-check-input custom-control-input" type="checkbox" id="allow_label_per_unit" name="allow_label_per_unit" value="1">
@php $no_label = ""; $single_label = ""; $per_unit_label = ""; $disable_per_unit = ""; if($mode == 'edit') { switch($product->default_print_stock_label) { case 0: $no_label = "selected"; break; case 1: $single_label = "selected"; break; case 2: $per_unit_label = "selected"; break; default: break; // yolo } if($product->allow_label_per_unit == 0) { $disable_per_unit="disabled"; $per_unit_label = ""; } } @endphp
@endif
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">
{{ $__t('Save & continue to add quantity unit conversions & barcodes') }}
@include('components.userfields_thead', array( 'userfields' => $productBarcodeUserfields )) @if($mode == "edit") @foreach($barcodes as $barcode) @if($barcode->product_id == $product->id || $barcode->product_id == null) @include('components.userfields_tbody', array( 'userfields' => $productBarcodeUserfields, 'userfieldValues' => FindAllObjectsInArrayByPropertyValue($productBarcodeUserfieldValues, 'object_id', $barcode->id) )) @endif @endforeach @endif
{{ $__t('Barcode') }} {{ $__t('Store') }} {{ $__t('Quantity unit') }} {{ $__t('Amount') }} {{ $__t('Last price') }} {{ $__t('Note') }}
{{ $barcode->barcode }} @if (FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $barcode->shopping_location_id) !== null) {{ FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $barcode->shopping_location_id)->name }} @endif @if(!empty($barcode->qu_id)) {{ FindObjectInArrayByPropertyValue($quantityunits, 'id', $barcode->qu_id)->name }} @endif @if(!empty($barcode->amount)) {{ $barcode->amount }} @endif {{ $barcode->last_price }} {{ $barcode->note }}
@if($mode == "edit") @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)) @endif @endforeach @endif
{{ $__t('Quantity unit from') }} {{ $__t('Quantity unit to') }} {{ $__t('Factor') }} {{ $__t('Group')}}
{{ FindObjectInArrayByPropertyValue($quantityunits, 'id', $quConversion->from_qu_id)->name }} {{ FindObjectInArrayByPropertyValue($quantityunits, 'id', $quConversion->to_qu_id)->name }} {{ $quConversion->factor }} @if($quConversion->product_id != null) {{ $__t('Product overrides') }} @else {{ $__t('Default conversions') }} @endif {!! $__t('This means 1 %1$s is the same as %2$s %3$s', FindObjectInArrayByPropertyValue($quantityunits, 'id', $quConversion->from_qu_id)->name, '' . $quConversion->factor . '', $__n($quConversion->factor, FindObjectInArrayByPropertyValue($quantityunits, 'id', $quConversion->to_qu_id)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', $quConversion->to_qu_id)->name_plural)) !!}
@if($mode == "edit" && !empty($product->picture_file_name))

{{ $__t('The current picture will be deleted on save') }}

@else

{{ $__t('No picture available') }}

@endif
@stop