foodsoft/app/views/ordering/my_order_result.haml
sandoz 0adce9d54c First try making tolerance not costly.
A new configuration setting was introduced: tolerance_is_costly
If set to false, article tolerance values do not count for total article price as long as the order is not finished.
This reduces the negative effect on using tolerance for the user.
2009-08-04 23:44:11 +02:00

132 lines
No EOL
5 KiB
Text

- title "Dein Bestellergebnis für #{@order.name}"
#element_navigation
= link_to_unless @order.previous == @order, "<< #{@order.previous.name}", :action => "my_order_result", :id => @order.previous
|
= link_to "Übersicht", :controller => 'ordering'
|
= link_to_unless @order.next == @order, "#{@order.next.name} >>", :action => "my_order_result", :id => @order.next
// Order summary
.left_column{:style => "width:45em"}
.box_title
%h2 Zusammenfassung
.column_content
%table
%tr{:valign => "top"}
%td{:style => "width:50%"}
%p
Lieferantin:
%b=h @order.name
- unless @order.note.blank?
%p
Notiz:
=h @order.note
%p
Ende:
%b=h format_time(@order.ends)
%p
Bestellsumme:
- if @group_order
%b=h number_to_currency(@group_order.price)
- else
%b Du hast nicht bestellt.
- if @order.closed?
%p
= "Abgerechnet von #{@order.updated_by.nick}"
= link_to "Kommentare lesen/schreiben", "#comments"
// directly switch to active orders
.right_column{:style => "width:23em;"}
.box_title
%h2 Laufende Bestellungen
.column_content
%table
- for order in Order.open
%tr
%td= link_to order.name, :action => 'order', :id => order
%td= "("+ time_ago_in_words(order.ends) + ")" if order.ends
// Article box
.single_column{:style => "clear:both; width:70em;"}
.box_title
%h2 Artikelübersicht
.column_content#result
- if @group_order
%p= link_to("Bestellung ändern", :action => "order", :id => @order) if @order.open?
%table.list
%thead
%tr
%th{:style => "width:40%"} Name
%th Gebinde
%th Einzelpreis
%th
%abbr{:title => "Menge + Toleranz"} Bestellt
%th
%abbr{:title => "Unter Berücksichtigung der anderen Gruppen"} Bekommen
%th Gesamtpreis
%tbody
- total = 0 #set counter for order-sum
- for category_name, order_articles in @order.articles_grouped_by_category
%tr{:style => "background-color:#EFEFEF"}
%td{:style => "text-align:left;"}=h category_name
%td{:colspan => "9"}
- for oa in order_articles
- # get the order-results for the ordergroup
- goa = oa.group_order_articles.first :conditions => {:group_order_id => @group_order.id}
- if goa
- quantity = goa.quantity
- tolerance = goa.tolerance
- result = goa.result
- if @order.open?
- if Foodsoft.config[:tolerance_is_costly]
- sub_total = oa.price.fc_price * (quantity + tolerance)
- else
- sub_total = oa.price.fc_price * quantity
- else
- sub_total = oa.price.fc_price * result
- else
- quantity, tolerance, result, sub_total = 0, 0, 0, 0
- total += sub_total
- # give the article different colors, dependent on order-result
- style = "grey"
- if (quantity > 0)
- style = result > 0 ? 'green' : 'red'
%tr{:class => cycle('even', 'odd', :name => 'articles'), :style => "color:#{style}"}
%td{:style => "width:40%"}
=h oa.article.name
- unless oa.article.note.blank?
= image_tag("lamp_grey.png", {:alt => "Notiz anzeigen", :size => "15x16", :border => "0", :onmouseover => "$('note_#{oa.id}').show();", :onmouseout => "$('note_#{oa.id}').hide();"})
%td= "#{oa.price.unit_quantity} x #{oa.article.unit}"
%td= number_to_currency(oa.price.fc_price)
%td
= quantity
= "+ #{tolerance}" if oa.price.unit_quantity > 1
%td= result > 0 ? result : "0"
%td= number_to_currency(sub_total)
- unless oa.article.note.blank?
%tr{:id => "note_#{oa.id}", :class => "note even", :style => "display:none"}
%td{:colspan => "6"}=h oa.article.note
%tr{:class => cycle('even', 'odd', :name => 'articles')}
%th{:colspan => "5"} Summe
%th= number_to_currency(total)
%br/
= link_to_top
- else
Du hast noch nicht bestellt.
= link_to "Das ist Deine Chance!", :action => "order", :id => @order
// Comments box
.single_column{:style => "width:70em;"}
.box_title
%h2=_ "Comments"
.column_content#comments
= render :partial => 'shared/comments', :locals => { :comments => @order.comments }
%p
- form_for :comment, :url => { :action => :add_comment, :id => @order } do |form|
%p
%b Neuen Kommentar hinzufügen:
%br/
= form.text_area :text, :cols => 50, :rows => 6
%br/
= submit_tag "Kommentar hinzufügen"
= link_to_top