Sha256: e3940d4e5bd5fcd6f6d697848ddfd774148fbe363aea5051f16b668b399f702c

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require_dependency "renalware/hd"

module Renalware
  module HD
    class MDMPatientsController < Renalware::MDMPatientsController
      def index
        filter_form = HD::MDMPatientsForm.new(filter_form_params)

        query = HD::MDMPatientsQuery.new(
          params: filter_form.ransacked_parameters.merge(query_params).with_indifferent_access
        )

        render_index(filter_form: filter_form,
                     query: query,
                     page_title: t(".page_title"),
                     view_proc: ->(patient) { patient_hd_mdm_path(patient) },
                     patient_presenter_class: HD::PatientPresenter)
      end

      private

      def filter_form_params
        params.fetch(:filter, {}).permit!
      end

      def query_params
        params.fetch(:q, {}).permit!
      end

      def render_index(filter_form:, **args)
        presenter = build_presenter(params: params, **args)
        authorize presenter.patients
        render(
          :index,
          locals: { presenter: presenter, filter_form: filter_form }
        )
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
renalware-core-2.0.51 app/controllers/renalware/hd/mdm_patients_controller.rb
renalware-core-2.0.50 app/controllers/renalware/hd/mdm_patients_controller.rb
renalware-core-2.0.48 app/controllers/renalware/hd/mdm_patients_controller.rb
renalware-core-2.0.47 app/controllers/renalware/hd/mdm_patients_controller.rb
renalware-core-2.0.46 app/controllers/renalware/hd/mdm_patients_controller.rb
renalware-core-2.0.45 app/controllers/renalware/hd/mdm_patients_controller.rb
renalware-core-2.0.44 app/controllers/renalware/hd/mdm_patients_controller.rb
renalware-core-2.0.43 app/controllers/renalware/hd/mdm_patients_controller.rb
renalware-core-2.0.42 app/controllers/renalware/hd/mdm_patients_controller.rb
renalware-core-2.0.41 app/controllers/renalware/hd/mdm_patients_controller.rb
renalware-core-2.0.40 app/controllers/renalware/hd/mdm_patients_controller.rb