= haml "orders/menu".to_sym :javascript $( function() { $( document ).tooltip(); }); %h1 View Order #modal-plot.modal-plot = haml "order/_head".to_sym, locals: {order: @order} - if @order.state == "new" %form.pure-form.pure-form-aligned(action="" method="post") -#%input(type="hidden" name="_method" value="put") :javascript $(function() { $( "#tabs" ).tabs(); }); #tabs - supplier_name = settings.supplier -# Use scopes? - understocked_items = @order.order_items.select{|i| i.local_product.present? && i.num_wished.nil?} - unordered_items = [] - ordered_items = @order.order_items.select{|i| i.num_wished.present? && i.num_wished != 0} - ignored_items = @order.order_items.select{|i| i.local_product.supplier==supplier_name && i.num_wished == 0} - other_items = [] - all_items = [] %ul %li %a(href="#under_min")undecided [#{understocked_items.count}] %li %a(href="#ordered")ordered [#{ordered_items.count}] %li %a(href="#ignored")ignored [#{ignored_items.count}] %li %a(href="#more")more #under_min = haml "order/_item_table".to_sym, locals: {order_items: understocked_items} #ordered = haml "order/_item_table".to_sym, locals: {order_items: ordered_items} #ignored = haml "order/_item_table".to_sym, locals: {order_items: ignored_items} #more %p Add another item? %br %label(for="internal_comment") Internal Comment %textarea#internal_comment(name="internal_comment")~ @order.internal_comment %br = haml "order/_order_actions".to_sym, locals: {order: @order} - else = haml "order/_order_actions".to_sym, locals: {order: @order} %br %table.pure-table %thead %tr %th Item %th(title="Wished Qty") %i.fa.fa-magic %th(title="Ordered Qty") %i.fa.fa-arrow-right %th Stock at time %th Stocked Qty - if !@stock.empty? %th Current Stock %tbody - @order.order_items.find_each do |item| %tr{:class => order_item_class(item)} -# color when not avail, or less available than wished! %td = local_product_link item.local_product %br - if item.local_product.order_info.present? %small= item.local_product.order_info %td(title="Quantity wished") - if item.state == "error" = error_icon tooltip_text: "There was an error during ordering - does the product exist?" =item.num_wished %td(title="Quantity ordered") - if item.state == "error" = error_icon tooltip_text: "There was an error during ordering - does the product exist?" =item.num_ordered %td(title="Stock at that time") =item.current_stock %td(title="Quantity stocked") =item.num_stocked - if !@stock.empty? %td(title="Current Stock") = @stock[item.local_product.product_id] %br = haml "order/_order_actions".to_sym, locals: {order: @order}