foodsoft/app/views/orders/_articles.html.haml

52 lines
2.1 KiB
Plaintext
Raw Normal View History

%table.table.table-hover
%thead
%tr
2013-11-23 12:05:29 +01:00
%th= heading_helper Article, :name
2013-12-18 21:34:54 +01:00
%th= heading_helper Article, :units
%th= t '.prices'
2013-12-18 21:34:54 +01:00
- if order.stockit?
%th= t '.units_ordered'
- else
%th= 'Members'
%th= t '.units_full'
- total_net, total_gross, counter = 0, 0, 0
%tbody
- order.articles_grouped_by_category.each do |category_name, order_articles|
%tr.article-category
%td
= category_name
%i.icon-tag
%td{:colspan => "9"}
- order_articles.each do |order_article|
- net_price = order_article.price.price
- gross_price = order_article.price.gross_price
- unit_quantity = order_article.price.unit_quantity
2013-12-18 21:34:54 +01:00
- units = order_article.units
- total_net += units * unit_quantity * net_price
- total_gross += units * unit_quantity * gross_price
2013-12-18 21:34:54 +01:00
- cssclass = (units > 0 ? 'used' : (order_article.quantity > 0 ? 'unused' : 'unavailable'))
%tr{:class => cycle('even', 'odd', :name => 'articles') + ' ' + cssclass}
%td=h order_article.article.name
2013-12-18 21:34:54 +01:00
%td #{unit_quantity} × #{order_article.article.unit}
%td= "#{number_to_currency(net_price)} / #{number_to_currency(gross_price)}"
- if order.stockit?
%td= units
- else
- if unit_quantity > 1 or order_article.tolerance > 0
%td= "#{order_article.quantity} + #{order_article.tolerance}"
- else
%td= "#{order_article.quantity}"
2013-12-18 21:34:54 +01:00
- 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)}"
%p
= t '.article_count'
= order.order_articles.ordered.count