2018-07-14 18:23:41 +02:00
@ extends ( 'layout.default' )
@ section ( 'title' , $L ( 'Recipes' ))
@ section ( 'activeNav' , 'recipes' )
@ section ( 'viewJsName' , 'recipes' )
@ section ( 'content' )
< div class = " row " >
2018-10-06 11:43:46 +02:00
< div class = " col-xs-12 col-md-6 pb-3 " >
2018-07-14 18:23:41 +02:00
< h1 >
@ yield ( 'title' )
< a class = " btn btn-outline-dark " href = " { { $U ('/recipe/new') }} " >
< i class = " fas fa-plus " ></ i > {{ $L ( 'Add' ) }}
</ a >
</ h1 >
< label for = " search " > {{ $L ( 'Search' ) }} </ label > < i class = " fas fa-search " ></ i >
< input type = " text " class = " form-control " id = " search " >
2018-08-11 14:38:17 +02:00
< table id = " recipes-table " class = " table table-striped dt-responsive " >
2018-07-14 18:23:41 +02:00
< thead >
< tr >
< th > {{ $L ( 'Name' ) }} </ th >
< th > {{ $L ( 'Requirements fulfilled' ) }} </ th >
</ tr >
</ thead >
< tbody >
@ foreach ( $recipes as $recipe )
2018-07-15 09:56:10 +02:00
< tr data - recipe - id = " { { $recipe->id }} " >
2018-07-14 18:23:41 +02:00
< td >
{{ $recipe -> name }}
</ td >
< td >
2018-07-15 09:56:10 +02:00
@ if ( FindObjectInArrayByPropertyValue ( $recipesSumFulfillment , 'recipe_id' , $recipe -> id ) -> need_fulfilled == 1 ) < i class = " fas fa-check text-success " ></ i >@ elseif ( FindObjectInArrayByPropertyValue ( $recipesSumFulfillment , '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 ( $recipesSumFulfillment , 'recipe_id' , $recipe -> id ) -> need_fulfilled == 1 ){{ $L ( 'Enough in stock' ) }} @ elseif ( FindObjectInArrayByPropertyValue ( $recipesSumFulfillment , 'recipe_id' , $recipe -> id ) -> need_fulfilled_with_shopping_list == 1 ){{ $L ( 'Not enough in stock, #1 ingredients missing but already on the shopping list' , FindObjectInArrayByPropertyValue ( $recipesSumFulfillment , 'recipe_id' , $recipe -> id ) -> missing_products_count ) }} @ else {{ $L ( 'Not enough in stock, #1 ingredients missing' , FindObjectInArrayByPropertyValue ( $recipesSumFulfillment , 'recipe_id' , $recipe -> id ) -> missing_products_count ) }} @ endif </ span >
2018-07-14 18:23:41 +02:00
</ td >
</ tr >
@ endforeach
</ tbody >
</ table >
</ div >
2018-07-15 09:56:10 +02:00
@ if ( $selectedRecipe !== null )
< div class = " col-xs-12 col-md-6 " >
< div id = " selectedRecipeCard " class = " card " >
< div class = " card-header " >
2018-08-11 11:48:25 +02:00
< i class = " fas fa-cocktail " ></ i > {{ $selectedRecipe -> name }} & nbsp ; & nbsp ;
2018-08-11 14:23:36 +02:00
< a id = " selectedRecipeConsumeButton " class = " btn btn-sm btn-outline-success py-0 " href = " # " data - toggle = " tooltip " title = " { { $L ('Consume all ingredients needed by this recipe') }} " data - recipe - id = " { { $selectedRecipe->id }} " data - recipe - name = " { { $selectedRecipe->name }} " >
2018-08-11 11:48:25 +02:00
< i class = " fas fa-utensils " ></ i >
</ a >
2018-08-11 14:23:36 +02:00
< a class = " btn btn-sm btn-outline-primary py-0 recipe-order-missing-button @if(FindObjectInArrayByPropertyValue( $recipesSumFulfillment , 'recipe_id', $selectedRecipe->id )->need_fulfilled_with_shopping_list == 1) { { disabled }}@endif " href = " # " data - toggle = " tooltip " title = " { { $L ('Put missing products on shopping list') }} " data - recipe - id = " { { $selectedRecipe->id }} " data - recipe - name = " { { $selectedRecipe->name }} " >
2018-08-11 11:48:25 +02:00
< i class = " fas fa-cart-plus " ></ i >
2018-08-11 14:38:17 +02:00
</ a >& nbsp ; & nbsp ;
< a id = " selectedRecipeEditButton " class = " btn btn-sm btn-outline-info py-0 " href = " { { $U ('/recipe/') }} { { $selectedRecipe->id }} " >
< i class = " fas fa-edit " ></ i >
</ a >
< a id = " selectedRecipeDeleteButton " class = " btn btn-sm btn-outline-danger py-0 " href = " # " data - recipe - id = " { { $selectedRecipe->id }} " data - recipe - name = " { { $selectedRecipe->name }} " >
< i class = " fas fa-trash " ></ i >
2018-08-11 11:48:25 +02:00
</ a >
2018-08-11 14:23:36 +02:00
< a id = " selectedRecipeToggleFullscreenButton " class = " btn btn-sm btn-outline-secondary py-0 float-right " href = " # " data - toggle = " tooltip " title = " { { $L ('Expand to fullscreen') }} " >
2018-07-15 09:56:10 +02:00
< i class = " fas fa-expand-arrows-alt " ></ i >
</ a >
</ div >
2018-10-25 20:36:29 +02:00
<!-- Subrecipes first -->
@ foreach ( $selectedRecipeSubRecipes as $selectedRecipeSubRecipe )
< div class = " card-body " >
< h3 class = " mb-0 " > {{ $selectedRecipeSubRecipe -> name }} </ h3 >
</ div >
@ php $selectedRecipeSubRecipePositionsFiltered = FindAllObjectsInArrayByPropertyValue ( $selectedRecipeSubRecipesPositions , 'recipe_id' , $selectedRecipeSubRecipe -> id ); @ endphp
@ if ( count ( $selectedRecipeSubRecipePositionsFiltered ) > 0 )
< div class = " card-body " >
< h5 class = " mb-0 " > {{ $L ( 'Ingredients' ) }} </ h5 >
</ div >
< ul class = " list-group list-group-flush " >
2018-10-27 10:37:31 +02:00
@ php $lastGroup = 'undefined' ; @ endphp
2018-10-25 20:36:29 +02:00
@ foreach ( $selectedRecipeSubRecipePositionsFiltered as $selectedRecipePosition )
2018-10-27 10:37:31 +02:00
@ if ( $lastGroup != $selectedRecipePosition -> ingredient_group )
< h5 class = " mb-2 mt-2 ml-4 " >< strong > {{ $selectedRecipePosition -> ingredient_group }} </ strong ></ h5 >
@ endif
2018-10-25 20:36:29 +02:00
< li class = " list-group-item " >
{{ $selectedRecipePosition -> amount }} {{ Pluralize ( $selectedRecipePosition -> amount , FindObjectInArrayByPropertyValue ( $quantityunits , 'id' , $selectedRecipePosition -> qu_id ) -> name , FindObjectInArrayByPropertyValue ( $quantityunits , 'id' , $selectedRecipePosition -> qu_id ) -> name_plural ) }} {{ FindObjectInArrayByPropertyValue ( $products , 'id' , $selectedRecipePosition -> product_id ) -> name }}
< span class = " timeago-contextual " >@ if ( FindObjectInArrayByPropertyValue ( $recipesFulfillment , 'recipe_pos_id' , $selectedRecipePosition -> id ) -> need_fulfilled == 1 ) {{ $L ( 'Enough in stock' ) }} @ else {{ $L ( 'Not enough in stock, #1 missing, #2 already on shopping list' , FindObjectInArrayByPropertyValue ( $recipesFulfillment , 'recipe_pos_id' , $selectedRecipePosition -> id ) -> missing_amount , FindObjectInArrayByPropertyValue ( $recipesFulfillment , 'recipe_pos_id' , $selectedRecipePosition -> id ) -> amount_on_shopping_list ) }} @ endif </ span >
@ if ( ! empty ( $selectedRecipePosition -> note ))
2018-10-27 10:39:52 +02:00
< div class = " text-muted " > { !! nl2br ( $selectedRecipePosition -> note ) !! } </ div >
2018-10-25 20:36:29 +02:00
@ endif
</ li >
2018-10-27 10:37:31 +02:00
@ php $lastGroup = $selectedRecipePosition -> ingredient_group ; @ endphp
2018-10-25 20:36:29 +02:00
@ endforeach
</ ul >
@ endif
@ if ( ! empty ( $selectedRecipeSubRecipe -> description ))
< div class = " card-body " >
< h5 > {{ $L ( 'Preparation' ) }} </ h5 >
{ !! $selectedRecipeSubRecipe -> description !! }
</ div >
@ endif
@ endforeach
<!-- Selected recipe -->
@ if ( $selectedRecipePositions -> count () > 0 )
2018-07-15 09:56:10 +02:00
< div class = " card-body " >
< h5 class = " mb-0 " > {{ $L ( 'Ingredients' ) }} </ h5 >
</ div >
< ul class = " list-group list-group-flush " >
2018-10-25 22:45:44 +02:00
@ php $lastGroup = 'undefined' ; @ endphp
2018-07-15 09:56:10 +02:00
@ foreach ( $selectedRecipePositions as $selectedRecipePosition )
2018-10-25 22:45:44 +02:00
@ if ( $lastGroup != $selectedRecipePosition -> ingredient_group )
2018-10-27 10:37:31 +02:00
< h5 class = " mb-2 mt-2 ml-4 " >< strong > {{ $selectedRecipePosition -> ingredient_group }} </ strong ></ h5 >
2018-10-25 22:45:44 +02:00
@ endif
2018-07-15 09:56:10 +02:00
< li class = " list-group-item " >
2018-08-09 17:24:04 +02:00
{{ $selectedRecipePosition -> amount }} {{ Pluralize ( $selectedRecipePosition -> amount , FindObjectInArrayByPropertyValue ( $quantityunits , 'id' , $selectedRecipePosition -> qu_id ) -> name , FindObjectInArrayByPropertyValue ( $quantityunits , 'id' , $selectedRecipePosition -> qu_id ) -> name_plural ) }} {{ FindObjectInArrayByPropertyValue ( $products , 'id' , $selectedRecipePosition -> product_id ) -> name }}
2018-07-15 09:56:10 +02:00
< span class = " timeago-contextual " >@ if ( FindObjectInArrayByPropertyValue ( $recipesFulfillment , 'recipe_pos_id' , $selectedRecipePosition -> id ) -> need_fulfilled == 1 ) {{ $L ( 'Enough in stock' ) }} @ else {{ $L ( 'Not enough in stock, #1 missing, #2 already on shopping list' , FindObjectInArrayByPropertyValue ( $recipesFulfillment , 'recipe_pos_id' , $selectedRecipePosition -> id ) -> missing_amount , FindObjectInArrayByPropertyValue ( $recipesFulfillment , 'recipe_pos_id' , $selectedRecipePosition -> id ) -> amount_on_shopping_list ) }} @ endif </ span >
2018-07-15 13:33:59 +02:00
@ if ( ! empty ( $selectedRecipePosition -> note ))
2018-10-27 10:39:52 +02:00
< div class = " text-muted " > { !! nl2br ( $selectedRecipePosition -> note ) !! } </ div >
2018-07-15 13:33:59 +02:00
@ endif
2018-07-15 09:56:10 +02:00
</ li >
2018-10-25 22:45:44 +02:00
@ php $lastGroup = $selectedRecipePosition -> ingredient_group ; @ endphp
2018-07-15 09:56:10 +02:00
@ endforeach
</ ul >
2018-10-25 20:36:29 +02:00
@ endif
@ if ( ! empty ( $selectedRecipe -> description ))
2018-07-15 09:56:10 +02:00
< div class = " card-body " >
< h5 > {{ $L ( 'Preparation' ) }} </ h5 >
2018-10-03 16:41:21 +02:00
{ !! $selectedRecipe -> description !! }
2018-07-15 09:56:10 +02:00
</ div >
2018-10-25 20:36:29 +02:00
@ endif
2018-07-15 09:56:10 +02:00
</ div >
</ div >
@ endif
2018-07-14 18:23:41 +02:00
</ div >
@ stop