Remove console, update move on open when either the default or the consume location change

This commit is contained in:
Rosemary Orchard 2022-04-18 09:11:34 +01:00
parent 3aed834269
commit 2451e7dda8

View File

@ -239,18 +239,24 @@ $('#product-form input').keyup(function(event)
$('#location_id').change(function(event)
{
Grocy.FrontendHelpers.ValidateForm('product-form');
updateMoveOnOpen();
});
$('#default_consume_location_id').change(function(event) {
updateMoveOnOpen();
});
function updateMoveOnOpen() {
var defaultLocation = $("#location_id :selected").val();
var consumeLocationLocation = document.getElementById('default_consume_location_id');
console.log('defaultLocation', defaultLocation);
console.log('consumeLocationLocation', consumeLocationLocation);
var moveOnOpen = document.getElementById('move_on_open');
if (consumeLocationLocation && defaultLocation !== consumeLocationLocation) {
moveOnOpen.removeAttribute('checked');
moveOnOpen.setAttribute('disabled', "");
} else {
moveOnOpen.removeAttribute('disabled');
}
}
});
$('#product-form input').keydown(function(event)