mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
421 (#507)
* 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:
@@ -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', { },
|
||||
|
@@ -26,9 +26,8 @@
|
||||
jsonData.open = $("#open").is(":checked");
|
||||
|
||||
var stockRowId = GetUriParam('stockRowId');
|
||||
jsonData.id = stockRowId;
|
||||
|
||||
Grocy.Api.Put("stock", jsonData,
|
||||
Grocy.Api.Put("stock/entry/" + stockRowId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
var successMessage = __t('Stock entry successfully updated') + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBookingEntry(\'' + result.id + '\',\'' + stockRowId + '\')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>';
|
||||
@@ -84,7 +83,7 @@ if (Grocy.Components.DateTimePicker)
|
||||
}
|
||||
|
||||
var stockRowId = GetUriParam('stockRowId');
|
||||
Grocy.Api.Get("stock/" + stockRowId + "/entry",
|
||||
Grocy.Api.Get("stock/entry/" + stockRowId,
|
||||
function (stockEntry)
|
||||
{
|
||||
Grocy.Components.LocationPicker.SetId(stockEntry.location_id);
|
||||
|
Reference in New Issue
Block a user