source: firmaeventos/static/js/funciones.js @ 11e5ced

Last change on this file since 11e5ced was b84cfca, checked in by rudmanmrrod <rudman22@…>, 7 years ago

Agregada cabecera y foote, y iframe para el pdf

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/**
2 * Funcion para refrescar el captcha
3 * @param element Recibe el parametro
4*/
5
6function refresh_captcha(element) {
7    $form = $(element).parents('form');
8    var url = location.protocol + "//" + window.location.hostname + ":" + location.port + "/captcha/refresh/";
9
10    $.getJSON(url, {}, function(json) {
11        $form.find('input[name="captcha_0"]').val(json.key);
12        $form.find('img.captcha').attr('src', json.image_url);
13    });
14
15    return false;
16}
17
18/**
19 * Función para obtener los usuarios de un evento
20*/
21function get_event_user() {
22    var modal = false;
23    var pasaporte = $('#id_pasaporte').val();
24    if (pasaporte!='') {
25        var routes = $(location).attr('pathname').split('/');
26        var pk = routes[routes.length-1];
27        var url = URL_USUARIO_EVENTO+pk+"/"+pasaporte;
28        $.getJSON(url, function(data){
29            if (Object.keys(data).length > 0) {
30                construir_datos(data.datos);
31            }
32            else{
33                simple_modal('Lo sentimos, no esta registrado para firmar');
34            }
35        }).fail(function(jqxhr, textStatus, error) {
36            simple_modal('Petición fállida' + textStatus + ", " + error);
37        })
38    }
39    else{
40        simple_modal('Debe ingresar un pasaporte');
41    }   
42}
43
44/**
45 * Función para crear un modal sencillo
46*/
47function simple_modal(mensaje) {
48    MaterialDialog.alert(
49        mensaje,
50        {
51            title:'Alerta',
52            buttons:{
53                close:{
54                    text:'cerrar',
55                    className:'blue',
56                }
57            }
58        }
59    );
60}
61
62/**
63 * Función para construir la data del participante
64 * @param data Recibe los datos para crear la lista
65*/
66function construir_datos(data) {
67    $('#datos_paricipante').html('');
68    html = '<ul class="collection">'
69    html += '<li class="collection-item"><b>Nombre: </b>'+data.nombres+'</li>';
70    html += '<li class="collection-item"><b>Apellido: </b>'+data.apellidos+'</li>';
71    html += '<li class="collection-item"><b>Pasaporte: </b>'+data.pasaporte+'</li>';
72    html += '<li class="collection-item"><b>Correo: </b>'+data.correo+'</li>';
73    html += '</ul>';
74    html += '<iframe width="700px" height="600px" src="https://192.168.12.154:8443/Murachi/0.1/archivos/listadopdf/cbcd0924-bbfe-49dc-afc8-f32348f20350.pdf">';
75    html += '</iframe><br/>';
76    html += '<a type="button" class="btn waves-effect blue darken-1" onclick="ObtenerCertificadoFirmanteMultiples(\''+data.documento+'\')">';
77    html += '<i class="material-icons left">mode_edit</i> Firmar</a>';
78    $('#datos_paricipante').html(html);
79}
Note: See TracBrowser for help on using the repository browser.