Skip to content

Commit

Permalink
Fixes #67
Browse files Browse the repository at this point in the history
  • Loading branch information
lentschi committed May 24, 2024
1 parent b78c887 commit 9d3df4e
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/receive-order-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
unlockReceiveInputField(unlockButton$) {
$('.units_received', unlockButton$.closest('tr')).prop('disabled', false).focus();
unlockButton$.closest('.input-prepend').prop('title', I18n.t('orders.edit_amount.field_unlocked_title'));
unlockButton$.replaceWith('<i class="icon icon-warning-sign add-on"></i>');
unlockButton$.replaceWith('<i class="icon icon-warning-sign"></i>');
}
}

Expand Down
19 changes: 17 additions & 2 deletions app/assets/stylesheets/bootstrap_and_overrides.css.less
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,27 @@ tr.order-article {
.group-order-input:not(.stock-order) {
text-align: center;

.goa-quantity {
.goa-quantity, .goa-tolerance {
width: 45px;
text-align: right;
}
}
}

.units_received_cell {
button {
margin-top: 0px;
height: 28px;
font-size: 10px;
line-height: 10px;
}

input.units_received {
min-width: 45px;
height: 18px;
}
}


// ********* Articles

Expand Down Expand Up @@ -444,7 +458,8 @@ label {
background-position: @align center;
}
input.package {
.package-image(right);
.package-image(90%);
background-size: 15px 15px;
// disabled and readonly definitions though
&[disabled], &[readonly] {
background-color: @inputDisabledBackground;
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/delta_input.less
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ form.delta-input, .delta-input form {
input[data-delta] {
text-align: center;
height: 14px;
min-width: 45px;

-moz-appearance: textfield;

Expand Down
23 changes: 12 additions & 11 deletions app/helpers/orders_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,18 @@ def receive_input_field(form)
data: data,
disabled: order_article.result_manually_changed?,
autocomplete: 'off'

if order_article.result_manually_changed?
input_html = content_tag(:span, class: 'input-prepend intable',
title: t('orders.edit_amount.field_locked_title', default: '')) do
button_tag(nil, type: :button, class: 'btn unlocker') {
content_tag(:i, nil, class: 'icon icon-unlock')
} + input_html
end
end

input_html.html_safe
span_html = if order_article.result_manually_changed?
content_tag(:span, class: 'input-prepend input-append intable',
title: t('orders.edit_amount.field_locked_title', default: '')) do
button_tag(nil, type: :button, class: 'btn unlocker') {
content_tag(:i, nil, class: 'icon icon-unlock')
} + input_html
end
else
content_tag(:span, class: 'input-append intable') { input_html }
end

span_html.html_safe
end

def ratio_quantity_data(order_article, default_unit = nil)
Expand Down
6 changes: 3 additions & 3 deletions app/inputs/delta_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ def input(wrapper_options)
# TODO: get generated id, don't know how yet - `add_default_name_and_id_for_value` might be an option

template.content_tag :div, class: 'delta-input input-prepend input-append' do
delta_button(content_tag(:i, nil, class: 'icon icon-plus'), 1, options) +
@builder.text_field(attribute_name, options) +
delta_button(content_tag(:i, nil, class: 'icon icon-minus'), -1, options)
delta_button(content_tag(:i, nil, class: 'icon icon-minus'), -1, options) +
delta_button(content_tag(:i, nil, class: 'icon icon-plus'), 1, options) +
@builder.text_field(attribute_name, options)
end
end
# template.button_tag('−', type: :submit, data: {decrement: options[:id]}, tabindex: -1, class: 'btn') +
Expand Down
8 changes: 4 additions & 4 deletions app/views/group_orders/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@
+
%span.unused= number_with_precision(@ordering_data[:order_articles][order_article.id][:quantity] - @ordering_data[:order_articles][order_article.id][:used_quantity], precision: 3, strip_insignificant_zeros: true)
.btn-group.numeric-step
%a.btn.btn-ordering.decrease
%i.icon-minus
%a.btn.btn-ordering.increase
%i.icon-plus
%input.goa-quantity{type: "number", name: "group_order[group_order_articles_attributes][#{order_article.id}][quantity]", value: @ordering_data[:order_articles][order_article.id][:quantity], data: quantity_data, autocomplete: 'off', class: 'input-mini numeric', style: ('display:none' if @order.stockit?), min: 0, max: (@ordering_data[:order_articles][order_article.id][:quantity_available] if @order.stockit?), step: order_article.article_version.group_order_granularity}
%a.btn.btn-ordering.decrease
%i.icon-minus
%span.numeric-step-error
= t('errors.step_error', granularity: order_article.article_version.group_order_granularity, min: 0)

Expand All @@ -135,11 +135,11 @@
+
%span.unused= number_with_precision(@ordering_data[:order_articles][order_article.id][:tolerance] - @ordering_data[:order_articles][order_article.id][:used_tolerance], precision: 3, strip_insignificant_zeros: true)
.btn-group
%a.btn.btn-ordering.decrease
%i.icon-minus
%a.btn.btn-ordering.increase
%i.icon-plus
%input.goa-tolerance{type: "number", name: "group_order[group_order_articles_attributes][#{order_article.id}][tolerance]", data: quantity_data, value: @ordering_data[:order_articles][order_article.id][:tolerance], autocomplete: 'off', class: 'input-mini numeric', min: 0, step: order_article.article_version.group_order_granularity, max: [@ordering_data[:order_articles][order_article.id][:ratio_group_order_unit_supplier_unit], @ordering_data[:order_articles][order_article.id][:minimum_order_quantity].presence || 0].max}
%a.btn.btn-ordering.decrease
%i.icon-minus

%td{id: "td_price_#{order_article.id}", style: "text-align:right; padding-right:10px; width:4em"}
%span{id: "price_#{order_article.id}_display", data: {price: @ordering_data[:order_articles][order_article.id][:total_price]}}= number_to_currency(@ordering_data[:order_articles][order_article.id][:total_price])
Expand Down

0 comments on commit 9d3df4e

Please sign in to comment.