Sha256: bf7c0f24b4dda5acc8af2cdab7d23fc28e21dd9d3a334bc469371fdcbb3a5032
Contents?: true
Size: 973 Bytes
Versions: 22
Compression:
Stored size: 973 Bytes
Contents
# frozen_string_literal: true require_dependency "renalware/clinics" module Renalware module Clinics class AppointmentsController < BaseController include Renalware::Concerns::Pageable 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 private def build_params_for_html_form(appointments) OpenStruct.new( patient_ids: appointments.map(&:patient_id).uniq ) end def query_params params .fetch(:q, {}) .merge(page: page, per_page: per_page) end end end end
Version data entries
22 entries across 22 versions & 1 rubygems