mirror of
https://github.com/grocy/grocy.git
synced 2025-08-23 05:19:11 +00:00
Add support for "Move on Open" (#1863)
* Add functionality to move a product when it is opened * Update the API to support this (and some other new fields) * Remove console, update move on open when either the default or the consume location change * Fix conflict from fridge * Ignore .DS_STORE from macOS * Fix the migration conflict * Fix the default location not appending properly * Revert changes no longer needed * Fix the checkbox disable logic, and call the function on page load * Simplify the transfer to use the existing function (which also adds logs) * Only move it if it's moving * Code formatting / naming * Clarify help text (it's not always about one unit, but about the corresponding amount opened) * Handle splitted stock entries + optimized/unified product property checks * Added UI feedback on auto moving Co-authored-by: Bernd Bestel <bernd@berrnd.de>
This commit is contained in:
@@ -189,6 +189,11 @@ $('#save-mark-as-open-button').on('click', function(e)
|
||||
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
||||
toastr.success(__t('Marked %1$s of %2$s as opened', parseFloat(jsonForm.amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }) + " " + __n(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural, true), productDetails.product.name) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockTransaction(\'' + result[0].transaction_id + '\')"><i class="fa-solid fa-undo"></i> ' + __t("Undo") + '</a>');
|
||||
|
||||
if (productDetails.product.move_on_open == 1)
|
||||
{
|
||||
toastr.info('<span>' + __t("Moved to %1$s", productDetails.default_consume_location.name) + "</span> <i class='fa-solid fa-exchange-alt'></i>");
|
||||
}
|
||||
|
||||
if (BoolVal(Grocy.UserSettings.stock_default_consume_amount_use_quick_consume_amount))
|
||||
{
|
||||
$('#display_amount').val(productDetails.product.quick_consume_amount);
|
||||
|
Reference in New Issue
Block a user