

  
-if @m_odr.start_at >  Date.today and params[:force].to_s == ""
  %div{:style => "margin-top:30px;font-weight:bold;font-weight:800;font-size:2em;text-transform:uppercase;font-family: 'Open Sans','Helvetica Neue', Helvetica, sans-serif;text-align:center;"}
    -count = ((@m_odr.start_at) - (Date.today))
    
    -if @m_odr.landing_text?
      =@m_odr.landing_text
    -else
      Démarrage 
    %div{:style => "font-weight:bold;font-weight:800;text-transform:uppercase;font-family: 'Open Sans','Helvetica Neue', Helvetica, sans-serif;text-align:center;line-height:200px;position:relative;top:-40px"}
      dans
      .clock{:style => "margin:2em;display:inline-block;width:auto;margin:0 auto;position:relative;top:35px"}
      -if count > 1
        jours !
      -else
        jour !
    <script type="text/javascript">
    =raw "var clock_max = #{count};"
    </script>
    :javascript
      var countup;
        
              var clock = $('.clock').FlipClock(0, {
                  clockFace: 'Counter',
                  minimumDigits: 1,
                  callbacks:{
                    init:function (){

                    }
                  }
              });
      if(clock_max > 0){
      countup = setInterval(function() {
          clock.increment();
              if(clock.getTime().time >= clock_max) {
              clock.stop();
              clearInterval(countup);
              }     
      }, 0);}
    
    -if false
      %p{:style => "font-weight:bold;font-size:2em;text-transform:uppercase;font-family:'Helvetica Neue', Helvetica, sans-serif;"}
        jours avant l'ouverture
        
-else
  -if !@m_odr_rep
    -@m_odr_rep = @m_odr.m_odr_reps.new(:t => params[:t])
    -@m_odr_rep.particulars.build(:skip_organisation => true, :validate_name => true,:skip_email => (true if !@m_odr.email_needed), :validate_email => (true if @m_odr.email_needed),:validate_tel => (true if @m_odr.tel_needed),:skip_validation => (true if !@m_odr.address_needed))
    -@m_odr_rep.m_odr_rep_ribs.build() if @m_odr.rib_process
  
    - @m_odr.m_odr_file_types.each do |ft|
      -@m_odr_rep.m_odr_files.build(:m_odr_file_type_id => ft.id)
  

  #odr_form
    =semantic_form_for [:public, @m_odr_rep], html: { multipart: true } , :remote => false do |f|
      =debug @m_odr_rep.errors.messages if current_admin
      =f.hidden_field :m_odr_id
      =hidden_field_tag :force, params[:force]
      =f.hidden_field :t
      
      .form_pannel
        %h3 Vous
      
        =f.inputs do
          =f.semantic_fields_for :particulars do |f|
          
            =f.hidden_field :validate_name
            =f.hidden_field :skip_organisation
            =f.hidden_field :validate_tel
            =f.hidden_field :validate_email
            =f.hidden_field :skip_email
            =f.hidden_field :skip_validation
            
            %table{:style => "width:100%;"}
              %tr
                %td{:style => "width:20%;padding-right:4px;"}
                  =f.input :civilite, :label => false, :placeholder => "Civilité", :as => :select, :collection => [[qit("don-particular-civilite-mme","Mme."), "Mme"], [qit("don-particular-civilite-m","M."), "M"]], :include_blank => true
                %td{:style => "width:40%;padding-right:4px;"}
                  =f.input :name, :label => false, :placeholder => (@m_odr_rep.m_odr.name_label? ? @m_odr_rep.m_odr.name_label : "Nom")
    
                %td{:style => "width:40%"}
                  =f.input :firstname, :label => false, :placeholder => (@m_odr_rep.m_odr.firstname_label? ? @m_odr_rep.m_odr.firstname_label : "Nom")
    
            -if @m_odr_rep.m_odr.address_process
              =f.input :address_2, :label => false, :placeholder => "Adresse"
              =f.input :address_3, :label => false, :placeholder => "Adresse suite"
              %table{:style => "width:100%;"}
                %tr
                  %td{:style => "width:30%;padding-right:4px;"}
                    =f.input :cp, :label => false, :placeholder => "Code postal"
                  %td{:style => "width:70%"}
                    =f.input :city, :label => false, :placeholder => "Ville"

              .select=f.input :country, :label => false, :placeholder => "Pays", :priority_countries => ["FR", "CH", "BE"], :include_blank => false, :locale => @lang.slug
            
            
            -if @m_odr_rep.m_odr.email_process
              =f.input :email, :label => (!@m_odr_rep.m_odr.placeholder? ? false : "Email :"), :placeholder => (@m_odr_rep.m_odr.placeholder? ? false : "Email")
            
            -if @m_odr_rep.m_odr.tel_process
              =f.input :tel, :label => (!@m_odr_rep.m_odr.placeholder? ? false : "Tel :"), :placeholder => (@m_odr_rep.m_odr.placeholder? ? false : "Tel")
              Nous ne vous contacterons par téléphone qu’en cas de problème avec votre dossier
    
      -if @m_odr_rep.m_odr_rep_ribs.size > 0
        .form_pannel
          %h3 Vos coordonnées bancaires
      
          =f.inputs do
            =f.semantic_fields_for :m_odr_rep_ribs do |f|
              %table
                %tr
                  %td{:style => "width:20%;padding-right:4px;"}
                    =f.input :bic, :label => "Bic : "
                  %td{:style => "width:40%;padding-right:4px;"}
                    =f.input :iban, :label => "Iban :", :input_html => {:class => "iban_input"}
                  
                  :javascript
                    $('.iban_input').mask('SSAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AA', {
                        placeholder: '____ ____ ____ ____ ____ ____ ____ ____ __'
                      });
    
    
      .form_pannel
        %h3 Votre achat
      
        -if f.object.m_odr.m_odr_product_cats.count > 0
          =f.inputs do
            =f.input :m_odr_product_cat_id, :label => (!@m_odr_rep.m_odr.placeholder ? false :(@m_odr_rep.m_odr.product_cat_label? ? @m_odr_rep.m_odr.product_cat_label : "Types :")), :as => :select, :collection => f.object.m_odr.m_odr_product_cats.order("id ASC"), :member_label => :name, :include_blank => true, :prompt => (@m_odr_rep.m_odr.product_cat_label? ? @m_odr_rep.m_odr.product_cat_label : "Nombre de pneus")
      
      
        =f.inputs do
          =f.input :m_odr_product_id, :label => (!@m_odr_rep.m_odr.placeholder ? false :(@m_odr_rep.m_odr.product_label? ? @m_odr_rep.m_odr.product_label : "Pneu :")), :as => :select, :collection => f.object.m_odr.m_odr_products.where(:m_odr_brand_id => f.object.m_odr.m_odr_brands.where("(start_at is null or start_at <= ?) and (public_end is null or public_end >= ?)", Date.today,Date.today) ).order("m_odr_brand_id ASC, m_odr_products.name"), :member_label => :member_label, :include_blank => true, :prompt => (@m_odr_rep.m_odr.product_label? ? @m_odr_rep.m_odr.product_label : "Pneu")
      
        =f.inputs do
          =f.input :qte, :label => (!@m_odr_rep.m_odr.placeholder ? false :(@m_odr_rep.m_odr.qte_label? ? @m_odr_rep.m_odr.qte_label : "Nombre de pneus :")), :as => :select, :collection => f.object.m_odr.m_odr_product_remises.group(:qte).order("qte").map{|a| a.qte}, :include_blank => true, :prompt => (@m_odr_rep.m_odr.qte_label? ? @m_odr_rep.m_odr.qte_label : "Nombre de pneus")
    
        =f.inputs do
          =f.input :m_odr_place, :label => (!@m_odr_rep.m_odr.placeholder ? false :(@m_odr_rep.m_odr.place_label? ? @m_odr_rep.m_odr.place_label : "Point de vente :")), :as => :select, :collection => f.object.m_odr.m_odr_places.order(:name), :include_blank => true, :prompt => (@m_odr_rep.m_odr.place_label? ? @m_odr_rep.m_odr.place_label : "Point de vente :")
        
        -if @m_odr_rep.m_odr.reduc_code_process
          =f.input :reduc_code, :label => (!@m_odr_rep.m_odr.placeholder? ? false : "Code promotionnel :"), :placeholder => (@m_odr_rep.m_odr.placeholder? ? false : "Code promotionnel")
      
      
        =f.inputs do
          =f.semantic_fields_for :m_odr_files do |f|
            =f.input :file, :label => f.object.m_odr_file_type.name
            =f.hidden_field :m_odr_file_type_id
        
        -if @m_odr_rep.m_odr.confirm_case_needed
          =f.input :rgpd, :label => (@m_odr_rep.m_odr.confirm_case_label? ? @m_odr_rep.m_odr.confirm_case_label : "J'accepte les conditions générales")
      %br
      %center=f.submit "Envoyer", :class => "btn btn-primary btn-lg"
      %br
      
  :scss
    abbr[title="required"] {
      //display: none;
     text-decoration:none;
     border:0;
    }
    form{
      td{
        vertical-align:top;
      }
      
    }
    
  -if [3,4].include?(@m_odr_rep.m_odr_id)
    :scss
      body{
      color:#333}
      h3{
        text-transform:uppercase;
        text-align:center;
        font-weight:bold;
      }
      .form-control{
        border-radius:0;
        font-size:1.2em;
        width:100%;
        box-sizing:border-box;
        border: 1px solid transparent;
        border-radius: 0;
        outline: 0;
        background: #f6f6f6;
        font-weight: 400;
        font-size: 14px;
        color: #333;
        box-shadow:0 0 0 white !important;
            padding: 25px 14px;
            
            &:focus{
              border-color: #fdda26;
              
            }
      }
      .form_pannel{
        box-shadow:0 0 0 white !important;
        
      }
      
      .select { position: relative; text-align: left; }
      
      
      .select select { 
        display: inline-block;
        width: 100%;
        height: 52px; 
        
        padding:0 14px;
        
        border: 1px solid transparent;
        border-radius: 0; outline: 0; background: #f6f6f6; font-weight: normal; font-size: 14px; color: #333; -webkit-appearance: none; -moz-appearance: none; appearance: none; cursor: pointer; }
      
      
      
      
      select{
        
        
        padding-right: 40px;
        padding-left: 14px;
        
    
        border-radius:0 !important;
        -webkit-appearance: none;
        color:#333;
       
        
      }
      
      .btn-primary{
        background:#fdda26;
        border:0;
        color:black;
        font-size:14px;
        padding:15px 40px;border-radius:0;
      }