.qi_header
  %h1
    Panachage
    %span
      Détail d'un panachage
    %span
      ="##{@partition.id}"



.qi_row
  .qi_pannel.qi_plain.padding

    %p
      %s
    %table.table
      %tr
        %th Produit source
        %th Qté source
        %th Kg Source


        %th Stock dispo ?
        %th Produit destination
        %th Qté destination

        %th Kg Destination

        %th Ecart poids

      -@partition.partition_lines.each do |pl|
        %tr
          %td
            =pl.p_product_ref_from.p_product.code
            =pl.p_product_ref_from.p_product.name
          %td
            = pl.qte_from
          %td
            = pl.from_weight


          %td
            -if pl.stock_available?
              Oui
            -else
              Non

          %td
            =pl.p_product_ref_from.p_product.code
            =pl.p_product_ref_to.p_product.name
          %td
            = pl.qte_to
          %td
            = pl.to_weight

          %td
            =pl.dif_weight




    -if @partition.ok_to_execute
      =link_to "Executer le panachage", generate_partition_admin_partition_path(@partition), :class => "btn btn-primary"

  %h3 Stocks générés
  #bills
    -params[:search][:per_page] = params[:search][:per_page] || 5000
    -per_page = params[:search][:per_page]
    -page = (params[:page] and params[:page] != "") ? params[:page] : 1

    -@line_stocks = @partition.line_stocks

    -@line_stocks = sort_by_sorting(@line_stocks, "date DESC")
    -@line_stocks = @line_stocks.page(page).per(per_page)
    %br



    .clear
    =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @line_stocks}

