mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
WIP:Added searchbar to select multiple modules
This commit is contained in:
parent
96d0194009
commit
f383586dcc
@ -333,10 +333,10 @@ echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters
|
|||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td class="w50p" id="select_multiple_modules_filtered">'.html_print_input(
|
echo '<td class="w50p" id="select_multiple_modules_filtered">'.html_print_input(
|
||||||
[
|
[
|
||||||
'type' => 'select_multiple_modules_filtered',
|
'type' => 'select_multiple_modules_filtered',
|
||||||
'uniqId' => 'modules',
|
'uniqId' => 'modules',
|
||||||
'class' => 'flex flex-row',
|
'class' => 'flex flex-row',
|
||||||
|
'searchBar' => true,
|
||||||
]
|
]
|
||||||
).'</td>';
|
).'</td>';
|
||||||
echo '</tr><tr>';
|
echo '</tr><tr>';
|
||||||
|
@ -1480,11 +1480,43 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
|||||||
'return' => true,
|
'return' => true,
|
||||||
'nothing' => __('All'),
|
'nothing' => __('All'),
|
||||||
'nothing_value' => 0,
|
'nothing_value' => 0,
|
||||||
'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')',
|
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$output .= '</div>';
|
$output .= '</div>';
|
||||||
|
|
||||||
|
if (empty($data['searchBar']) === false && $data['searchBar'] === true) {
|
||||||
|
$output .= '<div>';
|
||||||
|
|
||||||
|
$output .= '<div>';
|
||||||
|
$output .= html_print_input(
|
||||||
|
[
|
||||||
|
'type' => 'text',
|
||||||
|
'name' => 'agent-searchBar-'.$uniqId,
|
||||||
|
'onKeyUp' => 'searchAgent(\''.$uniqId.'\')',
|
||||||
|
'value' => __('Type for search...'),
|
||||||
|
'return' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$output .= '</div>';
|
||||||
|
|
||||||
|
$output .= '<div>';
|
||||||
|
$output .= html_print_input(
|
||||||
|
[
|
||||||
|
'type' => 'text',
|
||||||
|
'name' => 'module-searchBar-'.$uniqId,
|
||||||
|
'onKeyUp' => 'searchModule(\''.$uniqId.'\')',
|
||||||
|
'return' => true,
|
||||||
|
'value' => 'test',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$output .= '</div>';
|
||||||
|
|
||||||
|
$output .= '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
$output .= '<div>';
|
$output .= '<div>';
|
||||||
// Agent.
|
// Agent.
|
||||||
$agents = agents_get_group_agents(
|
$agents = agents_get_group_agents(
|
||||||
@ -1533,7 +1565,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
|||||||
'return' => true,
|
'return' => true,
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'style' => 'min-width: 200px;max-width:200px;',
|
'style' => 'min-width: 200px;max-width:200px;',
|
||||||
'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')',
|
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1550,7 +1582,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
|||||||
'name' => 'filtered-module-show-common-modules-'.$uniqId,
|
'name' => 'filtered-module-show-common-modules-'.$uniqId,
|
||||||
'selected' => $data['mShowCommonModules'],
|
'selected' => $data['mShowCommonModules'],
|
||||||
'return' => true,
|
'return' => true,
|
||||||
'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')',
|
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ function fmModuleChange(uniqId, isMeta) {
|
|||||||
if (data) {
|
if (data) {
|
||||||
jQuery.each(data, function(id, value) {
|
jQuery.each(data, function(id, value) {
|
||||||
var option = $("<option></option>");
|
var option = $("<option></option>");
|
||||||
if (isMeta === true) {
|
if (isMeta === 1) {
|
||||||
option
|
option
|
||||||
.attr(
|
.attr(
|
||||||
"value",
|
"value",
|
||||||
@ -251,3 +251,50 @@ function fmModuleChange(uniqId, isMeta) {
|
|||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Function to search in agents select.
|
||||||
|
function searchAgent(uniqId) {
|
||||||
|
// Declare variables
|
||||||
|
var agents = $("#filtered-module-agents-" + uniqId + " option");
|
||||||
|
|
||||||
|
// Loop through all list items, and hide those who don't match the search query
|
||||||
|
agents.each(function() {
|
||||||
|
var filter = $("#text-agent-searchBar-modules")
|
||||||
|
.val()
|
||||||
|
.toUpperCase();
|
||||||
|
|
||||||
|
if (
|
||||||
|
$(this)
|
||||||
|
.text()
|
||||||
|
.toUpperCase()
|
||||||
|
.indexOf(filter) > -1
|
||||||
|
) {
|
||||||
|
$(this).show();
|
||||||
|
} else {
|
||||||
|
$(this).hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to search in modules select.
|
||||||
|
function searchModule(uniqId) {
|
||||||
|
// Declare variables
|
||||||
|
var modules = $("#filtered-module-modules-" + uniqId + " option");
|
||||||
|
|
||||||
|
// Loop through all list items, and hide those who don't match the search query
|
||||||
|
modules.each(function() {
|
||||||
|
var filter = $("#text-module-searchBar-modules")
|
||||||
|
.val()
|
||||||
|
.toUpperCase();
|
||||||
|
if (
|
||||||
|
$(this)
|
||||||
|
.text()
|
||||||
|
.toUpperCase()
|
||||||
|
.indexOf(filter) > -1
|
||||||
|
) {
|
||||||
|
$(this).show();
|
||||||
|
} else {
|
||||||
|
$(this).hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -8473,7 +8473,7 @@ div#err_msg_centralised {
|
|||||||
#select_multiple_modules_filtered > div {
|
#select_multiple_modules_filtered > div {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-around;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@ -8500,3 +8500,7 @@ div#err_msg_centralised {
|
|||||||
#select_multiple_modules_filtered > div > div > .select2 {
|
#select_multiple_modules_filtered > div > div > .select2 {
|
||||||
min-width: 250px !important;
|
min-width: 250px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#select_multiple_modules_filtered > div > div > select {
|
||||||
|
max-width: 250px !important;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user