mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
UI strings/tooltips/basic handling review/optimizations
This commit is contained in:
@@ -764,6 +764,8 @@ $(window).on("message", function(e)
|
||||
|
||||
$(".change-table-columns-visibility-button").on("click", function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
var dataTableSelector = $(e.currentTarget).attr("data-table-selector");
|
||||
var dataTable = $(dataTableSelector).DataTable();
|
||||
|
||||
|
@@ -122,12 +122,12 @@ $('.input-group-chore-period-type').on('change', function(e)
|
||||
|
||||
$(".period-type-input").addClass("d-none");
|
||||
$(".period-type-" + periodType).removeClass("d-none");
|
||||
$('#chore-period-type-info').attr("title", "");
|
||||
$('#chore-period-type-info').attr("data-original-title", "");
|
||||
$("#period_config").val("");
|
||||
|
||||
if (periodType === 'manually')
|
||||
{
|
||||
$('#chore-period-type-info').attr("title", __t('This means the next execution of this chore is not scheduled'));
|
||||
$('#chore-period-type-info').attr("data-original-title", __t('This means the next execution of this chore is not scheduled'));
|
||||
}
|
||||
else if (periodType === 'dynamic-regular')
|
||||
{
|
||||
@@ -135,32 +135,32 @@ $('.input-group-chore-period-type').on('change', function(e)
|
||||
$("#period_days").attr("min", "0");
|
||||
$("#period_days").attr("max", "9999");
|
||||
$("#period_days").parent().find(".invalid-feedback").text(__t('This cannot be negative'));
|
||||
$('#chore-period-type-info').attr("title", __t('This means the next execution of this chore is scheduled %s days after the last execution', periodDays.toString()));
|
||||
$('#chore-period-type-info').attr("data-original-title", __t('This means the next execution of this chore is scheduled %s days after the last execution', periodDays.toString()));
|
||||
}
|
||||
else if (periodType === 'daily')
|
||||
{
|
||||
$('#chore-period-type-info').attr("title", __t('This means the next execution of this chore is scheduled 1 day after the last execution'));
|
||||
$('#chore-period-interval-info').attr("title", __t('This means the next execution of this chore should only be scheduled every %s days', periodInterval.toString()));
|
||||
$('#chore-period-type-info').attr("data-original-title", __t('This means the next execution of this chore is scheduled 1 day after the last execution'));
|
||||
$('#chore-period-interval-info').attr("data-original-title", __t('This means the next execution of this chore should only be scheduled every %s days', periodInterval.toString()));
|
||||
}
|
||||
else if (periodType === 'weekly')
|
||||
{
|
||||
$('#chore-period-type-info').attr("title", __t('This means the next execution of this chore is scheduled 1 day after the last execution, but only for the weekdays selected below'));
|
||||
$('#chore-period-type-info').attr("data-original-title", __t('This means the next execution of this chore is scheduled 1 day after the last execution, but only for the weekdays selected below'));
|
||||
$("#period_config").val($(".period-type-weekly input:checkbox:checked").map(function() { return this.value; }).get().join(","));
|
||||
$('#chore-period-interval-info').attr("title", __t('This means the next execution of this chore should only be scheduled every %s weeks', periodInterval.toString()));
|
||||
$('#chore-period-interval-info').attr("data-original-title", __t('This means the next execution of this chore should only be scheduled every %s weeks', periodInterval.toString()));
|
||||
}
|
||||
else if (periodType === 'monthly')
|
||||
{
|
||||
$('#chore-period-type-info').attr("title", __t('This means the next execution of this chore is scheduled on the below selected day of each month'));
|
||||
$('#chore-period-type-info').attr("data-original-title", __t('This means the next execution of this chore is scheduled on the below selected day of each month'));
|
||||
$("label[for='period_days']").text(__t("Day of month"));
|
||||
$("#period_days").attr("min", "1");
|
||||
$("#period_days").attr("max", "31");
|
||||
$("#period_days").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", "31"));
|
||||
$('#chore-period-interval-info').attr("title", __t('This means the next execution of this chore should only be scheduled every %s months', periodInterval.toString()));
|
||||
$('#chore-period-interval-info').attr("data-original-title", __t('This means the next execution of this chore should only be scheduled every %s months', periodInterval.toString()));
|
||||
}
|
||||
else if (periodType === 'yearly')
|
||||
{
|
||||
$('#chore-period-type-info').attr("title", __t('This means the next execution of this chore is scheduled 1 year after the last execution'));
|
||||
$('#chore-period-interval-info').attr("title", __t('This means the next execution of this chore should only be scheduled every %s years', periodInterval.toString()));
|
||||
$('#chore-period-type-info').attr("data-original-title", __t('This means the next execution of this chore is scheduled 1 year after the last execution'));
|
||||
$('#chore-period-interval-info').attr("data-original-title", __t('This means the next execution of this chore should only be scheduled every %s years', periodInterval.toString()));
|
||||
}
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm('chore-form');
|
||||
@@ -176,23 +176,23 @@ $('.input-group-chore-assignment-type').on('change', function(e)
|
||||
|
||||
if (assignmentType === 'no-assignment')
|
||||
{
|
||||
$('#chore-assignment-type-info').attr("title", __t('This means the next execution of this chore will not be assigned to anyone'));
|
||||
$('#chore-assignment-type-info').attr("data-original-title", __t('This means the next execution of this chore will not be assigned to anyone'));
|
||||
}
|
||||
else if (assignmentType === 'who-least-did-first')
|
||||
{
|
||||
$('#chore-assignment-type-info').attr("title", __t('This means the next execution of this chore will be assigned to the one who executed it least'));
|
||||
$('#chore-assignment-type-info').attr("data-original-title", __t('This means the next execution of this chore will be assigned to the one who executed it least'));
|
||||
$("#assignment_config").attr("required", "");
|
||||
$("#assignment_config").removeAttr("disabled");
|
||||
}
|
||||
else if (assignmentType === 'random')
|
||||
{
|
||||
$('#chore-assignment-type-info').attr("title", __t('This means the next execution of this chore will be assigned randomly'));
|
||||
$('#chore-assignment-type-info').attr("data-original-title", __t('This means the next execution of this chore will be assigned randomly'));
|
||||
$("#assignment_config").attr("required", "");
|
||||
$("#assignment_config").removeAttr("disabled");
|
||||
}
|
||||
else if (assignmentType === 'in-alphabetical-order')
|
||||
{
|
||||
$('#chore-assignment-type-info').attr("title", __t('This means the next execution of this chore will be assigned to the next one in alphabetical order'));
|
||||
$('#chore-assignment-type-info').attr("data-original-title", __t('This means the next execution of this chore will be assigned to the next one in alphabetical order'));
|
||||
$("#assignment_config").attr("required", "");
|
||||
$("#assignment_config").removeAttr("disabled");
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ $(".numberpicker-up-button").unbind('click').on("click", function()
|
||||
|
||||
$(".numberpicker").on("keyup", function()
|
||||
{
|
||||
if ($(this).data("not-equal") && !$(this).data("not-equal").toString().isEmpty() && $(this).data("not-equal") == $(this).val())
|
||||
if ($(this).attr("data-not-equal") && !$(this).attr("data-not-equal").toString().isEmpty() && $(this).attr("data-not-equal") == $(this).val())
|
||||
{
|
||||
$(this)[0].setCustomValidity("error");
|
||||
}
|
||||
|
@@ -94,7 +94,7 @@ $(".input-group-productamountpicker").on("change", function()
|
||||
var destinationAmount = amount / quFactor;
|
||||
var destinationQuName = __n(destinationAmount, $("#qu_id").attr("data-destination-qu-name"), $("#qu_id").attr("data-destination-qu-name-plural"))
|
||||
|
||||
if (destinationQuName == selectedQuName || Grocy.Components.ProductAmountPicker.AllowAnyQuEnabled || amount.toString().isEmpty() || selectedQuName.toString().isEmpty())
|
||||
if ($("#qu_id").attr("data-destination-qu-name") == selectedQuName || Grocy.Components.ProductAmountPicker.AllowAnyQuEnabled || amount.toString().isEmpty() || selectedQuName.toString().isEmpty())
|
||||
{
|
||||
$("#qu-conversion-info").addClass("d-none");
|
||||
}
|
||||
|
@@ -134,7 +134,8 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_stock.id);
|
||||
|
||||
$('#display_amount').attr('data-not-equal', productDetails.stock_amount);
|
||||
$('#display_amount').attr("data-stock-amount", productDetails.stock_amount)
|
||||
$('#display_amount').attr('data-not-equal', productDetails.stock_amount * $("#qu_id option:selected").attr("data-qu-factor"));
|
||||
|
||||
if (productDetails.product.allow_partial_units_in_stock == 1)
|
||||
{
|
||||
@@ -228,9 +229,12 @@ $('#inventory-form input').keydown(function(event)
|
||||
}
|
||||
});
|
||||
|
||||
$('#display_amount').on('keypress', function(e)
|
||||
|
||||
$('#qu_id').on('change', function(e)
|
||||
{
|
||||
$('#display_amount').trigger('change');
|
||||
$('#display_amount').attr('data-not-equal', parseFloat($('#display_amount').attr('data-stock-amount')) * parseFloat($("#qu_id option:selected").attr("data-qu-factor")));
|
||||
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %1$s or equal %2$s', "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1", parseFloat($('#display_amount').attr('data-not-equal')).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts })));
|
||||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||
});
|
||||
|
||||
Grocy.Components.DateTimePicker.GetInputElement().on('change', function(e)
|
||||
@@ -246,7 +250,7 @@ Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
|
||||
$('#display_amount').on('keyup', function(e)
|
||||
{
|
||||
var productId = Grocy.Components.ProductPicker.GetValue();
|
||||
var newAmount = parseInt($('#display_amount').val());
|
||||
var newAmount = parseInt($('#amount').val());
|
||||
|
||||
if (productId)
|
||||
{
|
||||
|
@@ -133,8 +133,8 @@ var calendar = $("#calendar").fullCalendar({
|
||||
<h5 class="small timeago-contextual text-truncate">' + fulfillmentIconHtml + " " + fulfillmentInfoHtml + '</h5> \
|
||||
' + costsAndCaloriesPerServing + ' \
|
||||
<h5> \
|
||||
<a class="ml-1 btn btn-outline-danger btn-xs remove-recipe-button" href="#"><i class="fas fa-trash"></i></a> \
|
||||
<a class="ml-1 btn btn-outline-info btn-xs edit-meal-plan-entry-button" href="#"><i class="fas fa-edit"></i></a> \
|
||||
<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="ml-1 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="ml-1 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="' + recipe.id.toString() + '" data-mealplan-servings="' + mealPlanEntry.recipe_servings + '" 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> \
|
||||
|
@@ -165,6 +165,11 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_purchase.id);
|
||||
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_purchase_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
||||
|
||||
if (GetUriParam("flow") === "shoppinglistitemtostock")
|
||||
{
|
||||
$('#display_amount').val(parseFloat(GetUriParam("amount")).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
||||
}
|
||||
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
if (productDetails.last_shopping_location_id != null)
|
||||
@@ -266,23 +271,26 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||
{
|
||||
var barcode = barcodeResult[0];
|
||||
|
||||
if (barcode.amount != null)
|
||||
if (barcode != null)
|
||||
{
|
||||
$("#display_amount").val(barcode.amount);
|
||||
$("#display_amount").select();
|
||||
}
|
||||
if (barcode.amount != null)
|
||||
{
|
||||
$("#display_amount").val(barcode.amount);
|
||||
$("#display_amount").select();
|
||||
}
|
||||
|
||||
if (barcode.qu_id != null)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||
}
|
||||
if (barcode.qu_id != null)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||
}
|
||||
|
||||
if (barcode.shopping_location_id != null)
|
||||
{
|
||||
Grocy.Components.ShoppingLocationPicker.SetId(barcode.shopping_location_id);
|
||||
}
|
||||
if (barcode.shopping_location_id != null)
|
||||
{
|
||||
Grocy.Components.ShoppingLocationPicker.SetId(barcode.shopping_location_id);
|
||||
}
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||
}
|
||||
}
|
||||
},
|
||||
function(xhr)
|
||||
@@ -406,11 +414,6 @@ $('#display_amount').on('change', function(e)
|
||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||
});
|
||||
|
||||
if (GetUriParam("flow") === "shoppinglistitemtostock")
|
||||
{
|
||||
$('#display_amount').val(parseFloat(GetUriParam("amount")).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
||||
}
|
||||
|
||||
function refreshPriceHint()
|
||||
{
|
||||
if ($('#amount').val() == 0 || $('#price').val() == 0)
|
||||
|
Reference in New Issue
Block a user