diff --git a/app/assets/javascripts/ordering.js b/app/assets/javascripts/ordering.js index a3dd1050..3d4027fe 100644 --- a/app/assets/javascripts/ordering.js +++ b/app/assets/javascripts/ordering.js @@ -226,10 +226,14 @@ $(function() { $('a[data-decrease_tolerance]').on('touchclick', function() { decreaseTolerance($(this).data('decrease_tolerance')); }); - + $('a[data-reorder_previous]').on('touchclick', function() { + console.log('reorder_previous'); + update($(this).data('reorder_previous'), $(this).data('quantity'), $(this).data('tolerance')); + }); + $('a[data-confirm_switch_order]').on('touchclick', function() { return (!modified || confirm(I18n.t('js.ordering.confirm_change'))); }); updateButtons($(document)); -}); +}); \ No newline at end of file diff --git a/app/views/group_orders/_form.html.haml b/app/views/group_orders/_form.html.haml index e0ee6126..c9478de1 100644 --- a/app/views/group_orders/_form.html.haml +++ b/app/views/group_orders/_form.html.haml @@ -103,6 +103,9 @@ = @ordering_data[:order_articles][order_article.id][:previous_quantity] + = @ordering_data[:order_articles][order_article.id][:previous_tolerance] + %a.btn.btn-ordering{"data-reorder_previous": order_article.id, "data-quantity": @ordering_data[:order_articles][order_article.id][:previous_quantity], "data-tolerance": @ordering_data[:order_articles][order_article.id][:previous_tolerance]} + %i.icon-repeat + order previous - if @order.stockit? %td= truncate order_article.article.supplier.name, length: 15 %td= h order_article.article.origin