From 82d1c41e9f8a276ebea0b4ff68fbef8bb566fd77 Mon Sep 17 00:00:00 2001 From: wvengen Date: Wed, 18 Dec 2013 21:34:54 +0100 Subject: [PATCH] update show order --- .../bootstrap_and_overrides.css.less | 4 ++-- app/views/orders/_articles.html.haml | 23 +++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.less b/app/assets/stylesheets/bootstrap_and_overrides.css.less index 42bafd17..6a598cbf 100644 --- a/app/assets/stylesheets/bootstrap_and_overrides.css.less +++ b/app/assets/stylesheets/bootstrap_and_overrides.css.less @@ -134,10 +134,10 @@ table { } // ordering -span.used { +.used { color: green; } -span.unused { +.unused { color: red; } diff --git a/app/views/orders/_articles.html.haml b/app/views/orders/_articles.html.haml index b0c54837..c1f02fa4 100644 --- a/app/views/orders/_articles.html.haml +++ b/app/views/orders/_articles.html.haml @@ -2,10 +2,12 @@ %thead %tr %th= heading_helper Article, :name - %th= heading_helper Article, :unit_quantity + %th= heading_helper Article, :units %th= t '.prices' - %th= t '.units_ordered' - - unless order.stockit? + - if order.stockit? + %th= t '.units_ordered' + - else + %th= 'Members' %th= t '.units_full' - total_net, total_gross, counter = 0, 0, 0 %tbody @@ -18,13 +20,14 @@ - order_articles.each do |order_article| - net_price = order_article.price.price - gross_price = order_article.price.gross_price - - units = order_article.units_to_order - unit_quantity = order_article.price.unit_quantity + - units = order_article.units - total_net += units * unit_quantity * net_price - total_gross += units * unit_quantity * gross_price - %tr{:class => cycle('even', 'odd', :name => 'articles'), :style => "color: #{units > 0 ? 'green' : 'red'}"} + - 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} x #{order_article.article.unit}" + %td #{unit_quantity} × #{order_article.article.unit} %td= "#{number_to_currency(net_price)} / #{number_to_currency(gross_price)}" - if order.stockit? %td= units @@ -33,7 +36,13 @@ %td= "#{order_article.quantity} + #{order_article.tolerance}" - else %td= "#{order_article.quantity}" - %td= units + - 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} + = units + %i.package pkg %p = t '.prices_sum' = "#{number_to_currency(total_net)} / #{number_to_currency(total_gross)}"