Improve unlock button for receiving OrderArticles manually adjusted
Conflicts: app/views/orders/_edit_amount.html.haml
This commit is contained in:
parent
a8e604c196
commit
8479678530
4 changed files with 16 additions and 7 deletions
|
@ -51,7 +51,8 @@ body {
|
|||
|
||||
// Do not use additional margin for input in table
|
||||
.form-horizontal .control-group.control-group-intable,
|
||||
.form-horizontal .controls.controls-intable {
|
||||
.form-horizontal .controls.controls-intable,
|
||||
.input-prepend.intable {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,10 +46,21 @@ module OrdersHelper
|
|||
def receive_input_field(form)
|
||||
order_article = form.object
|
||||
units_expected = (order_article.units_billed or order_article.units_to_order)
|
||||
form.text_field :units_received, class: 'input-nano package units_received',
|
||||
|
||||
# unlock button, to prevent overwriting if it was manually distributed
|
||||
input_html = ''
|
||||
if order_article.result_manually_changed?
|
||||
input_html += '<span class="input-prepend intable">' +
|
||||
button_tag(nil, type: :button, class: 'btn unlocker', title: t('.locked_to_protect_unlock_button')) {'<i class="icon icon-unlock"></i>'.html_safe}
|
||||
end
|
||||
|
||||
input_html += form.text_field :units_received, class: 'input input-nano package units_received',
|
||||
data: {'units-expected' => units_expected},
|
||||
disabled: order_article.result_manually_changed?,
|
||||
title: order_article.result_manually_changed? ? t('.locked_to_protect_manual_update') : nil,
|
||||
autocomplete: 'off'
|
||||
|
||||
input_html += '</span>' if order_article.result_manually_changed?
|
||||
input_html.html_safe
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,6 +25,3 @@
|
|||
%td.units_delta
|
||||
%td
|
||||
= link_to t('ui.edit'), edit_order_order_article_path(order_article.order, order_article, without_units: true), remote: true, class: 'btn btn-small'
|
||||
- if order_article.result_manually_changed?
|
||||
= button_tag nil, class: 'btn btn-small unlocker', title: t('.locked_to_protect_unlock_button') do
|
||||
%i.icon-unlock
|
||||
|
|
|
@ -62,8 +62,8 @@
|
|||
}
|
||||
|
||||
function unlock_receive_input_field() {
|
||||
$('.units_received', $(this).closest('tr')).prop('disabled', false);
|
||||
$(this).remove();
|
||||
$('.units_received', $(this).closest('tr')).prop('disabled', false).focus();
|
||||
$(this).replaceWith('<i class="icon icon-warning-sign add-on"></i>');
|
||||
}
|
||||
|
||||
%table#order_articles.ordered-articles.table.table-striped.stupidtable
|
||||
|
|
Loading…
Reference in a new issue