= haml "orders/menu".to_sym :javascript $( function() { $( document ).tooltip(); }); %h1 Non-Remote Order for supplier #{@supplier.name} #modal-plot.modal-plot #supplier_info - if @supplier.order_info.present? #flash.ui-state-highlight = info_icon %b Delivery info: = @supplier.order_info - if @supplier.delivery_time_days #flash.ui-state-highlight = info_icon %b Delivery Time (in days): = @supplier.delivery_time_days - if @supplier.minimum_order_value #flash.ui-state-highlight = info_icon %b Minimum Order Value = @supplier.minimum_order_value € - if @supplier.order_info.present? || @supplier.delivery_time_days || @supplier.minimum_order_value %br %center %form#non_remote_order.pure-form(action="" method="post") %input(name="supplier_id" type="hidden" value="#{@supplier.id}") %table.pure-table.pure-table-striped %thead %tr %th Name %th Qty %th(title="Packsize") = packsize_icon %th Avg. sales / m %th Stock %th Missing %th Purchase Price %th Chart %tbody - @order.order_items.find_each do |order_item| - product = order_item.local_product - product_monthly_sales = @monthly_sales && @monthly_sales[product.product_id] - product_stock = @stock[product.product_id] %tr(title="Complete sales info") %td = product_link product - if product.supplier_prod_name %br %small = product.supplier_sku = product.supplier_prod_name - if product.order_info.present? #flash.ui-state-highlight = error_icon = product.order_info %td(title="Quantity to order") - if @order.state == "new" = haml "widgets/_qty_wished_input".to_sym, locals: {product: product, input_id_num: product.id, num_wished: order_item.num_wished} - else %input.qty{readonly: true, value: order_item.num_wished, size: 2} %td(title="Packsize of product") - if product.packsize.present? = product.packsize - else %i.fa.fa-ban %td(title="Monthly sales of product") = product_monthly_sales %td(title="Product Stock") = product_stock %td(title="Predicted quantity missing to stock for 30 days") - if product_stock && product_monthly_sales -# red/yellow/green -# if negative, put button = product_stock - product_monthly_sales %td(title="Purchase Price") - if product.purchase_price = product.purchase_price € %td - stock_url = "/product/#{product.id}/stock_sales_plot" %a.stock_show_action{:href => "", :data => {url: stock_url, product: product.name}} Stock/Sales %br %center Total price (updates on 'Save' click): %br %b = "%.2f" % @order.order_items.inject(0.0) {|acc, oi| acc += oi.num_wished.to_i * oi.local_product.purchase_price.to_f} € - if @order.order_items.detect{|oi| oi.num_wished.to_i > 0 && oi.local_product.purchase_price.present?} \... plus products without purchase price %br .br %table.pure-table.pure-table-bordered(width="100%") %thead %tr %th %label(for="internal_comment") Internal Comment %th %label(for="public") Public Comment %tbody %tr %td %textarea#internal_comment(name="internal_comment")~ @order.internal_comment %td %textarea#public_comment(name="public_comment")~ @order.public_comment %br %center %h2 Actions - if @order.state != "deleted" && @order.state != "mailed" %button.pure-button.pure-button-primary(name="action" value="save") = save_icon Save - if @order.state != "deleted" && @order.state != "mailed" %button.pure-button.pure-button-secondary(name="action" value="fix") Save and fix, mark as mailed - if @order.state != "deleted" %button.pure-button.pure-button-primary(name="action" value="delete") Delete -#%button#ajax_mailto.pure-button.pure-button-secondary -# %i.fa.fa-envelope -# Open mail -#:javascript -# $("#ajax_mailto").click(function(e){ -# e.preventDefault(); -# var parameters = $('#non_remote_order').serialize(); -# //alert(parameters); -# $.ajax({ -# url: "/order/non_remote/#{@supplier.id}/mailto", -# data: parameters, -# type: 'POST', -# success: function(data){ -# if(data.indexOf('mailto') > -1){ -# window.location = data; -# } -# } -# }); -# }); -#Edit supplier ... %br - if @mail_preview_text.to_s != "" %table.pure-table %tr %td %h2 Mail preview %pre~ "SUBJECT: #{@mail_preview_subject}" %pre~ "TO: #{@supplier.email}" %pre~ @mail_preview_text %a{:href => @mailto_url, :target => 'rawbotz_mail_order'} Open mail %td %h2 Mail template %pre~ @supplier.order_template %a.pure-button(href="/supplier/#{@supplier.id}#tab_order_settings") Edit template %br - else %h2 Mail template %pre~ @supplier.order_template %a.pure-button(href="/supplier/#{@supplier.id}#tab_order_settings") Edit template %br