2018-07-14 18:23:41 +02:00
@ extends ( 'layout.default' )
2019-05-01 20:19:18 +02:00
@ section ( 'title' , $__t ( 'Recipes' ))
2018-07-14 18:23:41 +02:00
@ section ( 'activeNav' , 'recipes' )
@ section ( 'viewJsName' , 'recipes' )
@ section ( 'content' )
2019-09-16 09:35:20 +02:00
< script >
Grocy . QuantityUnits = { !! json_encode ( $quantityUnits ) !! };
Grocy . QuantityUnitConversionsResolved = { !! json_encode ( $quantityUnitConversionsResolved ) !! };
</ script >
2018-07-14 18:23:41 +02:00
< div class = "row" >
2020-10-31 18:37:10 +01:00
< div class = "col-xs-12 col-md-6 d-print-none" >
< div class = "title-related-links border-bottom mb-2 py-1" >
2020-04-19 08:51:02 -04:00
< h2 class = "title" >@ yield ( 'title' ) </ h2 >
2020-11-07 14:53:45 +01:00
< div class = "float-right" >
< button class = "btn btn-outline-dark d-md-none mt-2 order-1 order-md-3"
type = "button"
data - toggle = "collapse"
data - target = "#table-filter-row" >
< i class = "fas fa-filter" ></ i >
</ button >
< button class = "btn btn-outline-dark d-md-none mt-2 order-1 order-md-3"
type = "button"
data - toggle = "collapse"
data - target = "#related-links" >
< i class = "fas fa-ellipsis-v" ></ i >
</ button >
</ div >
< div class = "related-links collapse d-md-flex order-2 width-xs-sm-100"
id = "related-links" >
< a class = "btn btn-primary responsive-button m-1 mt-md-0 mb-md-0 float-right"
2020-08-31 20:32:50 +02:00
href = "{{ $U ('/recipe/new') }}" >
2020-04-19 08:51:02 -04:00
{{ $__t ( 'Add' ) }}
</ a >
</ div >
</ div >
2020-10-31 18:37:10 +01:00
2020-11-07 14:53:45 +01:00
< div class = "row collapse d-md-flex"
id = "table-filter-row" >
< div class = "col-xs-12 col-md-5 col-xl-5" >
2020-10-31 18:37:10 +01:00
< div class = "input-group" >
2020-04-19 08:51:02 -04:00
< div class = "input-group-prepend" >
2020-08-31 20:32:50 +02:00
< span class = "input-group-text" >< i class = "fas fa-search" ></ i ></ span >
2020-04-19 08:51:02 -04:00
</ div >
2020-08-31 20:32:50 +02:00
< input type = "text"
id = "search"
class = "form-control"
placeholder = "{{ $__t ('Search') }}" >
2020-04-19 08:51:02 -04:00
</ div >
2019-05-03 19:22:58 +02:00
</ div >
2020-11-07 14:53:45 +01:00
< div class = "col-xs-12 col-md-5 col-xl-5" >
2020-10-31 18:37:10 +01:00
< div class = "input-group" >
2020-04-19 08:51:02 -04:00
< div class = "input-group-prepend" >
2020-10-31 18:37:10 +01:00
< span class = "input-group-text" >< i class = "fas fa-filter" ></ i >& nbsp ;{{ $__t ( 'Status' ) }} </ span >
2020-04-19 08:51:02 -04:00
</ div >
2020-11-16 19:10:29 +01:00
< select class = "custom-control custom-select"
2020-08-31 20:32:50 +02:00
id = "status-filter" >
2020-04-19 08:51:02 -04:00
< option value = "all" > {{ $__t ( 'All' ) }} </ option >
2020-11-15 09:21:54 +01:00
< option value = "Xenoughinstock" > {{ $__t ( 'Enough in stock' ) }} </ option >
2020-04-19 08:51:02 -04:00
< option value = "enoughinstockwithshoppinglist" > {{ $__t ( 'Not enough in stock, but already on the shopping list' ) }} </ option >
< option value = "notenoughinstock" > {{ $__t ( 'Not enough in stock' ) }} </ option >
</ select >
</ div >
2019-05-03 19:22:58 +02:00
</ div >
2020-11-07 14:53:45 +01:00
< div class = "col" >
2020-11-08 19:00:12 +01:00
< div class = "float-right mt-1" >
2020-11-07 14:53:45 +01:00
< a id = "clear-filter-button"
class = "btn btn-sm btn-outline-info"
href = "#" >
{{ $__t ( 'Clear filter' ) }}
</ a >
</ div >
</ div >
2019-05-03 19:22:58 +02:00
</ div >
2018-07-14 18:23:41 +02:00
2020-10-31 18:37:10 +01:00
< ul class = "nav nav-tabs grocy-tabs" >
2019-03-05 17:59:33 +01:00
< li class = "nav-item" >
2020-08-31 20:32:50 +02:00
< a class = "nav-link active"
id = "list-tab"
data - toggle = "tab"
href = "#list" > {{ $__t ( 'List' ) }} </ a >
2019-03-05 17:59:33 +01:00
</ li >
< li class = "nav-item" >
2020-08-31 20:32:50 +02:00
< a class = "nav-link"
id = "gallery-tab"
data - toggle = "tab"
href = "#gallery" > {{ $__t ( 'Gallery' ) }} </ a >
2019-03-05 17:59:33 +01:00
</ li >
</ ul >
2020-04-24 11:41:57 -04:00
< div class = "tab-content grocy-tabs" >
2020-08-31 20:32:50 +02:00
< div class = "tab-pane show active"
id = "list" >
< table id = "recipes-table"
2020-11-07 14:53:45 +01:00
class = "table table-sm table-striped nowrap w-100" >
2019-03-05 17:59:33 +01:00
< 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 = "#recipes-table"
href = "#" >< i class = "fas fa-eye" ></ i ></ a >
</ th >
2019-05-01 20:19:18 +02:00
< th > {{ $__t ( 'Name' ) }} </ th >
2020-02-09 21:16:47 +01:00
< th > {{ $__t ( 'Desired servings' ) }} </ th >
2020-12-21 20:13:49 +01:00
< th class = "@if(!GROCY_FEATURE_FLAG_STOCK) d-none @endif" > {{ $__t ( 'Requirements fulfilled' ) }} </ th >
2019-03-05 17:59:33 +01:00
< th class = "d-none" > Hidden status for sorting of "Requirements fulfilled" column </ th >
2019-05-03 19:22:58 +02:00
< th class = "d-none" > Hidden status for filtering by status </ th >
2019-09-20 13:37:53 +02:00
< th class = "d-none" > Hidden recipe ingredient product names </ th >
2019-04-23 09:06:18 +02:00
@ include ( 'components.userfields_thead' , array (
2020-08-31 20:32:50 +02:00
'userfields' => $userfields
2019-04-23 09:06:18 +02:00
))
2019-03-05 17:59:33 +01:00
</ tr >
</ thead >
< tbody class = "d-none" >
@ foreach ( $recipes as $recipe )
2020-08-31 20:32:50 +02:00
< tr id = "recipe-row-{{ $recipe->id }}"
data - recipe - id = "{{ $recipe->id }}" >
2020-04-24 11:41:57 -04:00
< td class = "fit-content border-right" >
2020-08-31 20:32:50 +02:00
< a class = "btn btn-info btn-sm hide-when-embedded hide-on-fullscreen-card"
2020-11-12 21:35:10 +01:00
href = "{{ $U ('/recipe/') }}{{ $recipe->id }}"
data - toggle = "tooltip"
title = "{{ $__t ('Edit this item') }}" >
2020-04-24 11:41:57 -04:00
< i class = "fas fa-edit" ></ i >
</ a >
2020-08-31 20:32:50 +02:00
< a class = "btn btn-sm btn-danger hide-when-embedded hide-on-fullscreen-card recipe-delete"
href = "#"
data - recipe - id = "{{ $recipe->id }}"
2020-11-12 21:35:10 +01:00
data - recipe - name = "{{ $recipe->name }}"
data - toggle = "tooltip"
title = "{{ $__t ('Delete this item') }}" >
2020-04-24 11:41:57 -04:00
< i class = "fas fa-trash" ></ i >
</ a >
</ td >
2019-03-05 17:59:33 +01:00
< td >
{{ $recipe -> name }}
</ td >
2019-03-09 10:49:26 +01:00
< td >
2019-03-05 17:59:33 +01:00
{{ $recipe -> desired_servings }}
</ td >
2020-12-21 20:13:49 +01:00
< td class = "@if(!GROCY_FEATURE_FLAG_STOCK) d-none @endif" >
2019-03-05 23:45:04 +01:00
@ if ( FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> need_fulfilled == 1 ) < i class = "fas fa-check text-success" ></ i >@ elseif ( FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> need_fulfilled_with_shopping_list == 1 ) < i class = "fas fa-exclamation text-warning" ></ i >@ else < i class = "fas fa-times text-danger" ></ i >@ endif
2019-05-02 20:20:18 +02:00
< span class = "timeago-contextual" >@ if ( FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> need_fulfilled == 1 ){{ $__t ( 'Enough in stock' ) }} @ elseif ( FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> need_fulfilled_with_shopping_list == 1 ){{ $__n ( FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> missing_products_count , 'Not enough in stock, %s ingredient missing but already on the shopping list' , 'Not enough in stock, %s ingredients missing but already on the shopping list' ) }} @ else {{ $__n ( FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> missing_products_count , 'Not enough in stock, %s ingredient missing' , 'Not enough in stock, %s ingredients missing' ) }} @ endif </ span >
2019-03-05 17:59:33 +01:00
</ td >
< td class = "d-none" >
2019-03-05 23:45:04 +01:00
{{ FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> missing_products_count }}
2019-03-05 17:59:33 +01:00
</ td >
2019-05-03 19:22:58 +02:00
< td class = "d-none" >
2020-11-15 09:21:54 +01:00
@ if ( FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> need_fulfilled == 1 ) Xenoughinstock @ elseif ( FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> need_fulfilled_with_shopping_list == 1 ) enoughinstockwithshoppinglist @ else notenoughinstock @ endif
2019-05-03 19:22:58 +02:00
</ td >
2019-09-20 13:37:53 +02:00
< td class = "d-none" >
@ foreach ( FindAllObjectsInArrayByPropertyValue ( $recipePositionsResolved , 'recipe_id' , $recipe -> id ) as $recipePos )
2020-08-31 20:32:50 +02:00
{{ FindObjectInArrayByPropertyValue ( $products , 'id' , $recipePos -> product_id ) -> name . ' ' }}
2019-09-20 13:37:53 +02:00
@ endforeach
</ td >
2019-04-23 09:06:18 +02:00
@ include ( 'components.userfields_tbody' , array (
2020-08-31 20:32:50 +02:00
'userfields' => $userfields ,
'userfieldValues' => FindAllObjectsInArrayByPropertyValue ( $userfieldValues , 'object_id' , $recipe -> id )
2019-04-23 09:06:18 +02:00
))
2019-03-05 17:59:33 +01:00
</ tr >
@ endforeach
</ tbody >
</ table >
</ div >
2020-08-31 20:32:50 +02:00
< div class = "tab-pane show"
id = "gallery" >
2020-04-24 11:41:57 -04:00
< div class = "card-columns no-gutters" >
2019-03-05 17:59:33 +01:00
@ foreach ( $recipes as $recipe )
2020-10-04 15:00:34 +02:00
< a class = "discrete-link recipe-gallery-item @if(FindObjectInArrayByPropertyValue( $recipesResolved , 'recipe_id', $recipe->id )->need_fulfilled == 1) recipe-enoughinstock @elseif(FindObjectInArrayByPropertyValue( $recipesResolved , 'recipe_id', $recipe->id )->need_fulfilled_with_shopping_list == 1) recipe-enoughinstockwithshoppinglist @else recipe-notenoughinstock @endif"
2020-08-31 20:32:50 +02:00
data - recipe - id = "{{ $recipe->id }}"
href = "#" >
< div id = "RecipeGalleryCard-{{ $recipe->id }}"
class = "card recipe-card" >
@ if ( ! empty ( $recipe -> picture_file_name ))
< img data - src = "{{ $U ('/api/files/recipepictures/' . base64_encode( $recipe->picture_file_name ) . '?force_serve_as=picture&best_fit_width=400') }}"
class = "card-img-top lazy" >
@ endif
< div class = "card-body text-center" >
< h5 class = "card-title mb-1" > {{ $recipe -> name }} </ h5 >
< p class = "card-text" >
@ if ( FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> need_fulfilled == 1 ) < i class = "fas fa-check text-success" ></ i >@ elseif ( FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> need_fulfilled_with_shopping_list == 1 ) < i class = "fas fa-exclamation text-warning" ></ i >@ else < i class = "fas fa-times text-danger" ></ i >@ endif
< span class = "timeago-contextual" >@ if ( FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> need_fulfilled == 1 ){{ $__t ( 'Enough in stock' ) }} @ elseif ( FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> need_fulfilled_with_shopping_list == 1 ){{ $__n ( FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> missing_products_count , 'Not enough in stock, %s ingredient missing but already on the shopping list' , 'Not enough in stock, %s ingredients missing but already on the shopping list' ) }} @ else {{ $__n ( FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> missing_products_count , 'Not enough in stock (not included in costs), %s ingredient missing' , 'Not enough in stock (not included in costs), %s ingredients missing' ) }} @ endif </ span >
</ p >
2019-03-05 17:59:33 +01:00
</ div >
2020-08-31 20:32:50 +02:00
</ div >
</ a >
2020-04-24 11:41:57 -04:00
@ endforeach
2019-03-05 17:59:33 +01:00
</ div >
</ div >
</ div >
2018-07-14 18:23:41 +02:00
</ div >
2018-07-15 09:56:10 +02:00
@ if ( $selectedRecipe !== null )
2020-04-24 11:41:57 -04:00
@ php
2020-08-31 20:32:50 +02:00
$allRecipes = $selectedRecipeSubRecipes ;
array_unshift ( $allRecipes , $selectedRecipe );
2020-04-24 11:41:57 -04:00
@ endphp
< div class = "col-xs-12 col-md-6 print-view" >
2020-08-31 20:32:50 +02:00
< div id = "selectedRecipeCard"
class = "card grocy-card" >
2020-04-24 11:41:57 -04:00
@ if ( count ( $allRecipes ) > 1 )
2020-08-31 20:32:50 +02:00
< div class = "card-header card-header-fullscreen d-print-none" >
< ul class = "nav nav-tabs grocy-tabs card-header-tabs" >
@ foreach ( $allRecipes as $index => $recipe )
< li class = "nav-item" >
< a class = "nav-link @if( $index == 0) active @endif"
data - toggle = "tab"
href = "#recipe-{{ $index + 1 }}" > {{ $recipe -> name }} </ a >
</ li >
@ endforeach
</ ul >
</ div >
2020-04-24 11:41:57 -04:00
@ endif
2020-02-04 19:48:00 +01:00
2020-04-24 11:41:57 -04:00
< div class = "tab-content grocy-tabs print break" >
@ foreach ( $allRecipes as $index => $recipe )
2020-08-31 20:32:50 +02:00
< div class = "tab-pane @if( $index == 0) active @endif"
id = "recipe-{{ $index + 1 }}"
role = "tabpanel" >
@ if ( ! empty ( $recipe -> picture_file_name ))
< img class = "card-img-top lazy"
src = "{{ $U ('/api/files/recipepictures/' . base64_encode( $recipe->picture_file_name ) . '?force_serve_as=picture') }}" >
@ endif
< div class = "card-body" >
< div class = "shadow p-4 mb-5 bg-white rounded mt-n5 d-print-none @if(empty( $recipe->picture_file_name )) d-none @endif" >
< div class = "d-flex justify-content-between align-items-center" >
< h3 class = "card-title mb-0" > {{ $recipe -> name }} </ h3 >
< div class = "card-icons d-flex flex-wrap justify-content-end flex-shrink-1" >
2020-12-21 20:13:49 +01:00
< a class = "@if(!GROCY_FEATURE_FLAG_STOCK) d-none @endif recipe-consume hide-when-embedded @if(FindObjectInArrayByPropertyValue( $recipesResolved , 'recipe_id', $recipe->id )->need_fulfilled == 0) disabled @endif"
2020-08-31 20:32:50 +02:00
href = "#"
data - toggle = "tooltip"
title = "{{ $__t ('Consume all ingredients needed by this recipe') }}"
data - recipe - id = "{{ $recipe->id }}"
data - recipe - name = "{{ $recipe->name }}" >
< i class = "fas fa-utensils" ></ i >
</ a >
2020-12-21 20:13:49 +01:00
< a class = "@if(!GROCY_FEATURE_FLAG_STOCK) d-none @endif recipe-shopping-list hide-when-embedded @if(FindObjectInArrayByPropertyValue( $recipesResolved , 'recipe_id', $recipe->id )->need_fulfilled_with_shopping_list == 1) disabled @endif"
2020-08-31 20:32:50 +02:00
href = "#"
data - toggle = "tooltip"
title = "{{ $__t ('Put missing products on shopping list') }}"
data - recipe - id = "{{ $recipe->id }}"
data - recipe - name = "{{ $recipe->name }}" >
< i class = "fas fa-cart-plus" ></ i >
</ a >
< a class = "recipe-fullscreen hide-when-embedded"
2020-11-08 19:51:56 +01:00
id = "selectedRecipeToggleFullscreenButton"
2020-08-31 20:32:50 +02:00
href = "#"
data - toggle = "tooltip"
title = "{{ $__t ('Expand to fullscreen') }}" >
< i class = "fas fa-expand-arrows-alt" ></ i >
</ a >
< a class = "recipe-print hide-when-embedded"
href = "#"
data - toggle = "tooltip"
title = "{{ $__t ('Print') }}" >
< i class = "fas fa-print" ></ i >
</ a >
2020-04-24 11:41:57 -04:00
</ div >
</ div >
2020-08-31 20:32:50 +02:00
</ div >
2018-10-25 20:36:29 +02:00
2020-08-31 20:32:50 +02:00
< div class = "mb-4 @if(!empty( $recipe->picture_file_name )) d-none @else d-flex @endif d-print-block justify-content-between align-items-center" >
< h1 class = "card-title mb-0" > {{ $recipe -> name }} </ h1 >
< div class = "card-icons d-flex flex-wrap justify-content-end flex-shrink-1 d-print-none" >
< a class = "recipe-consume hide-when-embedded @if(FindObjectInArrayByPropertyValue( $recipesResolved , 'recipe_id', $recipe->id )->need_fulfilled == 0) disabled @endif"
href = "#"
data - toggle = "tooltip"
title = "{{ $__t ('Consume all ingredients needed by this recipe') }}"
data - recipe - id = "{{ $recipe->id }}"
data - recipe - name = "{{ $recipe->name }}" >
< i class = "fas fa-utensils" ></ i >
</ a >
< a class = "recipe-shopping-list hide-when-embedded @if(FindObjectInArrayByPropertyValue( $recipesResolved , 'recipe_id', $recipe->id )->need_fulfilled_with_shopping_list == 1) disabled @endif"
href = "#"
data - toggle = "tooltip"
title = "{{ $__t ('Put missing products on shopping list') }}"
data - recipe - id = "{{ $recipe->id }}"
data - recipe - name = "{{ $recipe->name }}" >
< i class = "fas fa-cart-plus" ></ i >
</ a >
< a class = "recipe-fullscreen hide-when-embedded"
href = "#"
data - toggle = "tooltip"
title = "{{ $__t ('Expand to fullscreen') }}" >
< i class = "fas fa-expand-arrows-alt" ></ i >
</ a >
< a class = "recipe-print hide-when-embedded PrintRecipe"
href = "#"
data - toggle = "tooltip"
title = "{{ $__t ('Print') }}" >
< i class = "fas fa-print" ></ i >
</ a >
2020-04-24 11:41:57 -04:00
</ div >
2020-08-31 20:32:50 +02:00
</ div >
2019-01-26 20:06:01 +01:00
2020-08-31 20:32:50 +02:00
@ php
$calories = FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> calories ;
$costs = FindObjectInArrayByPropertyValue ( $recipesResolved , 'recipe_id' , $recipe -> id ) -> costs ;
@ endphp
2020-02-04 19:48:00 +01:00
2020-08-31 20:32:50 +02:00
< div class = "row ml-1" >
@ if ( ! empty ( $calories ) && intval ( $calories ) > 0 )
< div class = "col-6 col-xl-3" >
< label > {{ $__t ( 'Calories' ) }} </ label >
< h3 class = "locale-number locale-number-generic pt-0" > {{ $calories }} </ h3 >
</ div >
@ endif
@ if ( GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING )
< div class = "col-5" >
< label > {{ $__t ( 'Costs' ) }} & nbsp ; </ 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-12-19 10:28:35 +01:00
title = "{{ $__t ('Based on the prices of the default consume rule which is " Opened first , then first due first , then first in first out "') }}" ></ i >
2020-08-31 20:32:50 +02:00
< h3 class = "locale-number locale-number-currency pt-0" > {{ $costs }} </ h3 >
</ div >
@ endif
2020-02-04 19:48:00 +01:00
2020-08-31 20:32:50 +02:00
@ if ( $index == 0 )
< div class = "col-12 col-xl-4 d-print-none" >
@ include ( 'components.numberpicker' , array (
'id' => 'servings-scale' ,
'label' => 'Desired servings' ,
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' => $recipe -> desired_servings ,
'additionalAttributes' => 'data-recipe-id="' . $recipe -> id . '"' ,
2020-11-15 14:15:09 +01:00
'hint' => $__t ( 'Base: %s' , $recipe -> base_servings ),
'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount'
2020-08-31 20:32:50 +02:00
))
2020-04-24 11:41:57 -04:00
</ div >
2020-08-31 20:32:50 +02:00
@ endif
</ div >
2020-02-04 19:48:00 +01:00
2020-08-31 20:32:50 +02:00
@ php
$recipePositionsFiltered = FindAllObjectsInArrayByPropertyValue ( $allRecipePositions [ $recipe -> id ], 'recipe_id' , $recipe -> id );
@ endphp
2020-02-04 19:48:00 +01:00
2020-08-31 20:32:50 +02:00
< ul class = "nav nav-tabs grocy-tabs mb-3 d-print-none"
role = "tablist" >
@ if ( count ( $recipePositionsFiltered ) > 0 )
< li class = "nav-item" >
< a class = "nav-link active"
data - toggle = "tab"
href = "#ingredients-{{ $index }}"
role = "tab" > {{ $__t ( 'Ingredients' ) }} </ a >
</ li >
@ endif
@ if ( ! empty ( $recipe -> description ))
< li class = "nav-item" >
< a class = "nav-link @if(count( $recipePositionsFiltered ) == 0) active @endif"
data - toggle = "tab"
href = "#prep-{{ $index }}"
role = "tab" > {{ $__t ( 'Preparation' ) }} </ a >
</ li >
@ endif
</ ul >
2020-02-04 19:48:00 +01:00
2020-08-31 20:32:50 +02:00
< div class = "tab-content grocy-tabs p-2 print" >
@ if ( count ( $recipePositionsFiltered ) > 0 )
< div class = "tab-pane active"
id = "ingredients-{{ $index }}"
role = "tabpanel" >
< div class = "mb-2 mt-3 d-none d-print-block" >
< h3 class = "mb-0" > {{ $__t ( 'Ingredients' ) }} </ h3 >
</ div >
< ul class = "list-group list-group-flush mb-5" >
@ php
$lastIngredientGroup = 'undefined' ;
$lastProductGroup = 'undefined' ;
$hasIngredientGroups = false ;
$hasProductGroups = false ;
@ endphp
@ foreach ( $recipePositionsFiltered as $selectedRecipePosition )
@ if ( $lastIngredientGroup != $selectedRecipePosition -> ingredient_group && ! empty ( $selectedRecipePosition -> ingredient_group ))
@ php $hasIngredientGroups = true ; @ endphp
< h5 class = "mb-2 mt-2 ml-1" >< strong > {{ $selectedRecipePosition -> ingredient_group }} </ strong ></ h5 >
@ endif
@ if ( boolval ( $userSettings [ 'recipe_ingredients_group_by_product_group' ]) && $lastProductGroup != $selectedRecipePosition -> product_group && ! empty ( $selectedRecipePosition -> product_group ))
@ php $hasProductGroups = true ; @ endphp
< h6 class = "mb-2 mt-2 @if( $hasIngredientGroups ) ml-3 @else ml-1 @endif" >< strong > {{ $selectedRecipePosition -> product_group }} </ strong ></ h6 >
@ endif
< li class = "list-group-item px-0 @if( $hasIngredientGroups && $hasProductGroups ) ml-4 @elseif( $hasIngredientGroups || $hasProductGroups ) ml-2 @else ml-0 @endif" >
@ if ( $selectedRecipePosition -> product_active == 0 )
2020-12-07 19:48:33 +01:00
< div class = "small text-muted font-italic" > {{ $__t ( 'Disabled' ) }} </ div >
2020-08-31 20:32:50 +02:00
@ endif
@ php
$product = FindObjectInArrayByPropertyValue ( $products , 'id' , $selectedRecipePosition -> 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' , $selectedRecipePosition -> qu_id );
2020-11-17 19:11:02 +01:00
if ( $productQuConversion && $selectedRecipePosition -> only_check_single_unit_in_stock == 0 )
2020-08-31 20:32:50 +02:00
{
$selectedRecipePosition -> recipe_amount = $selectedRecipePosition -> recipe_amount * $productQuConversion -> factor ;
}
@ endphp
@ if ( ! empty ( $selectedRecipePosition -> recipe_variable_amount ))
{{ $selectedRecipePosition -> recipe_variable_amount }}
@ else
< span class = "locale-number locale-number-quantity-amount" >@ if ( $selectedRecipePosition -> recipe_amount == round ( $selectedRecipePosition -> recipe_amount , 2 )){{ round ( $selectedRecipePosition -> recipe_amount , 2 ) }} @ else {{ $selectedRecipePosition -> recipe_amount }} @ endif </ span >
@ endif
{{ $__n ( $selectedRecipePosition -> recipe_amount , FindObjectInArrayByPropertyValue ( $quantityUnits , 'id' , $selectedRecipePosition -> qu_id ) -> name , FindObjectInArrayByPropertyValue ( $quantityUnits , 'id' , $selectedRecipePosition -> qu_id ) -> name_plural ) }} {{ FindObjectInArrayByPropertyValue ( $products , 'id' , $selectedRecipePosition -> product_id ) -> name }}
2020-12-21 20:13:49 +01:00
@ if ( GROCY_FEATURE_FLAG_STOCK )
2020-08-31 20:32:50 +02:00
@ if ( $selectedRecipePosition -> need_fulfilled == 1 ) < i class = "fas fa-check text-success" ></ i >@ elseif ( $selectedRecipePosition -> need_fulfilled_with_shopping_list == 1 ) < i class = "fas fa-exclamation text-warning" ></ i >@ else < i class = "fas fa-times text-danger" ></ i >@ endif
< span class = "timeago-contextual" >@ if ( FindObjectInArrayByPropertyValue ( $recipePositionsResolved , 'recipe_pos_id' , $selectedRecipePosition -> id ) -> need_fulfilled == 1 ) {{ $__t ( 'Enough in stock' ) }} @ else {{ $__t ( 'Not enough in stock (not included in costs), %1$s missing, %2$s already on shopping list' , round ( FindObjectInArrayByPropertyValue ( $recipePositionsResolved , 'recipe_pos_id' , $selectedRecipePosition -> id ) -> missing_amount , 2 ), round ( FindObjectInArrayByPropertyValue ( $recipePositionsResolved , 'recipe_pos_id' , $selectedRecipePosition -> id ) -> amount_on_shopping_list , 2 )) }} @ endif </ span >
2020-12-21 20:13:49 +01:00
@ endif
2020-12-07 19:48:33 +01:00
@ if ( $selectedRecipePosition -> need_fulfilled == 1 && GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING ) < span class = "float-right font-italic ml-2 locale-number locale-number-currency" > {{ $selectedRecipePosition -> costs }} </ span > @ endif
< span class = "float-right font-italic" >< span class = "locale-number locale-number-quantity-amount" > {{ $selectedRecipePosition -> calories }} {{ $__t ( 'Calories' ) }} </ span ></ span >
2020-08-31 20:32:50 +02:00
@ if ( ! empty ( $selectedRecipePosition -> recipe_variable_amount ))
< div class = "small text-muted font-italic" > {{ $__t ( 'Variable amount' ) }} </ div >
@ endif
2020-02-02 17:26:32 +01:00
2020-08-31 20:32:50 +02:00
@ if ( ! empty ( $selectedRecipePosition -> note ))
< div class = "text-muted" > { !! nl2br ( $selectedRecipePosition -> note ) !! } </ div >
@ endif
</ li >
@ php $lastProductGroup = $selectedRecipePosition -> product_group ; @ endphp
@ php $lastIngredientGroup = $selectedRecipePosition -> ingredient_group ; @ endphp
@ endforeach
</ ul >
</ div >
@ endif
< div class = "tab-pane @if(count( $recipePositionsFiltered ) == 0) active @endif"
id = "prep-{{ $index }}"
role = "tabpanel" >
< div class = "mb-2 d-none d-print-block" >
< h3 class = "mb-0" > {{ $__t ( 'Preparation' ) }} </ h3 >
2020-04-24 11:41:57 -04:00
</ div >
2020-08-31 20:32:50 +02:00
@ if ( ! empty ( $recipe -> description ))
{ !! $recipe -> description !! }
@ endif
2020-04-24 11:41:57 -04:00
</ div >
</ div >
</ div >
2020-08-31 20:32:50 +02:00
</ div >
2019-01-26 20:06:01 +01:00
2020-08-31 20:32:50 +02:00
< div id = "missing-recipe-pos-list"
class = "list-group d-none mt-3" >
@ foreach ( $recipePositionsResolved as $recipePos )
@ if ( in_array ( $recipePos -> recipe_id , $includedRecipeIdsAbsolute ) && $recipePos -> missing_amount > 0 )
< a href = "#"
class = "list-group-item list-group-item-action list-group-item-primary missing-recipe-pos-select-button" >
< div class = "form-check form-check-inline" >
< input class = "form-check-input missing-recipe-pos-product-checkbox"
type = "checkbox"
data - product - id = "{{ $recipePos->product_id }}"
checked >
</ div >
{{ FindObjectInArrayByPropertyValue ( $products , 'id' , $recipePos -> product_id ) -> name }}
</ a >
@ endif
@ endforeach
</ div >
2020-04-24 11:41:57 -04:00
@ endforeach
2018-07-15 09:56:10 +02:00
</ div >
</ div >
</ div >
@ endif
2018-07-14 18:23:41 +02:00
</ div >
@ stop