%div{:class => ("sheet_block" if !@sheet_year.id)}

	-remote_form_for(@sheet_year) do |f|
		= f.error_messages
	
		= f.label :year, "Année :"
		= f.text_field :year
	
		= f.label :join_type , "Type d'adhésion : "
		= f.select :join_type, SheetYear::JOIN_TYPE.map {|u| [u[1], u[0]] }

		= f.label :benefactor, "Bienfaiteur : " 
		= f.check_box :benefactor
	
		%br
		= f.label :gift_year, "Année d'adhésion offerte : "
		= f.check_box :gift_year, :onchange => "payment_form("+@sheet_year.id.to_s+",$(this).attr('checked'));" 
	
		%br


		#payment_form{:id => @sheet_year.id, :style => ("display:none;" if @sheet_year.gift_year)}
			= f.label :paid_at, "Date de paiement : "
			= f.date_select :paid_at, :include_blank => true
	
			= f.label :amount, "Montant : "
			= f.text_field :amount 
			%br
	
			= f.label :payment_type, "Type de paiement : "
			= f.select :payment_type, SheetYear::PAYMENT_TYPE.map {|u| [u[1], u[0]] }, {},{:onchange => "check_form("+@sheet_year.id.to_s+",$(this).val());"}
		
		
			%br
			#check_form{:id => @sheet_year.id, :style => ("display:none;" if @sheet_year.payment_type != 1)}
				= f.label :bank, "Banque : "
				= f.text_field :bank 
	
				= f.label :check_number, "Numéro du chèque : "
				= f.text_field :check_number 
	
			= f.hidden_field :sheet_id 
	
		= f.submit 'Sauvegarder' 
		-if @sheet_year.id
			= link_to_remote 'Annuler', :url => @sheet_year, :method => :get
		-else
			= link_to 'Annuler', "#", :onclick => "$('#new_sheet_year').html('');return false;"
	
