

%h1 Envoyer une newsletter
%p
  = link_to i(:"eye"), admin_newsletter_path(@newsletter), :target => "_blank"
  
  Newsletter sélectionnée :
  =@newsletter.title
  
  
  
%ul.nav.nav-tabs#myTab
  %li.active
    %a{:href => "#send_sheets"}
      Envoyer à une selection d'adhérents
  %li
    %a{:href => "#groups"}
      Envoyer à des groupes d'inscrits
.tab-content
  .tab-pane.active#send_sheets

   


    =#render :partial => "admin/sheets/sheets_search", :locals => {:url => ""}
    
    %p
      %a{:href => "#", :onclick => "$('#sheets_selecteds input:checkbox').attr('checked', true);return false"} Tout sélectionner.
      %a{:href => "#", :onclick => "$('#sheets_selecteds input:checkbox').attr('checked', false);return false"} Tout désélectionner
    #sheets_selecteds
    
      =render :partial => "sheets_selecteds"
    
  
  .tab-pane#groups
    =form_tag send_newsletter_admin_newsletter_path(:id => params[:id]) do
  
      %table.table.table-striped
        -Newsgroup.all.each do |ng|
          %tr  
            %td
              =check_box_tag "confirmed_groups[]", ng.id,false, :id => "confirmed_groups_"+ng.id.to_s
              %label{:for => "confirmed_groups_"+ng.id.to_s, :style => "display:inline;"}
                =ng.name
                (
                =ng.annonce_accounts.enableds.count
                )
      %br
      %br
      
      %p
        =check_box_tag "all_paid",true,false, :id => "all_paid"
        %label{:for => "all_paid", :style => "display:inline;"}
          Tous les payants
      
      %p
        =check_box_tag "all_non_paid_aff",true,false, :id => "all_non_paid_aff"
        %label{:for => "all_non_paid_aff", :style => "display:inline;"}
          Tous les non payants interessés par le programme d'affiliation
      
         
      %br
      %br  
      =submit_tag "Envoyer la newsletter à toutes les personnes de ce groupe", :class => "btn btn-danger"
    
  
  


<script>
$('#myTab a').click(function (e) {
e.preventDefault();
$(this).tab('show');
})

</script>



%br
%br
%br