From 6de3a6a750c74e3320150664df9aa833ea9168a0 Mon Sep 17 00:00:00 2001 From: dmendez Date: Thu, 12 Jul 2018 20:04:02 +0000 Subject: [PATCH] Validacion Promotor de Proyecto git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C215 --- .../DetallePropuestaNormativa.js | 66 +++++++++++++------ 1 file changed, 45 insertions(+), 21 deletions(-) diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/DetallePropuestaNormativa.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/DetallePropuestaNormativa.js index 886ab6b29..9db54c336 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/DetallePropuestaNormativa.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/DetallePropuestaNormativa.js @@ -2,6 +2,7 @@ var IDTipoProyecto; var model = {}; var EsRespuesta = false; +var EsPromotor = false; var IDComentario = 0; var EsForo = false; var NombreDocumento; @@ -10,6 +11,9 @@ var SubTipoproyecto; var respuestaForo; var IdPropuestaNormativa; +var Promotor; +var Estado; + jQuery(document).ready(function () { $(document).tooltip(); @@ -40,6 +44,12 @@ jQuery(document).ready(function () { IDPropuesta = ObtenerParametros().propuesta; IDTipoProyecto = ObtenerParametros().tipo; + Promotor = ObtenerParametros().promotor; + Estado = ObtenerParametros().estado; + + + + if (IsNullOrEmpty(IDPropuesta)) { alert("No ha seleccionado una propuesta"); $("#formDetallePropuesta").FormReadOnly(); @@ -62,12 +72,13 @@ jQuery(document).ready(function () { }; IdPropuestaNormativa = ROT47(IDPropuesta.toString()); - ObtenerPropuesta(); getDataModel(); + ObtenerPropuesta(); if ($("#txtPromotorProyecto").val() == UsuarioSistema) { $("#txtFechaFinalizacion").noReadOnly(); $('#btnModificar').enable(); + EsPromotor = true; } @@ -100,12 +111,14 @@ this.getDataModel = function () { $("#btnAgregarComentario").unbind("click"); $("#btnAgregarComentario").click(function () { - - if (ValidarPermisos('Ingreso y actualización de área de foro').length <= 0 || $('#txtEstado').val() != "Inicial") { - toastr.warning('No tiene permisos para ejecutar esta opción', Message_Warning); - return; + if (EsPromotor == false) { + if (ValidarPermisos('Ingreso y actualización de área de foro').length <= 0 || Estado != Estados.Inicial.Codigo) { + toastr.warning('No tiene permisos para ejecutar esta opción', Message_Warning); + return; + } } + $("#divRespuesta").empty(); $("#lblcomentario").text("Comentario"); $("#txtAsunto").val(''); @@ -169,16 +182,21 @@ this.getDataModel = function () { $("#txtEstado").readOnly(); $('#btnModificar').disable(); - if (ValidarPermisos('Ingreso y actualización de área de proyecto').length <= 0 || $('#txtEstado').val() != "Inicial" ) { - $("#tabs").tabs({ - disabled: [2] - }); - } - if (ValidarPermisos('Accesar expediente de foro').length <= 0 || $('#txtEstado').val() != "Inicial") { - $("#tabs").tabs({ - disabled: [3] - }); + if (EsPromotor == false) { + + if (ValidarPermisos('Ingreso y actualización de área de proyecto').length <= 0 || Estado != Estados.Inicial.Codigo ) { + $("#tabs").tabs({ + disabled: [2] + }); + } + + if (ValidarPermisos('Accesar expediente de foro').length <= 0 || Estado != Estados.Inicial.Codigo ) { + $("#tabs").tabs({ + disabled: [3] + }); + } + } CargarUsuarios(); @@ -1206,15 +1224,21 @@ $('#tableDocMatriz').on('click', 'button', function () { this.AbrirAdjuntos = function (id) { - if (id == 2 && ValidarPermisos('Accesar documentos auxiliares del foro').length <= 0) { - toastr.warning('No tiene permisos para ejecutar esta opción', Message_Warning); - return; + if (EsPromotor == false) { + + if (id == 2 && ValidarPermisos('Accesar documentos auxiliares del foro').length <= 0) { + toastr.warning('No tiene permisos para ejecutar esta opción', Message_Warning); + return; + } + + if (id == 3 && ValidarPermisos('Accesar expediente de propuesta normativa').length <= 0) { + toastr.warning('No tiene permisos para ejecutar esta opción', Message_Warning); + return; + } + } - if (id == 3 && ValidarPermisos('Accesar expediente de propuesta normativa').length <= 0) { - toastr.warning('No tiene permisos para ejecutar esta opción', Message_Warning); - return; - } + $('#hiddenSubTipoDocumento').val(id);