From 03eaa6c79f9ee9761e390ca79e8ff26ba8128737 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sat, 6 Oct 2018 18:19:31 +0200 Subject: [PATCH] Add possibility to filter by product group on stock overview page --- controllers/StockController.php | 3 ++- localization/de.php | 1 + public/viewjs/stockoverview.js | 11 +++++++++++ views/stockoverview.blade.php | 14 ++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/controllers/StockController.php b/controllers/StockController.php index 9fb222fd..1bafe1d1 100644 --- a/controllers/StockController.php +++ b/controllers/StockController.php @@ -23,7 +23,8 @@ class StockController extends BaseController 'locations' => $this->Database->locations()->orderBy('name'), 'currentStock' => $this->StockService->GetCurrentStock(), 'missingProducts' => $this->StockService->GetMissingProducts(), - 'nextXDays' => 5 + 'nextXDays' => 5, + 'productGroups' => $this->Database->product_groups()->orderBy('name') ]); } diff --git a/localization/de.php b/localization/de.php index 8bf7e975..8dc56887 100644 --- a/localization/de.php +++ b/localization/de.php @@ -278,6 +278,7 @@ return array( 'No instruction manual available' => 'Keine Bedienungsanleitung vorhanden', 'The current instruction manual will be deleted when you save the equipment' => 'Die aktuelle Bedienungsanleitung wird beim Speichern des Geräts gelöscht', 'No picture available' => 'Kein Bild vorhanden', + 'Filter by product group' => 'Nach Produktgruppe filtern', //Constants 'manually' => 'Manuell', diff --git a/public/viewjs/stockoverview.js b/public/viewjs/stockoverview.js index f5e6b742..b5d879ae 100644 --- a/public/viewjs/stockoverview.js +++ b/public/viewjs/stockoverview.js @@ -31,6 +31,17 @@ $("#location-filter").on("change", function() stockOverviewTable.column(4).search(value).draw(); }); +$("#product-group-filter").on("change", function() +{ + var value = $(this).val(); + if (value === "all") + { + value = ""; + } + + stockOverviewTable.column(6).search(value).draw(); +}); + $("#status-filter").on("change", function() { var value = $(this).val(); diff --git a/views/stockoverview.blade.php b/views/stockoverview.blade.php index 5e33d6c4..2a548619 100644 --- a/views/stockoverview.blade.php +++ b/views/stockoverview.blade.php @@ -36,6 +36,15 @@ @endforeach +
+ + +