Reporting view new style

This commit is contained in:
Jonathan 2023-02-28 14:27:18 +01:00
parent 1d28762d22
commit 8d44bb7af1
3 changed files with 371 additions and 177 deletions

View File

@ -42,7 +42,7 @@ switch ($action) {
default:
case 'new':
$actionButtons = html_print_submit_button(
__('Save'),
__('Create'),
'add',
false,
[ 'icon' => 'next' ],
@ -66,39 +66,26 @@ switch ($action) {
$table = new stdClass();
$table->width = '100%';
$table->id = 'add_alert_table';
$table->class = 'databox filters';
$table->head = [];
$table->data = [];
$table->size = [];
if (is_metaconsole() === true) {
$table->class = 'databox filters';
$table->head[0] = __('Main data');
$table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center';
}
$table->data = [];
$table->size = [];
$table->size = [];
$table->size[0] = '15%';
$table->size[1] = '90%';
if (is_metaconsole() === false) {
$table->size[0] = '15%';
$table->size[1] = '90%';
$table->style[0] = 'font-weight: bold; vertical-align: top;';
} else {
$table->style[0] = 'font-weight: bold;';
$table->class = 'filter-table-adv databox';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->size[2] = '50%';
$table->size[3] = '50%';
}
$table->data['name'][0] = __('Name');
$table->data['name'][1] = html_print_input_text(
'name',
$reportName,
__('Name'),
80,
100,
true,
false,
true
);
$table->data['group'][0] = __('Group');
$write_groups = users_get_groups_for_select(
false,
'AR',
@ -108,6 +95,36 @@ $write_groups = users_get_groups_for_select(
'id_grupo'
);
if (is_metaconsole() === true) {
$table->data['name'][0] = __('Name');
$table->data['name'][1] = html_print_input_text(
'name',
$reportName,
__('Name'),
80,
100,
true,
false,
true
);
$table->data['group'][0] = __('Group');
} else {
$table->data[0][0] = html_print_label_input_block(
__('Name'),
html_print_input_text(
'name',
$reportName,
__('Name'),
false,
100,
true,
false,
true
)
);
}
// If the report group is not among the
// RW groups (special permission) we add it.
if (isset($write_groups[$idGroupReport]) === false && $idGroupReport) {
@ -120,8 +137,9 @@ if (users_can_manage_group_all('RW') === true) {
$return_all_group = true;
}
$table->data['group'][1] = '<div class="w290px inline">';
$table->data['group'][1] .= html_print_input(
if (is_metaconsole() === true) {
$table->data['group'][1] = '<div class="w290px inline">';
$table->data['group'][1] .= html_print_input(
[
'type' => 'select_groups',
'id_user' => $config['id_user'],
@ -135,8 +153,28 @@ $table->data['group'][1] .= html_print_input(
'return' => true,
'required' => true,
]
);
$table->data['group'][1] .= '</div>';
);
$table->data['group'][1] .= '</div>';
} else {
$table->data[0][1] = html_print_label_input_block(
__('Group'),
html_print_input(
[
'type' => 'select_groups',
'id_user' => $config['id_user'],
'privilege' => 'AR',
'returnAllGroup' => $return_all_group,
'name' => 'id_group',
'selected' => $idGroupReport,
'script' => '',
'nothing' => '',
'nothing_value' => '',
'return' => true,
'required' => true,
]
)
);
}
if ($report_id_user == $config['id_user']
|| is_user_admin($config['id_user'])
@ -147,6 +185,7 @@ if ($report_id_user == $config['id_user']
'group_edit' => __('The next group can edit the report'),
'user_edit' => __('Only the user and admin user can edit the report'),
];
if (is_metaconsole() === true) {
$table->data['access'][0] = __('Write Access');
$table->data['access'][0] .= ui_print_help_tip(
__('For example, you want a report that the people of "All" groups can see but you want to edit only for you or your group.'),
@ -162,12 +201,12 @@ if ($report_id_user == $config['id_user']
true
);
$style = 'display: none;';
$class = ' invisible_important ';
if ($type_access_selected == 'group_edit') {
$style = '';
$class = '';
}
$table->data['access'][1] .= '<span style="'.$style.'" class="access_subform" id="group_edit">';
$table->data['access'][1] .= '<span class="access_subform'.$class.'" id="group_edit">';
$table->data['access'][1] .= '<div class="w290px inline">';
$table->data['access'][1] .= html_print_select_groups(
false,
@ -182,6 +221,45 @@ if ($report_id_user == $config['id_user']
);
$table->data['access'][1] .= '</div>';
$table->data['access'][1] .= '</span>';
} else {
$table->data[1][0] = html_print_label_input_block(
__('Write Access').ui_print_help_tip(
__('For example, you want a report that the people of "All" groups can see but you want to edit only for you or your group.'),
true
),
html_print_select(
$type_access,
'type_access',
$type_access_selected,
'change_type_access(this)',
'',
0,
true
)
);
$options['div_class'] = 'invisible_important';
$options['div_id'] = 'group_edit';
if ($type_access_selected == 'group_edit') {
$options['div_class'] = '';
}
$table->data[1][1] = html_print_label_input_block(
__('Group'),
html_print_select_groups(
false,
'RW',
false,
'id_group_edit',
$id_group_edit,
false,
'',
'',
true
),
$options
);
}
}
if ($enterpriseEnable) {
@ -190,6 +268,7 @@ if ($enterpriseEnable) {
$non_interactive_check = $non_interactive;
}
if (is_metaconsole() === true) {
$table->data['interactive_report'][0] = __('Non interactive report');
$table->data['interactive_report'][1] .= html_print_checkbox_switch(
'non_interactive',
@ -197,19 +276,45 @@ if ($enterpriseEnable) {
$non_interactive_check,
true
);
} else {
$table->data[2][0] = html_print_label_input_block(
__('Non interactive report'),
html_print_checkbox_switch(
'non_interactive',
1,
$non_interactive_check,
true
)
);
}
}
$table->data['description'][0] = __('Description');
$table->data['description'][1] = html_print_textarea(
if (is_metaconsole() === true) {
$table->data['description'][0] = __('Description');
$table->data['description'][1] = html_print_textarea(
'description',
2,
80,
$description,
'',
true
);
);
} else {
$table->data[2][1] = html_print_label_input_block(
__('Description'),
html_print_textarea(
'description',
2,
1,
$description,
'',
true
)
);
}
if (enterprise_installed() === true) {
if (is_metaconsole() === true) {
$table->data['cover'][0] = __('Generate cover page in PDF render');
$table->data['cover'][1] = html_print_checkbox_switch(
'cover_page_render',
@ -225,6 +330,27 @@ if (enterprise_installed() === true) {
$index_render,
true
);
} else {
$table->data[3][0] = html_print_label_input_block(
__('Generate cover page in PDF render'),
html_print_checkbox_switch(
'cover_page_render',
1,
$cover_page_render,
true
)
);
$table->data[3][1] = html_print_label_input_block(
__('Generate index in PDF render'),
html_print_checkbox_switch(
'index_render',
1,
$index_render,
true
)
);
}
}
echo '<form class="" method="post">';
@ -238,11 +364,10 @@ echo '</div></form>';
?>
<script type="text/javascript">
function change_type_access(select_item) {
$(".access_subform").hide();
if ($(select_item).val() == "group_edit") {
$("#group_edit").show()
$("#group_edit").removeClass('invisible_important');
} else {
$("#group_edit").hide()
$("#group_edit").addClass('invisible_important');
}
}

View File

@ -46,35 +46,14 @@ function dialog_message(message_id) {
});
});
$('[id^=checkbox-massive_report_check]').change(function(){
if($(this).parent().parent().parent().hasClass('checkselected')){
$(this).parent().parent().parent().removeClass('checkselected');
}
else{
$(this).parent().parent().parent().addClass('checkselected');
}
});
$('[id^=checkbox-all_delete]').change(function(){
if ($("#checkbox-all_delete").prop("checked")) {
$('[id^=checkbox-massive_report_check]')
.parent()
.parent()
.parent()
.addClass('checkselected');
$(".check_delete").prop("checked", true);
console.log($('.check_delete'));
$('.check_delete').each(function(){
$('#hidden-id_report_'+$(this).val()).prop("disabled", false);
});
}
else{
$('[id^=checkbox-massive_report_check]')
.parent()
.parent()
.parent()
.removeClass('checkselected');
console.log($('.check_delete'));
$(".check_delete").prop("checked", false);
}
});
@ -752,9 +731,8 @@ switch ($action) {
$table_aux = new stdClass();
$table_aux->width = '100%';
if (is_metaconsole()) {
$table_aux->class = 'databox filters';
$table_aux->cellpadding = 0;
$table_aux->cellspacing = 0;
$table_aux->colspan[0][0] = 4;
$table_aux->data[0][0] = '<b>'.__('Group').'</b>';
@ -786,14 +764,59 @@ switch ($action) {
);
$table_aux->data[0][2] .= '</b>';
$table_aux->data[0][3] = html_print_input_text(
'search',
__('search'),
$search,
'',
30,
'',
true
);
} else {
$table_aux->class = 'filter-table-adv';
$table_aux->size[0] = '30%';
$table_aux->size[1] = '30%';
$table_aux->size[2] = '30%';
$table_aux->data[0][0] = html_print_label_input_block(
__('Group'),
html_print_select_groups(
false,
$access,
true,
'id_group',
$id_group,
'',
'',
'',
true,
false,
true,
'',
false,
'',
false,
false,
'id_grupo'
)
);
$table_aux->data[0][1] = html_print_label_input_block(
__('Free text for search: ').ui_print_help_tip(
__('Search by report name or description, list matches.'),
true
),
html_print_input_text(
__('search'),
$search,
'',
30,
'',
true
)
);
}
if (is_metaconsole()) {
$table_aux->data[0][6] = html_print_submit_button(
__('Search'),
'search_submit',
@ -801,6 +824,7 @@ switch ($action) {
'class="sub upd"',
true
);
}
$url_rb = 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder';
if (is_metaconsole()) {
@ -809,9 +833,37 @@ switch ($action) {
$filter .= '</form>';
ui_toggle($filter, __('Show Option'));
} else {
echo '<form action="'.$url_rb.'&id_group='.$id_group.'&pure='.$pure.'" method="post">';
html_print_table($table_aux);
echo '</form>';
$searchForm = '<form action="'.$url_rb.'&id_group='.$id_group.'&pure='.$pure.'" method="post">';
$searchForm .= html_print_table($table_aux, true);
$searchForm .= html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Search'),
'search_submit',
false,
[
'mode' => 'mini',
'icon' => 'search',
],
true
),
],
true
);
$searchForm .= '</form>';
ui_toggle(
$searchForm,
'<span class="subsection_header_title">'.__('Filters').'</span>',
'filter_form',
'',
false,
false,
'',
'white-box-content',
'box-flat white_table_graph fixed_filter_bar'
);
}
ui_require_jquery_file('pandora.controls');
@ -1116,7 +1168,13 @@ switch ($action) {
$data[$next] = ui_print_group_icon(
$report['id_group'],
true
true,
'',
'',
true,
false,
false,
'invert_filter'
);
$next++;
}

View File

@ -10555,7 +10555,8 @@ table#simple tr td,
table#advanced tr td,
table.principal_table tr td,
.white_table_flex > table tr td,
.table_section table tr td {
.table_section table tr td,
#agent_controls {
display: flex;
flex-direction: row;
align-items: center;
@ -11367,3 +11368,13 @@ div[role="dialog"] {
-webkit-mask: url(../../images/alert@svg.svg) no-repeat center / contain;
margin: 0 auto;
}
.flex-colum-center {
display: flex;
flex-direction: column;
align-items: center;
}
.flex-colum-center > img {
margin: 5px;
}