lib/foodsoft_current_orders/app/views/current_orders/ordergroups/_articles.html.haml
- total = 0
%tbody.list
- if @goas and @goas.length > 0
- for goa in @goas
- total += goa.total_price
= render 'article', goa: goa
- else
%tr
%td{colspan: 10}
%i No articles for #{@ordergroup.name} in the current orders.
%tfoot
%tr
%td{colspan: 9}
- new_articles = OrderArticle.includes(:article, :article_price).where(order_id: @order_ids)
- new_article_data = articles_for_select2(new_articles) {|a| "#{a.article.name} (#{a.article.unit}, #{number_to_currency a.price.fc_price})"}
= form_for GroupOrderArticle.new, remote: true, html: {'data-submit-onchange' => true, style: 'margin: 0'} do |f|
= f.select :order_article_id,
options_for_select(new_article_data.map {|a| [a[:text], a[:id]]}),
{}, {style: 'width: 500px', 'data-placeholder' => t('.add_new') }
= f.hidden_field :ordergroup_id, value: @ordergroup.id
%tr#single_ordergroup_total{:class => cycle('even', 'odd', :name => 'articles')}
%th{colspan: 7}= t 'shared.articles_by.price_sum'
%th.price_sum{colspan: 2, data: {value: total}}= number_to_currency(total)