#v_contact_show
  =render :partial => "show"
  
  
  
.qi_row
  .tab
    %ul.nav.nav-tabs{:role => "tablist"}
      
      
      -params[:tab] = params[:tab] || "volumes_periodiques"
      %li.nav-item=link_to "Mouvements du client", "?tab=volumes_periodiques#tabs", :class => "nav-link"+(" active" if params[:tab] == "volumes_periodiques").to_s
      
      %li.nav-item=link_to "Bons d'achats & remises du client", "?tab=v_bdas#tabs", :class => "nav-link"+(" active" if params[:tab] == "v_bdas").to_s
      
      %li.nav-item=link_to "Historique des mails envoyés", "?tab=mails#tabs", :class => "nav-link"+(" active" if params[:tab] == "mails").to_s
        
      
    .tab-content
      #tab-1.tab-pane.active{:role => "tabpanel"}
        -if params[:tab] == "v_bdas"
          #volumes_periodiques
          
            -params[:search][:per_page] = params[:search][:per_page] || 50
            -per_page = params[:search][:per_page]
            -page = (params[:page] and params[:page] != "") ? params[:page] : 1 
            -@v_bdas =@v_contact.v_bdas
            -@v_bdas = sort_by_sorting(@v_bdas, "date DESC, id DESC")
            -@v_bdas = @v_bdas.page(page).per(per_page)

            =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @v_bdas}

        
        
        -if params[:tab] == "volumes_periodiques"
          #volumes_periodiques
          
            -params[:search][:per_page] = params[:search][:per_page] || 50
            -per_page = params[:search][:per_page]
            -page = (params[:page] and params[:page] != "") ? params[:page] : 1 
            -@volumes =@v_contact.volumes
            -@volumes = sort_by_sorting(@volumes, "datedebut DESC, id DESC")
            -@volumes = @volumes.page(page).per(per_page)

            =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @volumes}

        
          
        -if params[:tab] == "mails"
          #mails
            -params[:search][:per_page] = params[:search][:per_page] || 50
            -per_page = params[:search][:per_page]
            -page = (params[:page] and params[:page] != "") ? params[:page] : 1 
            -@mail_hists = @v_contact.mail_hists
            -@mail_hists = sort_by_sorting(@mail_hists, "created_at DESC")
            -@mail_hists = @mail_hists.page(page).per(per_page)
    
            =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @mail_hists}
    
            