From 84fe791078429127c8d8592ffcf83a5a635594df Mon Sep 17 00:00:00 2001 From: wvengen Date: Wed, 18 Dec 2013 22:08:02 +0100 Subject: [PATCH] update balancing screen --- app/helpers/orders_helper.rb | 10 ++++++++++ app/views/finance/balancing/_order_article.html.haml | 5 +++-- app/views/finance/balancing/_orders.html.haml | 2 +- app/views/orders/_articles.html.haml | 6 +----- app/views/orders/index.html.haml | 2 +- app/views/orders/show.html.haml | 2 +- config/locales/en.yml | 1 + 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/helpers/orders_helper.rb b/app/helpers/orders_helper.rb index 9ddcca4a..b9e5698d 100644 --- a/app/helpers/orders_helper.rb +++ b/app/helpers/orders_helper.rb @@ -15,4 +15,14 @@ module OrdersHelper options += [[I18n.t('helpers.orders.option_stock'), url_for(action: 'new', supplier_id: 0)]] options_for_select(options) end + + def units_history_line(order_article) + if order_article.order.open? + nil + else + units_info = "#{order_article.units_to_order} ordered" + units_info += ", #{order_article.units_billed} billed" unless order_article.units_billed.nil? + units_info += ", #{order_article.units_received} received" unless order_article.units_received.nil? + end + end end diff --git a/app/views/finance/balancing/_order_article.html.haml b/app/views/finance/balancing/_order_article.html.haml index 6512d0c4..565cff89 100644 --- a/app/views/finance/balancing/_order_article.html.haml +++ b/app/views/finance/balancing/_order_article.html.haml @@ -1,8 +1,9 @@ %td.closed = link_to order_article.article.name, '#', 'data-toggle-this' => "#group_order_articles_#{order_article.id}" %td= order_article.article.order_number -%td - = order_article.units_to_order +%td{title: units_history_line(order_article)} + = order_article.units + %i.package pkg - unless order_article.ordered_quantities_equal_to_group_orders? %span{:style => "color:red;font-weight: bold"} ! %td #{order_article.price.unit_quantity} × #{order_article.article.unit} diff --git a/app/views/finance/balancing/_orders.html.haml b/app/views/finance/balancing/_orders.html.haml index 3c54e340..c25696e7 100644 --- a/app/views/finance/balancing/_orders.html.haml +++ b/app/views/finance/balancing/_orders.html.haml @@ -19,7 +19,7 @@ %td= show_user(order.updated_by) %td - unless order.closed? - = link_to t('.receive'), edit_finance_receive_path(order), class: 'btn btn-mini' + = link_to t('orders.index.action_receive'), receive_order_path(order), class: 'btn btn-mini' = link_to t('.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-mini btn-primary' = link_to t('.close'), close_direct_finance_order_path(order), :confirm => t('.confirm'), :method => :put, class: 'btn btn-mini' diff --git a/app/views/orders/_articles.html.haml b/app/views/orders/_articles.html.haml index c1f02fa4..562f9196 100644 --- a/app/views/orders/_articles.html.haml +++ b/app/views/orders/_articles.html.haml @@ -36,11 +36,7 @@ %td= "#{order_article.quantity} + #{order_article.tolerance}" - else %td= "#{order_article.quantity}" - - unless order.open? - - units_info = "#{order_article.units_to_order} ordered" - - units_info += ", #{order_article.units_billed} billed" unless order_article.units_billed.nil? - - units_info += ", #{order_article.units_received} received" unless order_article.units_received.nil? - %td{title: units_info} + %td{title: units_history_line(order_article)} = units %i.package pkg %p diff --git a/app/views/orders/index.html.haml b/app/views/orders/index.html.haml index 1a8d7c29..c288de84 100644 --- a/app/views/orders/index.html.haml +++ b/app/views/orders/index.html.haml @@ -54,7 +54,7 @@ %td= truncate(order.note) %td -# TODO btn-success class only if not received before - = link_to t('.receive'), receive_order_path(order), class: 'btn btn-small btn-success' + = link_to t('.action_receive'), receive_order_path(order), class: 'btn btn-small btn-success' %td = link_to t('ui.edit'), '#', class: 'btn btn-small disabled' diff --git a/app/views/orders/show.html.haml b/app/views/orders/show.html.haml index 73206da1..ef294091 100644 --- a/app/views/orders/show.html.haml +++ b/app/views/orders/show.html.haml @@ -33,7 +33,7 @@ confirm: t('.confirm_end', order: @order.name) - elsif not @order.closed? -# TODO btn-success class only if not received before - = link_to t('orders.index.receive'), receive_order_path(@order), class: 'btn btn-success' + = link_to t('orders.index.action_receive'), receive_order_path(@order), class: 'btn btn-success' - unless @order.closed? = link_to t('ui.delete'), @order, confirm: t('.confirm_delete'), method: :delete, class: 'btn btn-danger' diff --git a/config/locales/en.yml b/config/locales/en.yml index 158673fb..71a7a3ad 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1114,6 +1114,7 @@ en: title: Article index: action_end: Close + action_receive: Receive confirm_delete: Do you really want to delete the order? confirm_end: Do you really want to close the order %{order}? There is no going back. closed_orders: Settled orders