Changes in static/js/funciones.js [5d88f36:452668a] in firmaeventos
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
static/js/funciones.js
r5d88f36 r452668a 74 74 html += '<li class="collection-item"><b>Correo: </b>'+data.correo+'</li>'; 75 75 html += '</ul>'; 76 html += '<iframe width="700px" height="600px" src="https:// 192.168.12.154:8443/Murachi/0.1/archivos/listadopdf/'+data.documento+'">';76 html += '<iframe width="700px" height="600px" src="https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/listadopdf/'+data.documento+'">'; 77 77 html += '</iframe><br/>'; 78 78 if (firma==true) { … … 80 80 } 81 81 else{ 82 html += '<a type="button" id="firmar" class="btn waves-effect blue darken-1" onclick=" ObtenerCertificadoFirmanteMultiples(\''+data.documento+'\')">';82 html += '<a type="button" id="firmar" class="btn waves-effect blue darken-1" onclick="comprobarFirma(\''+data.documento+'\')">'; 83 83 html += '<i class="material-icons left">mode_edit</i> Firmar</a>'; 84 84 } … … 87 87 88 88 /** 89 * Función para comprobar firma 90 * @param fileId Recibe el id del documento 91 */ 92 function comprobarFirma(fileId){ 93 var routes = $(location).attr('pathname').split('/'); 94 var pk = routes[routes.length-1]; 95 $.ajax({ 96 type: 'GET', 97 async: false, 98 url:URL_COMPROBAR_FIRMA+pk, 99 success: function(datos){ 100 if (datos.validate==true) { 101 simple_modal(datos.mensaje); 102 } 103 else{ 104 $.ajax({ 105 type: 'POST', 106 async: false, 107 url:URL_COMPROBAR_FIRMA+pk, 108 success: function(datos){ 109 if (datos.validate==true) { 110 ObtenerCertificadoFirmanteMultiples(fileId,pk); 111 } 112 else{ 113 simple_modal("Ocurrió un error al actualizar los datos"); 114 } 115 }, 116 error: function(jqXHR, textStatus, errorThrown){ 117 console.log('error: ' + textStatus); 118 } 119 }); 120 } 121 }, 122 error: function(jqXHR, textStatus, errorThrown){ 123 console.log('error: ' + textStatus); 124 } 125 }); 126 } 127 128 /** 89 129 * Función para obtener el certificado del participante 90 130 * @param fileId Recibe el id del documento 91 */ 92 function ObtenerCertificadoFirmanteMultiples(fileId){ 131 * @param pk Recibe el id del evento 132 */ 133 function ObtenerCertificadoFirmanteMultiples(fileId,pk){ 93 134 var xPos = yPos= signaturePage = ""; 94 135 var lastSignature = false; 95 var routes = $(location).attr('pathname').split('/');96 var pk = routes[routes.length-1];97 136 98 137 $.ajax({ … … 125 164 126 165 // ahora llamar al ajax de obtener la resena del pdf 127 ObtenerHashPDFServerMultiples(parameters, cert );166 ObtenerHashPDFServerMultiples(parameters, cert, pk); 128 167 129 168 }, … … 139 178 error = "No hay soporte para el manejo del certificado"; 140 179 } 180 $.ajax({ 181 type: 'POST', 182 async: false, 183 url:URL_COMPROBAR_FIRMA+pk, 184 success: function(datos){ 185 console.log(datos); 186 }, 187 error: function(jqXHR, textStatus, errorThrown){ 188 console.log('error: ' + textStatus); 189 } 190 }); 141 191 simple_modal(error); 142 192 } … … 155 205 * @param parameters Recibe los parametros 156 206 * @param cert Recibe los certificados 157 */ 158 function ObtenerHashPDFServerMultiples(parameters,cert){ 207 * @param pk Recibe el id del evento 208 */ 209 function ObtenerHashPDFServerMultiples(parameters,cert,pk){ 159 210 160 211 $.ajax({ 161 212 type: 'POST', 162 213 contentType: 'application/json', 163 url:"https://192.168.12.154:8443/Murachi/0.1/archivos/pdfs2", 164 //url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs", 165 //url: "https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/firmados/pdfs", 214 url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfsqr", 166 215 dataType: "json", 167 216 data: parameters, … … 177 226 window.hwcrypto.sign(cert, {type: hashtype, hex: hash}, {lang: lang}).then( 178 227 function(signature) { 179 FinalizarFirmaMultiples(signature.hex );228 FinalizarFirmaMultiples(signature.hex, pk); 180 229 }, 181 230 function(err) { … … 190 239 error = "No hay soporte para el manejo del certificado"; 191 240 } 241 $.ajax({ 242 type: 'POST', 243 async: false, 244 url:URL_COMPROBAR_FIRMA+pk, 245 success: function(datos){ 246 console.log(datos); 247 }, 248 error: function(jqXHR, textStatus, errorThrown){ 249 console.log('error: ' + textStatus); 250 } 251 }); 192 252 simple_modal(error); 193 253 }); … … 204 264 * Función para enviar la firma al servidor 205 265 * @param signature Recibe la firma 206 */ 207 function FinalizarFirmaMultiples(signature){ 266 * @param pk Recibe el id del evento 267 */ 268 function FinalizarFirmaMultiples(signature, pk){ 208 269 209 270 $.ajax({ 210 271 type: 'POST', 211 272 contentType: 'application/json', 212 url:"https://192.168.12.154:8443/Murachi/0.1/archivos/pdfs/resenas", 213 //url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs/resenas", 273 url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs/resenas", 214 274 dataType: 'json', 215 275 data: JSON.stringify({"signature":signature}), … … 218 278 success: function(data, textStatus, jqXHR){ 219 279 actualizar_participante(data['signedFileId']); 280 $.ajax({ 281 type: 'POST', 282 async: false, 283 url:URL_COMPROBAR_FIRMA+pk, 284 success: function(datos){ 285 console.log(datos); 286 }, 287 error: function(jqXHR, textStatus, errorThrown){ 288 console.log('error: ' + textStatus); 289 } 290 }); 220 291 }, 221 292 error: function(jqXHR, textStatus, errorThrown){ 222 293 console.log('error en pdfs/resenas: ' + textStatus); 294 $.ajax({ 295 type: 'POST', 296 async: false, 297 url:URL_COMPROBAR_FIRMA+pk, 298 success: function(datos){ 299 console.log(datos); 300 }, 301 error: function(jqXHR, textStatus, errorThrown){ 302 console.log('error: ' + textStatus); 303 } 304 }); 223 305 } 224 306 });
Note: See TracChangeset
for help on using the changeset viewer.