.p_product_page
  .qi_header
    %h1
      =link_to ic(:user)+" Mon compte", public_my_account_path
      %span
        =link_to "Les produits KapsMe disponibles", public_p_products_path
      %span
        =@p_product.p_product_cat.name if @p_product.p_product_cat
        =@p_product.name


  .qi_row
    .qi_pannel.qi_plain.padding
      -if @p_product.image_file
        .image_col
          =image_tag @p_product.image_file.file.large.medium.url 
      .description{:style => ("margin-left:0;" if !@p_product.image_file)}
        =simple_format @p_product.description
      .clear
      %br
      
      
            
      -if @p_product.get_prices(current_p_customer).count > 1
        %p
          Prix de
          =number_to_currency @p_product.get_prices(current_p_customer).last.price
          à 
          = number_to_currency @p_product.get_prices(current_p_customer).first.price 
        %table.table.price_table
          %tr
        
            -@p_product.get_prices(current_p_customer).each do |price|
  
              %td
                A partir de 
                =price.nbr.to_i
                ex
          %tr
        
            -@p_product.get_prices(current_p_customer).each do |price|
  
              %td
                =number_to_currency price.price
      
      -elsif @p_product.get_prices(current_p_customer).count == 1
        %p
          =number_to_currency @p_product.get_prices(current_p_customer).last.price
          
        
      -if @p_product.get_prices(current_p_customer).count > 0 and @p_product.get_prices(current_p_customer).first.price > 0.0
        .sub_header
          %h2 Commander
      
        .p_sheet_line_order
          -@p_sheet_line = PSheetLine.new(:p_product => @p_product)
          -#@p_sheet_line.generate_p_sheet_line_lines

          =semantic_form_for [:public, @p_sheet_line], :remote => false do |form|
  
            = form.hidden_field :p_product_id, :class => "p_product_id"
  
            -if form.object.p_product
    
              -p_product = form.object.p_product
      
    
              -if false
                %table.table.order_table
                  %tr
                    %th Taille
                    %th Couleur
                    %th Qte
                  -s = "a"
                  -si = 1
    

                  -if true
                    -p_product.p_product_stocks.order("p_size_id ASC, p_color_id ASC").each do |ps|
      
                      -si = p_product.p_product_stocks.where(:p_size_id => ps.p_size_id).count()
        
                      %tr
                        -if ps.p_size_id != s
                          -s = ps.p_size_id
          
                          %td{:rowspan => si}

                            =ps.p_size.name if ps.p_size
        
                        %td
                          =ps.p_color.name if ps.p_color
              
                        %td
                          -p_sheet_line_line = @p_sheet_line.p_sheet_line_lines.new(:p_product_stock_id => ps.id)
                
                          =form.fields_for(:p_sheet_line_lines, p_sheet_line_line) do |builder|
                            =builder.hidden_field :p_product_stock_id,:label => false, :as => :string
                            =builder.input :qte,:label => false, :as => :string
                        
                        

              %table.table.order_table
                %tr
                  %th
                  -p_product.p_sizes.all.each do |p_size|
                    %th.size_th
                      =p_size.name
                    
                -p_product.p_colors.all.each do |p_color|
                  %tr
                    %td=p_color.name
                  
                    -p_product.p_sizes.all.each do |p_size|
                      %td
                        -ps = p_product.p_product_stocks.where(:p_size_id => p_size.id, :p_color_id => p_color.id).first
                      
                        -if ps
                          -p_sheet_line_line = @p_sheet_line.p_sheet_line_lines.new(:p_product_stock_id => ps.id)
              
                          =form.fields_for(:p_sheet_line_lines, p_sheet_line_line) do |builder|
                            =builder.hidden_field :p_product_stock_id,:label => false, :as => :string
                            =builder.input :qte,:label => false, :as => :string
                      
      
              =form.submit "Commander", :class => "btn btn-primary"

:scss
  .size_th{
    width:80px;
    
  }


