class ConsentFormsController
Public Instance Methods
Source
# File app/controllers/consent_forms_controller.rb, line 101 def create_patient patient = Patient.from_consent_form(@consent_form) ActiveRecord::Base.transaction do patient.save! academic_year = @consent_form.academic_year SchoolMove.new( academic_year:, patient:, school: @consent_form.school_for_school_move ).confirm!(user: current_user) @consent_form.match_with_patient!(patient, current_user:) reset_count! end if patient.nhs_number.nil? PatientNHSNumberLookupJob.perform_later(patient) else PatientUpdateFromPDSJob.perform_later(patient) end flash[:success] = "#{patient.full_name}’s record created from a consent \ response from #{@consent_form.parent_full_name}" redirect_to action: :index end
Source
# File app/controllers/consent_forms_controller.rb, line 76 def edit_archive render :archive end
Source
# File app/controllers/consent_forms_controller.rb, line 48 def edit_match render :match, layout: "full" end
Source
# File app/controllers/consent_forms_controller.rb, line 14 def index authorize ConsentForm consent_forms = policy_scope(ConsentForm).unmatched.order(:recorded_at) if (session_slug = params[:session_slug]).present? @session = policy_scope(Session).find_by(slug: session_slug) consent_forms = consent_forms.for_session(@session) end @pagy, @consent_forms = pagy(consent_forms) render layout: "full" end
Source
# File app/controllers/consent_forms_controller.rb, line 94 def new_patient @patient = Patient.from_consent_form(@consent_form).tap(&:clear_changes_information) render :patient end
Source
# File app/controllers/consent_forms_controller.rb, line 33 def search patients = if @search_params_present @form.apply( policy_scope(Patient).includes(:school, parent_relationships: :parent) ) else Patient.none end @pagy, @patients = pagy(patients) render layout: "full" end
Source
# File app/controllers/consent_forms_controller.rb, line 29 def show render layout: "three_quarters" end
Source
# File app/controllers/consent_forms_controller.rb, line 80 def update_archive @consent_form.assign_attributes(archive_params) if @consent_form.save redirect_to consent_forms_path, flash: { success: "Consent response from #{@consent_form.parent_full_name} archived" } else render :archive, status: :unprocessable_content end end
Source
# File app/controllers/consent_forms_controller.rb, line 52 def update_match @consent_form.match_with_patient!(@patient, current_user:) reset_count! session = @consent_form.session programme = session.programmes_for(patient: @patient).first heading_link_href = if programme.nil? patient_path(@patient) else session_patient_programme_path(session, @patient, programme) end flash[:success] = { heading: "Consent matched for", heading_link_text: @patient.full_name, heading_link_href: } redirect_to action: :index end