templates/movimientos/item_movimiento/ingresar.html.twig line 1

Open in your IDE?
  1. {% extends 'navbar.html.twig' %}
  2. {% block title %}Administrar Items{% endblock %}
  3. {% block content_user %}
  4. <div class="container">
  5.     <div class="h5">
  6.         {% if tipo == 'oc' %}
  7.             Ingreso de Articulo Orden Compra
  8.         {% elseif tipo == 'or' %}
  9.             Regreso excedente orden reparacion
  10.         {% else %}
  11.             Devolucion Prestamo
  12.             
  13.         {% endif %}
  14.         <hr>
  15.     </div>
  16.     <ul>
  17.         {% for t in movimiento.detalle %}
  18.                 <li>{{ t|upper }}</li>
  19.         {% endfor %}
  20.     </ul>
  21.     <hr>
  22.     <div class="card p-4">
  23.         <form method="post" id="input-art" action="{{ path('app_movimientos_item_movimiento_procesar_ingreso', { id : movimiento.id })}}">
  24.             <table class="table table table-striped table-hover table-bordered table-sm">
  25.                 <thead>
  26.                     <tr>
  27.                         <th>#</th>
  28.                         <th>Articulo</th>
  29.                         <th>Cant. Solicitada</th>
  30.                         <th>
  31.                             {{ tipo == 'oc' ? 'Cant. Ing.' : 'Devol. Art.' }}
  32.                         </th>
  33.                         <th>Observaciones</th>
  34.                     </tr>
  35.                 </thead>
  36.                 <tbody>
  37.                     {% for it in movimiento.items %}
  38.                         <tr>
  39.                             <td>{{ loop.index }}</td>
  40.                             <td>{{ it.articulo }}</td>
  41.                             <td>{{ it.cantidad }}</td> 
  42.                             <td>
  43.                                 {% if not movimiento.yaProcesada or not movimiento.isDevuelta %}
  44.                                     <input type="text" 
  45.                                            name="item-{{ it.id }}" 
  46.                                            class="form-control form-control-sm col-2" 
  47.                                            value="{{ tipo == 'or' ? '0' : it.cantidad }}"/>
  48.                                 {% else %}
  49.                                     {{ it.cantidadIngresada }}
  50.                                 {% endif %}
  51.                             </td>    
  52.                             <td>
  53.                                 {% if not movimiento.yaProcesada or not movimiento.isDevuelta %}
  54.                                     <input type="text" name="obser-{{ it.id }}" class="form-control form-control-sm col-12" value="{{ it.observaciones }}"/>
  55.                                 {% else %}
  56.                                     {{ it.observaciones }}
  57.                                 {% endif %}
  58.                             </td>               
  59.                         </tr>
  60.                     {% endfor %}
  61.                 </tbody>
  62.             </table>
  63.             {% if not movimiento.yaProcesada or not movimiento.isDevuelta %}
  64.                 <div class="form-row">
  65.                     <div class="col-lg-2">
  66.                         <input type="date" class="form-control" name="recepcion"/>
  67.                     </div>
  68.                     <!--div class="col-lg-5">
  69.                         <select class="form-control form-select" name="deposito">
  70.                             {% for d in depositos %}
  71.                                 <option value="{{ d.id }}">
  72.                                     {{ d }}
  73.                                 </option>
  74.                             {% endfor %}
  75.                         </select>
  76.                     </div-->
  77.                     <div class="col-lg-5">
  78.                         <input type="submit" value="{{ tipo == 'oc' ? 'Ingresar Articulos al Stock' : 'Realizar Devolucion' }}" class="btn btn-danger btn-input"/>
  79.                     </div>
  80.                 </div>
  81.             {% endif %}
  82.         </form>
  83.     </div>
  84.     <br>
  85.     <a href="{{ path(path) }}" class="btn btn-primary">Volver a la lista</a>
  86. </div>
  87. {% endblock %}
  88. {% block javascripts_footer %}
  89.     
  90.     {{ parent() }}
  91.     <script type="text/javascript">
  92.         $('.btn-input').click(function(event) {
  93.                                                 event.preventDefault();
  94.                                                 let form = $(this).closest('form');
  95.                                                 console.log(form.serialize());
  96.                                                 $.post(form.attr('action'),
  97.                                                        form.serialize(),
  98.                                                        function(data) {
  99.                                                                         console.log(data);
  100.                                                                         if (data.ok)
  101.                                                                         {
  102.                                                                             window.location.reload();
  103.                                                                         }
  104.                                                                         else
  105.                                                                         {
  106.                                                                             bootbox.alert(data.msg);
  107.                                                                         }
  108.                                                        });
  109.                                             });
  110.        
  111.     </script>
  112. {% endblock %}