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

64 lines
2.6 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= t '.title'
- 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= heading_helper Article, :name
%th= heading_helper Article, :note
- if @order.stockit?
%th= t '.stockit'
- else
%th= heading_helper Article, :origin
%th= heading_helper Article, :manufacturer
%th= heading_helper Article, :unit_quantity
%th= t '.prices'
- 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)
- row_class = ''
- if included
- row_class = 'selected'
- elsif @order.erroneous_article_ids.include?(article.id)
- row_class = 'error'
%tr{class: row_class, id: article.id}
%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' }
-# also when all are deselected, make sure this parameter is sent (controller removes empty values again)
= hidden_field_tag "order[article_ids][]", nil
%td{:colspan => "6"}= t '.select_all'
- if (@template_orders && !@template_orders.empty?)
= render :partial => 'template_orders_script'
.form-actions
= f.submit class: 'btn'
= link_to t('ui.or_cancel'), orders_path
- unless @order.erroneous_article_ids.empty?
 
= check_box_tag 'order[ignore_warnings]'
= t '.ignore_warnings'