Changeset fd66636 in firmaeventos


Ignore:
Timestamp:
Nov 22, 2017, 1:35:39 PM (6 years ago)
Author:
lhernandez <lhernandez@…>
Branches:
master
Children:
adb2e3a
Parents:
406146f (diff), 2ce257a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of https://github.com/cenditel-desarrollo/FirmaEventos

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • base/templates/base.vars.javascript.html

    rd2472e8 r2c1cb23  
    66    // URL para actualizar la firma de un participante
    77    var URL_ACTUALIZAR_PARTICIPACION = "{% url 'participantes:update_participante_evento' %}";
     8   
     9    // URL para comprobar si el firmante es el último
     10    var URL_ULTIMO_FIRMANTE = "{% url 'participantes:participante_restante_evento_nid' %}";
    811           
    912</script>
  • eventos/templates/register.event.html

    r6312fce r406146f  
    5858
    5959{% block content %}
    60     <div class="content center">
     60    <div class="content">
     61      <div class="center">
    6162        <h5>Datos del Evento</h5><hr/><br>
    6263        <form id="form" method="post" enctype="multipart/form-data">
     
    7980                <div class="btn">
    8081                <span for="icon_prefix {{ form.archivo.auto_id }}">Archivo</span>
    81                     <input type="file" name="file" id="file" accept=".pdf">
     82                    <input type="file" name="file" id="file" accept="application/pdf">
    8283                </div>
    8384                <div class="file-path-wrapper">
     
    8788               
    8889            </div>
     90          </div>
     91            <div class="col s8 m2 offset-s2">
    8992            <div id="pdf-main-container" style="display:none;"><center><h5>Configurar Posicion de la Firma</h5></center>
    9093                  <div id="pdf-loader2">Cargando documento ...</div>
     
    9295                    <div id="pdf-meta2">
    9396                      <div id="pdf-buttons2">
    94                         <button type="button" id="pdf-prev2" class="btn btn-default btn-sm">
    95                           <span class="glyphicon glyphicon-step-backward"></span>
    96                         </button>
    97                         <button type="button" id="pdf-next2" class="btn btn-default btn-sm">
    98                           <span class="glyphicon glyphicon-step-forward"></span>
    99                         </button>                               
     97                        <a class="waves-effect waves-light btn" id="pdf-prev2"><i class="material-icons">keyboard_arrow_left</i></a>
     98                        <a class="waves-effect waves-light btn" id="pdf-next2"><i class="material-icons">keyboard_arrow_right</i></a>
    10099                      </div>
    101100                      <div id="page-count-container">Página <div id="pdf-current-page2"></div> de <div id="pdf-total-pages2"></div></div>
    102101                    </div>
     102                    <img class="text" src="{% static 'img/QRCode.png' %}" id="texto"/>
    103103                    <div class="overflow" >
    104104                      <div id="container1" class=".cropper-hidden">
     
    112112                    <div id="page-loader2">Cargando página ...</div>
    113113              </div>
     114            </div>
     115            <div class="center">
    114116            <h5>Datos de los Participantes</h5><hr/><br>
    115117            <table class="striped" id="id_orders_table">
     
    144146                </tbody>
    145147            </table>
    146             <div>
     148            </div>
     149            <div class="center">
     150                {{ form.pos_x }}
     151                {{ form.pos_y }}
     152                {{ form.pag }}
    147153                <button type="submit" class="btn waves-effect blue darken-1">Registrar</button>
    148154            </div>
  • participantes/urls.py

    re91566e r2c1cb23  
    88    url(r'^search-participante/$', ParticipanteEventoSearch.as_view(), name='search_participante_nid'),
    99    url(r'^update-participante-evento/$', AjaxParticipanteFirmaEvento.as_view(), name='update_participante_evento'),
     10    url(r'^participante-restante/(?P<evento>\d+)/$', ParticipantesRestantes.as_view(), name='participante_restante_evento'),
     11    url(r'^participante-restante/$', ParticipantesRestantes.as_view(), name='participante_restante_evento_nid'),
    1012]
  • participantes/views.py

    rd17da63 r2c1cb23  
    113113
    114114        return JsonResponse(data, safe=False)
     115
     116class ParticipantesRestantes(View):
     117    """!
     118    Muestra si el participante restante es el último
     119
     120    @author Rodrigo Boet  (rboet at cenditel.gob.ve)
     121    @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a>
     122    @date 22-11-2017
     123    @version 1.0.0
     124    """
     125
     126    def get(self,request,evento):
     127        """!
     128        Metodo para antender la vista por GET
     129
     130        @author Rodrigo Boet (rboet at cenditel.gob.ve)
     131        @copyright GNU/GPLv3
     132        @date 22-11-2017
     133        @param self <b>{object}</b> Objeto que instancia la clase
     134        @param request <b>{object}</b> Objeto que contiene la petición
     135        @param evento <b>{int}</b> Recibe el id del evento
     136        @return Retorna un Json con la respuesta
     137        """
     138        participante_evento = ParticipanteEvento.objects.select_related().filter(fk_evento=evento)
     139        falta_porfirma = participante_evento.filter(firma=False).count()
     140        data = {}
     141        if(falta_porfirma==1):
     142            evento = Evento.objects.get(pk=evento)
     143            data = {'valid':True,'data':{'posX':evento.pos_x,'posY':evento.pos_y,'page':evento.pag}}
     144        else:
     145            data = {'valid':False}
     146
     147        return JsonResponse(data, safe=False)
  • static/css/style.css

    r4db73c3 r406146f  
    5252    color: #1e88e5;
    5353}
     54
     55.overflow {
     56  position: relative;
     57  overflow: auto;
     58  width: 100%;
     59}
  • static/js/DraggableSortable.js

    r6312fce r406146f  
    3434          VALOR_X = parseInt(ui.position['left']);
    3535          VALOR_Y = parseInt(ui.position['top']);
     36          console.log(VALOR_X, VALOR_Y)
    3637        }
    37        
     38        $('#id_pos_x').val(VALOR_X)
     39        $('#id_pos_y').val(VALOR_Y)
     40        $('#id_pag').val(__CURRENT_PAGE)
    3841      },
    3942   
  • static/js/docsDraggable.js

    r6312fce r406146f  
    110110
    111111  // Validate whether PDF
    112   if(['application/pdf'].indexOf($("#file-sign-ft_Vble").get(0).files[0].type) == -1) {
     112  if(['application/pdf'].indexOf($("#file").get(0).files[0].type) == -1) {
    113113      alert('Error : Not a PDF');
    114114      return;
     
    128128
    129129  // Send the object url of the pdf
    130   showPDF2(URL.createObjectURL($("#file-sign-ft_Vble").get(0).files[0]));
     130  showPDF2(URL.createObjectURL($("#file").get(0).files[0]));
    131131
    132132
  • static/js/funciones.js

    ra1de3f1 r2c1cb23  
    9191*/
    9292function ObtenerCertificadoFirmanteMultiples(fileId){
    93 
    94         // identificador del archivo en el servidor
    95         window.hwcrypto.getCertificate({lang: "en"}).then(
    96                 function(response) {
    97                         var cert = response;
    98                         var parameters = "";
    99                         parameters = JSON.stringify({
    100                                 "fileId":fileId,
    101                                 "certificate":cert.hex,
    102                                 "reason":"Certificado",
    103                                 "location":"RedGealc",
    104                                 "contact":"RedGealc",
    105                                 "signatureVisible":"false",
    106                                 "signaturePage": "",
    107                                 "xPos": "",
    108                                 "yPos": ""
    109                                 });                             
    110 
    111                         // ahora llamar al ajax de obtener la resena del pdf
    112                         ObtenerHashPDFServerMultiples(parameters, cert);       
    113 
    114                 },
    115                 function(err) {
    116             var error;
    117             if(err == "Error: user_cancel") {
    118                 error = "El usuario cancelo la operación";
    119              }     
    120              else if(err == "Error: no_certificates") {
    121                  error = "No hay certificado disponible";
    122              }
    123              else if(err == "Error: no_implementation") {
    124                  error = "No hay soporte para el manejo del certificado";
    125                         }
    126             simple_modal(error);
     93    var xPos = yPos= signaturePage = "";
     94    var lastSignature = false;
     95    var routes = $(location).attr('pathname').split('/');
     96    var pk = routes[routes.length-1];
     97   
     98    $.ajax({
     99                type: 'GET',
     100        async: false,
     101                url:URL_ULTIMO_FIRMANTE+pk,
     102                success: function(datos){
     103            if (datos.valid==true) {
     104                xPos = datos.data.posX;
     105                yPos = datos.data.posY;
     106                signaturePage = datos.data.page;
     107                lastSignature = true;
     108            }
     109            window.hwcrypto.getCertificate({lang: "en"}).then(
     110                function(response) {
     111                    var cert = response;
     112                    var parameters = "";
     113                    parameters = JSON.stringify({
     114                        "fileId":fileId,
     115                        "certificate":cert.hex,
     116                        "reason":"Certificado",
     117                        "location":"RedGealc",
     118                        "contact":"RedGealc",
     119                        "signatureVisible":"false",
     120                        "signaturePage": signaturePage,
     121                        "xPos": xPos,
     122                        "yPos": yPos,
     123                        "lastSignature":lastSignature
     124                        });                             
     125       
     126                    // ahora llamar al ajax de obtener la resena del pdf
     127                    ObtenerHashPDFServerMultiples(parameters, cert);   
     128       
     129                },
     130                function(err) {
     131                    var error;
     132                    if(err == "Error: user_cancel") {
     133                        error = "El usuario cancelo la operación";
     134                     }     
     135                     else if(err == "Error: no_certificates") {
     136                         error = "No hay certificado disponible";
     137                     }
     138                     else if(err == "Error: no_implementation") {
     139                         error = "No hay soporte para el manejo del certificado";
     140                    }
     141                    simple_modal(error);
     142                }
     143       
     144            );
     145                },
     146                error: function(jqXHR, textStatus, errorThrown){
     147                        console.log('error: ' + textStatus);
    127148                }
    128 
    129         );
     149        });
    130150}
    131151
Note: See TracChangeset for help on using the changeset viewer.