templates/movimientos/item_movimiento/new.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.     <ul>
  6.         {% for t in movimiento.detalle %}
  7.                 <li>{{ t|upper }}</li>
  8.         {% endfor %}
  9.     </ul>
  10.     {% for message in app.flashes('error') %}
  11.         <div class="alert alert-danger">
  12.             {{ message }}
  13.         </div>
  14.     {% endfor %}
  15.     {% if movimiento.modificable %}
  16.         <div class="card p-4">
  17.                 {{ include('movimientos/item_movimiento/_form.html.twig') }}
  18.         </div>
  19.     {% endif %}
  20.     <hr>
  21.     <div class="card p-4">
  22.         <table class="table table table-striped table-hover table-bordered table-sm">
  23.             <thead>
  24.                 <tr>
  25.                     <th>#</th>
  26.                     <th>Articulo</th>
  27.                     <th>Cantidad</th>
  28.                     {% if movimiento.yaProcesada %}
  29.                         <th>
  30.                                  {{ movimiento.instance == 'oc' ? 'Cant. Ing.' : 'Devol. Art.' }}
  31.                         </th>
  32.                         <th>Observaciones</th>
  33.                     {% else %}
  34.                         <th></th>
  35.                     {% endif %}
  36.                 </tr>
  37.             </thead>
  38.             <tbody>
  39.                 {% for it in movimiento.items %}
  40.                     <tr>
  41.                         <td>{{ loop.index }}</td>
  42.                         <td>{{ it.articulo }}</td>
  43.                         <td class="text-right">{{ it.cantidad }}</td>                    
  44.                         
  45.                             {% if movimiento.yaProcesada %}
  46.                                 <td class="text-right">
  47.                                     {{ it.cantidadIngresada }}
  48.                                 </td>
  49.                                 <td>
  50.                                     {{ it.observaciones }}
  51.                                 </td>
  52.                             {% else %}
  53.                                 <td class="text-center">
  54.                                     <a data-loop="{{ loop.index }}" 
  55.                                        class="btn btn-danger btn-sm del-it" 
  56.                                        href="{{ path('app_movimientos_item_movimiento_delete', { id : it.id }) }}"/>-</a>
  57.                                 </td>
  58.                                 
  59.                             {% endif %}
  60.                         
  61.                     </tr>
  62.                 {% endfor %}
  63.             </tbody>
  64.         </table>
  65.         {% if movimiento.finalizable and not movimiento.yaProcesada %}
  66.             <form method="post" action="{{ path(pathsend, { id : movimiento.id }) }}" >
  67.                 <input type="submit" class="btn btn-primary finalice" value="Finalizar Movimiento"/>
  68.             </form>
  69.         {% endif %}
  70.     </div>
  71.     <br>
  72.     <a href="{{ path(path) }}" class="btn btn-success">
  73.                     {{ movimiento.yaProcesada ? '<< Volver' : 'Dejar en Borrador' }}
  74.     </a>
  75. </div>
  76. {% endblock %}
  77. {% block javascripts_footer %}
  78.     
  79.     {{ parent() }}
  80.     <script type="text/javascript">
  81.         $('.task').change(function(){
  82.                                         $('#emailHelp').html('');
  83.                                         let s = $(".task option:selected").data("task")
  84.                                         if (s)
  85.                                         {
  86.                                             $('#emailHelp').html(s);
  87.                                         }
  88.         });
  89.         $('.finalice').click(function(event){
  90.                                                 event.preventDefault();
  91.                                                 let f = $(this).closest('form');
  92.                                                 bootbox.confirm({
  93.                                                                     message: 'Seguro finalizar el movimiento?',
  94.                                                                     buttons: {
  95.                                                                             confirm: {
  96.                                                                                     label: 'Si, finalizar',
  97.                                                                                     className: 'btn-success'
  98.                                                                             },
  99.                                                                             cancel: {
  100.                                                                                     label: 'No, cancelar',
  101.                                                                                     className: 'btn-danger'
  102.                                                                             }
  103.                                                                     },
  104.                                                                     callback: function (result) {
  105.                                                                                                   if (result)
  106.                                                                                                   {
  107.                                                                                                         f.submit();
  108.                                                                                                   }
  109.                                                                                                 }
  110.                                                                 });
  111.         });
  112.         $('.del-it').click(function(event) {
  113.                                                 event.preventDefault();
  114.                                                 let a = $(this);
  115.                                                 bootbox.confirm({
  116.                                                                     message: 'Seguro Eliminar el item # ' + a.data('loop') + '?',
  117.                                                                     buttons: {
  118.                                                                             confirm: {
  119.                                                                                     label: 'Si, eliminar',
  120.                                                                                     className: 'btn-success'
  121.                                                                             },
  122.                                                                             cancel: {
  123.                                                                                     label: 'No, cancelar',
  124.                                                                                     className: 'btn-danger'
  125.                                                                             }
  126.                                                                     },
  127.                                                                     callback: function (result) {
  128.                                                                                                   if (result)
  129.                                                                                                   {
  130.                                                                                                         $.post(a.attr('href'),
  131.                                                                                                                function (data){
  132.                                                                                                                                 if (data.ok)
  133.                                                                                                                                 {
  134.                                                                                                                                     window.location.href = window.location.href;
  135.                                                                                                                                 }
  136.                                                                                                                                 else
  137.                                                                                                                                 {
  138.                                                                                                                                     bootbox.alert('No se pudo llevar a cabo la eliminacion del item # ' + a.data('loop'));
  139.                                                                                                                                 }
  140.                                                                                                                });
  141.                                                                                                   }
  142.                                                                                                 }
  143.                                                                 });
  144.         });
  145.     </script>
  146. {% endblock %}