Merge branch 'ent-5769-borrado-de-eventos-no-pide-confirmacion' into 'develop'
Ent 5769 borrado de eventos no pide confirmacion See merge request artica/pandorafms!3271
This commit is contained in:
commit
76828ba745
|
@ -713,7 +713,6 @@ function update_event(table, id_evento, type, event_rep, row) {
|
||||||
});
|
});
|
||||||
var t1 = new Date();
|
var t1 = new Date();
|
||||||
|
|
||||||
// Update events matching current filters and id_evento selected.
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
async: true,
|
async: true,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
@ -751,6 +750,7 @@ function update_event(table, id_evento, type, event_rep, row) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// Update events matching current filters and id_evento selected.
|
||||||
|
|
||||||
function validate_event(table, id_evento, event_rep, row) {
|
function validate_event(table, id_evento, event_rep, row) {
|
||||||
var button = document.getElementById("val-" + id_evento);
|
var button = document.getElementById("val-" + id_evento);
|
||||||
|
@ -791,7 +791,39 @@ function delete_event(table, id_evento, event_rep, row) {
|
||||||
processed += 1;
|
processed += 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var message =
|
||||||
|
"<h4 style = 'text-align: center; color: black;' > Are you sure?</h4> ";
|
||||||
|
confirmDialog({
|
||||||
|
title: "ATTENTION",
|
||||||
|
message: message,
|
||||||
|
cancel: "Cancel",
|
||||||
|
ok: "Ok",
|
||||||
|
onAccept: function() {
|
||||||
|
button.children[0];
|
||||||
|
button.children[0].src = "images/spinner.gif";
|
||||||
|
return update_event(
|
||||||
|
table,
|
||||||
|
id_evento,
|
||||||
|
{ delete_event: 1 },
|
||||||
|
event_rep,
|
||||||
|
row
|
||||||
|
);
|
||||||
|
},
|
||||||
|
onDeny: function() {
|
||||||
|
button.children[0];
|
||||||
|
button.children[0].src = "images/cross.png";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function execute_delete_event_reponse(table, id_evento, event_rep, row) {
|
||||||
|
var button = document.getElementById("del-" + id_evento);
|
||||||
|
if (!button) {
|
||||||
|
// Button does not exist. Ignore.
|
||||||
|
processed += 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
button.children[0];
|
button.children[0];
|
||||||
button.children[0].src = "images/spinner.gif";
|
button.children[0].src = "images/spinner.gif";
|
||||||
return update_event(table, id_evento, { delete_event: 1 }, event_rep, row);
|
return update_event(table, id_evento, { delete_event: 1 }, event_rep, row);
|
||||||
|
@ -799,110 +831,126 @@ function delete_event(table, id_evento, event_rep, row) {
|
||||||
|
|
||||||
// Imported from old files.
|
// Imported from old files.
|
||||||
function execute_event_response(event_list_btn) {
|
function execute_event_response(event_list_btn) {
|
||||||
processed = 0;
|
var message =
|
||||||
$("#max_custom_event_resp_msg").hide();
|
"<h4 style = 'text-align: center; color: black;' > Are you sure?</h4> ";
|
||||||
$("#max_custom_selected").hide();
|
confirmDialog({
|
||||||
|
title: "ATTENTION",
|
||||||
|
message: message,
|
||||||
|
cancel: "Cancel",
|
||||||
|
ok: "Ok",
|
||||||
|
onAccept: function() {
|
||||||
|
// Continue execution.
|
||||||
|
processed = 0;
|
||||||
|
$("#max_custom_event_resp_msg").hide();
|
||||||
|
$("#max_custom_selected").hide();
|
||||||
|
|
||||||
var response_id = $("select[name=response_id]").val();
|
var response_id = $("select[name=response_id]").val();
|
||||||
|
|
||||||
var total_checked = $(".chk_val:checked").length;
|
var total_checked = $(".chk_val:checked").length;
|
||||||
|
|
||||||
// Check select an event.
|
// Check select an event.
|
||||||
if (total_checked == 0) {
|
if (total_checked == 0) {
|
||||||
$("#max_custom_selected").show();
|
$("#max_custom_selected").show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isNaN(response_id)) {
|
if (!isNaN(response_id)) {
|
||||||
// It is a custom response
|
// It is a custom response
|
||||||
var response = get_response(response_id);
|
var response = get_response(response_id);
|
||||||
|
|
||||||
// If cannot get response abort it
|
// If cannot get response abort it
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Limit number of events to apply custom responses
|
||||||
|
// due performance reasons.
|
||||||
|
if (total_checked > $("#max_execution_event_response").val()) {
|
||||||
|
$("#max_custom_event_resp_msg").show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var response_command = [];
|
||||||
|
$(".response_command_input").each(function() {
|
||||||
|
response_command[$(this).attr("name")] = $(this).val();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (event_list_btn) {
|
||||||
|
$("#button-submit_event_response").hide(function() {
|
||||||
|
$("#response_loading_dialog").show(function() {
|
||||||
|
var check_params = get_response_params(response_id);
|
||||||
|
|
||||||
|
if (check_params[0] !== "") {
|
||||||
|
show_event_response_command_dialog(
|
||||||
|
response_id,
|
||||||
|
response,
|
||||||
|
total_checked
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
check_massive_response_event(
|
||||||
|
response_id,
|
||||||
|
response,
|
||||||
|
total_checked,
|
||||||
|
response_command
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$("#button-btn_str").hide(function() {
|
||||||
|
$("#execute_again_loading").show(function() {
|
||||||
|
check_massive_response_event(
|
||||||
|
response_id,
|
||||||
|
response,
|
||||||
|
total_checked,
|
||||||
|
response_command
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// It is not a custom response
|
||||||
|
switch (response_id) {
|
||||||
|
case "in_progress_selected":
|
||||||
|
$(".chk_val:checked").each(function() {
|
||||||
|
// Parent: TD. GrandParent: TR.
|
||||||
|
in_process_event(
|
||||||
|
dt_events,
|
||||||
|
$(this).val(),
|
||||||
|
$(this).attr("event_rep"),
|
||||||
|
this.parentElement.parentElement
|
||||||
|
);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "validate_selected":
|
||||||
|
$(".chk_val:checked").each(function() {
|
||||||
|
validate_event(
|
||||||
|
dt_events,
|
||||||
|
$(this).val(),
|
||||||
|
$(this).attr("event_rep"),
|
||||||
|
this.parentElement.parentElement
|
||||||
|
);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "delete_selected":
|
||||||
|
console.log($(this));
|
||||||
|
$(".chk_val:checked").each(function() {
|
||||||
|
execute_delete_event_reponse(
|
||||||
|
dt_events,
|
||||||
|
$(this).val(),
|
||||||
|
$(this).attr("event_rep"),
|
||||||
|
this.parentElement.parentElement
|
||||||
|
);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onDeny: function() {
|
||||||
|
processed += 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
// Limit number of events to apply custom responses
|
|
||||||
// due performance reasons.
|
|
||||||
if (total_checked > $("#max_execution_event_response").val()) {
|
|
||||||
$("#max_custom_event_resp_msg").show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var response_command = [];
|
|
||||||
$(".response_command_input").each(function() {
|
|
||||||
response_command[$(this).attr("name")] = $(this).val();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (event_list_btn) {
|
|
||||||
$("#button-submit_event_response").hide(function() {
|
|
||||||
$("#response_loading_dialog").show(function() {
|
|
||||||
var check_params = get_response_params(response_id);
|
|
||||||
|
|
||||||
if (check_params[0] !== "") {
|
|
||||||
show_event_response_command_dialog(
|
|
||||||
response_id,
|
|
||||||
response,
|
|
||||||
total_checked
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
check_massive_response_event(
|
|
||||||
response_id,
|
|
||||||
response,
|
|
||||||
total_checked,
|
|
||||||
response_command
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$("#button-btn_str").hide(function() {
|
|
||||||
$("#execute_again_loading").show(function() {
|
|
||||||
check_massive_response_event(
|
|
||||||
response_id,
|
|
||||||
response,
|
|
||||||
total_checked,
|
|
||||||
response_command
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// It is not a custom response
|
|
||||||
switch (response_id) {
|
|
||||||
case "in_progress_selected":
|
|
||||||
$(".chk_val:checked").each(function() {
|
|
||||||
// Parent: TD. GrandParent: TR.
|
|
||||||
in_process_event(
|
|
||||||
dt_events,
|
|
||||||
$(this).val(),
|
|
||||||
$(this).attr("event_rep"),
|
|
||||||
this.parentElement.parentElement
|
|
||||||
);
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case "validate_selected":
|
|
||||||
$(".chk_val:checked").each(function() {
|
|
||||||
validate_event(
|
|
||||||
dt_events,
|
|
||||||
$(this).val(),
|
|
||||||
$(this).attr("event_rep"),
|
|
||||||
this.parentElement.parentElement
|
|
||||||
);
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case "delete_selected":
|
|
||||||
$(".chk_val:checked").each(function() {
|
|
||||||
delete_event(
|
|
||||||
dt_events,
|
|
||||||
$(this).val(),
|
|
||||||
$(this).attr("event_rep"),
|
|
||||||
this.parentElement.parentElement
|
|
||||||
);
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_massive_response_event(
|
function check_massive_response_event(
|
||||||
|
|
Loading…
Reference in New Issue