* refactor to be stock/entry/{entryId}

* Allow recipeform add productworkflow

* on document ready stockdetail filter based on ProductPicker

* openDate fixes for undo

* RefreshStockDetailRow refresh location-id
This commit is contained in:
kriddles
2020-01-22 14:08:49 -06:00
committed by Bernd Bestel
parent 101355cae2
commit ef9f28d154
8 changed files with 114 additions and 94 deletions

View File

@@ -19,7 +19,6 @@ $.fn.dataTable.ext.search.push(function(settings, data, dataIndex)
return false;
});
Grocy.Components.ProductPicker.GetPicker().trigger('change');
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
{
@@ -116,7 +115,7 @@ $(document).on("click", ".stock-name-cell", function(e)
function RefreshStockDetailRow(stockRowId)
{
Grocy.Api.Get("stock/" + stockRowId + "/entry",
Grocy.Api.Get("stock/entry/" + stockRowId,
function(result)
{
var stockRow = $('#stock-' + stockRowId + '-row');
@@ -161,6 +160,8 @@ function RefreshStockDetailRow(stockRowId)
});
$('#stock-' + stockRowId + '-best-before-date-timeago').attr('datetime', result.best_before_date + ' 23:59:59');
$(".stock-consume-button").attr('data-location-id',result.location_id);
var locationName = "";
Grocy.Api.Get("objects/locations/" + result.location_id,
function(locationResult)
@@ -175,6 +176,7 @@ function RefreshStockDetailRow(stockRowId)
$('#stock-' + stockRowId + '-location').parent().effect('highlight', { }, 500);
$('#stock-' + stockRowId + '-location').fadeOut(500, function()
{
$(this).attr('data-location-id',result.location_id);
$(this).text(locationName).fadeIn(500);
});
@@ -231,6 +233,8 @@ $(window).on("message", function(e)
}
});
Grocy.Components.ProductPicker.GetPicker().trigger('change');
function UndoStockBookingEntry(bookingId, stockRowId)
{
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', { },