mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 20:26:42 +00:00
Better approach for stock overview filtering by location (references #11)
This commit is contained in:
@@ -130,6 +130,7 @@ return array(
|
|||||||
'Track charge cycle of battery #1' => 'Erfasse einen Ladezyklus für Batterie #1',
|
'Track charge cycle of battery #1' => 'Erfasse einen Ladezyklus für Batterie #1',
|
||||||
'Track execution of habit #1' => 'Erfasse eine Ausführung von #1',
|
'Track execution of habit #1' => 'Erfasse eine Ausführung von #1',
|
||||||
'Filter by location' => 'Nach Standort filtern',
|
'Filter by location' => 'Nach Standort filtern',
|
||||||
|
'Search' => 'Suche',
|
||||||
|
|
||||||
//Constants
|
//Constants
|
||||||
'manually' => 'Manuell',
|
'manually' => 'Manuell',
|
||||||
|
@@ -182,3 +182,15 @@ a.discrete-link:focus {
|
|||||||
#toast-container > div {
|
#toast-container > div {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-gutters {
|
||||||
|
margin-right: 0;
|
||||||
|
margin-left: 0;
|
||||||
|
padding-right: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dataTables_filter,
|
||||||
|
.dataTables_info {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
@@ -1,36 +1,13 @@
|
|||||||
var stockOverviewTable = $('#stock-overview-table').DataTable({
|
var stockOverviewTable = $('#stock-overview-table').DataTable({
|
||||||
'bPaginate': false,
|
'paginate': false,
|
||||||
'order': [[3, 'asc']],
|
'order': [[3, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'visible': false, 'targets': 4 }
|
{ 'visible': false, 'targets': 4 }
|
||||||
],
|
],
|
||||||
'language': JSON.parse(L('datatables_localization')),
|
'language': JSON.parse(L('datatables_localization'))
|
||||||
"dom": '<"filter-by-location">f'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("div.filter-by-location").html('<div class="dataTables_filter"><label>' + L('Filter by location') + ':<select id="location-filter" class="form-control input-sm" style="margin-left: 0.5em;"></label></div>');
|
|
||||||
|
|
||||||
$('#stock-overview-table_wrapper').on("DOMSubtreeModified", function()
|
|
||||||
{
|
|
||||||
$('#stock-overview-table_wrapper').off("DOMSubtreeModified");
|
|
||||||
|
|
||||||
Grocy.Api.Get('get-objects/locations',
|
|
||||||
function(locations)
|
|
||||||
{
|
|
||||||
$('#location-filter').append($('<option></option>').val("all").html(L("All")));
|
|
||||||
$.each(locations, function(index)
|
|
||||||
{
|
|
||||||
var locationName = locations[index].name;
|
|
||||||
$('#location-filter').append($('<option></option>').val(locationName).html(locationName));
|
|
||||||
});
|
|
||||||
},
|
|
||||||
function(xhr)
|
|
||||||
{
|
|
||||||
console.error(xhr);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
$("#location-filter").on("change", function()
|
$("#location-filter").on("change", function()
|
||||||
{
|
{
|
||||||
var value = $(this).val();
|
var value = $(this).val();
|
||||||
@@ -41,6 +18,16 @@ $('#stock-overview-table_wrapper').on("DOMSubtreeModified", function()
|
|||||||
|
|
||||||
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)
|
$(document).on('click', '.product-consume-button', function(e)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"Version": "1.12.0",
|
"Version": "1.12.1",
|
||||||
"ReleaseDate": "2018-07-08"
|
"ReleaseDate": "2018-07-08"
|
||||||
}
|
}
|
||||||
|
@@ -17,9 +17,23 @@
|
|||||||
<p class="btn btn-lg btn-danger no-real-button responsive-button">{{ $L('#1 products are already expired', $countAlreadyExpired) }}</p>
|
<p class="btn btn-lg btn-danger no-real-button responsive-button">{{ $L('#1 products are already expired', $countAlreadyExpired) }}</p>
|
||||||
<p class="btn btn-lg btn-info no-real-button responsive-button">{{ $L('#1 products are below defined min. stock amount', count($missingProducts)) }}</p>
|
<p class="btn btn-lg btn-info no-real-button responsive-button">{{ $L('#1 products are below defined min. stock amount', count($missingProducts)) }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="discrete-content-separator-2x"></div>
|
<div class="discrete-content-separator-2x"></div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-3 no-gutters">
|
||||||
|
<label for="location-filter">{{ $L('Filter by location') }}</label>
|
||||||
|
<select class="form-control" id="location-filter">
|
||||||
|
<option value="all">{{ $L('All') }}</option>
|
||||||
|
@foreach($locations as $location)
|
||||||
|
<option value="{{ $location->name }}">{{ $location->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<label for="search">{{ $L('Search') }}</label>
|
||||||
|
<input type="text" class="form-control" id="search">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table id="stock-overview-table" class="table table-striped">
|
<table id="stock-overview-table" class="table table-striped">
|
||||||
|
Reference in New Issue
Block a user