foodsoft/app/views/group_orders/order.html.haml

89 lines
4.5 KiB
Plaintext
Raw Normal View History

2011-06-13 16:23:56 +02:00
- content_for :head do
= render 'data'
= render :partial => 'order_head'
- form_tag(:action => 'saveOrder', :id => @order) do
.single_column{:style => "clear:both;margin-bottom:7em;"}
.box_title
2013-02-09 02:01:31 +01:00
%h2= t '.title'
2011-06-13 16:23:56 +02:00
.column_content
%table#order.list
%thead
%tr
2013-02-09 02:01:31 +01:00
%th= t 'group_orders.form.name'
2011-06-13 16:23:56 +02:00
%th{:style => "width:13px;"}
2013-02-09 02:01:31 +01:00
%th{:style => "width:4.5em;"}= t 'group_orders.form.price'
%th{:style => "width:4.5em;"}= t 'group_orders.form.unit'
%th{:style => "width:70px;"}= t 'group_orders.form.unit_missing'
%th#col_required= t 'group_orders.form.amount'
2011-06-13 16:23:56 +02:00
- if not @order.stockit?
2013-02-09 02:01:31 +01:00
%th#col_tolerance= t 'group_orders.form.tolerance'
%th{:style => "width:15px;"}= t 'group_orders.form.sum'
2011-06-13 16:23:56 +02:00
%tbody
- total = 0
- i = 0
- @articles_grouped_by_category.each do |category, order_articles|
%tr{:style => "background-color:#EFEFEF"}
%td{:style => "text-align:left"}
%b= h category
%td{:colspan => "9"}
- order_articles.each do |order_article|
- if FoodsoftConfig[:tolerance_is_costly]
2011-06-13 16:23:56 +02:00
- article_total = @price[i] * (@tolerance[i] + @quantity[i])
- else
- article_total = @price[i] * @quantity[i]
- total += article_total
%tr{:class => "#{cycle('even', 'odd', :name => 'articles')} order-article", :valign => "top"}
%td.name= order_article.article.name
%td= h order_article.article.origin
%td= number_to_currency(@price[i])
%td= order_article.article.unit
%td
%span{:id => "missing_units_#{i}"}
- if @order.stockit?
- order_article.article.quantity_available
- else
- missing_units = @unit[i] - (((@quantity[i] + @others_quantity[i]) % @unit[i]) + @tolerance[i] + @others_tolerance[i])
- missing_units < 0 ? 0 : missing_units
%td.quantity
%input{:id => "q_#{i}", :name => "ordered[#{order_article.id}][quantity]", :size => "2", :type => "hidden", :value => @quantity[i]}/
%span.used{:id => "q_used_#{i}"}= @used_quantity[i]
+
%span.unused{:id => "q_unused_#{i}"}= @quantity[i] - @used_quantity[i]
= button_to_function('+', "increaseQuantity(#{i})")
= button_to_function('-', "decreaseQuantity(#{i})")
- unless @order.stockit?
%td.tolerance
%input{:id => "t_#{i}", :name => "ordered[#{order_article.id}][tolerance]", :size => "2", :type => "hidden", :value => @tolerance[i]}/
- if (@unit[i] > 1)
%span.used{:id => "t_used_#{i}"}= @used_tolerance[i]
+
%span.unused{:id => "t_unused_#{i}"}= @tolerance[i] - @used_tolerance[i]
= button_to_function('+', "increaseTolerance(#{i})")
= button_to_function('-', "decreaseTolerance(#{i})")
%td{:id => "td_price_#{i}", :style => "text-align:right; padding-right:10px; width:4em"}
%span{:id => "price_#{i}_display"}= number_to_currency(article_total, :unit => "")
.article-info
%h3= order_article.article.name
.right
2013-02-09 02:01:31 +01:00
= t('group_orders.form.units_full') + ':'
2011-06-13 16:23:56 +02:00
%span{:id => "units_#{i}"}= order_article.units_to_order
%br/
2013-02-09 02:01:31 +01:00
= t('group_orders.form.total_units') + ':'
2011-06-13 16:23:56 +02:00
%span{:id => "q_total_#{i}"}= @quantity[i] + @others_quantity[i]
%br/
2013-02-09 02:01:31 +01:00
= t('group_orders.form.total_tolerance') + ':'
2011-06-13 16:23:56 +02:00
%span{:id => "t_total_#{i}"}= @tolerance[i] + @others_tolerance[i]
%br/
.left
2013-02-09 02:01:31 +01:00
#{t 'group_orders.form.manufacturer'}: #{order_article.article.manufacturer}
2011-06-13 16:23:56 +02:00
%br/
2013-02-09 02:01:31 +01:00
#{t 'group_orders.form.units'}: #{@order.stockit? ? order_article.article.quantity_available : @unit[i]} * #{h order_article.article.unit}
2011-06-13 16:23:56 +02:00
%br/
2013-02-09 02:01:31 +01:00
#{t 'group_orders.form.note'}: #{order_article.article.note}
2011-06-13 16:23:56 +02:00
%br/
- i = i + 1
2013-02-09 02:01:31 +01:00
= render "order_footer", :total => total