Opciones 8 9 10 11 12 Validaciones

git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C212
This commit is contained in:
dmendez 2018-07-12 17:42:28 +00:00
parent 6fc0a29384
commit b029b62acd

View file

@ -61,8 +61,9 @@ jQuery(document).ready(function () {
IdProyectoNormativo: ROT47(IDPropuesta.toString()) IdProyectoNormativo: ROT47(IDPropuesta.toString())
}; };
IdPropuestaNormativa = ROT47(IDPropuesta.toString()); IdPropuestaNormativa = ROT47(IDPropuesta.toString());
getDataModel();
ObtenerPropuesta(); ObtenerPropuesta();
getDataModel();
if ($("#txtPromotorProyecto").val() == UsuarioSistema) { if ($("#txtPromotorProyecto").val() == UsuarioSistema) {
$("#txtFechaFinalizacion").noReadOnly(); $("#txtFechaFinalizacion").noReadOnly();
@ -99,6 +100,12 @@ this.getDataModel = function () {
$("#btnAgregarComentario").unbind("click"); $("#btnAgregarComentario").unbind("click");
$("#btnAgregarComentario").click(function () { $("#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(); $("#divRespuesta").empty();
$("#lblcomentario").text("Comentario"); $("#lblcomentario").text("Comentario");
$("#txtAsunto").val(''); $("#txtAsunto").val('');
@ -118,6 +125,7 @@ this.getDataModel = function () {
$("#btnAgregarElemento").unbind("click"); $("#btnAgregarElemento").unbind("click");
$("#btnAgregarElemento").click(function () { $("#btnAgregarElemento").click(function () {
$("#divRespuestaMatriz").empty(); $("#divRespuestaMatriz").empty();
$("#lblComentarioMatriz").text("Comentario"); $("#lblComentarioMatriz").text("Comentario");
$("#txtAsuntoMatriz").val(''); $("#txtAsuntoMatriz").val('');
@ -148,7 +156,7 @@ this.getDataModel = function () {
$("#btnGuardarEvento").click(function () { $("#btnGuardarEvento").click(function () {
GuardarEvento(); GuardarEvento();
}); });
$("#txtFechaFinalizacion").datepicker(); $("#txtFechaFinalizacion").datepicker();
$("#txtNombreProyecto").readOnly(); $("#txtNombreProyecto").readOnly();
@ -161,16 +169,24 @@ this.getDataModel = function () {
$("#txtEstado").readOnly(); $("#txtEstado").readOnly();
$('#btnModificar').disable(); $('#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(); CargarUsuarios();
} }
this.ActualizarItem = function (accion) { 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?")) if (!confirm((accion == true) ? "Se guardarán los cambios.\n ¿Desea continuar?" : "Desea eliminar el registro.\n ¿Desea continuar?"))
{ return; } { return; }
@ -1189,6 +1205,18 @@ $('#tableDocMatriz').on('click', 'button', function () {
}); });
this.AbrirAdjuntos = function (id) { 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); $('#hiddenSubTipoDocumento').val(id);
@ -1554,4 +1582,117 @@ $('#tableDocEvento').on('click', 'button', function () {
window.open(data[4]); window.open(data[4]);
}); });
this.Export2Doc = function (element, filename) {
var preHtml = "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word' xmlns='http://www.w3.org/TR/REC-html40'><head><meta charset='utf-8'><title>Export HTML To Doc</title></head><body>";
var postHtml = "</body></html>";
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 = "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word' xmlns='http://www.w3.org/TR/REC-html40'><head><meta charset='utf-8'><title>SINORT</title></head><body>";
var postHtml = "</body></html>";
var html = preHtml;
html = html + '<p><center><img src="http://localhost/AYA.SlnSinort/dist/img/bannersinort.png" style="margin: 0 auto;" align="middle" width="300"></center></p>' ;
html = html + '<br/>'
html = html + '<center><h1>SISTEMA DE NORMATIVA Y REGULACION TECNICA DEL AyA</h1></center>'
html = html + '<br/>'
html = html + '<h1>' + ((TipoComentario == 'Matriz') ? 'MATRIZ' : 'FORO') + '</h1>' +
'<p>PROYECTO NORMATIVO N. ' + model.ProyectoNormativo.IdProyectoNormativo + ' NOMBRE: ' + model.ProyectoNormativo.NombreProyectoNormativo + '</p>' ;
html = html + '<hr/>'
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 + '<p><img src="http://localhost/AYA.SlnSinort/bower_components/Ionicons/png/512/chatbubble-working.png" style="margin: 0 auto;" height="30" width="30"><font face="verdana" color="green">ASUNTO :' + item.Asunto + '</font></p>'
html = html + '<p><img src="http://localhost/AYA.SlnSinort/bower_components/Ionicons/png/512/chatbubbles.png" style="margin: 0 auto;" height="30" width="30">Comentario : ' + item.Comentario + '</p>';
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 + '<p><img src="http://localhost/AYA.SlnSinort/bower_components/Ionicons/png/512/ios7-redo.png" style="margin: 0 auto;" height="30" width="30"><font face="verdana" color="blue"> Respuesta ' + lstitem.Comentario + '</font></p>'
html = html + '<p><img src="http://localhost/AYA.SlnSinort/bower_components/Ionicons/png/512/ios7-contact-outline.png" style="margin: 0 auto;" height="30" width="30">' + lstitem.UsuarioSistema + ' - ' + lstitem.FechaCreacion + '</p>'
html = html + '<hr/>'
});
});
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);
};