@php require_frontend_packages(['datatables', 'summernote']); @endphp @extends('layout.default') @if($mode == 'edit') @section('title', $__t('Edit recipe')) @else @section('title', $__t('Create recipe')) @endif @section('content')

@yield('title')

@if($mode == 'edit') @if(!empty($recipe->picture_file_name)) @endif @endif

{{ $__t('A name is required') }}
@php if($mode == 'edit') { $value = $recipe->base_servings; } else { $value = 1; } @endphp @include('components.numberpicker', array( 'id' => 'base_servings', 'label' => 'Servings', 'min' => $DEFAULT_MIN_AMOUNT, 'decimals' => $userSettings['stock_decimal_places_amounts'], 'value' => $value, 'hint' => $__t('The ingredients listed here result in this amount of servings'), 'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount' ))
not_check_shoppinglist == 1) checked @endif class="form-check-input custom-control-input" type="checkbox" id="not_check_shoppinglist" name="not_check_shoppinglist" value="1">
@include('components.productpicker', array( 'products' => $products, 'isRequired' => false, 'label' => 'Produces product', 'prefillById' => $mode == 'edit' ? $recipe->product_id : '', 'hint' => $__t('When a product is selected, one unit (per serving in stock quantity unit) will be added to stock on consuming this recipe'), 'disallowAllProductWorkflows' => true, )) @include('components.userfieldsform', array( 'userfields' => $userfields, 'entity' => 'recipes' ))
{{ $__t('Save & continue to add ingredients and included recipes') }}
@if($mode == "edit") @foreach($recipePositions as $recipePosition) @endforeach @endif
{{ $__t('Product') }} {{ $__t('Amount') }} {{ $__t('Note') }} {{ $__t('Ingredient group') }}
{{ FindObjectInArrayByPropertyValue($products, 'id', $recipePosition->product_id)->name }} @php // The amount can't be non-numeric when using the frontend, // but some users decide to edit the database manually and // enter something like "4 or 5" in the amount column (brilliant) // => So at least don't crash this view by just assuming 0 if that's the case if (!is_numeric($recipePosition->amount)) { $recipePosition->amount = 0; } $product = FindObjectInArrayByPropertyValue($products, 'id', $recipePosition->product_id); $productQuConversions = FindAllObjectsInArrayByPropertyValue($quantityUnitConversionsResolved, 'product_id', $product->id); $productQuConversions = FindAllObjectsInArrayByPropertyValue($productQuConversions, 'from_qu_id', $product->qu_id_stock); $productQuConversion = FindObjectInArrayByPropertyValue($productQuConversions, 'to_qu_id', $recipePosition->qu_id); if ($productQuConversion && $recipePosition->only_check_single_unit_in_stock == 0) { $recipePosition->amount = $recipePosition->amount * $productQuConversion->factor; } @endphp @if(!empty($recipePosition->variable_amount)) {{ $recipePosition->variable_amount }} @else @if($recipePosition->amount == round($recipePosition->amount)){{ round($recipePosition->amount) }}@else{{ $recipePosition->amount }}@endif @endif {{ $__n($recipePosition->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', $recipePosition->qu_id)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', $recipePosition->qu_id)->name_plural, true) }} @if(!empty($recipePosition->variable_amount))
{{ $__t('Variable amount') }}
@endif
{{ $recipePosition->ingredient_group }}
@if($mode == "edit") @foreach($recipeNestings as $recipeNesting) @endforeach @endif
{{ $__t('Recipe') }} {{ $__t('Servings') }}
{{ FindObjectInArrayByPropertyValue($recipes, 'id', $recipeNesting->includes_recipe_id)->name }} {{ $recipeNesting->servings }}
@if(!empty($recipe->picture_file_name))

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

@else

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

@endif
@stop