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

74 lines
3.2 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
.fold-line
= f.input :starts, as: :date_picker_time
2015-09-23 22:38:20 +02:00
= f.input :boxfill, as: :date_picker_time if @order.is_boxfill_useful?
= f.input :ends, as: :date_picker_time
= f.input :pickup, as: :date_picker, input_html: {class: 'input-small'}
= f.input :end_action, collection: Order.end_actions,include_blank: false,
input_html: {class: 'input-xxlarge'}, value_method: ->(k){ k.first },
label_method: ->(k){ t("activerecord.attributes.order.end_actions.#{k.first}") }
= f.input :note, input_html: {rows: 2, class: 'input-xxlarge'}
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
2020-09-04 12:57:19 +02:00
= @order.errors.messages[:articles].join(" ")
2012-10-30 00:20:47 +01:00
%table.table.table-hover#articleList
%tr
%th= check_box_tag 'checkall', "1", false, { 'data-check-all' => '#articleList' }
2013-11-23 12:05:29 +01:00
%th= heading_helper Article, :name
%th= heading_helper Article, :note
2012-10-30 00:20:47 +01:00
- if @order.stockit?
%th= t '.stockit'
2012-10-30 00:20:47 +01:00
- else
2013-11-23 12:05:29 +01:00
%th= heading_helper Article, :origin
%th= heading_helper Article, :manufacturer
%th= heading_helper Article, :units
%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)
2013-09-03 17:37:49 +02:00
- row_class = ''
- if included
2013-09-03 17:37:49 +02:00
- row_class = 'selected'
- elsif @order.erroneous_article_ids.include?(article.id)
- row_class = 'error'
%tr{class: row_class, id: article.id}
2012-10-30 00:20:47 +01:00
%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= truncate article.note, length: 25, tooltip: true
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
%td= truncate article.origin, length: 15, tooltip: true
%td= truncate article.manufacturer, length: 15, tooltip: true
%td
= article.unit
- if article.unit_quantity > 1
%span{style: 'color: grey'} × #{article.unit_quantity}#{pkg_helper_icon}
2012-10-30 00:20:47 +01:00
%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'
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
- unless @order.erroneous_article_ids.empty?
 
= check_box_tag 'order[ignore_warnings]'
= t '.ignore_warnings'