%tr#p_product{:id => p_product.id}
  
  %td{:style => "white-space: nowrap;"}= link_to p_product.code, edit_admin_p_product_path(p_product)
  %td{:style => "white-space: nowrap;"}=link_to p_product.name, edit_admin_p_product_path(p_product)
  
  %td=raw p_product.p_customer_cats.map{|a| a.name}.join(",")
  %td
    = p_product.p_product_cat.name if p_product.p_product_cat
  
  %td
    = p_product.s_brand.name if p_product.s_brand
  
  
    
  -if p_product_ref = p_product.p_product_refs.first
    
    %td
      -if p_product_ref.uv?
        = p_product_ref.uv
      -else
        %span.red= ic :warning
    
    %td
      =p_product_ref.capacite
    
    %td
      =p_product.price_calc
      
    
    %td.numeraire
      -if p_product_ref.ct_price_ht.to_f == 0.0
        %span.red= ic :warning
      =number_to_currency p_product_ref.ct_price_ht
      
    %td.numeraire
      -if p_product.price_calc == "Kg" 
        -if p_product_ref.weight.to_f != 0.0
          =number_to_currency( p_product_ref.ct_price_ht / p_product_ref.weight)
        -else
          %span.red= ic :warning
        
    %td.numeraire
      =p_product.tva_rate(1).rate if p_product.tva_rate(1)
      ="%"
    
    
    %td.numeraire
      -if p_product_ref.weight?
        = p_product_ref.weight
        Kg
      -elsif p_product.price_calc == "Kg"
        %span.red= ic :warning
    
  %td
    =p_product.country
    
  %td=p_product.sub_country
    
  %td=p_product.domaine
    

      


  %td.actions
    -if current_admin.has_permission?("products-d")
      = link_to i(:"trash-o"), [:admin, p_product], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer ce produit ? ' } , :remote => true if !PriceLine.where(:p_product_ref_id => p_product.p_product_ref_ids).first
    =#debug PriceLine.where(:p_product_id => p_product.id).first
    -if current_admin.has_permission?("products-e")
      = link_to i(:pencil), edit_admin_p_product_path(p_product), :remote => false

