diff --git a/localization/de.php b/localization/de.php index e95237ed..60c42def 100644 --- a/localization/de.php +++ b/localization/de.php @@ -130,6 +130,7 @@ return array( 'Track charge cycle of battery #1' => 'Erfasse einen Ladezyklus für Batterie #1', 'Track execution of habit #1' => 'Erfasse eine Ausführung von #1', 'Filter by location' => 'Nach Standort filtern', + 'Search' => 'Suche', //Constants 'manually' => 'Manuell', diff --git a/public/css/grocy.css b/public/css/grocy.css index e38fc54a..a1725274 100644 --- a/public/css/grocy.css +++ b/public/css/grocy.css @@ -182,3 +182,15 @@ a.discrete-link:focus { #toast-container > div { box-shadow: none; } + +.no-gutters { + margin-right: 0; + margin-left: 0; + padding-right: 0; + padding-left: 0; +} + +.dataTables_filter, +.dataTables_info { + display: none; +} diff --git a/public/viewjs/stockoverview.js b/public/viewjs/stockoverview.js index c4ec4e87..c7f349b0 100644 --- a/public/viewjs/stockoverview.js +++ b/public/viewjs/stockoverview.js @@ -1,46 +1,33 @@ var stockOverviewTable = $('#stock-overview-table').DataTable({ - 'bPaginate': false, + 'paginate': false, 'order': [[3, 'asc']], 'columnDefs': [ { 'orderable': false, 'targets': 0 }, { 'visible': false, 'targets': 4 } ], - 'language': JSON.parse(L('datatables_localization')), - "dom": '<"filter-by-location">f' + 'language': JSON.parse(L('datatables_localization')) }); -$("div.filter-by-location").html('
'); - -$('#stock-overview-table_wrapper').on("DOMSubtreeModified", function() +$("#location-filter").on("change", function() { - $('#stock-overview-table_wrapper').off("DOMSubtreeModified"); - - Grocy.Api.Get('get-objects/locations', - function(locations) - { - $('#location-filter').append($('').val("all").html(L("All"))); - $.each(locations, function(index) - { - var locationName = locations[index].name; - $('#location-filter').append($('').val(locationName).html(locationName)); - }); - }, - function(xhr) - { - console.error(xhr); - } - ); - - $("#location-filter").on("change", function() + var value = $(this).val(); + if (value === "all") { - var value = $(this).val(); - if (value === "all") - { - value = ""; - } + value = ""; + } + + stockOverviewTable.column(4).search(value).draw(); +}); - stockOverviewTable.column(4).search(value).draw(); - }); +$("#search").on("keyup", function() +{ + var value = $(this).val(); + if (value === "all") + { + value = ""; + } + + stockOverviewTable.search(value).draw(); }); $(document).on('click', '.product-consume-button', function(e) diff --git a/version.json b/version.json index d04f61c4..7aaef4ef 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { - "Version": "1.12.0", + "Version": "1.12.1", "ReleaseDate": "2018-07-08" } diff --git a/views/stockoverview.blade.php b/views/stockoverview.blade.php index 498ab8f8..7fda16f4 100644 --- a/views/stockoverview.blade.php +++ b/views/stockoverview.blade.php @@ -17,10 +17,24 @@ + +