mirror of
https://github.com/grocy/grocy.git
synced 2025-10-12 16:44:55 +00:00
Squashed commit
Improve journal pages loading time (new date range filter) Various small style adjustments (meal plan page and others) Pulled German translations from Transifex Show the shopping list total value (closes #1309) Make it possible to copy recipes (closes #714) Implemented optional "auto decimal separator for price inputs" (closes #1345) Removed table grouped column fixed order restriction (closes #1402) Don't filter out style, class, id attributes of html text (closes #1298) Added product picture as column on the stock overview page (closes #1283) Added grocycodes also for chores and batteries (+ camera barcode scanning for /choretracking and /batterytracking, this now closes #221)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
var batteriesJournalTable = $('#batteries-journal-table').DataTable({
|
||||
'paginate': true,
|
||||
'order': [[2, 'desc']],
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
@@ -12,13 +11,16 @@ batteriesJournalTable.columns.adjust().draw();
|
||||
$("#battery-filter").on("change", function()
|
||||
{
|
||||
var value = $(this).val();
|
||||
var text = $("#battery-filter option:selected").text();
|
||||
if (value === "all")
|
||||
{
|
||||
text = "";
|
||||
RemoveUriParam("battery");
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateUriParam("battery", value);
|
||||
}
|
||||
|
||||
batteriesJournalTable.column(1).search(text).draw();
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
$("#search").on("keyup", Delay(function()
|
||||
@@ -36,14 +38,27 @@ $("#clear-filter-button").on("click", function()
|
||||
{
|
||||
$("#search").val("");
|
||||
$("#battery-filter").val("all");
|
||||
batteriesJournalTable.column(1).search("").draw();
|
||||
batteriesJournalTable.search("").draw();
|
||||
$("#daterange-filter").val("24");
|
||||
|
||||
RemoveUriParam("months");
|
||||
RemoveUriParam("battery");
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
$("#daterange-filter").on("change", function()
|
||||
{
|
||||
UpdateUriParam("months", $(this).val());
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
if (typeof GetUriParam("battery") !== "undefined")
|
||||
{
|
||||
$("#battery-filter").val(GetUriParam("battery"));
|
||||
$("#battery-filter").trigger("change");
|
||||
}
|
||||
|
||||
if (typeof GetUriParam("months") !== "undefined")
|
||||
{
|
||||
$("#daterange-filter").val(GetUriParam("months"));
|
||||
}
|
||||
|
||||
$(document).on('click', '.undo-battery-execution-button', function(e)
|
||||
|
@@ -122,6 +122,21 @@ $(document).on("click", ".battery-name-cell", function(e)
|
||||
$("#batteriesoverview-batterycard-modal").modal("show");
|
||||
});
|
||||
|
||||
$(document).on('click', '.battery-grocycode-label-print', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
document.activeElement.blur();
|
||||
|
||||
var batteryId = $(e.currentTarget).attr('data-battery-id');
|
||||
Grocy.Api.Get('batteries/' + batteryId + '/printlabel', function(labelData)
|
||||
{
|
||||
if (Grocy.Webhooks.labelprinter !== undefined)
|
||||
{
|
||||
Grocy.FrontendHelpers.RunWebhook(Grocy.Webhooks.labelprinter, labelData);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function RefreshStatistics()
|
||||
{
|
||||
var nextXDays = $("#info-due-batteries").data("next-x-days");
|
||||
|
@@ -83,6 +83,21 @@ $('#battery-form input').keydown(function(event)
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.battery-grocycode-label-print', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
document.activeElement.blur();
|
||||
|
||||
var batteryId = $(e.currentTarget).attr('data-chore-id');
|
||||
Grocy.Api.Get('batteries/' + batteryId + '/printlabel', function(labelData)
|
||||
{
|
||||
if (Grocy.Webhooks.labelprinter !== undefined)
|
||||
{
|
||||
Grocy.FrontendHelpers.RunWebhook(Grocy.Webhooks.labelprinter, labelData);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
$('#name').focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('battery-form');
|
||||
|
@@ -60,7 +60,8 @@ $('#battery_id').on('change', function(e)
|
||||
|
||||
$('.combobox').combobox({
|
||||
appendId: '_text_input',
|
||||
bsVersion: '4'
|
||||
bsVersion: '4',
|
||||
clearIfNoMatch: false
|
||||
});
|
||||
|
||||
$('#battery_id').val('');
|
||||
@@ -97,6 +98,16 @@ $('#tracked_time').find('input').on('keypress', function(e)
|
||||
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
||||
});
|
||||
|
||||
$(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
|
||||
{
|
||||
if (!(target == "@batterypicker" || target == "undefined" || target == undefined)) // Default target
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$('#battery_id_text_input').val(barcode).trigger('change');
|
||||
});
|
||||
|
||||
function UndoChargeCycle(chargeCycleId)
|
||||
{
|
||||
Grocy.Api.Post('batteries/charge-cycles/' + chargeCycleId.toString() + '/undo', {},
|
||||
@@ -110,3 +121,38 @@ function UndoChargeCycle(chargeCycleId)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
$('#battery_id_text_input').on('blur', function(e)
|
||||
{
|
||||
if ($('#battery_id').hasClass("combobox-menu-visible"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var input = $('#battery_id_text_input').val().toString();
|
||||
var possibleOptionElement = [];
|
||||
|
||||
// grocycode handling
|
||||
if (input.startsWith("grcy"))
|
||||
{
|
||||
var gc = input.split(":");
|
||||
if (gc[1] == "b")
|
||||
{
|
||||
possibleOptionElement = $("#battery_id option[value=\"" + gc[2] + "\"]").first();
|
||||
}
|
||||
}
|
||||
|
||||
if (possibleOptionElement.length > 0)
|
||||
{
|
||||
$('#battery_id').val(possibleOptionElement.val());
|
||||
$('#battery_id').data('combobox').refresh();
|
||||
$('#battery_id').trigger('change');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#battery_id').val(null);
|
||||
$('#battery_id_text_input').val("");
|
||||
$('#battery_id').data('combobox').refresh();
|
||||
$('#battery_id').trigger('change');
|
||||
}
|
||||
});
|
||||
|
@@ -237,3 +237,18 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.chore-grocycode-label-print', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
document.activeElement.blur();
|
||||
|
||||
var choreId = $(e.currentTarget).attr('data-chore-id');
|
||||
Grocy.Api.Get('chores/' + choreId + '/printlabel', function(labelData)
|
||||
{
|
||||
if (Grocy.Webhooks.labelprinter !== undefined)
|
||||
{
|
||||
Grocy.FrontendHelpers.RunWebhook(Grocy.Webhooks.labelprinter, labelData);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@@ -1,5 +1,4 @@
|
||||
var choresJournalTable = $('#chores-journal-table').DataTable({
|
||||
'paginate': true,
|
||||
'order': [[2, 'desc']],
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
@@ -12,13 +11,22 @@ choresJournalTable.columns.adjust().draw();
|
||||
$("#chore-filter").on("change", function()
|
||||
{
|
||||
var value = $(this).val();
|
||||
var text = $("#chore-filter option:selected").text();
|
||||
if (value === "all")
|
||||
{
|
||||
text = "";
|
||||
RemoveUriParam("chore");
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateUriParam("chore", value);
|
||||
}
|
||||
|
||||
choresJournalTable.column(1).search(text).draw();
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
$("#daterange-filter").on("change", function()
|
||||
{
|
||||
UpdateUriParam("months", $(this).val());
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
$("#search").on("keyup", Delay(function()
|
||||
@@ -36,14 +44,21 @@ $("#clear-filter-button").on("click", function()
|
||||
{
|
||||
$("#search").val("");
|
||||
$("#chore-filter").val("all");
|
||||
choresJournalTable.column(1).search("").draw();
|
||||
choresJournalTable.search("").draw();
|
||||
$("#daterange-filter").val("24");
|
||||
|
||||
RemoveUriParam("months");
|
||||
RemoveUriParam("chore");
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
if (typeof GetUriParam("chore") !== "undefined")
|
||||
{
|
||||
$("#chore-filter").val(GetUriParam("chore"));
|
||||
$("#chore-filter").trigger("change");
|
||||
}
|
||||
|
||||
if (typeof GetUriParam("months") !== "undefined")
|
||||
{
|
||||
$("#daterange-filter").val(GetUriParam("months"));
|
||||
}
|
||||
|
||||
$(document).on('click', '.undo-chore-execution-button', function(e)
|
||||
|
@@ -185,6 +185,21 @@ $(document).on("click", ".chore-name-cell", function(e)
|
||||
$("#choresoverview-chorecard-modal").modal("show");
|
||||
});
|
||||
|
||||
$(document).on('click', '.chore-grocycode-label-print', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
document.activeElement.blur();
|
||||
|
||||
var choreId = $(e.currentTarget).attr('data-chore-id');
|
||||
Grocy.Api.Get('chores/' + choreId + '/printlabel', function(labelData)
|
||||
{
|
||||
if (Grocy.Webhooks.labelprinter !== undefined)
|
||||
{
|
||||
Grocy.FrontendHelpers.RunWebhook(Grocy.Webhooks.labelprinter, labelData);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function RefreshStatistics()
|
||||
{
|
||||
var nextXDays = $("#info-due-chores").data("next-x-days");
|
||||
|
@@ -83,7 +83,8 @@ $('#chore_id').on('change', function(e)
|
||||
|
||||
$('.combobox').combobox({
|
||||
appendId: '_text_input',
|
||||
bsVersion: '4'
|
||||
bsVersion: '4',
|
||||
clearIfNoMatch: false
|
||||
});
|
||||
|
||||
$('#chore_id_text_input').focus();
|
||||
@@ -113,6 +114,16 @@ $('#choretracking-form input').keydown(function(event)
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
|
||||
{
|
||||
if (!(target == "@chorepicker" || target == "undefined" || target == undefined)) // Default target
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$('#chore_id_text_input').val(barcode).trigger('change');
|
||||
});
|
||||
|
||||
Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
||||
@@ -131,3 +142,38 @@ function UndoChoreExecution(executionId)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
$('#chore_id_text_input').on('blur', function(e)
|
||||
{
|
||||
if ($('#chore_id').hasClass("combobox-menu-visible"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var input = $('#chore_id_text_input').val().toString();
|
||||
var possibleOptionElement = [];
|
||||
|
||||
// grocycode handling
|
||||
if (input.startsWith("grcy"))
|
||||
{
|
||||
var gc = input.split(":");
|
||||
if (gc[1] == "c")
|
||||
{
|
||||
possibleOptionElement = $("#chore_id option[value=\"" + gc[2] + "\"]").first();
|
||||
}
|
||||
}
|
||||
|
||||
if (possibleOptionElement.length > 0)
|
||||
{
|
||||
$('#chore_id').val(possibleOptionElement.val());
|
||||
$('#chore_id').data('combobox').refresh();
|
||||
$('#chore_id').trigger('change');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#chore_id').val(null);
|
||||
$('#chore_id_text_input').val("");
|
||||
$('#chore_id').data('combobox').refresh();
|
||||
$('#chore_id').trigger('change');
|
||||
}
|
||||
});
|
||||
|
@@ -92,3 +92,20 @@ $(".numberpicker").on("keydown", function(e)
|
||||
$(this).parent().find(".numberpicker-down-button").click();
|
||||
}
|
||||
});
|
||||
|
||||
$(".numberpicker.locale-number-input.locale-number-currency").on("blur", function()
|
||||
{
|
||||
if (BoolVal(Grocy.UserSettings.stock_auto_decimal_separator_prices))
|
||||
{
|
||||
var value = this.value.toString();
|
||||
var decimalPlaces = parseInt(Grocy.UserSettings.stock_decimal_places_prices);
|
||||
|
||||
if (value.length <= decimalPlaces)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var valueNew = parseFloat(value.substring(0, value.length - decimalPlaces) + '.' + value.slice(decimalPlaces * -1)).toLocaleString(undefined, { minimumFractionDigits: decimalPlaces, maximumFractionDigits: decimalPlaces });
|
||||
$(this).val(valueNew);
|
||||
}
|
||||
});
|
||||
|
@@ -84,7 +84,7 @@ Grocy.Components.ProductCard.Refresh = function(productId)
|
||||
|
||||
if (productDetails.last_price !== null)
|
||||
{
|
||||
$('#productcard-product-last-price').text(__t("%1$s per %2$s", Number.parseFloat(productDetails.last_price).toLocaleString() + ' ' + Grocy.Currency, productDetails.quantity_unit_stock.name));
|
||||
$('#productcard-product-last-price').text(__t("%1$s per %2$s", Number.parseFloat(productDetails.last_price).toLocaleString(undefined, { style: "currency", currency: Grocy.Currency, minimumFractionDigits: Grocy.UserSettings.stock_decimal_places_prices, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_prices }), productDetails.quantity_unit_stock.name));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -93,7 +93,7 @@ Grocy.Components.ProductCard.Refresh = function(productId)
|
||||
|
||||
if (productDetails.avg_price !== null)
|
||||
{
|
||||
$('#productcard-product-average-price').text(__t("%1$s per %2$s", Number.parseFloat(productDetails.avg_price).toLocaleString() + ' ' + Grocy.Currency, productDetails.quantity_unit_stock.name));
|
||||
$('#productcard-product-average-price').text(__t("%1$s per %2$s", Number.parseFloat(productDetails.avg_price).toLocaleString(undefined, { style: "currency", currency: Grocy.Currency, minimumFractionDigits: Grocy.UserSettings.stock_decimal_places_prices, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_prices }), productDetails.quantity_unit_stock.name));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -149,18 +149,17 @@ $('#product_id_text_input').on('blur', function(e)
|
||||
var input = $('#product_id_text_input').val().toString();
|
||||
var possibleOptionElement = [];
|
||||
|
||||
// did we enter a grocycode?
|
||||
// grocycode handling
|
||||
if (input.startsWith("grcy"))
|
||||
{
|
||||
var gc = input.split(":");
|
||||
if (gc[1] == "p")
|
||||
{
|
||||
// find product id
|
||||
possibleOptionElement = $("#product_id option[value=\"" + gc[2] + "\"]").first();
|
||||
$("#product_id").data("grocycode", true);
|
||||
}
|
||||
}
|
||||
else // process barcode as usual
|
||||
else // Normal product barcode handling
|
||||
{
|
||||
possibleOptionElement = $("#product_id option[data-additional-searchdata*=\"" + input + ",\"]").first();
|
||||
}
|
||||
|
@@ -32,10 +32,10 @@ var calendar = $("#calendar").fullCalendar({
|
||||
<div class="btn-group mr-2 my-1"> \
|
||||
<button type="button" class="btn btn-outline-dark btn-xs add-recipe-button" data-toggle="tooltip" title="' + __t('Add recipe') + '"><i class="fas fa-plus"></i></a></button> \
|
||||
<button type="button" class="btn btn-outline-dark btn-xs dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button> \
|
||||
<div class="dropdown-menu"> \
|
||||
<a class="dropdown-item add-note-button" href="#">' + __t('Add note') + '</a> \
|
||||
<a class="dropdown-item add-product-button" href="#">' + __t('Add product') + '</a> \
|
||||
<a class="dropdown-item copy-day-button" href="#">' + __t('Copy this day') + '</a> \
|
||||
<div class="table-inline-menu dropdown-menu"> \
|
||||
<a class="dropdown-item add-note-button" href="#"><span class="dropdown-item-text">' + __t('Add note') + '</span></a> \
|
||||
<a class="dropdown-item add-product-button" href="#"><span class="dropdown-item-text">' + __t('Add product') + '</span></a> \
|
||||
<a class="dropdown-item copy-day-button" href="#"><span class="dropdown-item-text">' + __t('Copy this day') + '</span></a> \
|
||||
</div> \
|
||||
</div>');
|
||||
|
||||
@@ -121,11 +121,11 @@ var calendar = $("#calendar").fullCalendar({
|
||||
var costsAndCaloriesPerServing = ""
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
costsAndCaloriesPerServing = '<h5 class="small text-truncate"><span class="locale-number locale-number-currency">' + resolvedRecipe.costs + '</span> / <span class="locale-number locale-number-generic">' + resolvedRecipe.calories + '</span> kcal ' + __t('per serving') + '<h5>';
|
||||
costsAndCaloriesPerServing = '<h5 class="small text-truncate mb-1"><span class="locale-number locale-number-currency">' + resolvedRecipe.costs + '</span> / <span class="locale-number locale-number-generic">' + resolvedRecipe.calories + '</span> kcal ' + __t('per serving') + '</h5>';
|
||||
}
|
||||
else
|
||||
{
|
||||
costsAndCaloriesPerServing = '<h5 class="small text-truncate"><span class="locale-number locale-number-generic">' + resolvedRecipe.calories + '</span> kcal ' + __t('per serving') + '<h5>';
|
||||
costsAndCaloriesPerServing = '<h5 class="small text-truncate mb-1"><span class="locale-number locale-number-generic">' + resolvedRecipe.calories + '</span> kcal ' + __t('per serving') + '</h5>';
|
||||
}
|
||||
|
||||
if (!Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK)
|
||||
@@ -136,16 +136,15 @@ var calendar = $("#calendar").fullCalendar({
|
||||
|
||||
element.html('\
|
||||
<div> \
|
||||
<h5 class="text-truncate ' + additionalTitleCssClasses + '">' + recipe.name + '<h5> \
|
||||
<h5 class="small text-truncate">' + __n(mealPlanEntry.recipe_servings, "%s serving", "%s servings") + '</h5> \
|
||||
<h5 class="small timeago-contextual text-truncate">' + fulfillmentIconHtml + " " + fulfillmentInfoHtml + '</h5> \
|
||||
<h5 class="text-truncate mb-1 cursor-link display-recipe-button ' + additionalTitleCssClasses + '" data-toggle="tooltip" title="' + __t("Display recipe") + '" data-recipe-id="' + recipe.id.toString() + '" data-recipe-name="' + recipe.name + '" data-mealplan-servings="' + mealPlanEntry.recipe_servings + '" data-recipe-type="' + recipe.type + '">' + recipe.name + '</h5> \
|
||||
<h5 class="small text-truncate mb-1">' + __n(mealPlanEntry.recipe_servings, "%s serving", "%s servings") + '</h5> \
|
||||
<h5 class="small timeago-contextual text-truncate mb-1">' + fulfillmentIconHtml + " " + fulfillmentInfoHtml + '</h5> \
|
||||
' + costsAndCaloriesPerServing + ' \
|
||||
<h5> \
|
||||
<a class="ml-1 btn btn-outline-info btn-xs edit-meal-plan-entry-button" href="#" data-toggle="tooltip" title="' + __t("Edit this item") + '"><i class="fas fa-edit"></i></a> \
|
||||
<a class="btn btn-outline-danger btn-xs remove-recipe-button" href="#" data-toggle="tooltip" title="' + __t("Delete this item") + '"><i class="fas fa-trash"></i></a> \
|
||||
<a class="ml-1 btn btn-outline-primary btn-xs recipe-order-missing-button ' + recipeOrderMissingButtonDisabledClasses + '" href="#" data-toggle="tooltip" title="' + __t("Put missing products on shopping list") + '" data-recipe-id="' + recipe.id.toString() + '" data-mealplan-servings="' + mealPlanEntry.recipe_servings + '" data-recipe-name="' + recipe.name + '" data-recipe-type="' + recipe.type + '"><i class="fas fa-cart-plus"></i></a> \
|
||||
<a class="btn btn-outline-success btn-xs recipe-consume-button ' + recipeConsumeButtonDisabledClasses + '" href="#" data-toggle="tooltip" title="' + __t("Consume all ingredients needed by this recipe") + '" data-recipe-id="' + internalShadowRecipe.id.toString() + '" data-mealplan-entry-id="' + mealPlanEntry.id.toString() + '" data-recipe-name="' + recipe.name + '" data-recipe-type="' + recipe.type + '"><i class="fas fa-utensils"></i></a> \
|
||||
<a class="ml-1 btn btn-outline-secondary btn-xs recipe-popup-button" href="#" data-toggle="tooltip" title="' + __t("Display recipe") + '" data-recipe-id="' + recipe.id.toString() + '" data-recipe-name="' + recipe.name + '" data-mealplan-servings="' + mealPlanEntry.recipe_servings + '" data-recipe-type="' + recipe.type + '"><i class="fas fa-eye"></i></a> \
|
||||
' + doneButtonHtml + ' \
|
||||
</h5> \
|
||||
</div>');
|
||||
@@ -166,11 +165,11 @@ var calendar = $("#calendar").fullCalendar({
|
||||
var costsAndCaloriesPerDay = ""
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
costsAndCaloriesPerDay = '<h5 class="small text-truncate"><span class="locale-number locale-number-currency">' + dayRecipeResolved.costs + '</span> / <span class="locale-number locale-number-generic">' + dayRecipeResolved.calories + '</span> kcal ' + __t('per day') + '<h5>';
|
||||
costsAndCaloriesPerDay = '<h5 class="small text-truncate"><span class="locale-number locale-number-currency">' + dayRecipeResolved.costs + '</span> / <span class="locale-number locale-number-generic">' + dayRecipeResolved.calories + '</span> kcal ' + __t('per day') + '</h5>';
|
||||
}
|
||||
else
|
||||
{
|
||||
costsAndCaloriesPerDay = '<h5 class="small text-truncate"><span class="locale-number locale-number-generic">' + dayRecipeResolved.calories + '</span> kcal ' + __t('per day') + '<h5>';
|
||||
costsAndCaloriesPerDay = '<h5 class="small text-truncate"><span class="locale-number locale-number-generic">' + dayRecipeResolved.calories + '</span> kcal ' + __t('per day') + '</h5>';
|
||||
}
|
||||
$(".fc-day-header[data-date='" + dayRecipeName + "']").append('<h5 id="day-summary-' + dayRecipeName + '" class="small text-truncate border-top pt-1 pb-0">' + costsAndCaloriesPerDay + '</h5>');
|
||||
}
|
||||
@@ -214,18 +213,18 @@ var calendar = $("#calendar").fullCalendar({
|
||||
var costsAndCaloriesPerServing = ""
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
costsAndCaloriesPerServing = '<h5 class="small text-truncate"><span class="locale-number locale-number-currency">' + productDetails.last_price * mealPlanEntry.product_amount + '</span> / <span class="locale-number locale-number-generic">' + productDetails.product.calories * mealPlanEntry.product_amount + '</span> kcal ' + '<h5>';
|
||||
costsAndCaloriesPerServing = '<h5 class="small text-truncate mb-1"><span class="locale-number locale-number-currency">' + productDetails.last_price * mealPlanEntry.product_amount + '</span> / <span class="locale-number locale-number-generic">' + productDetails.product.calories * mealPlanEntry.product_amount + '</span> kcal ' + '</h5>';
|
||||
}
|
||||
else
|
||||
{
|
||||
costsAndCaloriesPerServing = '<h5 class="small text-truncate"><span class="locale-number locale-number-generic">' + productDetails.product.calories * mealPlanEntry.product_amount + '</span> kcal ' + '<h5>';
|
||||
costsAndCaloriesPerServing = '<h5 class="small text-truncate mb-1"><span class="locale-number locale-number-generic">' + productDetails.product.calories * mealPlanEntry.product_amount + '</span> kcal ' + '</h5>';
|
||||
}
|
||||
|
||||
element.html('\
|
||||
<div> \
|
||||
<h5 class="text-truncate ' + additionalTitleCssClasses + '">' + productDetails.product.name + '<h5> \
|
||||
<h5 class="small text-truncate"><span class="locale-number locale-number-quantity-amount">' + mealPlanEntry.product_amount + "</span> " + __n(mealPlanEntry.product_amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural) + '</h5> \
|
||||
<h5 class="small timeago-contextual text-truncate">' + fulfillmentIconHtml + " " + fulfillmentInfoHtml + '</h5> \
|
||||
<h5 class="text-truncate mb-1 cursor-link display-product-button ' + additionalTitleCssClasses + '" data-toggle="tooltip" title="' + __t("Display product") + '" data-product-id="' + productDetails.product.id.toString() + '">' + productDetails.product.name + '</h5> \
|
||||
<h5 class="small text-truncate mb-1"><span class="locale-number locale-number-quantity-amount">' + mealPlanEntry.product_amount + "</span> " + __n(mealPlanEntry.product_amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural) + '</h5> \
|
||||
<h5 class="small timeago-contextual text-truncate mb-1">' + fulfillmentIconHtml + " " + fulfillmentInfoHtml + '</h5> \
|
||||
' + costsAndCaloriesPerServing + ' \
|
||||
<h5> \
|
||||
<a class="ml-1 btn btn-outline-danger btn-xs remove-product-button" href="#" data-toggle="tooltip" title="' + __t("Delete this item") + '"><i class="fas fa-trash"></i></a> \
|
||||
@@ -252,11 +251,11 @@ var calendar = $("#calendar").fullCalendar({
|
||||
var costsAndCaloriesPerDay = ""
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
costsAndCaloriesPerDay = '<h5 class="small text-truncate"><span class="locale-number locale-number-currency">' + dayRecipeResolved.costs + '</span> / <span class="locale-number locale-number-generic">' + dayRecipeResolved.calories + '</span> kcal ' + __t('per day') + '<h5>';
|
||||
costsAndCaloriesPerDay = '<h5 class="small text-truncate"><span class="locale-number locale-number-currency">' + dayRecipeResolved.costs + '</span> / <span class="locale-number locale-number-generic">' + dayRecipeResolved.calories + '</span> kcal ' + __t('per day') + '</h5>';
|
||||
}
|
||||
else
|
||||
{
|
||||
costsAndCaloriesPerDay = '<h5 class="small text-truncate"><span class="locale-number locale-number-generic">' + dayRecipeResolved.calories + '</span> kcal ' + __t('per day') + '<h5>';
|
||||
costsAndCaloriesPerDay = '<h5 class="small text-truncate"><span class="locale-number locale-number-generic">' + dayRecipeResolved.calories + '</span> kcal ' + __t('per day') + '</h5>';
|
||||
}
|
||||
$(".fc-day-header[data-date='" + dayRecipeName + "']").append('<h5 id="day-summary-' + dayRecipeName + '" class="small text-truncate border-top pt-1 pb-0">' + costsAndCaloriesPerDay + '</h5>');
|
||||
}
|
||||
@@ -266,7 +265,7 @@ var calendar = $("#calendar").fullCalendar({
|
||||
{
|
||||
element.html('\
|
||||
<div> \
|
||||
<h5 class="text-wrap text-break ' + additionalTitleCssClasses + '">' + mealPlanEntry.note + '<h5> \
|
||||
<h5 class="text-wrap text-break mb-1 ' + additionalTitleCssClasses + '">' + mealPlanEntry.note + '</h5> \
|
||||
<h5> \
|
||||
<a class="ml-1 btn btn-outline-danger btn-xs remove-note-button" href="#" data-toggle="tooltip" title="' + __t("Delete this item") + '"><i class="fas fa-trash"></i></a> \
|
||||
<a class="btn btn-outline-info btn-xs edit-meal-plan-entry-button" href="#" data-toggle="tooltip" title="' + __t("Delete this item") + '"><i class="fas fa-edit"></i></a> \
|
||||
@@ -831,7 +830,7 @@ $(document).on('click', '.recipe-consume-button', function(e)
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("click", ".recipe-popup-button", function(e)
|
||||
$(document).on("click", ".display-recipe-button", function(e)
|
||||
{
|
||||
// Remove the focus from the current button
|
||||
// to prevent that the tooltip stays until clicked anywhere else
|
||||
@@ -868,6 +867,16 @@ $(document).on("click", ".recipe-popup-button", function(e)
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on("click", ".display-product-button", function(e)
|
||||
{
|
||||
// Remove the focus from the current button
|
||||
// to prevent that the tooltip stays until clicked anywhere else
|
||||
document.activeElement.blur();
|
||||
|
||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr('data-product-id'));
|
||||
$("#mealplan-productcard-modal").modal("show");
|
||||
});
|
||||
|
||||
$(document).on("click", ".mealplan-entry-done-button", function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
@@ -21,7 +21,8 @@ const swaggerUi = SwaggerUIBundle({
|
||||
],
|
||||
layout: 'StandaloneLayout',
|
||||
docExpansion: "list",
|
||||
defaultModelsExpandDepth: -1
|
||||
defaultModelsExpandDepth: -1,
|
||||
validatorUrl: false
|
||||
});
|
||||
|
||||
window.ui = swaggerUi;
|
||||
|
@@ -269,7 +269,6 @@ $("#delete-current-product-picture-button").on("click", function(e)
|
||||
|
||||
var quConversionsTable = $('#qu-conversions-table-products').DataTable({
|
||||
'order': [[1, 'asc']],
|
||||
"orderFixed": [[4, 'asc']],
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 },
|
||||
@@ -285,7 +284,6 @@ quConversionsTable.columns.adjust().draw();
|
||||
|
||||
var barcodeTable = $('#barcode-table').DataTable({
|
||||
'order': [[1, 'asc']],
|
||||
"orderFixed": [[1, 'asc']],
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 },
|
||||
@@ -302,7 +300,7 @@ $('#name').focus();
|
||||
$('.input-group-qu').trigger('change');
|
||||
Grocy.FrontendHelpers.ValidateForm('product-form');
|
||||
|
||||
$(document).on('click', '.stockentry-grocycode-product-label-print', function(e)
|
||||
$(document).on('click', '.product-grocycode-label-print', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
document.activeElement.blur();
|
||||
|
@@ -117,7 +117,7 @@ $('#save-purchase-button').on('click', function(e)
|
||||
}
|
||||
var successMessage = __t('Added %1$s of %2$s to stock', amountMessage + " " + __n(amountMessage, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural), productDetails.product.name) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockTransaction(\'' + result[0].transaction_id + '\')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>';
|
||||
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABELPRINTER)
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABEL_PRINTER)
|
||||
{
|
||||
if (Grocy.Webhooks.labelprinter !== undefined)
|
||||
{
|
||||
@@ -126,7 +126,7 @@ $('#save-purchase-button').on('click', function(e)
|
||||
post_data.grocycode = 'grcy:p:' + jsonForm.product_id + ":" + result[0].stock_id
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
|
||||
{
|
||||
post_data.duedate = __t('DD') + ': ' + result[0].best_before_date
|
||||
post_data.due_date = __t('DD') + ': ' + result[0].best_before_date
|
||||
}
|
||||
|
||||
if (jsonForm.print_stock_label > 0)
|
||||
@@ -304,7 +304,7 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||
}
|
||||
}
|
||||
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABELPRINTER)
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABEL_PRINTER)
|
||||
{
|
||||
$("#print_stock_label").val(productDetails.product.default_print_stock_label);
|
||||
if (productDetails.product.allow_label_per_unit)
|
||||
|
@@ -77,7 +77,6 @@ $('.save-recipe').on('click', function(e)
|
||||
|
||||
var recipesPosTables = $('#recipes-pos-table').DataTable({
|
||||
'order': [[1, 'asc']],
|
||||
"orderFixed": [[4, 'asc']],
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 },
|
||||
|
@@ -61,6 +61,7 @@ $("a[data-toggle='tab']").on("shown.bs.tab", function(e)
|
||||
{
|
||||
var tabId = $(e.target).attr("id");
|
||||
window.localStorage.setItem("recipes_last_tab_id", tabId);
|
||||
LoadImagesLazy();
|
||||
});
|
||||
|
||||
$("#search").on("keyup", Delay(function()
|
||||
@@ -166,6 +167,24 @@ $(".recipe-delete").on('click', function(e)
|
||||
});
|
||||
});
|
||||
|
||||
$(".recipe-copy").on('click', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
var objectId = $(e.currentTarget).attr('data-recipe-id');
|
||||
|
||||
Grocy.Api.Post("recipes/" + objectId.toString() + "/copy", {},
|
||||
function(result)
|
||||
{
|
||||
window.location.href = U('/recipes?recipe=' + result.created_object_id.toString());
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on('click', '.recipe-shopping-list', function(e)
|
||||
{
|
||||
var objectName = $(e.currentTarget).attr('data-recipe-name');
|
||||
@@ -346,3 +365,5 @@ if (window.location.hash === "#fullscreen")
|
||||
{
|
||||
$("#selectedRecipeToggleFullscreenButton").click();
|
||||
}
|
||||
|
||||
LoadImagesLazy();
|
||||
|
@@ -1,6 +1,5 @@
|
||||
var shoppingListTable = $('#shoppinglist-table').DataTable({
|
||||
'order': [[1, 'asc']],
|
||||
"orderFixed": [[3, 'asc']],
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 },
|
||||
|
@@ -125,7 +125,7 @@ $(document).on("click", ".stock-name-cell", function(e)
|
||||
$("#stockentry-productcard-modal").modal("show");
|
||||
});
|
||||
|
||||
$(document).on('click', '.stockentry-grocycode-stockentry-label-print', function(e)
|
||||
$(document).on('click', '.stockentry-grocycode-label-print', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
document.activeElement.blur();
|
||||
|
@@ -1,5 +1,4 @@
|
||||
var stockJournalTable = $('#stock-journal-table').DataTable({
|
||||
'paginate': true,
|
||||
'order': [[3, 'desc']],
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
@@ -12,15 +11,16 @@ stockJournalTable.columns.adjust().draw();
|
||||
$("#product-filter").on("change", function()
|
||||
{
|
||||
var value = $(this).val();
|
||||
var text = $("#product-filter option:selected").text();
|
||||
if (value === "all")
|
||||
{
|
||||
stockJournalTable.column(1).search("").draw();
|
||||
RemoveUriParam("product");
|
||||
}
|
||||
else
|
||||
{
|
||||
stockJournalTable.column(1).search(">" + text + "<").draw();
|
||||
UpdateUriParam("product", value);
|
||||
}
|
||||
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
$("#transaction-type-filter").on("change", function()
|
||||
@@ -59,6 +59,12 @@ $("#user-filter").on("change", function()
|
||||
stockJournalTable.column(6).search(text).draw();
|
||||
});
|
||||
|
||||
$("#daterange-filter").on("change", function()
|
||||
{
|
||||
UpdateUriParam("months", $(this).val());
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
$("#search").on("keyup", Delay(function()
|
||||
{
|
||||
var value = $(this).val();
|
||||
@@ -77,17 +83,21 @@ $("#clear-filter-button").on("click", function()
|
||||
$("#location-filter").val("all");
|
||||
$("#user-filter").val("all");
|
||||
$("#product-filter").val("all");
|
||||
stockJournalTable.column(1).search("").draw();
|
||||
stockJournalTable.column(4).search("").draw();
|
||||
stockJournalTable.column(5).search("").draw();
|
||||
stockJournalTable.column(6).search("").draw();
|
||||
stockJournalTable.search("").draw();
|
||||
$("#daterange-filter").val("6");
|
||||
|
||||
RemoveUriParam("months");
|
||||
RemoveUriParam("product");
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
if (typeof GetUriParam("product") !== "undefined")
|
||||
{
|
||||
$("#product-filter").val(GetUriParam("product"));
|
||||
$("#product-filter").trigger("change");
|
||||
}
|
||||
|
||||
if (typeof GetUriParam("months") !== "undefined")
|
||||
{
|
||||
$("#daterange-filter").val(GetUriParam("months"));
|
||||
}
|
||||
|
||||
$(document).on('click', '.undo-stock-booking-button', function(e)
|
||||
|
@@ -1,5 +1,4 @@
|
||||
var journalSummaryTable = $('#stock-journal-summary-table').DataTable({
|
||||
'paginate': true,
|
||||
'order': [[1, 'asc']],
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
|
@@ -17,6 +17,7 @@
|
||||
{ 'visible': false, 'targets': 14 },
|
||||
{ 'visible': false, 'targets': 15 },
|
||||
{ 'visible': false, 'targets': 16 },
|
||||
{ 'visible': false, 'targets': 17 },
|
||||
{ "type": "num", "targets": 3 },
|
||||
{ "type": "html-num-fmt", "targets": 9 },
|
||||
{ "type": "html-num-fmt", "targets": 10 },
|
||||
@@ -29,6 +30,7 @@
|
||||
|
||||
$('#stock-overview-table tbody').removeClass("d-none");
|
||||
stockOverviewTable.columns.adjust().draw();
|
||||
LoadImagesLazy();
|
||||
|
||||
$("#location-filter").on("change", function()
|
||||
{
|
||||
@@ -104,7 +106,7 @@ $("#search").on("keyup", Delay(function()
|
||||
stockOverviewTable.search(value).draw();
|
||||
}, 200));
|
||||
|
||||
$(document).on('click', '.stockentry-grocycode-product-label-print', function(e)
|
||||
$(document).on('click', '.product-grocycode-label-print', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
document.activeElement.blur();
|
||||
|
@@ -27,6 +27,11 @@ if (BoolVal(Grocy.UserSettings.stock_default_consume_amount_use_quick_consume_am
|
||||
$("#stock_default_consume_amount").attr("disabled", "");
|
||||
}
|
||||
|
||||
if (BoolVal(Grocy.UserSettings.stock_auto_decimal_separator_prices))
|
||||
{
|
||||
$("#stock_auto_decimal_separator_prices").prop("checked", true);
|
||||
}
|
||||
|
||||
RefreshLocaleNumberInput();
|
||||
|
||||
$("#stock_default_consume_amount_use_quick_consume_amount").on("click", function()
|
||||
|
Reference in New Issue
Block a user