From 557db9e07de1818b98195c25aaddfe57563301f6 Mon Sep 17 00:00:00 2001 From: fipwmaqzufheoxq92ebc <29818044+fipwmaqzufheoxq92ebc@users.noreply.github.com> Date: Fri, 25 Sep 2020 11:16:10 +0200 Subject: [PATCH] Fixes #1005. Recipes: filter by stock-status in gallery --- public/viewjs/recipes.js | 11 +++++++++++ views/recipes.blade.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/public/viewjs/recipes.js b/public/viewjs/recipes.js index d176c435..c79829dc 100644 --- a/public/viewjs/recipes.js +++ b/public/viewjs/recipes.js @@ -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) diff --git a/views/recipes.blade.php b/views/recipes.blade.php index 756aacd4..e28ad07a 100644 --- a/views/recipes.blade.php +++ b/views/recipes.blade.php @@ -144,7 +144,7 @@ id="gallery">