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

60 lines
2.3 KiB
Plaintext
Raw Normal View History

2011-06-10 13:53:51 +02:00
= simple_form_for @order do |f|
2012-10-30 00:20:47 +01:00
= f.hidden_field :supplier_id
= f.input :note, input_html: {rows: 8}
= f.input :starts, input_html: {class: 'input-small'}
= f.input :ends, input_html: {class: 'input-small'}
2009-01-06 11:49:19 +01:00
%h2= t '.title'
2012-10-30 00:20:47 +01:00
- if @order.errors.has_key?(:articles)
.alert.alert-error
= @order.errors.get(:articles).join(" ")
%table.table.table-hover#articleList
%tr
%th= check_box_tag 'checkall', "1", false, { 'data-check-all' => '#articleList' }
%th= t '.name'
%th= t '.note'
2012-10-30 00:20:47 +01:00
- if @order.stockit?
%th= t '.stockit'
2012-10-30 00:20:47 +01:00
- else
%th= t '.origin'
%th= t '.supplier'
%th= t '.unit_quantity'
%th= t '.prices'
2012-10-30 00:20:47 +01:00
- for category_name, articles in @order.articles_for_ordering
%tr.article-category
%td
%td{:colspan => "6", :style => "text-align:left"}
= category_name
%i.icon-tag
- for article in articles
/ check if the article is selected or has an error
- included = @order.article_ids.include?(article.id.to_s)
- if included
- included_class = 'selected'
- elsif @order.errors.has_key?(:articles) and @order.articles_to_be_removed_and_ordered.map{|a| a.article_id}.include?(article.id)
- included_class = 'error'
- else
- included_class = ''
2012-10-30 00:20:47 +01:00
%tr{:class => included_class, :id => article.id.to_s }
%td= check_box_tag "order[article_ids][]", article.id, included, :id => "checkbox_#{article.id}"
%td.click-me{'data-check-this' => "#checkbox_#{article.id}"}= article.name
%td=h truncate article.note, :length => 25
2011-06-10 13:53:51 +02:00
- if @order.stockit?
2012-10-30 00:20:47 +01:00
%td= "#{article.quantity_available} * #{article.unit}"
2011-06-10 13:53:51 +02:00
- else
2012-10-30 00:20:47 +01:00
%td=h truncate article.origin, :length => 15
%td=h truncate article.manufacturer, :length => 15
%td= "#{article.unit_quantity} x #{article.unit}"
%td= "#{number_to_currency(article.price)} / #{number_to_currency(article.fc_price)}"
%tr
%td
= check_box_tag 'checkall', "1", false, { 'data-check-all' => '#articleList' }
%td{:colspan => "6"}= t '.select_all'
2009-01-06 11:49:19 +01:00
2011-06-10 13:53:51 +02:00
- if (@template_orders && !@template_orders.empty?)
= render :partial => 'template_orders_script'
2009-01-06 11:49:19 +01:00
2012-10-30 00:20:47 +01:00
.form-actions
= f.submit class: 'btn'
= link_to t('ui.or_cancel'), orders_path