From 9d3df4efe475dd9d2d38e015df229f48772be2fd Mon Sep 17 00:00:00 2001 From: Florian Lentsch Date: Mon, 20 May 2024 16:59:42 +0200 Subject: [PATCH] Fixes #67 --- app/assets/javascripts/receive-order-form.js | 2 +- .../bootstrap_and_overrides.css.less | 19 +++++++++++++-- app/assets/stylesheets/delta_input.less | 1 + app/helpers/orders_helper.rb | 23 ++++++++++--------- app/inputs/delta_input.rb | 6 ++--- app/views/group_orders/_form.html.haml | 8 +++---- 6 files changed, 38 insertions(+), 21 deletions(-) diff --git a/app/assets/javascripts/receive-order-form.js b/app/assets/javascripts/receive-order-form.js index 86485998..320b54dc 100644 --- a/app/assets/javascripts/receive-order-form.js +++ b/app/assets/javascripts/receive-order-form.js @@ -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(''); + unlockButton$.replaceWith(''); } } diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.less b/app/assets/stylesheets/bootstrap_and_overrides.css.less index 1a2a1bab..e737fcdd 100644 --- a/app/assets/stylesheets/bootstrap_and_overrides.css.less +++ b/app/assets/stylesheets/bootstrap_and_overrides.css.less @@ -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 @@ -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; diff --git a/app/assets/stylesheets/delta_input.less b/app/assets/stylesheets/delta_input.less index d3719fd4..078157cd 100644 --- a/app/assets/stylesheets/delta_input.less +++ b/app/assets/stylesheets/delta_input.less @@ -17,6 +17,7 @@ form.delta-input, .delta-input form { input[data-delta] { text-align: center; height: 14px; + min-width: 45px; -moz-appearance: textfield; diff --git a/app/helpers/orders_helper.rb b/app/helpers/orders_helper.rb index c4c41214..a9904933 100644 --- a/app/helpers/orders_helper.rb +++ b/app/helpers/orders_helper.rb @@ -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) diff --git a/app/inputs/delta_input.rb b/app/inputs/delta_input.rb index 50423d88..2a764b07 100644 --- a/app/inputs/delta_input.rb +++ b/app/inputs/delta_input.rb @@ -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') + diff --git a/app/views/group_orders/_form.html.haml b/app/views/group_orders/_form.html.haml index ce5c8022..a5ae897d 100644 --- a/app/views/group_orders/_form.html.haml +++ b/app/views/group_orders/_form.html.haml @@ -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) @@ -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])