2013-11-25 13:48:54 +01:00
|
|
|
- content_for :javascript do
|
|
|
|
:javascript
|
|
|
|
|
|
|
|
function update_delta(input) {
|
|
|
|
var units = $(input).val();
|
|
|
|
var expected = $(input).data('units-expected');
|
|
|
|
var html;
|
|
|
|
|
|
|
|
if (units.replace(/\s/g,"")=="") {
|
|
|
|
// no value
|
|
|
|
html = '';
|
|
|
|
} else if (isNaN(units)) {
|
|
|
|
html = '<i class="icon-remove" style="color: red"></i>';
|
|
|
|
} else if (units == expected) {
|
|
|
|
// equal value
|
|
|
|
html = '<i class="icon-ok" style="color: green"></i>';
|
|
|
|
} else if (units < expected) {
|
|
|
|
html = '<span style="color: red">- '+(expected-units)+'</span>';
|
|
|
|
} else /*if (units> expected)*/ {
|
|
|
|
html = '<span style="color: green">+ '+(units-expected)+'</span>';
|
|
|
|
}
|
|
|
|
|
|
|
|
$(input).closest('tr').find('.units_delta').html(html);
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).on('change', 'input[data-units-expected]', function() {
|
|
|
|
update_delta(this);
|
|
|
|
});
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
$('input[data-units-expected]').each(function() {
|
|
|
|
update_delta(this);
|
|
|
|
});
|
2013-11-26 13:31:07 +01:00
|
|
|
});
|
|
|
|
|
2013-12-31 13:46:25 +01:00
|
|
|
%table#order_articles.ordered-articles.table.table-striped.stupidtable
|
2013-11-25 13:48:54 +01:00
|
|
|
%thead
|
|
|
|
%tr
|
2013-12-18 21:06:05 +01:00
|
|
|
%th.sort{:data => {:sort => 'string'}}= heading_helper Article, :order_number, short: true
|
2013-12-31 13:46:25 +01:00
|
|
|
%th.default-sort.sort{:data => {:sort => 'string'}}= heading_helper Article, :name
|
2013-12-30 14:34:26 +01:00
|
|
|
%th= heading_helper Article, :unit
|
2013-11-25 13:48:54 +01:00
|
|
|
%th Members
|
|
|
|
%th Ordered
|
2013-12-30 14:34:26 +01:00
|
|
|
%th= heading_helper Article, :price
|
2013-12-18 21:53:31 +01:00
|
|
|
-#%th Invoice # TODO implement invoice screen
|
2013-11-25 13:48:54 +01:00
|
|
|
%th Received
|
2013-12-30 14:34:26 +01:00
|
|
|
%th= heading_helper ArticlePrice, :price
|
2013-11-25 13:48:54 +01:00
|
|
|
%th
|
2013-12-30 14:34:26 +01:00
|
|
|
%th= t 'ui.actions'
|
2013-12-31 13:46:25 +01:00
|
|
|
%tfoot
|
|
|
|
%tr
|
|
|
|
%th{:colspan => 10}
|
|
|
|
= link_to t('.add_article'), new_order_order_article_path(@order), remote: true, class: 'btn btn-small'
|
2013-11-25 13:48:54 +01:00
|
|
|
%tbody#result_table
|
|
|
|
- @order_articles.each do |order_article|
|
2013-12-18 21:06:05 +01:00
|
|
|
= render :partial => 'edit_amount', :locals => {:order_article => order_article}
|
2013-11-25 13:48:54 +01:00
|
|
|
|