mirror of
https://github.com/grocy/grocy.git
synced 2026-04-05 20:36:15 +02:00
Possible fix for the chore & battery dropdown clearing issue - #1560
This commit is contained in:
parent
53e405c4f8
commit
365a8a2abc
|
|
@ -122,10 +122,8 @@ function UndoChargeCycle(chargeCycleId)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
$('#battery_id_text_input').on('blur', function(e)
|
$('#battery_id_text_input').on('blur', function(e) {
|
||||||
{
|
if ($('#battery_id').hasClass("combobox-menu-visible")) {
|
||||||
if ($('#battery_id').hasClass("combobox-menu-visible"))
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -133,26 +131,21 @@ $('#battery_id_text_input').on('blur', function(e)
|
||||||
var possibleOptionElement = [];
|
var possibleOptionElement = [];
|
||||||
|
|
||||||
// grocycode handling
|
// grocycode handling
|
||||||
if (input.startsWith("grcy"))
|
if (input.startsWith("grcy")) {
|
||||||
{
|
|
||||||
var gc = input.split(":");
|
var gc = input.split(":");
|
||||||
if (gc[1] == "b")
|
if (gc[1] == "b") {
|
||||||
{
|
|
||||||
possibleOptionElement = $("#battery_id option[value=\"" + gc[2] + "\"]").first();
|
possibleOptionElement = $("#battery_id option[value=\"" + gc[2] + "\"]").first();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (possibleOptionElement.length > 0)
|
if (possibleOptionElement.length > 0) {
|
||||||
{
|
|
||||||
$('#battery_id').val(possibleOptionElement.val());
|
$('#battery_id').val(possibleOptionElement.val());
|
||||||
$('#battery_id').data('combobox').refresh();
|
$('#battery_id').data('combobox').refresh();
|
||||||
$('#battery_id').trigger('change');
|
$('#battery_id').trigger('change');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$('#battery_id').val(null);
|
$('#battery_id').val(null);
|
||||||
$('#battery_id_text_input').val("");
|
$('#battery_id_text_input').val("");
|
||||||
$('#battery_id').data('combobox').refresh();
|
$('#battery_id').data('combobox').refresh();
|
||||||
$('#battery_id').trigger('change');
|
$('#battery_id').trigger('change');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,6 @@ $('#chore_id_text_input').on('blur', function(e)
|
||||||
{
|
{
|
||||||
possibleOptionElement = $("#chore_id option[value=\"" + gc[2] + "\"]").first();
|
possibleOptionElement = $("#chore_id option[value=\"" + gc[2] + "\"]").first();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (possibleOptionElement.length > 0)
|
if (possibleOptionElement.length > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -176,4 +175,5 @@ $('#chore_id_text_input').on('blur', function(e)
|
||||||
$('#chore_id').data('combobox').refresh();
|
$('#chore_id').data('combobox').refresh();
|
||||||
$('#chore_id').trigger('change');
|
$('#chore_id').trigger('change');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user