324 lines
No EOL
11 KiB
JavaScript
324 lines
No EOL
11 KiB
JavaScript
$("#formRecibirConsolidarDocumentos").EnableValidationToolTip();
|
|
var model = {};
|
|
|
|
|
|
var Etapas = {
|
|
DE_Recibir_Consolidar_Doc: ($("#hiddenStep").val() == "DE_Recibir_Consolidar_Doc" ? true : false)
|
|
};
|
|
|
|
|
|
|
|
|
|
jQuery(document).ready(function () {
|
|
switch (true) {
|
|
case Etapas.DE_Recibir_Consolidar_Doc:
|
|
GetControlsSettings("Cathay_DE_Recibir_Consolidar_Doc", "Cathay_Desembolso", "formRecibirConsolidarDocumentos", true);
|
|
break;
|
|
default:
|
|
toastr.warning("Estimado usuario, no existe configuración para el formulario al que está accediendo.");
|
|
break;
|
|
}
|
|
});
|
|
|
|
this.getDataModel = function () {
|
|
|
|
$('#btnCompletarTarea').unbind('click');
|
|
$('#btnCompletarTarea').click(function () {
|
|
GuardarFormulario(GuardarDocumentosLegales, true);
|
|
});
|
|
|
|
|
|
$('#btnGuardarDatos').click(function () {
|
|
GuardarFormulario(GuardarDocumentosLegales, false);
|
|
});
|
|
|
|
|
|
$('#btnsDocumentacionCompleta').change(function () {
|
|
ToggleButtonSwitch(this)
|
|
});
|
|
|
|
|
|
$('#btnsRequiereHojaPendientes').change(function () {
|
|
ToggleButtonSwitch(this)
|
|
});
|
|
|
|
|
|
$("#ListaDocumentosLegales").Grid("Set", {
|
|
setCustomSettings: function (Settings) {
|
|
|
|
var ListaColumnasOcultas = new Array();
|
|
|
|
if (Etapas.FR_Gen_Doc_Legales)
|
|
ListaColumnasOcultas = ["Decision", "Comentarios", "Adjuntar"]
|
|
else if (Etapas.FR_Revisar_Doc)
|
|
ListaColumnasOcultas = ["Adjuntar"]
|
|
else if (Etapas.FR_Enviar_Doc_Cliente)
|
|
ListaColumnasOcultas = ["Decision", "Comentarios", "ChkRequiereRevision"]
|
|
|
|
//oculta columnas
|
|
$.each(Settings.ColumnDefinition, function (id, item) {
|
|
|
|
if ($.inArray(item.data, ListaColumnasOcultas) != -1)
|
|
item.bVisible = false;
|
|
|
|
Settings.ColumnDefinition[id] = item;
|
|
});
|
|
|
|
if (Settings.data.length > 0)
|
|
$.each(Settings.data, function (idl, item) {
|
|
var id = item.IdTipoDocumento;
|
|
item.opciones = '';
|
|
|
|
if (Etapas.FR_Gen_Doc_Legales)
|
|
item.opciones += '<span class=" fa fa-2x fa-upload primary HandCursor" onclick=" GenerarDocumento(\'' + id + '\');"></span >';
|
|
|
|
item.opciones += ' <span class=" fa fa-2x fa-download primary HandCursor" onclick="' +
|
|
(item.ClasificacionDocumentosAdjuntos == null ? "alert('no se ha adjuntado documento');" : ' window.open(\'' + item.ClasificacionDocumentosAdjuntos.RutaDescarga + '\');') + '"></span >';
|
|
|
|
if (Etapas.FR_Gen_Doc_Legales)
|
|
item.opciones += ' <span class="fa-2x fa fa-paperclip primary HandCursor" onclick=" AdjuntarDocumento(' + id + ');" ></span>';
|
|
|
|
item.ChkRequiereRevision = '<input type="checkbox" id="RequiereRevision_' + id + '" ' +
|
|
(item.RequiereRevision == true ? ' checked="checked" ' : '')
|
|
+ (Etapas.FR_Gen_Doc_Legales ? '' : ' disabled="disabled" ')
|
|
+ ' >';
|
|
|
|
item.Adjuntar = (item.ClasificacionDocumentosAdjuntos == null ? '--' : '<input type="checkbox" id="Adjuntar_' + id + '" >');
|
|
|
|
item.Comentarios = '<textarea rows="5" class="form-control" id="ComentariosEvaluacion_' + id
|
|
+ '">' + (IsNullOrEmpty(item.ComentariosEvaluacion) ? '' : item.ComentariosEvaluacion) + '</textarea>';
|
|
|
|
Settings.data[idl] = $.extend(true, {}, item);
|
|
});
|
|
|
|
return Settings;
|
|
}
|
|
});
|
|
|
|
|
|
ToggleTitle();
|
|
CargarFormulario();
|
|
|
|
|
|
}
|
|
|
|
this.ToggleButtonSwitch = function (sender) {
|
|
var _Excluyente = "0";
|
|
|
|
switch (sender.value) {
|
|
case "1":
|
|
_Excluyente = "0";
|
|
break;
|
|
case "0":
|
|
_Excluyente = "1";
|
|
break;
|
|
default:
|
|
_Excluyente = sender.value;
|
|
break;
|
|
|
|
}
|
|
|
|
switch (sender.id) {
|
|
case 'btnsDocumentacionCompleta':
|
|
if ($("#btnsRequiereHojaPendientes").val() != _Excluyente)
|
|
$("#btnsRequiereHojaPendientes").ButtonSwitch('set', _Excluyente);
|
|
break;
|
|
case 'btnsRequiereHojaPendientes':
|
|
if ($("#btnsDocumentacionCompleta").val() != _Excluyente)
|
|
$("#btnsDocumentacionCompleta").ButtonSwitch('set', _Excluyente);
|
|
break;
|
|
}
|
|
|
|
$("#formRecibirConsolidarDocumentos").validateElement('#' + sender.id);
|
|
|
|
ToggleMotivos();
|
|
|
|
}
|
|
|
|
this.ToggleTitle = function () {
|
|
|
|
switch (true) {
|
|
case Etapas.DE_Recibir_Consolidar_Doc:
|
|
$("#titulo_pantalla").text("Recibir y Consolidar Documentos del Cliente");
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
this.ToggleMotivos = function () {
|
|
|
|
var lockMotivos = $("#btnsRequiereHojaPendientes").val() == "0";
|
|
|
|
if (lockMotivos) {
|
|
$("#txtDetallePendiente").enable();
|
|
$("#txtDetallePendiente").required();
|
|
}
|
|
else {
|
|
$("#txtDetallePendiente").disable();
|
|
$("#txtDetallePendiente").noRequired();
|
|
}
|
|
|
|
$("#formRecibirConsolidarDocumentos").valid();
|
|
}
|
|
|
|
this.CargarFormulario = function () {
|
|
|
|
Ultimus.LoadMessage();
|
|
|
|
model = LeerControlesUltimus(model);
|
|
|
|
Ultimus.AjaxPostData(server + "api/FormalizacionAPI/CargarFormalizacion", model, true, false, function (data) {
|
|
|
|
model = data == null ? {} : data;
|
|
var _modelDatosFormalizacion = model.DatosGeneralesFormalizacion == null || model.DatosGeneralesFormalizacion.length == 0 ? {} : model.DatosGeneralesFormalizacion;
|
|
|
|
$("#btnsDocumentacionCompleta").ButtonSwitch('set', _modelDatosFormalizacion.DocumentacionCompleta == null ? null : (_modelDatosFormalizacion.DocumentacionCompleta == true ? 0 : 1));
|
|
$("#btnsRequiereHojaPendientes").ButtonSwitch('set', _modelDatosFormalizacion.RequiereHojaPendientes == null ? null : (_modelDatosFormalizacion.RequiereHojaPendientes == true ? 0 : 1));
|
|
$("#txtDetallePendiente").val(_modelDatosFormalizacion.DetallePendiente == null ? "" : _modelDatosFormalizacion.DetallePendiente);
|
|
|
|
|
|
CargaListaDocumentosLegales();
|
|
|
|
$("#formRecibirConsolidarDocumentos").valid();
|
|
|
|
ENDREQUEST();
|
|
|
|
}, "EXITOSO");
|
|
}
|
|
|
|
this.CargaListaDocumentosLegales = function () {
|
|
|
|
model = LeerControlesUltimus(model);
|
|
$("#ListaDocumentosLegales").Grid("BuildGrid", model);
|
|
|
|
}
|
|
|
|
this.GuardarDocumentosLegales = function () {
|
|
var FormalizacionDocumentosLegales = $("#ListaDocumentosLegales").Grid("Get");
|
|
|
|
var DatosGeneralesFormalizacion = model.DatosGeneralesFormalizacion == null ? {} : model.DatosGeneralesFormalizacion;
|
|
|
|
if (FormalizacionDocumentosLegales != null && FormalizacionDocumentosLegales.length > 0) {
|
|
$.each(FormalizacionDocumentosLegales, function (id, item) {
|
|
item.opciones = null;
|
|
item.ChkRequiereRevision = null;
|
|
item.Comentarios = null;
|
|
item.Adjuntar = null;
|
|
|
|
item.RequiereRevision = $("#RequiereRevision_" + item.IdTipoDocumento).is(":checked");
|
|
|
|
if (Etapas.FR_Revisar_Doc) {
|
|
item.ComentariosEvaluacion = $("#ComentariosEvaluacion_" + item.IdTipoDocumento).val();
|
|
}
|
|
});
|
|
}
|
|
|
|
DatosGeneralesFormalizacion.FormalizacionDocumentosLegales = FormalizacionDocumentosLegales;
|
|
|
|
model.DatosGeneralesFormalizacion = DatosGeneralesFormalizacion;
|
|
|
|
model = LeerControlesUltimus(model);
|
|
Ultimus.AjaxPostData(server + "api/FormalizacionAPI/GuardarDocumentosLegales", model, true, true, function (data) {
|
|
|
|
$("#btnCompletarTarea").enable();
|
|
|
|
ENDREQUEST();
|
|
|
|
}, null, "Datos guardados con exito");
|
|
}
|
|
|
|
this.GuardarFormulario = function (FunctionCallBack, enviar) {
|
|
|
|
if (!$("#formRecibirConsolidarDocumentos").valid()) {
|
|
ENDREQUEST();
|
|
toastr.warning("Ingresar todos los campos que son requeridos.");
|
|
return;
|
|
}
|
|
|
|
var _modelDatosFormalizacion = model.DatosGeneralesFormalizacion == null || model.DatosGeneralesFormalizacion.length == 0 ? {} : model.DatosGeneralesFormalizacion;
|
|
_modelDatosFormalizacion.DocumentacionCompleta = $("#btnsDocumentacionCompleta").val() == "0" ? true : (IsNullOrEmpty($("#btnsDocumentacionCompleta").val()) ? null : false);
|
|
_modelDatosFormalizacion.RequiereHojaPendientes = $("#btnsRequiereHojaPendientes").val() == "0" ? true : (IsNullOrEmpty($("#btnsRequiereHojaPendientes").val()) ? null : false);
|
|
_modelDatosFormalizacion.Step = $("#hiddenStep").val();
|
|
_modelDatosFormalizacion.Incident = $("#hiddenIncident").val();
|
|
_modelDatosFormalizacion.Procesos = _modelDatosFormalizacion.Procesos == null ? {} : _modelDatosFormalizacion.Procesos;
|
|
_modelDatosFormalizacion.Procesos.NombreProceso = $("#hiddenProcess").val();
|
|
|
|
model.UltimusUserID = $("#hiddenUserID").val();
|
|
model.Solicitud.Funcionario = null;
|
|
model.Solicitud.ParticipantesLegalesAdicionales = null;
|
|
model.DatosGeneralesFormalizacion = _modelDatosFormalizacion;
|
|
|
|
var ExistCallBack = (FunctionCallBack != null && typeof FunctionCallBack !== 'undefined' && $.isFunction(FunctionCallBack)) ? true : false;
|
|
|
|
Ultimus.AjaxPostData(server + "api/FormalizacionAPI/GuardarFormalizacion", model, true, true, function (data) {
|
|
|
|
$('#btnCompletarTarea').enable();
|
|
$('#btnFinalizarTarea').enable();
|
|
|
|
|
|
if (ExistCallBack) {
|
|
if ($("#btnsDocumentacionCompleta").val() == "0")
|
|
if (!GridExpediente_ValidarDocumentacionCompleta()) {
|
|
ENDREQUEST();
|
|
return false;
|
|
}
|
|
|
|
FunctionCallBack(data);
|
|
}
|
|
|
|
if (enviar == true)
|
|
EnviarIncidente(false);
|
|
else
|
|
ENDREQUEST();
|
|
|
|
}, "EXITOSO");
|
|
}
|
|
|
|
this.CargarTablaParticipantes = function () {
|
|
|
|
|
|
$("#ListaParticipantesAgenda").Grid('Set', {
|
|
setCustomSettings: function (Settings) {
|
|
//configura columnas
|
|
if (Settings.data.length > 0)
|
|
$.each(Settings.data, function (id, item) {
|
|
|
|
|
|
var objEmailParcipante = { IdRecipienteEmailSolicitud: 0, EmailToValidate: item.Correo };
|
|
var EmaiAdded = ExistsEmailRecipient(objEmailParcipante);
|
|
var eventoClick = 'onclick=' + (EmaiAdded == true ? '"RemoverCorreoParticipante(' + objEmailParcipante.IdRecipienteEmailSolicitud + ');"' : '"AgregarCorreoParticipante(' + "'" + item.Correo + "'" + ');"');
|
|
item.opciones = '<span id=' + "'" + item.Correo + "'" + ' class="text-' + (EmaiAdded == true ? "success" : "muted") + ' HandCursor" ' + eventoClick + '><i class="fa fa-check-circle fa-2x"></i></span>';
|
|
});
|
|
|
|
return Settings;
|
|
},
|
|
RowEvent: function (IdControl, DataRow) { }
|
|
});
|
|
|
|
$("#ListaParticipantesAgenda").Grid('Refresh');
|
|
}
|
|
|
|
this.RecargaTablaParticipantes = function () {
|
|
$("#ListaParticipantesAgenda").Grid('Refresh');
|
|
}
|
|
|
|
this.PostRemoveEmailRecipient = function () {
|
|
$("#ListaParticipantesAgenda").Grid('Refresh');
|
|
}
|
|
|
|
this.AgregarCorreoParticipante = function (_EmailToAdd) {
|
|
try {
|
|
AddEmailRecipient(_EmailToAdd, RecargaTablaParticipantes);
|
|
} catch (e) {
|
|
|
|
}
|
|
}
|
|
|
|
this.RemoverCorreoParticipante = function (_IdEmailToRemove) {
|
|
try {
|
|
RemoveEmailRecipient(_IdEmailToRemove, RecargaTablaParticipantes);
|
|
} catch (e) {
|
|
|
|
}
|
|
} |