= haml "products/menu".to_sym %h1= @product.name %form.pure-form.pure-form-aligned(action="" method="post") %input(type="hidden" name="_method" value="put") - if @product.hidden? .ui-state-error This product is hidden (in rawbotz). - if !@product.active? .ui-state-error This product is deactivated (in magento). %fieldset .pure-control-group %label(for="product_id") Product ID %input#product_id(type="text" readonly value="#{@product.product_id}") .pure-control-group %label(for="product_page") Product Page (Shop frontend) - frontend_url = Rawbotz::LocalShop.product_page_frontend(@product, settings.conf) %a(href="#{frontend_url}" target="blank") = frontend_url .pure-control-group %label(for="product_page") Product Page (Shop backend) - backend_url = Rawbotz::LocalShop.product_page_backend(@product, settings.conf) %a(href="#{backend_url}" target="blank") = backend_url .pure-control-group %label(for="supplier") Supplier = supplier_link @product.supplier - if @product.supplier == settings.supplier || @product.remote_product.present? .pure-control-group %label(for="supplier") Remote Product - if @product.supplier != settings.supplier = error_icon = remote_product_link @product (but not from remote shop!) - elsif @product.remote_product.nil? not linked %a(href="/product/#{@product.id}/link") Linking View - else = remote_product_link @product - if @product.supplier == settings.supplier || @product.remote_product.present? .pure-control-group %label(for="remote_frontend") Remote Frontend Product page %a(href="#{Rawbotz::RemoteShop.product_page_url(@product, settings.conf)}" target="remote_shop") = Rawbotz::RemoteShop.product_page_url(@product, settings.conf) .pure-control-group %label(for="packsize") Pack size = @product.packsize .pure-control-group %label(for="shelve") Shelve = @product.shelve_nr - if @product.supplier_sku.present? .pure-control-group %label(for="supplier_sku") Supplier SKU = @product.supplier_sku - if @product.supplier_prod_name.present? .pure-control-group %label(for="supplier_prod_name") Supplier Product Name = @product.supplier_prod_name - if @product.order_info.present? .pure-control-group %label(for="order_info") Order Info = @product.order_info - if @product.purchase_price.present? .pure-control-group %label(for="purchase_price") Purchase Price = @product.purchase_price .pure-control-group %label(for="organic") Organic = bool_icon @product.organic? %h2 Actions - if @product.supplier == settings.supplier && !@product.remote_product.present? = haml "widgets/_link".to_sym, locals: {local_product: @product, redirect_to: 'product'} %br = haml :"_hide_unhide_button", locals: {product: @product} - if @plot_data.any? .pure-g .pure-u-1-1 %h2 Stock and Sales Values (30 days) .pure-u-2-5 %table.pure-table.pure-table-striped %thead %tr %th Month %th Qty Sold %th Quarter %tbody - @sales_monthly.each_slice(3) do |sales| - sales.each do |s| %tr %td = Date::MONTHNAMES[s[0].month] = s[0].year %td=s[1] %td %tr(style="background-color: rgb(132,122,102);") %td(colspan="2") = Date::MONTHNAMES[sales[0][0].month] = sales[0][0].year \- = Date::MONTHNAMES[sales[-1][0].month] = sales[-1][0].year %td -#= sales.inspect = sales.inject(0) {|acc, s| acc + s[1].to_i } .pure-u-3-5 = haml :"product/_stock_sales_plot", locals: {plot_data: @plot_data, markers: @sales_monthly} %br - if @stock_product.present? %h2 Stock and Sales data statistics = haml "stock_product/value_table".to_sym, locals: {stock_product: @stock_product} %br - if @product.order_items.present? %h2 Orders %table.pure-table %thead %tr %th Order %th Date %th Num ordered %th Num stocked %tbody - @product.order_items.where("num_ordered > 0").order(updated_at: :desc).find_each do |order_item| %tr %td= order_link order_item.order %td= order_item.order.updated_at %td= order_item.num_ordered %td= order_item.num_stocked