src/templates/ReclutaProceso/cambiaUnidad.html.twig line 1

Open in your IDE?
  1. {% extends "@crud\\crud.html.twig" %}
  2. {% block jquery %}
  3.     {{ parent() }}
  4.     <script type="text/javascript">
  5.         $(function()
  6.         {
  7.             $("#buscar").click(function(e){
  8.                 if ($('#cedula').val())
  9.                 {
  10.                     var url='{{ path('search_recluta_asignado', {'cedula': '__CEDULA__'}) }}';
  11.                     url=url.replace('__CEDULA__',$('#cedula').val());
  12.                     $('#contenedor_cambio').mask('&nbsp;&nbsp;&nbsp;&nbsp;Buscando...');
  13.                     $.getJSON(url , function(result){
  14.                         $('#contenedor_cambio').unmask();
  15.                         if (result.ok)
  16.                         {
  17.                             $('#resultados').removeClass('hide');
  18.                             $('#base').val(result.base);
  19.                             $('#centro').html(result.centros);
  20.                             $('#unidad').html(result.unidades);
  21.                             $('#unidad_asignada').val(result.unidad);
  22.                             $('#recluta').val(result.recluta);
  23.                             $('#asignado_a').html(result.asignado);
  24.                         }
  25.                         else
  26.                         {
  27.                             showError(bootbox, result.error);
  28.                         }
  29.                     });
  30.                 }
  31.             });        
  32.             $("#cambiar").click(function(e){
  33.                 if ($('#unidad').val()!=$('#unidad_asignada').val())
  34.                 {
  35.                     var url='{{ path('do_cambiar_unidad', {'reclutaProceso': '__RECLUTA__', 'unidad': '__UNIDAD__'}) }}';
  36.                     url=url.replace('__RECLUTA__',$('#recluta').val());
  37.                     url=url.replace('__UNIDAD__',$('#unidad').val());
  38.                     $('#contenedor_cambio').mask('&nbsp;&nbsp;&nbsp;&nbsp;Cambiando...');
  39.                     $.getJSON(url , function(result){
  40.                         $('#contenedor_cambio').unmask();
  41.                         if (result.ok)
  42.                         {
  43.                             showError(bootbox, 'Cambio realizado');
  44.                             $('#resultados').addClass('hide');
  45.                             $('#cedula').val('');
  46.                         }
  47.                         else
  48.                         {
  49.                             showError(bootbox, result.error);
  50.                         }
  51.                     });
  52.                 }
  53.                 else
  54.                 {
  55.                     showError(bootbox, 'No ha cambiado la unidad');
  56.                 }
  57.             });        
  58.             $("#base").change(function(e){
  59.                 if ($("#base").val())
  60.                 {
  61.                     $('#resultados').mask('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cargando...');
  62.                     var url = '{{ path('load_centros_por_base', {'base': '__BASE__'}) }}';
  63.                     url = url.replace('__BASE__', $("#base").val());
  64.                     $('#centro').load(url, function(){
  65.                         $('#unidad').html('');  
  66.                         $('#resultados').unmask();
  67.                     });  
  68.                 }
  69.             }); 
  70.             $("#centro").change(function(e){
  71.                 if ($("#centro").val())
  72.                 {
  73.                     $('#resultados').mask('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cargando...');
  74.                     var url = '{{ path('load_unidades_por_centro', {'centro': '__CENTRO__'}) }}';
  75.                     url = url.replace('__CENTRO__', $("#centro").val());
  76.                     $('#unidad').load(url, function(){
  77.                         $('#resultados').unmask();
  78.                     });  
  79.                 }
  80.             }); 
  81.         
  82.         });
  83.         
  84.     </script>    
  85.     
  86. {% endblock %}
  87. {% block content %}
  88.     <div class="widget-box transparent">
  89.         <div class="widget-header widget-header-flat">
  90.             <h4 class="widget-title lighter">
  91.                 <i class="fas fa-pencil-alt orange"></i>
  92.                 Cambiar unidad a recluta
  93.             </h4>
  94.             <!--div class="widget-toolbar">
  95.                 <a href="#" data-action="collapse">
  96.                     <i class="fas fa-chevron-up"></i>
  97.                 </a>
  98.             </div-->
  99.         </div>
  100.         <div id='contenedor_cambio' class="widget-body" style="display: block;">
  101.             <div class="widget-main no-padding">
  102.                 <br>
  103.                     <table>
  104.                         <thead>
  105.                             <tr>
  106.                                 <td style='padding: 8px'>
  107.                                     Indique la cédula del recluta:&nbsp;
  108.                                 </td>
  109.                                 <td style='padding: 8px'>
  110.                                     <input id='cedula' type='text'> <button id='buscar'>Buscar</button>   
  111.                                 </td>
  112.                             </tr>
  113.                         <thead>
  114.                         <tbody id='resultados' class='hide'>
  115.                             <tr>
  116.                                 <td style='padding: 8px'>
  117.                                     Asignado a:
  118.                                     <input id='unidad_asignada' type='hidden'>
  119.                                     <input id='recluta' type='hidden'>
  120.                                 </td>
  121.                                 <td style='padding: 8px' id='asignado_a'>
  122.                                     jajajajajaja    
  123.                                 </td>
  124.                             </tr>
  125.                             <tr>
  126.                                 <td style='padding: 8px'>
  127.                                     Cambiar a:
  128.                                 </td>
  129.                                 <td style='padding: 8px'>
  130.                                 </td>
  131.                             </tr>
  132.                             <tr>
  133.                                 <td style='padding: 8px'>
  134.                                     Base Movilización:
  135.                                 </td>
  136.                                 <td style='padding: 8px'>
  137.                                     <select id='base'>
  138.                                         {% for base in bases %}
  139.                                             <option value='{{ base.id }}'>{{ base }}</option>
  140.                                         {% endfor %}
  141.                                     </select>    
  142.                                 </td>
  143.                             </tr>
  144.                             <tr>
  145.                                 <td style='padding: 8px'>
  146.                                     Centro Movilización:
  147.                                 </td>
  148.                                 <td style='padding: 8px'>
  149.                                     <select id='centro'>
  150.                                     </select>
  151.                                 </td>
  152.                             </tr>
  153.                             <tr>
  154.                                 <td style='padding: 8px'>
  155.                                     Unidad Militar:
  156.                                 </td>
  157.                                 <td style='padding: 8px'>
  158.                                     <select id='unidad'>
  159.                                     </select>
  160.                                 </td>
  161.                             </tr>
  162.                             <tr>
  163.                                 <td style='padding: 8px'>
  164.                                 </td>
  165.                                 <td style='padding: 8px'>
  166.                                     <button id='cambiar'>Cambiar</button>
  167.                                 </td>
  168.                             </tr>
  169.                         </tbody>
  170.                 </table>
  171.             </div>                   
  172.         </div>                   
  173.     </div>
  174. {% endblock %}