[WIP] Simplified overviews on mobile (#1115)

* Simplified stock overview on mobile.

* Stock table horizontally scrollable

* Use the new mobile views for all pages (except the shopping list page, use the existing special handling there for now)
And add a clear filter button to all pages

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
This commit is contained in:
4lloyd
2020-11-07 14:53:45 +01:00
committed by GitHub
parent 9aa9bd1cc7
commit 76cbf796b6
63 changed files with 948 additions and 156 deletions

23
public/viewjs/stockoverview.js Normal file → Executable file
View File

@@ -10,8 +10,25 @@
{ 'visible': false, 'targets': 8 }
],
});
$('#stock-overview-table').on('column-sizing.dt', function(e, settings)
{
var dtScrollWidth = $('.dataTables_scroll').width();
var stockTableWidth = $('#stock-overview-table').width();
if (dtScrollWidth < stockTableWidth)
{
$('.dataTables_scrollBody').addClass("grab-cursor");
} else
{
$('.dataTables_scrollBody').removeClass("grab-cursor");
}
});
$('#stock-overview-table tbody').removeClass("d-none");
stockOverviewTable.columns.adjust().draw();
$('.dataTables_scrollBody').addClass("dragscroll");
dragscroll.reset();
$("#location-filter").on("change", function()
{
@@ -229,9 +246,9 @@ function RefreshStatistics()
Grocy.Api.Get('stock/volatile?expiring_days=' + nextXDays,
function(result)
{
$("#info-expiring-products").text(__n(result.expiring_products.length, '%s product expires', '%s products expiring') + ' ' + __n(nextXDays, 'within the next day', 'within the next %s days'));
$("#info-expired-products").text(__n(result.expired_products.length, '%s product is already expired', '%s products are already expired'));
$("#info-missing-products").text(__n(result.missing_products.length, '%s product is below defined min. stock amount', '%s products are below defined min. stock amount'));
$("#info-expiring-products").html('<span class="d-block d-md-none">' + result.expiring_products.length + ' <i class="fas fa-clock"></i></span><span class="d-none d-md-block">' + __n(result.expiring_products.length, '%s product expires', '%s products expiring') + ' ' + __n(nextXDays, 'within the next day', 'within the next %s days') + '</span>');
$("#info-expired-products").html('<span class="d-block d-md-none">' + result.expired_products.length + ' <i class="fas fa-times-circle"></i></span><span class="d-none d-md-block">' + __n(result.expired_products.length, '%s product is already expired', '%s products are already expired') + '</span>');
$("#info-missing-products").html('<span class="d-block d-md-none">' + result.missing_products.length + ' <i class="fas fa-exclamation-circle"></i></span><span class="d-none d-md-block">' + __n(result.missing_products.length, '%s product is below defined min. stock amount', '%s products are below defined min. stock amount') + '</span>');
},
function(xhr)
{