src/templates/Usuario/new.html.twig line 1

Open in your IDE?
  1. {% extends "@crud\\crud\\new.html.twig" %}
  2. {% block jquery %}
  3.     {{ parent() }}
  4.     <script type="text/javascript">
  5.         $(function()
  6.         {
  7.             var submitted = false;
  8.             $('#searchForm').submit(function(e){
  9.                 e.preventDefault();
  10.                     if ($('#identificacion').val()=='')
  11.                     {
  12.                         showError(bootbox,"{{ 'usuario.error.identificacion' | trans({}, 'crud') }}");
  13.                     }
  14.                     else
  15.                     {
  16.                         $("#searchDiv").mask("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Buscando...");
  17.                         var url='{{ path('busca_usuario', {'numeroId':'__ID__','routeClassName': routeClassName}) }}';
  18.                         url = url.replace('__ID__',$("#identificacion").val());
  19.                         $.getJSON(url, function(data) {
  20.                             if (data.resultado=='NO_USER')
  21.                             {
  22.                                 $("#idData").html($('#identificacion').val());
  23.                                 $("#searchDiv").unmask();
  24.                                 $("#searchDiv").addClass('hide');
  25.                                 $("#nouser").removeClass('hide');
  26.                             }
  27.                             else
  28.                             {
  29.                                 $("#searchDiv").unmask();
  30.                                 $("#searchDiv").addClass('hide');
  31.                                 $("#personBDId").val(data.id);
  32.                                 $("#personId").html(data.identificacion);
  33.                                 $("#personNombre").html(data.nombre);
  34.                                 $("#personTelefono").html(data.telefono);
  35.                                 $("#personMovil").html(data.movil);
  36.                                 $("#personMail").html(data.mail);
  37.                                 $("#personDireccion").html(data.direccion);
  38.                                 if (data.foto != "")
  39.                                     $("#personFoto").html('<img width="100%" src="'+data.foto+'">');
  40.                                 else
  41.                                     $("#personFoto").html('<img width="100%" src="{{ asset('images/foto_hombre.jpg') }}">');
  42.                                 if (!data.availabe)
  43.                                 {
  44.                                     $("#inhabilitado").removeClass('hide');
  45.                                     $("#inhabilitadoData").html(data.rol);
  46.                                     $("#confirmar").addClass('hide');
  47.                                 }
  48.                                 $("#person").removeClass('hide');
  49.                             }
  50.                         });
  51.                     }
  52.             });
  53.             $('#searchAgainNoUser').click(function(){
  54.                 $('#nouser').addClass('hide');
  55.                 $('#searchDiv').removeClass('hide');
  56.                 submitted = false;
  57.             });
  58.             $('#searchAgainWrongPerson').click(function(){
  59.                 $('#person').addClass('hide');
  60.                 $('#inhabilitado').addClass('hide');
  61.                 $("#confirmar").removeClass('hide');
  62.                 $('#searchDiv').removeClass('hide');
  63.                 submitted = false;
  64.             });
  65.             $('#confirmar').click(function(){
  66.                 $("#person").mask("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cargando...");
  67.                 var url='{{ path('fast_create', { 'rol': rol, 'routeClassName': routeClassName, 'id': '__ID__'}) }}';
  68.                 var id = $('#personBDId').val();
  69.                 url = url.replace('__ID__', id);
  70.                 document.location.href = url;
  71.             });
  72.             $('#crear').click(function(){
  73.                 $("#nouser").addClass("hide");
  74.                 $('#form_{{ routeClassName }}_username').val($('#identificacion').val());
  75.                 $('#form_{{ routeClassName }}_username').attr('readonly',true);
  76.                 $('#form_{{ routeClassName }}_nit').val($('#identificacion').val());
  77.                 $("#crud_form_{{ routeClassName}}").removeClass("hide");
  78.             });
  79.             $('#searchAgainForm').click(function(e){
  80.                 e.preventDefault();
  81.                 $('#personaId').html('');
  82.                 $('#searchDiv').removeClass('hide');
  83.                 $("#crud_form_{{ routeClassName}} input").val('');
  84.                 $("#crud_form_{{ routeClassName}} select").val('');
  85.                 $("#span_{{ routeClassName}}_direccion").html('');
  86.                 $("#crud_form_{{ routeClassName}}").addClass("hide");
  87.                 submitted = false;
  88.             });
  89.             $(".address").change(function(){
  90.                 var address = $('#form_{{ routeClassName }}_calle').val();
  91.                 address += ' Nro: '+$('#form_{{ routeClassName }}_numero').val();
  92.                 if ($('#form_{{ routeClassName }}_apartamento').val())
  93.                     address += ' Apto: '+$('#form_{{ routeClassName }}_apartamento').val();
  94.                 address += ' e/'+$('#form_{{ routeClassName }}_entreCalle').val();
  95.                 if ($('#form_{{ routeClassName }}_reparto').val())
  96.                     address += ', '+$('#form_{{ routeClassName }}_reparto').val();
  97.                 if ($('#form_{{ routeClassName }}_municipio').val())
  98.                     address += '. '+$('#form_{{ routeClassName }}_municipio option:selected').text();
  99.                 $('#form_{{ routeClassName }}_direccion').val(address);
  100.                 $('#span_{{ routeClassName }}_direccion').html(address);
  101.             });
  102.         });
  103.         
  104.     </script>    
  105. {% endblock %} 
  106.  
  107. {% block ico_heading %}
  108. {% endblock %}
  109. {% block formulario %}
  110.     {% include 'Usuario\\formulario_new.html.twig' %}
  111. {#    
  112.     <span id="personaId" class="hide"></span>
  113.     <div id="content-usuario">
  114.         <div id="searchDiv" class="row">
  115.             <form id="searchForm">
  116.                 <div class="col-xs-12">
  117.                     <h5 class="blue lighter">{{ 'usuario.datos.identificacionTip' | trans({}, 'crud') | upper }}</h5>
  118.                 </div>
  119.                 <div class="col-xs-12 col-sm-5">
  120.                     <table class="table table-striped table-bordered table-hover">
  121.                         <tr>
  122.                             <th style="width: 30%;">
  123.                                 <label class=" required ">
  124.                                     {{ 'admin.fields.username' | trans({}, 'crud') | upper }}
  125.                                 </label>
  126.                             </th>    
  127.                             <td>
  128.                                 <input id="identificacion" type="text" style="width: 100%" required="true">
  129.                                 </select>
  130.                             </td>
  131.                         </tr>
  132.                     </table>
  133.                 </div>    
  134.                 <div class="col-xs-12 col-sm-2">
  135.                     <button id="searchBtn" class="btn btn-info">
  136.                         <i class="fas fa-search"></i>
  137.                         {{ 'botones.buscar' | trans({}, 'crud') | upper }}
  138.                     </button>
  139.                 </div>  
  140.             </form>        
  141.         </div> 
  142.         <div id="nouser" class="hide">
  143.             <div class="alert alert-danger">
  144.                 <strong>
  145.                     <i class="fas fa-info-circle bigger-150"></i>
  146.                     {{ 'usuario.error.noexist' | trans({}, 'crud') }}
  147.                 </strong>
  148.                 <br>
  149.                 <br>
  150.                 <table>
  151.                     <tr>
  152.                         <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  153.                         <td style="text-align: right">
  154.                             <strong>{{ 'admin.fields.username' | trans({}, 'crud') }}:</strong> 
  155.                         </td>
  156.                         <td>&nbsp;&nbsp;</td>
  157.                         <td>
  158.                             <span id='idData'></span>
  159.                         </td>
  160.                     </tr>
  161.                 </table>
  162.                 <br>
  163.             </div>
  164.             <div class="row">
  165.                 <div class="col-xs-6" style="text-align: center">
  166.                     <button id="crear" class="btn btn-success">
  167.                         <i class="fas fa-plus"></i>
  168.                         {{ 'botones.nuevo' | trans({}, 'crud') | upper }}
  169.                     </button>
  170.                 </div>    
  171.                 <div class="col-xs-6" style="text-align: center">
  172.                     <button id="searchAgainNoUser" class="btn btn-info">
  173.                         <i class="fas fa-search"></i>
  174.                         {{ 'botones.rebuscar' | trans({}, 'crud') | upper }}
  175.                     </button>
  176.                 </div>    
  177.             </div>    
  178.         </div> 
  179.         <div id="person" class="hide">
  180.             <input id="personBDId" type="hidden">
  181.             <div class="row">
  182.                 <div id="personFoto" class="col-xs-12 col-sm-6 col-md-2" style="text-align: center">
  183.                 </div>                
  184.                 <div class="col-xs-12 col-sm-6 col-md-10">
  185.                     <div class="row">
  186.                         <div class="col-xs-12 col-sm-6">
  187.                             <table class="table table-striped table-bordered table-hover">
  188.                                 <tr>
  189.                                     <th style="width: 30%;">
  190.                                         <label>
  191.                                             {{ 'admin.fields.username' | trans({}, 'crud') }}
  192.                                         </label>
  193.                                     </th>    
  194.                                     <td>
  195.                                         <span id="personId"></span>
  196.                                     </td>
  197.                                 </tr>
  198.                             </table>
  199.                         </div>                
  200.                         <div class="col-xs-12 col-sm-6">
  201.                             <table class="table table-striped table-bordered table-hover">
  202.                                 <tr>
  203.                                     <th style="width: 30%;">
  204.                                         <label>
  205.                                             {{ 'admin.fields.nombreCompleto' | trans({}, 'crud') }}
  206.                                         </label>
  207.                                     </th>    
  208.                                     <td>
  209.                                         <span id="personNombre"></span>
  210.                                     </td>
  211.                                 </tr>
  212.                             </table>
  213.                         </div>                
  214.                     </div>
  215.                     <div class="row">
  216.                         <div class="col-xs-12 col-sm-6">
  217.                             <table class="table table-striped table-bordered table-hover">
  218.                                 <tr>
  219.                                     <th style="width: 30%;">
  220.                                         <label>
  221.                                             {{ 'admin.fields.telefono' | trans({}, 'crud') }}
  222.                                         </label>
  223.                                     </th>    
  224.                                     <td>
  225.                                         <span id="personTelefono"></span>
  226.                                     </td>
  227.                                 </tr>
  228.                             </table>
  229.                         </div>                
  230.                         <div class="col-xs-12 col-sm-6">
  231.                             <table class="table table-striped table-bordered table-hover">
  232.                                 <tr>
  233.                                     <th style="width: 30%;">
  234.                                         <label>
  235.                                             {{ 'admin.fields.movil' | trans({}, 'crud') }}
  236.                                         </label>
  237.                                     </th>    
  238.                                     <td>
  239.                                         <span id="personMovil"></span>
  240.                                     </td>
  241.                                 </tr>
  242.                             </table>
  243.                         </div>                
  244.                     </div>
  245.                     <div class="row">
  246.                         <div class="col-xs-12 col-sm-6">
  247.                             <table class="table table-striped table-bordered table-hover">
  248.                                 <tr>
  249.                                     <th style="width: 30%;">
  250.                                         <label>
  251.                                             {{ 'admin.fields.email' | trans({}, 'crud') }}
  252.                                         </label>
  253.                                     </th>    
  254.                                     <td>
  255.                                         <span id="personMail"></span>
  256.                                     </td>
  257.                                 </tr>
  258.                             </table>
  259.                         </div>                
  260.                         <div class="col-xs-12 col-sm-6">
  261.                             <table class="table table-striped table-bordered table-hover">
  262.                                 <tr>
  263.                                     <th style="width: 30%;">
  264.                                         <label>
  265.                                             {{ 'admin.fields.direccion' | trans({}, 'crud') }}
  266.                                         </label>
  267.                                     </th>    
  268.                                     <td>
  269.                                         <span id="personDireccion"></span>
  270.                                     </td>
  271.                                 </tr>
  272.                             </table>
  273.                         </div>  
  274.                     </div>  
  275.                 </div>
  276.             </div>    
  277.             <div id="inhabilitado" class="row hide">
  278.                 <div class="col-xs-12">
  279.                     <div class="hr hr-8 hr-dotted"></div>
  280.                     <div class="alert alert-danger">
  281.                         <strong>
  282.                             <i class="fas fa-info-circle bigger-150"></i>
  283.                             {{ 'usuario.inhabilitado.rol' | trans({}, 'crud') }}
  284.                         </strong>
  285.                         <br>
  286.                         <br>
  287.                         <span id="inhabilitadoData"><span>
  288.                         <br>
  289.                     </div>
  290.                 </div>   
  291.             </div>    
  292.             <div class="hr hr-8 hr-dotted"></div>
  293.             <div class="row">
  294.                 <div class="col-xs-6" style="text-align: center">
  295.                     <button id="confirmar" class="btn btn-success">
  296.                         <i class="fas fa-check"></i>
  297.                         {{ 'botones.confirmar' | trans({}, 'crud') | upper }}
  298.                     </button>
  299.                 </div>    
  300.                 <div class="col-xs-6" style="text-align: center">
  301.                     <button id="searchAgainWrongPerson" class="btn btn-info">
  302.                         <i class="fas fa-search"></i>
  303.                         {{ 'botones.rebuscar' | trans({}, 'crud') | upper }}
  304.                     </button>
  305.                 </div>    
  306.             </div>    
  307.         </div>        
  308.         <div id="formDiv" class="hide">
  309.             <div id="formulario"></div>
  310.         </div>
  311.     </div>
  312.     #}
  313. {% endblock formulario %} 
  314.