#11653 Fixed operation for Agent parent field

This commit is contained in:
Jorge Rincon 2023-07-19 15:48:33 +02:00
parent e645f65e8e
commit ac23a4c375
1 changed files with 21 additions and 6 deletions

View File

@ -300,7 +300,7 @@ if (enterprise_installed() === true) {
// Parent agents.
$paramsParentAgent = [];
$paramsParentAgent['return'] = true;
$paramsParentAgent['show_helptip'] = false;
$paramsParentAgent['show_helptip'] = true;
$paramsParentAgent['input_name'] = 'id_parent';
$paramsParentAgent['print_hidden_input_idagent'] = true;
$paramsParentAgent['hidden_input_idagent_name'] = 'id_agent_parent';
@ -646,7 +646,7 @@ if (enterprise_installed() === true) {
// Parent agent.
$tableAdvancedAgent->data['parent_agent'][] = html_print_label_input_block(
__('Parent'),
__('Agent parent'),
ui_print_agent_autocomplete_input($paramsParentAgent)
);
@ -1205,15 +1205,30 @@ ui_require_jquery_file('bgiframe');
$("#cascade_protection_module").attr("disabled", 'disabled');
}
$("#checkbox-cascade_protection").change(function () {
var checked = $("#checkbox-cascade_protection").is(":checked");
if (checked) {
$("#text-id_parent").change(function(){
const parent = $("#text-id_parent").val();
if (parent != '') {
$("#checkbox-cascade_protection").prop('checked', true);
$("#cascade_protection_module").removeAttr("disabled");
}
else {
$("#cascade_protection_module").val(0);
$("#cascade_protection_module").attr("disabled", 'disabled');
$("#text-id_parent").removeAttr("required");
$("#cascade_protection_module").empty();
$("#checkbox-cascade_protection").prop('checked', false);
}
});
$("#checkbox-cascade_protection").change(function () {
var checked = $("#checkbox-cascade_protection").is(":checked"); if (checked) {
$("#cascade_protection_module").removeAttr("disabled");
$("#text-id_parent").attr("required", "required");
}
else {
$("#cascade_protection_module").val(0);
$("#cascade_protection_module").attr("disabled", 'disabled');
$("#text-id_parent").removeAttr("required");
}
});