Class: Renalware::Clinics::AppointmentsController

Inherits:
BaseController show all
Includes:
Renalware::Concerns::Pageable
Defined in:
app/controllers/renalware/clinics/appointments_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#patient

Instance Method Details

#createObject



28
29
30
31
32
33
34
35
36
# File 'app/controllers/renalware/clinics/appointments_controller.rb', line 28

def create
  appointment = Appointment.new(appointment_params)
  authorize appointment
  if appointment.save_by(current_user)
    redirect_to appointments_path, notice: t(".success", model_name: "Appointment")
  else
    render_new(appointment)
  end
end

#indexObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/renalware/clinics/appointments_controller.rb', line 10

def index
  appointments_query = AppointmentQuery.new(query_params)
  appointments = appointments_query.call.page(page).per(per_page)
  authorize appointments

  render :index, locals: {
    appointments: appointments,
    query: appointments_query.search,
    clinics: Clinic.ordered,
    users: User.ordered,
    request_html_form_params: build_params_for_html_form(appointments)
  }
end

#newObject



24
25
26
# File 'app/controllers/renalware/clinics/appointments_controller.rb', line 24

def new
  render_new(Appointment.new)
end