Fixes #1005. Recipes: filter by stock-status in gallery

This commit is contained in:
fipwmaqzufheoxq92ebc 2020-09-25 11:16:10 +02:00
parent 4b5b7bcb19
commit 557db9e07d
No known key found for this signature in database
GPG Key ID: F4DF989490C2ADB7
2 changed files with 12 additions and 1 deletions

View File

@ -75,6 +75,17 @@ $("#status-filter").on("change", function()
}
recipesTables.column(5).search(value).draw();
$('.recipe-gallery-item').removeClass('d-none');
if(value !== "")
{
if(value === 'enoughtinstock')
$('.recipe-gallery-item').not('.recipe-enoughtinstock').addClass('d-none');
if(value === 'enoughinstockwithshoppinglist')
$('.recipe-gallery-item').not('.recipe-enoughinstockwithshoppinglist').addClass('d-none');
if(value === 'notenoughinstock')
$('.recipe-gallery-item').not('.recipe-notenoughinstock').addClass('d-none');
}
});
$(".recipe-delete").on('click', function(e)

View File

@ -144,7 +144,7 @@
id="gallery">
<div class="card-columns no-gutters">
@foreach($recipes as $recipe)
<a class="discrete-link recipe-gallery-item"
<a class="discrete-link recipe-gallery-item @if(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled == 1) recipe-enoughtinstock @elseif(FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $recipe->id)->need_fulfilled_with_shopping_list == 1) recipe-enoughinstockwithshoppinglist @else recipe-notenoughinstock @endif"
data-recipe-id="{{ $recipe->id }}"
href="#">
<div id="RecipeGalleryCard-{{ $recipe->id }}"