Class: Renalware::Modalities::ReasonsController

Inherits:
BaseController show all
Defined in:
app/controllers/renalware/modalities/reasons_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#patient

Instance Method Details

#indexObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/renalware/modalities/reasons_controller.rb', line 10

def index
  @reason_hd_pd = HaemodialysisToPD.all
  @reason_pd_hd = PDToHaemodialysis.all

  modal_change_type = params[:modal_change_type]
  type = modal_change_type ? "Renalware::Modalities::#{modal_change_type.camelize}" : nil

  @modality_reason_select = Reason.where(type: type)

  respond_to do |format|
    format.html
    format.json {
      render json: @modality_reason_select.as_json(only: [:id, :rr_code, :description])
    }
  end
end