Sha256: 7a2656177be309c3db6fa3653769fbf7db62170ab800a63dfea76b697566a80f

Contents?: true

Size: 1.5 KB

Versions: 15

Compression:

Stored size: 1.5 KB

Contents

require_dependency "adherent/application_controller"

module Adherent
  class ReglementsController < ApplicationController
    
    # enegistrer un nouveau réglement est en fait créer une nouvelle imputation 
    # pour un paiement. 
    # Il est donc obligatoire d'avoir un paiement
    #
    def new
      @payment = Payment.find(params[:payment_id])
      @member = @payment.member
      @reglement = @payment.reglements.new(amount:@payment.non_impute)
      @unpaid_adhesions = Adhesion.unpaid
    end
    
    # TODO voir pour faire les deux approches (succès et échec)
    def create
      @payment = Payment.find(params[:payment_id])
      @payment.imputation_on_adh(params[:reglement][:adhesion_id])
      redirect_to member_payments_path(@payment.member)
      
    end
    
    def show
      @payment = Payment.find(params[:payment_id])
      @reglement = @payment.reglements.find(params[:id])
    end
    
    
    
   # DELETE /reglement/1
    
    def destroy
      @payment = Payment.find(params[:payment_id])
      @reglement = @payment.reglements.find(params[:id])
      if @reglement.destroy
        flash[:notice] = 'Le reglement a été supprimé'
      else
        flash[:alert] = 'Le règlement n\'a pas pu être supprimé'
      end
  
      respond_to do |format|
        format.html { redirect_to member_payment_url(@payment.member, @payment) }
      end
    end
    
    private
    
    def reglement_params
      params.require(:reglement).permit(:amount, :payment_id)
    end
    
  
    
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
adherent-0.3.0 app/controllers/adherent/reglements_controller.rb
adherent-0.2.9 app/controllers/adherent/reglements_controller.rb
adherent-0.2.8 app/controllers/adherent/reglements_controller.rb
adherent-0.2.7 app/controllers/adherent/reglements_controller.rb
adherent-0.2.6 app/controllers/adherent/reglements_controller.rb
adherent-0.2.5 app/controllers/adherent/reglements_controller.rb
adherent-0.2.4 app/controllers/adherent/reglements_controller.rb
adherent-0.2.3 app/controllers/adherent/reglements_controller.rb
adherent-0.2.2.4 app/controllers/adherent/reglements_controller.rb
adherent-0.2.2.3 app/controllers/adherent/reglements_controller.rb
adherent-0.2.2.2 app/controllers/adherent/reglements_controller.rb
adherent-0.2.2.1 app/controllers/adherent/reglements_controller.rb
adherent-0.2.2 app/controllers/adherent/reglements_controller.rb
adherent-0.2.1 app/controllers/adherent/reglements_controller.rb
adherent-0.2.0 app/controllers/adherent/reglements_controller.rb