mirror of
https://github.com/grocy/grocy.git
synced 2025-08-18 03:25:50 +00:00
[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:
23
public/viewjs/stockoverview.js
Normal file → Executable file
23
public/viewjs/stockoverview.js
Normal file → Executable 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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user