{% extends 'navbar.html.twig' %}{% block title %}Administrar Items{% endblock %}{% block content_user %}<div class="container"> <ul> {% for t in movimiento.detalle %} <li>{{ t|upper }}</li> {% endfor %} </ul> {% for message in app.flashes('error') %} <div class="alert alert-danger"> {{ message }} </div> {% endfor %} {% if movimiento.modificable %} <div class="card p-4"> {{ include('movimientos/item_movimiento/_form.html.twig') }} </div> {% endif %} <hr> <div class="card p-4"> <table class="table table table-striped table-hover table-bordered table-sm"> <thead> <tr> <th>#</th> <th>Articulo</th> <th>Cantidad</th> {% if movimiento.yaProcesada %} <th> {{ movimiento.instance == 'oc' ? 'Cant. Ing.' : 'Devol. Art.' }} </th> <th>Observaciones</th> {% else %} <th></th> {% endif %} </tr> </thead> <tbody> {% for it in movimiento.items %} <tr> <td>{{ loop.index }}</td> <td>{{ it.articulo }}</td> <td class="text-right">{{ it.cantidad }}</td> {% if movimiento.yaProcesada %} <td class="text-right"> {{ it.cantidadIngresada }} </td> <td> {{ it.observaciones }} </td> {% else %} <td class="text-center"> <a data-loop="{{ loop.index }}" class="btn btn-danger btn-sm del-it" href="{{ path('app_movimientos_item_movimiento_delete', { id : it.id }) }}"/>-</a> </td> {% endif %} </tr> {% endfor %} </tbody> </table> {% if movimiento.finalizable and not movimiento.yaProcesada %} <form method="post" action="{{ path(pathsend, { id : movimiento.id }) }}" > <input type="submit" class="btn btn-primary finalice" value="Finalizar Movimiento"/> </form> {% endif %} </div> <br> <a href="{{ path(path) }}" class="btn btn-success"> {{ movimiento.yaProcesada ? '<< Volver' : 'Dejar en Borrador' }} </a></div>{% endblock %}{% block javascripts_footer %} {{ parent() }} <script type="text/javascript"> $('.task').change(function(){ $('#emailHelp').html(''); let s = $(".task option:selected").data("task") if (s) { $('#emailHelp').html(s); } }); $('.finalice').click(function(event){ event.preventDefault(); let f = $(this).closest('form'); bootbox.confirm({ message: 'Seguro finalizar el movimiento?', buttons: { confirm: { label: 'Si, finalizar', className: 'btn-success' }, cancel: { label: 'No, cancelar', className: 'btn-danger' } }, callback: function (result) { if (result) { f.submit(); } } }); }); $('.del-it').click(function(event) { event.preventDefault(); let a = $(this); bootbox.confirm({ message: 'Seguro Eliminar el item # ' + a.data('loop') + '?', buttons: { confirm: { label: 'Si, eliminar', className: 'btn-success' }, cancel: { label: 'No, cancelar', className: 'btn-danger' } }, callback: function (result) { if (result) { $.post(a.attr('href'), function (data){ if (data.ok) { window.location.href = window.location.href; } else { bootbox.alert('No se pudo llevar a cabo la eliminacion del item # ' + a.data('loop')); } }); } } }); }); </script>{% endblock %}