#sheet_search
	=form_tag(url,{:method => :put, :remote => true, :onsubmit => "$('#sheets').html('<center>Chargement en cours...</center>');"}) do
		%table.sheet_search
			%tr
				%td
					%h4 Type de fiche : 			
					=check_box_tag "sheet_filter[sheet_type][]", 1, (true if params[:sheet_filter] and params[:sheet_filter][:sheet_type] and params[:sheet_filter][:sheet_type].include?("1"))
					Adhérent
					=check_box_tag "sheet_filter[sheet_type][]", 2, (true if params[:sheet_filter] and params[:sheet_filter][:sheet_type] and params[:sheet_filter][:sheet_type].include?("2"))
					Sympathisants
				
				%td	
					%h4 Dernier renouvellement :
					-last_year= SheetYear.find(:first, :order => "year DESC").year
					-first_year= SheetYear.find(:first, :order => "year ASC").year
					-y = last_year
					#sheet_years_search_years
						%p
							%a{:href => "#", :onclick => "$('#sheet_years_search_years input:checkbox').attr('checked', true);return false"} Tout sélectionner.
							%a{:href => "#", :onclick => "$('#sheet_years_search_years input:checkbox').attr('checked', false);return false"} Tout désélectionner
						
						-while y >= first_year 
			
							=check_box_tag "sheet_filter[sheet_year][]", y, (true if params[:sheet_filter] and params[:sheet_filter][:sheet_year] and params[:sheet_filter][:sheet_year].include?(y.to_s))
							=y
							%br
							-y -= 1

				%td
					%h4 Résidence :
					#cities
						%p
							%a{:href => "#", :onclick => "$('#cities input:checkbox').attr('checked', true);return false"} Tout sélectionner.
							%a{:href => "#", :onclick => "$('#cities input:checkbox').attr('checked', false);return false"} Tout désélectionner
						
					
						-Sheet.find(:all, :group => :city, :order => :city).each do |c|
							=check_box_tag "sheet_filter[sheet_city][]", c.city, (true if params[:sheet_filter] and params[:sheet_filter][:sheet_city] and params[:sheet_filter][:sheet_city].include?(c.city))
							=c.city
							%br
					
		.links=submit_tag "Mettre à jour", :class => "btn btn-primary" 