Readonly receive input if GroupOrderArticle result has manually been changed

Conflicts:
	app/helpers/orders_helper.rb
	app/views/orders/_edit_amount.html.haml
This commit is contained in:
wvengen 2014-01-03 10:33:09 +01:00
parent 7aae7f4d55
commit 98f59a3de3
7 changed files with 43 additions and 9 deletions

View file

@ -4,7 +4,6 @@
- order_title = []
- order_title.append Article.human_attribute_name(:manufacturer)+': ' + order_article.article.manufacturer unless order_article.article.manufacturer.to_s.empty?
- order_title.append Article.human_attribute_name(:note)+': ' + order_article.article.note unless order_article.article.note.to_s.empty?
- units_expected = (order_article.units_billed or order_article.units_to_order)
%td= order_article.article.order_number
%td.name{title: order_title.join("\n")}= order_article.article.name
%td.unit= order_article.article.unit
@ -18,8 +17,10 @@
= order_article.units_billed
= pkg_helper order_article.article
%td
= form.text_field :units_received, class: 'input-nano package', data: {'units-expected' => units_expected}
= receive_input_field(form)
= pkg_helper order_article.article_price, false
- if order_article.result_manually_changed?
%input{type: :button, value: t('.override', default: 'Override'), class: 'btn btn-small unlocker'}
/ TODO add almost invisible text_field for entering single units
%td.units_delta
%td

View file

@ -35,6 +35,8 @@
});
init_add_article('#add_article');
$('.unlocker', '#order_articles tbody').on('click', unlock_receive_input_field);
});
function init_add_article(sel) {
@ -58,6 +60,12 @@
$('#add_article').select2('data', null);
}).select2('data', null);
}
function unlock_receive_input_field() {
var order_article_entry = $(this).closest('tr');
$('.units_received', order_article_entry).removeAttr('readonly');
$(this).remove();
}
%table#order_articles.ordered-articles.table.table-striped.stupidtable
%thead