Sha256: 3554863816f6d6bbbd3e9a9a9e5b04628c8669d808f4fdba70f00ab38fbd9d44
Contents?: true
Size: 1.1 KB
Versions: 19
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true module Renalware class DeathsController < BaseController include PresenterHelper include Pagy::Backend def index query = Patients::DeceasedPatientsQuery.new(params[:q]) pagy, patients = pagy(query.call.includes(previous_modality: :description)) authorize patients render locals: { patients: present(patients, PatientPresenter), q: query.search, pagy: pagy } end def edit authorize patient render_edit end def update authorize patient if patient.update(death_params) redirect_to patient_clinical_profile_path(patient), notice: t(".success", model_name: "patient") else flash.now[:error] = t(".failed", model_name: "patient") render_edit end end private def render_edit render :edit, locals: { patient: patient } end def death_params params .require(:patient) .permit(:died_on, :first_cause_id, :second_cause_id, :death_notes) .merge(by: current_user) end end end
Version data entries
19 entries across 19 versions & 1 rubygems