Avoid double validation, avoid redraw
This commit is contained in:
parent
ecc2fef8f6
commit
d12773cfd0
|
@ -669,7 +669,7 @@ function show_event_response_command_dialog(id, response, total_checked) {
|
|||
});
|
||||
}
|
||||
|
||||
function update_event(table, id_evento, type) {
|
||||
function update_event(table, id_evento, type, redraw) {
|
||||
var inputs = $("#events_form :input");
|
||||
var values = {};
|
||||
inputs.each(function() {
|
||||
|
@ -688,20 +688,22 @@ function update_event(table, id_evento, type) {
|
|||
filter: values
|
||||
},
|
||||
success: function() {
|
||||
if (redraw) {
|
||||
table.draw().page(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function validate_event(table, id_evento) {
|
||||
return update_event(table, id_evento, { validate_event: 1 });
|
||||
return update_event(table, id_evento, { validate_event: 1 }, false);
|
||||
}
|
||||
|
||||
function in_process_event(table, id_evento) {
|
||||
return update_event(table, id_evento, { in_process_event: 1 });
|
||||
return update_event(table, id_evento, { in_process_event: 1 }, false);
|
||||
}
|
||||
|
||||
function delete_event(table, id_evento, row) {
|
||||
function delete_event(table, id_evento) {
|
||||
$(row)
|
||||
.closest("tr")
|
||||
.remove();
|
||||
|
|
|
@ -1428,7 +1428,7 @@ function process_datatables_item(item) {
|
|||
item.options += ')" ><?php echo html_print_image('images/eye.png', true, ['title' => __('Show more')]); ?></a>';
|
||||
|
||||
// Validate.
|
||||
item.options += '<a href="javascript:" onclick="validate_event(dt_<?php echo $table_id; ?>,';
|
||||
item.options += '<a href="javascript:" onclick="$(this).hide(); validate_event(dt_<?php echo $table_id; ?>,';
|
||||
if (item.max_id_evento) {
|
||||
item.options += item.max_id_evento+')" >';
|
||||
item.options += '<?php echo html_print_image('images/tick.png', true, ['title' => __('Validate events')]); ?></a>';
|
||||
|
@ -1438,7 +1438,7 @@ function process_datatables_item(item) {
|
|||
}
|
||||
|
||||
// In process.
|
||||
item.options += '<a href="javascript:" onclick="in_process_event(dt_<?php echo $table_id; ?>,';
|
||||
item.options += '<a href="javascript:" onclick="$(this).hide(); in_process_event(dt_<?php echo $table_id; ?>,';
|
||||
if (item.max_id_evento) {
|
||||
item.options += item.max_id_evento+')" >';
|
||||
} else {
|
||||
|
@ -1447,7 +1447,7 @@ function process_datatables_item(item) {
|
|||
item.options += '<?php echo html_print_image('images/hourglass.png', true, ['title' => __('Change to in progress status')]); ?></a>';
|
||||
|
||||
// Delete.
|
||||
item.options += '<a href="javascript:" onclick="delete_event(dt_<?php echo $table_id; ?>,';
|
||||
item.options += '<a href="javascript:" onclick="$(this).hide(); delete_event(dt_<?php echo $table_id; ?>,';
|
||||
if (item.max_id_evento) {
|
||||
item.options += item.max_id_evento+', this)" >';
|
||||
item.options += '<?php echo html_print_image('images/cross.png', true, ['title' => __('Delete events')]); ?></a>';
|
||||
|
|
Loading…
Reference in New Issue