From b029b62acd6dea62c8e78c2790defd47e251b5bf Mon Sep 17 00:00:00 2001
From: dmendez
Date: Thu, 12 Jul 2018 17:42:28 +0000
Subject: [PATCH] Opciones 8 9 10 11 12 Validaciones
git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C212
---
.../DetallePropuestaNormativa.js | 157 +++++++++++++++++-
1 file changed, 149 insertions(+), 8 deletions(-)
diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/DetallePropuestaNormativa.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/DetallePropuestaNormativa.js
index ebb5f1401..886ab6b29 100644
--- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/DetallePropuestaNormativa.js
+++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/DetallePropuestaNormativa.js
@@ -61,8 +61,9 @@ jQuery(document).ready(function () {
IdProyectoNormativo: ROT47(IDPropuesta.toString())
};
IdPropuestaNormativa = ROT47(IDPropuesta.toString());
- getDataModel();
+
ObtenerPropuesta();
+ getDataModel();
if ($("#txtPromotorProyecto").val() == UsuarioSistema) {
$("#txtFechaFinalizacion").noReadOnly();
@@ -99,6 +100,12 @@ 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;
+ }
+
$("#divRespuesta").empty();
$("#lblcomentario").text("Comentario");
$("#txtAsunto").val('');
@@ -118,6 +125,7 @@ this.getDataModel = function () {
$("#btnAgregarElemento").unbind("click");
$("#btnAgregarElemento").click(function () {
+
$("#divRespuestaMatriz").empty();
$("#lblComentarioMatriz").text("Comentario");
$("#txtAsuntoMatriz").val('');
@@ -148,7 +156,7 @@ this.getDataModel = function () {
$("#btnGuardarEvento").click(function () {
GuardarEvento();
});
-
+
$("#txtFechaFinalizacion").datepicker();
$("#txtNombreProyecto").readOnly();
@@ -161,16 +169,24 @@ 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]
+ });
+ }
+
CargarUsuarios();
}
this.ActualizarItem = function (accion) {
-
- //if (!$("#formDetallePropuesta").valid()) {
- // toastr.warning("Ingresar todos los campos que son requeridos.");
- // return false;
- //}
+
if (!confirm((accion == true) ? "Se guardarán los cambios.\n ¿Desea continuar?" : "Desea eliminar el registro.\n ¿Desea continuar?"))
{ return; }
@@ -1189,6 +1205,18 @@ $('#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 (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);
@@ -1554,4 +1582,117 @@ $('#tableDocEvento').on('click', 'button', function () {
window.open(data[4]);
-});
\ No newline at end of file
+});
+
+this.Export2Doc = function (element, filename) {
+
+ var preHtml = "Export HTML To Doc";
+ var postHtml = "";
+ var html = preHtml + document.getElementById(element).innerHTML + postHtml;
+
+ var blob = new Blob(['\ufeff', html], {
+ type: 'application/msword'
+ });
+
+ // Specify link url
+ var url = 'data:application/vnd.ms-word;charset=utf-8,' + encodeURIComponent(html);
+
+ // Specify file name
+ filename = filename ? filename + '.doc' : 'document.doc';
+
+ // Create download link element
+ var downloadLink = document.createElement("a");
+
+ document.body.appendChild(downloadLink);
+
+ if (navigator.msSaveOrOpenBlob) {
+ navigator.msSaveOrOpenBlob(blob, filename);
+ } else {
+ // Create a link to the file
+ downloadLink.href = url;
+
+ // Setting the file name
+ downloadLink.download = filename;
+
+ //triggering the function
+ downloadLink.click();
+ }
+
+ document.body.removeChild(downloadLink);
+
+};
+
+
+this.ExportarADoc = function (TipoComentario, filename) {
+
+ var preHtml = "SINORT";
+ var postHtml = "";
+ var html = preHtml;
+
+ html = html + '
' ;
+ html = html + '
'
+ html = html + 'SISTEMA DE NORMATIVA Y REGULACION TECNICA DEL AyA
'
+ html = html + '
'
+ html = html + '' + ((TipoComentario == 'Matriz') ? 'MATRIZ' : 'FORO') + '
' +
+ 'PROYECTO NORMATIVO N. ' + model.ProyectoNormativo.IdProyectoNormativo + ' NOMBRE: ' + model.ProyectoNormativo.NombreProyectoNormativo + '
' ;
+
+ html = html + '
'
+
+ var listaComentariosMatriz = $.grep(model.ProyectoNormativo.ComentariosProyecto, function (data) {
+ return data.IdTipoComentario == ((TipoComentario == 'Matriz') ? Comentarios.Matriz.Codigo : Comentarios.Foro.Codigo) && data.Respuesta == null;
+ });
+
+
+ $.each(listaComentariosMatriz, function (key, item) {
+ html = html + '
ASUNTO :' + item.Asunto + '
'
+ html = html + '
Comentario : ' + item.Comentario + '
';
+
+
+ var listaRespuestasComentariosMatriz = $.grep(model.ProyectoNormativo.ComentariosProyecto, function (data) {
+ return data.IdTipoComentario == ((TipoComentario == 'Matriz') ? Comentarios.Matriz.Codigo : Comentarios.Foro.Codigo) && data.Respuesta == item.IdComentarioProyecto;
+ });
+
+ $.each(listaRespuestasComentariosMatriz, function (lstkey, lstitem) {
+ html = html + '
Respuesta ' + lstitem.Comentario + '
'
+ html = html + '
' + lstitem.UsuarioSistema + ' - ' + lstitem.FechaCreacion + '
'
+ html = html + '
'
+ });
+
+ });
+
+
+ html = html + postHtml;
+
+ var blob = new Blob(['\ufeff', html], {
+ type: 'application/msword'
+ });
+
+ // Specify link url
+ //var url = 'data:application/vnd.ms-word;charset=utf-8,' + encodeURIComponent(html);
+ var url = 'data:application/vnd.ms-word;charset=utf-8,' + encodeURIComponent(html);
+
+ // Specify file name
+ filename = filename ? filename + '.doc' : 'document.doc';
+
+ // Create download link element
+ var downloadLink = document.createElement("a");
+
+ document.body.appendChild(downloadLink);
+
+ if (navigator.msSaveOrOpenBlob) {
+ navigator.msSaveOrOpenBlob(blob, filename);
+ } else {
+ // Create a link to the file
+ downloadLink.href = url;
+
+ // Setting the file name
+ downloadLink.download = filename;
+
+ //triggering the function
+ downloadLink.click();
+ }
+
+ document.body.removeChild(downloadLink);
+
+
+};
\ No newline at end of file