=semantic_form_for [:admin, @p_product], :remote => false do |f|

  .qi_row
    .qi_pannel.qi_plain.padding
      =f.inputs do
        .row.qi_cancel_margins
           
          .col-sm-3
            = f.input :p_product_cat_id, :label => "Catégorie produit :", :collection => PProductCat.all, :as => :select, :include_blank => false
          
          .col-sm-3
            = f.input :p_customer_id, :label => "Produit personnalisé pour un client :", :collection => PCustomer.all, :as => :select, :include_blank => true, :member_label => :show_name_extend
      
          
            
      
          .col-sm-3
            = f.input :s_brand_id, :label => "Marque produit :", :collection => SBrand.all, :as => :select, :include_blank => false
          
          .col-sm-3
            %br
            = f.input :enabled, :label => "Produit actif ?"
            
        
      
      
        .row.qi_cancel_margins
           
          .col-sm-4
            =f.input :p_customer_cats, :label => "Disponible pour les clients :", :collection => PCustomerCat.all, :as => :check_boxes
            
          %input#p_product_tva_rate_ids_none{:name => "p_product[tva_rate_ids][]", :type => "hidden", :value => ""}/
      
    
          -AccountingZone.all.each do |az|
            .col-sm-4
              .check_boxes.input.optional.form-group
                %label.control-label 
                  ="Taux de TVA (#{az.name}):"
          
              -TvaRate.where(:accounting_zone_id => az.id).order("rate ASC").all.each do |tr|
                .checkbox
                  %label.choice{:for => "p_product_tva_rate_ids_#{tr.id}"}
                    %input#p_product_tva_rate_ids{:id => tr.id, :checked => ("checked" if f.object.tva_rate_ids.include?(tr.id)), :name => "p_product[tva_rate_ids][]", :type => "checkbox", :value => tr.id, :onchange => "$(this).closest('td').find('input').not(this).prop('checked', false); "}
                    =tr.member_label
        
          =# f.input :tva_rate_ids, :collection => TvaRate.where(:accounting_zone_id => az.id).order("rate ASC").all, :as => :check_boxes, :member_label => :member_label, :label => "Taux de TVA (#{az.name}):"
  
     
      
      
        %table{:style => "width:100%"}
          %tr
            %td{:style => "width:50%;vertical-align:top;"}= f.input :code, :label => "Référence :"
            %td{:style => "width:50%;vertical-align:top;"}= f.input :sub_code, :label => "Référence fournisseur :"
          
        = f.input :name, :label => "Désignation :" 
        =# f.input :ct_price_ht, :label => "Prix HT :" 
      
      

        .p_product_refs_form
          =f.semantic_fields_for :p_product_refs do |form|
            =render :partial => "admin/p_product_refs/form", :locals => {:form => form}
      
        .row.qi_cancel_margins
          .col-sm-4
            =f.input :p_product_sub_cats, :label => "Sous catégories :", :collection => PProductSubCat.where(["parent_id is NULL"]).all, :as => :check_boxes, :nested_set=>true, :member_label => :member_label
            
          .col-sm-4
            = f.input :discount_enrobage, :label => "Remise enrobage ?", :as => :boolean
       
        -if false
          %p= link_to_add_fields "Ajouter une référence", f, :p_product_refs
      
        -if false
          = f.input :code, :label => "Code :"
          = f.input :capacite, :label => "Capacité :" 
          = f.input :uv, :label => "Unité de vente :" 
          
          = f.input :conditionnement, :label => "Conditionnement :" 
          = f.input :compte_achat, :label => "Compte achat :" 
          = f.input :compte_vente, :label => "Compte vente :" 
          = f.input :compte_transport, :label => "Compte transport :" 
      
      
          
        
          .col-sm-4  
            = f.input :ct_purchase_price_ht, :label => "Prix achat HT :" 
   
   
   
   
  .large_actions
    .actions
      =f.submit "sauvegarder", :class => "btn btn-primary btn-ap-add"
      
      
:scss

  .check_boxes{
    list-style-type: none;
    
  }
  .choices{
    .choices-group{
      padding-left:0;
    }
    ol li{
      list-style-type: none;
      
      ul{
        padding:0;
      }
      
    }
    
    label{
      font-weight:normal;
    }
  
    .label{
      display: inherit !important;
      padding: inherit !important;
      font-size: inherit !important;
      font-weight: bold !important;
      line-height: inherit !important;
      color: inherit !important;
      text-align: inherit !important;
      white-space: inherit !important;
      vertical-align: inherit !important;
      border-radius: inherit !important;
      border:0;
      margin-bottom:0;
      
      label{
        font-weight: bold !important;
      }
      
      
    }
  
  
  }
  
      
      
      
      
  