From 9219d099c89165269b5d9360607b7e9c9ecaeed4 Mon Sep 17 00:00:00 2001 From: wvengen Date: Fri, 3 Jan 2014 12:42:36 +0100 Subject: [PATCH] ui update for packages display --- .../bootstrap_and_overrides.css.less | 22 +++++++++++++------ app/helpers/orders_helper.rb | 7 ++++-- .../_edit_results_by_articles.html.haml | 2 +- .../balancing/_order_article.html.haml | 4 ++-- app/views/orders/_articles.html.haml | 10 +++++---- 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.less b/app/assets/stylesheets/bootstrap_and_overrides.css.less index de47897f..031a40fa 100644 --- a/app/assets/stylesheets/bootstrap_and_overrides.css.less +++ b/app/assets/stylesheets/bootstrap_and_overrides.css.less @@ -55,6 +55,12 @@ body { @mainRedColor: #ED0606; +@articleUsedColor: green; +@articleUnusedColor: red; +@articleUnavailColor: #999; +@articleUpdatedColor: #468847; + + .logo { margin: 10px 0 0 30px; float: left; @@ -135,10 +141,10 @@ table { // ordering .used { - color: green; + color: @articleUsedColor; } .unused { - color: red; + color: @articleUnusedColor; } #order-footer, .article-info { @@ -202,11 +208,11 @@ tr.order-article:hover .article-info { // ********* Articles tr.just-updated { - color: #468847; + color: @articleUpdatedColor; } tr.unavailable { - color: #999; + color: @articleUnavailColor; } // articles edit all @@ -276,9 +282,11 @@ i.package { padding-left: 20px; font-style: normal; } -.package { - color: #999; -} +@packageDim: 35%; +.package { color: tint(@textColor, @packageDim); } +.used .package { color: tint(@articleUsedColor, @packageDim); } +.unused .package { color: tint(@articleUnusedColor, @packageDim); } +.unavailable .package { color: @articleUnavailColor; } .input-nano { width: 30px; diff --git a/app/helpers/orders_helper.rb b/app/helpers/orders_helper.rb index 3d2d5bbe..d1b67932 100644 --- a/app/helpers/orders_helper.rb +++ b/app/helpers/orders_helper.rb @@ -28,6 +28,7 @@ module OrdersHelper # can be article or article_price def pkg_helper(article, icon=true) + return nil if article.unit_quantity == 1 if icon " × #{article.unit_quantity}".html_safe else @@ -35,9 +36,11 @@ module OrdersHelper end end - def article_price_change_hint(order_article) + def article_price_change_hint(order_article, gross=false) return nil if order_article.article.price == order_article.article_price.price - "".html_safe + title = "#{t('.old_price')}: #{number_to_currency order_article.article.price}" + title += " / #{number_to_currency order_article.article.gross_price}" if gross + "".html_safe end def receive_input_field(form) diff --git a/app/views/finance/balancing/_edit_results_by_articles.html.haml b/app/views/finance/balancing/_edit_results_by_articles.html.haml index 55dbe212..05e06071 100644 --- a/app/views/finance/balancing/_edit_results_by_articles.html.haml +++ b/app/views/finance/balancing/_edit_results_by_articles.html.haml @@ -4,7 +4,7 @@ %th= sort_link_helper Article.model_name.human, "name" %th= sort_link_helper Article.human_attribute_name(:order_number_short), "order_number" %th= t('.amount') - %th= heading_helper Article, :units + %th= heading_helper Article, :unit %th= t('.net') %th= t('.gross') %th= heading_helper Article, :tax diff --git a/app/views/finance/balancing/_order_article.html.haml b/app/views/finance/balancing/_order_article.html.haml index 88cc55fc..24125544 100644 --- a/app/views/finance/balancing/_order_article.html.haml +++ b/app/views/finance/balancing/_order_article.html.haml @@ -3,10 +3,10 @@ %td= order_article.article.order_number %td{title: units_history_line(order_article)} = order_article.units - %i.package pkg + = pkg_helper order_article.article_price - if s=order_article.ordered_quantities_different_from_group_orders? %span{:style => "color:red;font-weight: bold"}= s -%td #{order_article.price.unit_quantity} × #{order_article.article.unit} +%td #{order_article.article.unit} %td = number_to_currency(order_article.price.price, :unit => "") :plain diff --git a/app/views/orders/_articles.html.haml b/app/views/orders/_articles.html.haml index 562f9196..df0e9a4b 100644 --- a/app/views/orders/_articles.html.haml +++ b/app/views/orders/_articles.html.haml @@ -2,7 +2,7 @@ %thead %tr %th= heading_helper Article, :name - %th= heading_helper Article, :units + %th= heading_helper Article, :unit %th= t '.prices' - if order.stockit? %th= t '.units_ordered' @@ -27,8 +27,10 @@ - cssclass = (units > 0 ? 'used' : (order_article.quantity > 0 ? 'unused' : 'unavailable')) %tr{:class => cycle('even', 'odd', :name => 'articles') + ' ' + cssclass} %td=h order_article.article.name - %td #{unit_quantity} × #{order_article.article.unit} - %td= "#{number_to_currency(net_price)} / #{number_to_currency(gross_price)}" + %td= order_article.article.unit + %td + = "#{number_to_currency(net_price)} / #{number_to_currency(gross_price)}" + = article_price_change_hint(order_article, gross: true) - if order.stockit? %td= units - else @@ -38,7 +40,7 @@ %td= "#{order_article.quantity}" %td{title: units_history_line(order_article)} = units - %i.package pkg + = pkg_helper order_article.price %p = t '.prices_sum' = "#{number_to_currency(total_net)} / #{number_to_currency(total_gross)}"