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

71 lines
2.6 KiB
Text
Raw Normal View History

= form.error_messages
2009-01-06 11:49:19 +01:00
.single_column
.box_title
%h2 Bestellung
2009-01-06 11:49:19 +01:00
.column_content
= form.hidden_field :supplier_id
2009-01-06 11:49:19 +01:00
%p
Lieferant:
= @order.supplier.name
2009-01-06 11:49:19 +01:00
%p
Notiz
2009-01-06 11:49:19 +01:00
%br/
= form.text_area :note, :cols => 50, :rows => 5
2009-01-06 11:49:19 +01:00
%p
Start
2009-01-06 11:49:19 +01:00
%br/
= form.datetime_select :starts, :start_year => Time.now.year - 1
2009-01-06 11:49:19 +01:00
%p
Ende
2009-01-06 11:49:19 +01:00
%br/
= form.datetime_select :ends, :start_year => Time.now.year - 1, :include_blank => true
2009-01-06 11:49:19 +01:00
.box_title
%h2 Artikel
2009-01-06 11:49:19 +01:00
.column_content
- if (@template_orders && !@template_orders.empty?)
%p
%label{:for => 'template'}=_ "Use article selection from"
%select{:name => "template_id", :onchange => "useTemplate(this[this.selectedIndex].value)"}
%option{:value => "-1", :selected => "selected"}=_ "Choose an order..."
- i = -1
- for order in @template_orders
%option{:value => (i += 1)}=h order.supplier.name
2009-01-06 11:49:19 +01:00
%table.list
%tr
%th= check_box_tag 'checkall', "1", false, { :onclick => "checkUncheckAll(this)" }
%th=_ "Name"
%th=_ "Note"
%th=_ "Origin"
%th=_ "Manufacturer"
%th=_ "Unit quantity"
%th=_ "Price"
- for category, articles in Article.group_by_category(@order.supplier.getArticlesAvailableForOrdering)
%tr{:style => "background-color:#EFEFEF"}
%td
%td{:colspan => "6", :style => "text-align:left"}
%b=h category
- for article in articles
/ check if the article is selected
- included = @order.order_articles.detect { |order_article| order_article.article_id == article.id }
- included_class = included ? ' selected' : ''
%tr{:class => cycle('even', 'odd') + ' click-me' + included_class, :id => article.id.to_s, :onclick => "checkRow('#{article.id}')"}
%td= check_box_tag "order[article_ids][]", article.id, included, { :id => "checkbox_#{article.id}", :onclick => "checkRow('#{article.id}')" }
2009-01-06 11:49:19 +01:00
%td=h article.name
%td=h truncate article.note, :length => 25
%td=h truncate article.origin, :length => 15
%td=h truncate article.manufacturer, :length => 15
2009-01-06 11:49:19 +01:00
%td= "#{article.unit_quantity} x #{article.unit}"
%td= "#{number_to_currency(article.price)} / #{number_to_currency(article.fc_price)}"
2009-01-06 11:49:19 +01:00
%tr
%td{:colspan => "6"}
= check_box_tag 'checkall', "1", false, { :onclick => "checkUncheckAll(this)" }
=_ "Select all"
- if (@template_orders && !@template_orders.empty?)
= render :partial => 'template_orders_script'