Added code to autocomplete with ux transactions

This commit is contained in:
Arturo Gonzalez 2017-04-21 14:32:31 +02:00
parent f6faa4861b
commit a2cff4195f
1 changed files with 40 additions and 12 deletions

View File

@ -1638,20 +1638,12 @@ function ui_pagination ($count, $url = false, $offset = 0,
}
$number_of_pages = ceil($count / $pagination);
//~ html_debug_print('number_of_pages');
//~ html_debug_print($number_of_pages);
$actual_page = floor($offset / $pagination);
//~ html_debug_print('actual_page');
//~ html_debug_print($actual_page);
$ini_page = floor($actual_page / $block_limit) * $block_limit;
//~ html_debug_print('ini_page');
//~ html_debug_print($ini_page);
$end_page = $ini_page + $block_limit - 1;
if ($end_page > $number_of_pages) {
$end_page = $number_of_pages - 1;
}
//~ html_debug_print('end_page');
//~ html_debug_print($end_page);
$output = "<div class='pagination $other_class'>";
@ -2907,6 +2899,11 @@ function ui_print_agent_autocomplete_input($parameters) {
if (isset($parameters['input_id_server_value'])) {
$input_id_server_value = $parameters['input_id_server_value'];
}
$from_ux_transaction = ''; //Default value
if (isset($parameters['from_ux'])) {
$from_ux_transaction = $parameters['from_ux'];
}
$metaconsole_enabled = false; //Default value
@ -2994,10 +2991,39 @@ function ui_print_agent_autocomplete_input($parameters) {
if (isset($parameters['javascript_name_function_select'])) {
$javascript_name_function_select = $parameters['javascript_name_function_select'];
}
$javascript_code_function_select = '
if ($from_ux_transaction != "") {
$javascript_code_function_select = '
function function_select_' . $input_name . '(agent_name) {
console.log(agent_name);
$("#' . $selectbox_id . '").empty();
var inputs = [];
inputs.push ("id_agent=" + $("#' . $hidden_input_idagent_id . '").val());
inputs.push ("get_agent_transactions=1");
inputs.push ("page=enterprise/include/ajax/ux_transaction.ajax");
jQuery.ajax ({
data: inputs.join ("&"),
type: "POST",
url: action="' . $javascript_ajax_page . '",
dataType: "json",
success: function (data) {
if (data) {
$("#' . $selectbox_id . '").append ($("<option value=0>None</option>"));
jQuery.each (data, function (id, value) {
$("#' . $selectbox_id . '").append ($("<option value=" + id + ">" + value + "</option>"));
});
}
}
});
return false;
}
';
}
else {
$javascript_code_function_select = '
function function_select_' . $input_name . '(agent_name) {
$("#' . $selectbox_id . '").empty ();
@ -3058,6 +3084,8 @@ function ui_print_agent_autocomplete_input($parameters) {
return false;
}
';
}
if (isset($parameters['javascript_code_function_select'])) {
$javascript_code_function_select = $parameters['javascript_code_function_select'];
}