foodsoft/app/views/orders/_form.html.haml
2012-10-30 00:20:47 +01:00

54 lines
2.1 KiB
Text

= simple_form_for @order do |f|
= 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'}
%h2 Artikel
- 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 Name
%th Notiz
- if @order.stockit?
%th Verfügbar
- else
%th Herkunft
%th Hersteller
%th Gebinde
%th Preis (netto/FC)
- 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
- included = @order.article_ids.include?(article.id)
- included_class = included ? ' selected' : ''
%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
- if @order.stockit?
%td= "#{article.quantity_available} * #{article.unit}"
- else
%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"} Alle auswählen
- if (@template_orders && !@template_orders.empty?)
= render :partial => 'template_orders_script'
.form-actions
= f.submit class: 'btn'
= link_to "oder abbrechen", orders_path