diff --git a/app/views/group_orders/show.html.haml b/app/views/group_orders/show.html.haml index 8c9678d7..c82fbcdc 100644 --- a/app/views/group_orders/show.html.haml +++ b/app/views/group_orders/show.html.haml @@ -7,107 +7,81 @@ - title t('.title', order: @order.name) .row-fluid - .well.pull-left - // Order summary - %dl.dl-horizontal - %dt= heading_helper Order, :name - %dd= @order.name - %dt= heading_helper Order, :note - %dd= @order.note - %dt= heading_helper Order, :ends - %dd= format_time(@order.ends) - %dt= heading_helper Order, :pickup - %dd= format_date(@order.pickup) - %dt= heading_helper GroupOrder, :price - %dd - - if @group_order - = number_to_currency(@group_order.price) - - else - = t '.not_ordered' - - if @group_order && @group_order.transport - %dt= heading_helper GroupOrder, :transport - %dd= number_to_currency(@group_order.transport) - %dt= heading_helper GroupOrder, :total - %dd= number_to_currency(@group_order.total) - - if @order.closed? - %dt= heading_helper Order, :closed_by - %dd= show_user_link @order.updated_by - %p= link_to t('.comment'), "#comments" - .well.pull-right - = close_button :alert + .well.span3 = render 'switch_order', current_order: @order + .well.span8 + %h2= t '.articles.title' + =render 'order_details' -// Article box -%section - %h2= t '.articles.title' - .column_content#result - - if @group_order - %p.pull-right= link_to t('.articles.show_hide'), '#', 'data-toggle-this' => 'tr.ignored' - %p= link_to(t('.articles.edit_order'), edit_group_order_path(@group_order, order_id: @order.id), class: 'btn btn-primary') if @order.open? - %table.table.table-hover - %thead - %tr - %th{style: "width:40%"}= heading_helper Article, :name - %th= heading_helper Article, :units - %th= t '.articles.unit_price' - %th - %abbr{title: t('.articles.ordered_title')}= t '.articles.ordered' - %th - %abbr{title: t('.articles.order_nopen_title')} - - if @order.open? - = t '.articles.order_open' - - else - = t '.articles.order_not_open' - %th= heading_helper GroupOrderArticle, :total_price - %tbody - - for category_name, order_articles in @order.articles_grouped_by_category - %tr.article-category - %td - = category_name - %i.icon-tag - %td{colspan: "9"} - - order_articles.each do |oa| - - # get the order-results for the ordergroup - - r = get_order_results(oa, @group_order.id) - %tr{class: cycle('even', 'odd', name: 'articles') + " " + order_article_class_name(r[:quantity], r[:tolerance], r[:result])} - %td{style: "width:40%"} - = oa.article.name + // Article box + %section + .column_content#result + - if @group_order + %p= link_to t('.articles.show_hide'), '#', 'data-toggle-this' => 'tr.ignored' + %table.table.table-hover + %thead + %tr + %th{style: "width:40%"}= heading_helper Article, :name + %th= heading_helper Article, :units + %th= t '.articles.unit_price' + %th + %abbr{title: t('.articles.ordered_title')}= t '.articles.ordered' + %th + %abbr{title: t('.articles.order_nopen_title')} + - if @order.open? + = t '.articles.order_open' + - else + = t '.articles.order_not_open' + %th= heading_helper GroupOrderArticle, :total_price + %tbody + - for category_name, order_articles in @order.articles_grouped_by_category + %tr.article-category + %td + = category_name + %i.icon-tag + %td{colspan: "9"} + - order_articles.each do |oa| + - # get the order-results for the ordergroup + - r = get_order_results(oa, @group_order.id) + %tr{class: cycle('even', 'odd', name: 'articles') + " " + order_article_class_name(r[:quantity], r[:tolerance], r[:result])} + %td{style: "width:40%"} + = oa.article.name + - unless oa.article.note.blank? + = image_tag("lamp_grey.png", {alt: t('.articles.show_note'), 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 + = r[:quantity] + = "+ #{r[:tolerance]}" if oa.price.unit_quantity > 1 + %td= r[:result] > 0 ? r[:result] : "0" + %td= number_to_currency(r[:sub_total]) - unless oa.article.note.blank? - = image_tag("lamp_grey.png", {alt: t('.articles.show_note'), 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 - = r[:quantity] - = "+ #{r[:tolerance]}" if oa.price.unit_quantity > 1 - %td= r[:result] > 0 ? r[:result] : "0" - %td= number_to_currency(r[: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"}= heading_helper GroupOrder, :price - %th= number_to_currency(@group_order.price) - - if @group_order.transport - %tr{class: cycle('even', 'odd', name: 'articles')} - %td{colspan: "5"}= heading_helper GroupOrder, :transport - %td= number_to_currency(@group_order.transport) - %tr{class: cycle('even', 'odd', name: 'articles')} - %th{colspan: "5"}= heading_helper GroupOrder, :total - %th= number_to_currency(@group_order.total) - %br/ - = link_to_top - - else - - if @order.open? - = t '.articles.not_ordered_msg' - = link_to t('.articles.order_now'), action: "order", id: @order - - else - = t '.articles.order_closed_msg' - + %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"}= heading_helper GroupOrder, :price + %th= number_to_currency(@group_order.price) + - if @group_order.transport + %tr{class: cycle('even', 'odd', name: 'articles')} + %td{colspan: "5"}= heading_helper GroupOrder, :transport + %td= number_to_currency(@group_order.transport) + %tr{class: cycle('even', 'odd', name: 'articles')} + %th{colspan: "5"}= heading_helper GroupOrder, :total + %th= number_to_currency(@group_order.total) + %br/ + = link_to_top + %p.pull-right= link_to(t('.articles.edit_order'), edit_group_order_path(@group_order, order_id: @order.id), class: 'btn btn-primary') if @order.open? + - else + - if @order.open? + = t '.articles.not_ordered_msg' + = link_to t('.articles.order_now'), action: "order", id: @order + - else + = t '.articles.order_closed_msg' // Comments box -%section - %h2= t '.comments.title' - #comments - = render 'shared/comments', comments: @order.comments - #new_comment= render 'order_comments/form', order_comment: @order.comments.build(user: current_user) - = link_to_top +%hr +%h2= t '.comments.title' +#comments + = render 'shared/comments', comments: @order.comments +#new_comment= render 'order_comments/form', order_comment: @order.comments.build(user: current_user) += link_to_top \ No newline at end of file