246 lines
7.5 KiB
JavaScript
246 lines
7.5 KiB
JavaScript
$("#formEvaluacionCaso").EnableValidationToolTip();
|
|
var IdSolicitud = $("#hidden_co_solicitud").val();
|
|
var ObjFirmaActual = null;
|
|
var FormLoaded = false;
|
|
|
|
jQuery(document).ready(function () {
|
|
if ($("#hiddenTaskStatus").val() == 3)
|
|
GetControlsSettings("Cathay_AnalizarCasoReadOnly", "Cathay_FrmAnalizarCaso", "formEvaluacionCaso", true);
|
|
else
|
|
GetControlsSettings("Cathay_AnalizarCaso", "Cathay_FrmAnalizarCaso", "formEvaluacionCaso", true);
|
|
|
|
|
|
});
|
|
|
|
this.getDataModel = function () {
|
|
$("#btnCompletarTarea").unbind('click');
|
|
$("#btnCompletarTarea").click(function () {
|
|
|
|
ActualizarDatos(true);
|
|
});
|
|
|
|
$("#ddlEvaluacionCaso").change(function () {
|
|
|
|
if ($("#ddlEvaluacionCaso option:selected").val() != "28") {
|
|
$("#txtComentarioEvaluacionCaso").required();
|
|
}
|
|
else {
|
|
$("#txtComentarioEvaluacionCaso").noRequired();
|
|
}
|
|
});
|
|
|
|
ConsultarDatosAprobacion();
|
|
|
|
|
|
}
|
|
|
|
this.InicializarDatosDecisiones = function () {
|
|
|
|
Ultimus.AjaxGetData(server + 'api/GlobalAPI/ObtenerDecision?Etapa=' + encodeURIComponent($("#hiddenStep").val()) + '&NombreProceso=' + encodeURIComponent($("#hiddenProcess").val()), false, false, function (data) {
|
|
|
|
$("#ddlEvaluacionCaso").empty();
|
|
$('#ddlEvaluacionCaso').append($("<option></option>").attr("value", "").text(""));
|
|
|
|
if (ObjFirmaActual.EsVoto == false) $('#lblEvaluacionCaso').text("Visto Bueno del Caso:");
|
|
|
|
$.each(data, function (id, item) {
|
|
|
|
if (ObjFirmaActual.EsVoto == false)
|
|
item.descripcion = item.descripcion.replace("Voto", "Visto Bueno");
|
|
|
|
$('#ddlEvaluacionCaso').append($("<option></option>").attr("value", item.codigo).text(item.descripcion));
|
|
});
|
|
|
|
FormLoaded = true;
|
|
ObtenerprobacionesComite();
|
|
});
|
|
}
|
|
|
|
this.ConsultarDatosAprobacion = function () {
|
|
|
|
var uri = "api/AnalizarCasoAPI/ConsultarDatosAprobacion/"
|
|
|
|
var Item = {
|
|
IdSolicitud: IdSolicitud,
|
|
UserName: $("#hiddenTaskUser").val(), //Ajuste por temas de reasignacion de casos
|
|
UsuarioModificado: $("#hiddenAssignedToUser").val()
|
|
};
|
|
|
|
var DTO = JSON.stringify(Item);
|
|
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: server + uri,
|
|
cache: false,
|
|
data: DTO,
|
|
async: true,
|
|
contentType: 'application/json; charset=utf-8',
|
|
dataType: 'json',
|
|
success: function (data) {
|
|
if (data != null) {
|
|
ObjFirmaActual = data;
|
|
HabilitarbtnCompletarTarea();
|
|
}
|
|
ObtenerComentario();
|
|
|
|
}
|
|
}).fail(function (jqxhr, textStatus, error) {
|
|
if (typeof AjaxFailEvent !== 'undefined' && $.isFunction(AjaxFailEvent) && !AjaxFailEvent(jqxhr, textStatus, error))
|
|
return;
|
|
toastr.error("Ha ocurrido un error inesperado. Vuela a intentarlo mas tarde");
|
|
|
|
ENDREQUEST();
|
|
}).then(function (value) {
|
|
InicializarDatosDecisiones();
|
|
});
|
|
}
|
|
|
|
this.HabilitarbtnCompletarTarea = function () {
|
|
if (ObjFirmaActual == null)
|
|
$("#btnCompletarTarea").disable();
|
|
else
|
|
$("#btnCompletarTarea").enable();
|
|
}
|
|
|
|
this.ActualizarDatos = function (enviar, change_page) {
|
|
|
|
|
|
var resp = false;
|
|
|
|
var uri = 'api/AnalizarCasoAPI/GuardarDatosAprobacion/';
|
|
|
|
if ($("#formEvaluacionCaso").valid()) {
|
|
if (confirm("Se guardarán los cambios y completará la tarea \n ¿Desea continuar?")) {
|
|
ObjFirmaActual.UserName = $("#hiddenUserID").val();
|
|
ObjFirmaActual.NombreCompleto = $("#hiddenUserFullName").val();
|
|
|
|
|
|
ObjFirmaActual.Comentario = $("#txtComentarioEvaluacionCaso").val();
|
|
ObjFirmaActual.IdDecision = $("#ddlEvaluacionCaso option:selected").val();
|
|
////Campos de Auditoria
|
|
ObjFirmaActual.Process = $("#hiddenProcess").val();
|
|
ObjFirmaActual.Step = $("#hiddenStep").val();
|
|
ObjFirmaActual.Incident = $("#hiddenIncident").val();
|
|
ObjFirmaActual.UsuarioCreador = $("#hiddenUserID").val();
|
|
|
|
|
|
Ultimus.AjaxPostData(Ultimus.server + uri, ObjFirmaActual, (change_page != true), false, function (data) {
|
|
if (data.CodigoRespuesta == "EXITOSO") {
|
|
|
|
|
|
if (enviar == true) {
|
|
InsertarActualizarComentario("");
|
|
EnviarIncidente(false,true,true);
|
|
}
|
|
|
|
|
|
resp = true;
|
|
}
|
|
else if (data.CodigoRespuesta == "ERROR") {
|
|
toastr.error("Ha ocurrido un error.");
|
|
ENDREQUEST();
|
|
}
|
|
else {
|
|
toastr.warning(data.DescripcionRespuesta);
|
|
ENDREQUEST();
|
|
}
|
|
}, "ERROR");
|
|
}
|
|
}
|
|
else {
|
|
toastr.warning("Ingresar todos los campos que son requeridos.");
|
|
}
|
|
|
|
return resp;
|
|
}
|
|
|
|
this.CambioPantallaMenuCallBack = function () {
|
|
|
|
InsertarActualizarComentario($("#txtComentarioEvaluacionCaso").val());
|
|
|
|
if (FormLoaded) {
|
|
|
|
if ($("#hiddenTaskStatus").val() == "1" && (Etapas.AP_Corre_Caratula_Adjuntar_Doc || Etapas.DE_AP_Corre_Caratula_Adjuntar_Doc))
|
|
return ActualizarDatos(false, true);
|
|
else
|
|
return true;
|
|
}
|
|
|
|
}
|
|
|
|
this.InsertarActualizarComentario = function (ComentarioEvaluacionCaso) {
|
|
|
|
var uri = "api/AnalizarCasoAPI/InsertarActualizarComentario/"
|
|
|
|
var Item = {
|
|
IdSolicitud: IdSolicitud,
|
|
Comentario: ComentarioEvaluacionCaso,
|
|
Step : $("#hiddenStep").val()
|
|
};
|
|
|
|
var DTO = JSON.stringify(Item);
|
|
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: server + uri,
|
|
cache: false,
|
|
data: DTO,
|
|
contentType: 'application/json; charset=utf-8',
|
|
async: false,
|
|
dataType: 'json',
|
|
success: function (data) {
|
|
if (data != null) {
|
|
|
|
}
|
|
}
|
|
}).fail(function (jqxhr, textStatus, error) {
|
|
if (typeof AjaxFailEvent !== 'undefined' && $.isFunction(AjaxFailEvent) && !AjaxFailEvent(jqxhr, textStatus, error))
|
|
return;
|
|
toastr.error("Ha ocurrido un error inesperado. Vuela a intentarlo mas tarde");
|
|
|
|
ENDREQUEST();
|
|
}).then(function (value) {
|
|
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
this.ObtenerComentario = function () {
|
|
try {
|
|
var idSolicitud = $("#hiddensol_co_solicitud").val();
|
|
var uri = "api/AnalizarCasoAPI/ObtenerComentario?IdSolicitud=" + idSolicitud
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: server + uri,
|
|
cache: false,
|
|
contentType: 'application/json; charset=utf-8',
|
|
dataType: 'json',
|
|
async: true,
|
|
success: function (data) {
|
|
|
|
if (data == null || data.length == 0)
|
|
return;
|
|
$("#txtComentarioEvaluacionCaso").val(data.Comentario)
|
|
$("#formEvaluacionCaso").validateElement("#txtComentarioEvaluacionCaso");
|
|
|
|
}
|
|
}).fail(function (jqxhr, textStatus, error) {
|
|
if (typeof AjaxFailEvent !== 'undefined' && $.isFunction(AjaxFailEvent) && !AjaxFailEvent(jqxhr, textStatus, error))
|
|
return;
|
|
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde", Message_Error);
|
|
ENDREQUEST();
|
|
|
|
}).then(function (value) {
|
|
//ENDREQUEST();
|
|
|
|
});
|
|
|
|
}
|
|
catch (e) {
|
|
toastr.error("Ha ocurrido un error inesperado al intentar cargar la información en el formulario. Por favor contacte al Administrador del Sistema");
|
|
ENDREQUEST();
|
|
}
|
|
};
|
|
|