This commit is contained in:
marcos 2021-08-24 13:30:50 +02:00
parent 4d270a3559
commit 24a66f0173
2 changed files with 22 additions and 4 deletions

View File

@ -601,7 +601,9 @@ function html_print_select_groups(
</style>
<script type="text/javascript">
$(document).ready(function() {
$('select[name="<?php echo $name; ?>"]').each(
function() {
$(this).select2({
@ -631,7 +633,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; ?>",
not_condition: $('#not_condition_switch').prop('checked'),
returnAllGroup: <?php echo (int) $returnAllGroup; ?>
}
@ -788,7 +790,7 @@ function html_print_select(
$required = 'required';
}
$output .= '<select '.$required.' id="'.$id.'" name="'.$name.'"'.$attributes.' '.$styleText.'>';
$output .= '<select '.$required.' onclick="'.$script.'" id="'.$id.'" name="'.$name.'"'.$attributes.' '.$styleText.'>';
if ($nothing !== false) {
if ($nothing != '' || empty($fields)) {

View File

@ -147,6 +147,7 @@ $not_condition = (string) get_parameter('not_condition', '');
$is_none = 'All';
if ($not_condition !== '') {
$is_none = 'None';
$not_condition = 'NOT';
}
// If option not_condition is enabled, the conditions of the queries are reversed.
@ -370,12 +371,12 @@ if (!empty($ag_custom_fields)) {
// Filter by tag.
if ($tag_filter !== 0) {
if (is_metaconsole()) {
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo '.$not_condition.' IN (
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
SELECT ttag_module.id_agente_modulo
FROM ttag_module
WHERE ttag_module.id_tag '.$not_condition.' IN ('.$tag_filter.'))';
} else {
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo '.$not_condition.' IN (
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
SELECT ttag_module.id_agente_modulo
FROM ttag_module
WHERE ttag_module.id_tag '.$condition_query.' '.$tag_filter.')';
@ -2057,9 +2058,22 @@ function refresh_pagination_callback (module_id, id_agent, server_name,module_na
});
}
function changeNotConditionStatus() {
let chkbox =document.getElementById('not_condition_switch');
if(chkbox.checked) {
/*
$('#status').select2().on("select2:open", function(e) {
var a = $('#select2-status-results > li');
console.log($(".select2-results__option")[0].textContent);
$(".select2-results__option")[1].textContent = "None";
});*/
$('#status').select2().on("select2:open", function(e) {
console.log(e);
// $("#select2-status-results > li")[1].innerHTML = "none";
});
document.getElementById("select2-status-container").innerHTML = "None";
document.getElementById("select2-moduletype-container").innerHTML = "None";
document.getElementById("select2-ag_group-container").innerHTML = "None";
@ -2067,6 +2081,7 @@ function changeNotConditionStatus() {
document.getElementById("select2-tag_filter-container").innerHTML = "None";
$('select[name=datatypebox] > option:first-child').val('None');
$('#datatypebox option:first').text('None');
}else {
document.getElementById("select2-status-container").innerHTML = "All";
document.getElementById("select2-moduletype-container").innerHTML = "All";
@ -2080,6 +2095,7 @@ function changeNotConditionStatus() {
}
let chkbox =document.getElementById('not_condition_switch');
let value_swtich = "<?php echo $not_condition; ?>";
if( value_swtich != "") {