Datatables & styles fix

This commit is contained in:
Pablo Aragon 2023-03-30 16:50:30 +02:00
parent a8333801bb
commit 3a2cbb7a62
6 changed files with 328 additions and 285 deletions

View File

@ -764,10 +764,9 @@ html_print_table($userManagementTable);
$vcard_data = []; $vcard_data = [];
$vcard_data['version'] = '3.0'; $vcard_data['version'] = '3.0';
$vcard_data['firstName'] = $user_info['firstname']; $vcard_data['firstName'] = $user_info['fullname'];
$vcard_data['lastName'] = $user_info['lastname']; $vcard_data['lastName'] = '';
$vcard_data['middleName'] = ($user_info['middlename'] === '1') ? '' : $user_info['middlename']; $vcard_data['middleName'] = '';
$vcard_data['nickname'] = $user_info['fullname'];
$vcard_data['workPhone'] = $user_info['phone']; $vcard_data['workPhone'] = $user_info['phone'];
$vcard_data['email'] = $user_info['email']; $vcard_data['email'] = $user_info['email'];
$vcard_data['organization'] = io_safe_output(get_product_name()); $vcard_data['organization'] = io_safe_output(get_product_name());

View File

@ -160,7 +160,7 @@ if ($load_filter_modal) {
true, true,
'', '',
false, false,
'margin-left:5px; width:'.$filter_id_width.';' 'width:'.$filter_id_width.';'
); );
$table->rowclass[] = 'display-grid'; $table->rowclass[] = 'display-grid';
@ -169,8 +169,9 @@ if ($load_filter_modal) {
'load_filter', 'load_filter',
false, false,
[ [
'class' => 'mini w25p', 'class' => 'mini w30p',
'style' => 'margin-left: 73%', 'icon' => 'load',
'style' => 'margin-left: 208px; width: 130px;',
'onclick' => 'load_filter_values();', 'onclick' => 'load_filter_values();',
], ],
true true
@ -189,7 +190,7 @@ function show_filter() {
draggable: true, draggable: true,
modal: false, modal: false,
closeOnEscape: true, closeOnEscape: true,
width: 500 width: 380
}); });
} }
@ -293,8 +294,9 @@ if ($save_filter_modal) {
'save_filter', 'save_filter',
false, false,
[ [
'class' => 'mini w25p', 'class' => 'mini ',
'style' => 'margin-left: 56%', 'icon' => 'save',
'style' => 'margin-left: 175px; width: 125px;',
'onclick' => 'save_new_filter();', 'onclick' => 'save_new_filter();',
], ],
true true
@ -330,8 +332,9 @@ if ($save_filter_modal) {
'update_filter', 'update_filter',
false, false,
[ [
'class' => 'mini w25p', 'class' => 'mini ',
'style' => 'margin-left: 56%', 'icon' => 'save',
'style' => 'margin-left: 155px; width: 145px;',
'onclick' => 'save_update_filter();', 'onclick' => 'save_update_filter();',
], ],
true true

View File

@ -3628,6 +3628,11 @@ function ui_print_datatable(array $parameters)
$parameters['csv'] = 1; $parameters['csv'] = 1;
} }
$dom_elements = '"plfrtiB"';
if (isset($parameters['dom_elements'])) {
$dom_elements = '"'.$parameters['dom_elements'].'"';
}
$filter = ''; $filter = '';
// Datatable filter. // Datatable filter.
if (isset($parameters['form']) && is_array($parameters['form'])) { if (isset($parameters['form']) && is_array($parameters['form'])) {
@ -3790,6 +3795,34 @@ function ui_print_datatable(array $parameters)
} }
$table .= '</tr></thead>'; $table .= '</tr></thead>';
if (isset($parameters['data_element']) === true) {
$table .= '<tbody>';
foreach ($parameters['data_element'] as $row) {
$table .= '<tr>';
foreach ($row as $td_data) {
$table .= '<td>'.$td_data.'</td>';
}
$table .= '</tr>';
}
$table .= '</tbody>';
$js = '<script>
$.fn.dataTable.ext.classes.sPageButton = "pandora_pagination mini-pandora-pagination"
var table = $("#'.$table_id.'").DataTable({
"dom": "'.$parameters['dom_elements'].'"
});
$("div.spinner-fixed").hide();
$("table#'.$table_id.'").removeClass("invisible");
$("#'.$table_id.'_filter > label > input").addClass("mini-search-input");
if (table.page.info().pages == 1) {
$("#'.$table_id.'_paginate").hide();
}
</script>';
}
$table .= '</table>'; $table .= '</table>';
$pagination_class = 'pandora_pagination'; $pagination_class = 'pandora_pagination';
@ -3813,6 +3846,7 @@ function ui_print_datatable(array $parameters)
$export_columns = ',columns: \'th:not(:last-child)\''; $export_columns = ',columns: \'th:not(:last-child)\'';
} }
if (isset($parameters['data_element']) === false) {
if (isset($parameters['ajax_url'])) { if (isset($parameters['ajax_url'])) {
$type_data = 'ajax: { $type_data = 'ajax: {
url: "'.ui_get_full_url('ajax.php', false, false, false).'", url: "'.ui_get_full_url('ajax.php', false, false, false).'",
@ -3957,11 +3991,6 @@ function ui_print_datatable(array $parameters)
$js .= $parameters['drawCallback']; $js .= $parameters['drawCallback'];
} }
$dom_elements = '"plfrtiB"';
if (isset($parameters['dom_elements'])) {
$dom_elements = '"'.$parameters['dom_elements'].'"';
}
$searching = 'false'; $searching = 'false';
if (isset($parameters['searching']) && $parameters['searching'] === true) { if (isset($parameters['searching']) && $parameters['searching'] === true) {
$searching = 'true'; $searching = 'true';
@ -4085,6 +4114,7 @@ function ui_print_datatable(array $parameters)
'; ';
$js .= '</script>'; $js .= '</script>';
}
// Order. // Order.
$info_msg_arr = []; $info_msg_arr = [];

View File

@ -453,6 +453,7 @@ class ModulesByStatus extends Widget
1000, 1000,
], ],
], ],
'dom_elements' => 'frtilp',
] ]
); );
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -816,10 +816,6 @@ div[id^="auto-os-"] > img {
height: 20px; height: 20px;
} }
.dataTables_paginate {
margin-right: 10px;
}
.w22px { .w22px {
width: 22px; width: 22px;
} }
@ -838,3 +834,13 @@ td.FF-thresholds-pdd {
padding: 0px !important; padding: 0px !important;
padding-left: 13px !important; padding-left: 13px !important;
} }
div.grid-stack-item-content a.pandora_pagination,
a.mini-pandora-pagination {
padding: 7px;
font-size: 9pt;
}
input.mini-search-input {
height: 30px;
}

View File

@ -434,6 +434,7 @@ if ($agent_view_page === true) {
); );
} }
if (is_metaconsole() === false) {
if (((bool) check_acl($config['id_user'], $id_group, 'AW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true)) { if (((bool) check_acl($config['id_user'], $id_group, 'AW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true)) {
if ($agent_view_page === true) { if ($agent_view_page === true) {
html_print_div( html_print_div(
@ -464,6 +465,9 @@ if (((bool) check_acl($config['id_user'], $id_group, 'AW') === true || (bool) ch
); );
} }
} }
} else {
html_print_action_buttons('');
}
$html_content = ob_get_clean(); $html_content = ob_get_clean();