Merge branch 'ent-10097-14749-anadir-filtro-de-busqueda-en-vista-de-dashboards' into 'develop'

Ent 10097 14749 anadir filtro de busqueda en vista de dashboards

See merge request artica/pandorafms!6455
This commit is contained in:
Gorka Sanchez 2023-11-20 15:30:42 +00:00
commit 23552eb164
2 changed files with 86 additions and 2 deletions

View File

@ -731,7 +731,8 @@ class Manager implements PublicLogin
int $limit=-1,
bool $favourite=false,
bool $slideshow=false,
string $id_user=''
string $id_user='',
array $rowFilter=[]
):array {
global $config;
@ -749,6 +750,14 @@ class Manager implements PublicLogin
$sql_where .= 'AND td.cells_slideshow = 1';
}
if (empty((int) $rowFilter['id_group']) === false) {
$sql_where .= ' AND td.id_group = '.$rowFilter['id_group'];
}
if (empty($rowFilter['name_filter']) === false) {
$sql_where .= ' AND td.name like "%'.$rowFilter['name_filter'].'%"';
}
if (empty($id_user) === true) {
$id_user = $config['id_user'];
}
@ -944,6 +953,13 @@ class Manager implements PublicLogin
private function showList()
{
global $config;
$id_group_filter = \get_parameter_post('id_group', '');
$name_filter = \get_parameter_post('name', '');
$rowFilter = [
'id_group' => $id_group_filter,
'name_filter' => $name_filter,
];
$limit_sql = $config['block_size'];
@ -957,7 +973,7 @@ class Manager implements PublicLogin
$resultCopy = $this->copy();
}
$dashboards = $this->getDashboards($this->offset, $limit_sql);
$dashboards = $this->getDashboards($this->offset, $limit_sql, false, false, '', $rowFilter);
$count = $this->getDashboardsCount();
View::render(

View File

@ -67,6 +67,74 @@ if (isset($resultCopy) === true) {
);
}
// Filter table.
$filter_id_group = \get_parameter_post('id_group', '');
$filter_name = \get_parameter_post('name', '');
$filterTable = new stdClass();
$filterTable->class = 'filter-table-adv w100p';
$filterTable->size[0] = '20%';
$filterTable->size[1] = '20%';
$filterTable->data = [];
$filterTable->data[0][0] = html_print_label_input_block(
__('Group'),
html_print_select_groups(
false,
'AR',
true,
'id_group',
$filter_id_group,
'',
'',
'',
true,
false,
true,
'w100p',
false,
''
)
);
$filterTable->data[0][1] = html_print_label_input_block(
__('Name'),
html_print_input_text('name', $filter_name, '', 25, 80, true)
);
$form_html = '<form id="form_dashboard_search" method="post" action="'.$urlDashboard.'">';
$form_html .= html_print_table($filterTable, true);
$form_html .= html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Filter'),
'uptbutton',
false,
[
'icon' => 'search',
'mode' => 'mini',
],
true
),
],
true
);
$form_html .= '</form>';
ui_toggle(
$form_html,
'<span class="subsection_header_title">'.__('Filter').'</span>',
'dashboard_search',
false,
true,
false,
'',
'white-box-content',
'box-flat white_table_graph fixed_filter_bar'
);
if (empty($dashboards) === true) {
ui_print_info_message(
[