lib/foodsoft_current_orders/app/views/current_orders/articles/_ordergroups.html.haml
- units = order_article.article.unit_unit
- multiplier = (params[:base_unit] and units) ? units.scalar : 1
%table.table.table-hover#articles_by_articles
%thead.list-heading
%tr
%th{:style => 'width:70%'}= Ordergroup.model_name.human
%th.center.dimmed
%acronym{:title => t('shared.articles.ordered_desc')}= t 'shared.articles.ordered'
%th.center
%acronym{:title => t('shared.articles.received_desc')}= t 'shared.articles.received'
%td.center.btn-group
- if units and units.units != order_article.article.unit
= link_to t('.piece'), current_orders_articles_path(order: order_article.order.id, id: order_article.id), remote: true, class: "btn btn-small #{'active' unless params[:base_unit]}"
= link_to units.units, current_orders_articles_path(order: order_article.order.id, id: order_article.id, base_unit: true), remote: true, class: "btn btn-small #{'active' if params[:base_unit]}"
= render 'shared/articles_by/article_single', order_article: order_article, heading: false, delta_column: true, base_unit: params[:base_unit]
%tfoot
%tr
%td
= form_for GroupOrderArticle.new, remote: true, html: {'data-submit-onchange' => true, style: 'margin: 0'} do |f|
= f.hidden_field :order_article_id, value: order_article.id
= f.select :ordergroup_id,
options_for_select(Ordergroup.undeleted.order(:name).all.map { |g| [ g.name, g.id ] }),
{include_blank: true}, {style: 'width: 100%', 'data-placeholder' => t('.add_new')}
%td{colspan: 3}
%tr#single_order_article_total
%th= t 'shared.articles_by.price_sum'
%td.center.dimmed #{order_article.quantity*multiplier} + #{order_article.tolerance*multiplier}
- sum = order_article.group_orders_sum
%th.center.count_sum= sum[:quantity]*multiplier
%tr.no-top-border#single_order_article_delta
%td
%td
%td.center
%span.units_delta{data: {'quantity-expected' => order_article.units * order_article.price.unit_quantity * multiplier}}