set first option select2 all to none if not condition is enabled

This commit is contained in:
marcos 2021-08-23 09:52:42 +02:00
parent 61409b72b4
commit 4d270a3559
3 changed files with 7 additions and 1 deletions

View File

@ -631,6 +631,7 @@ function html_print_select_groups(
inclusions: '<?php echo $json_inclusions; ?>',
step: params.page || 1,
strict: "<?php echo $strict_user; ?>",
not_condition: "<?php echo $inverse; ?>",
returnAllGroup: <?php echo (int) $returnAllGroup; ?>
}

View File

@ -386,6 +386,7 @@ class Group extends Entity
$search = get_parameter('search', '');
$step = get_parameter('step', 1);
$limit = get_parameter('limit', false);
$not_condition = get_parameter('not_condition', '');
$exclusions = get_parameter('exclusions', '[]');
$inclusions = get_parameter('inclusions', '[]');
@ -430,6 +431,11 @@ class Group extends Entity
$return = self::prepareGroups($groups);
// When not_condition is select firts option text change All to None.
if ($not_condition === 'on') {
$return[0]['text'] = 'None';
}
if (is_array($return) === false) {
return;
}

View File

@ -1954,7 +1954,6 @@ $table->data[4][0] .= __('Not condition');
<script type="text/javascript">
if(!document.getElementById('not_condition_switch').checked){
console.log("pepe");
document.getElementById("select2-ag_group-container").innerHTML = "None";
}