= simple_form_for(consult, html: { autocomplete: "off" }, wrapper: :horizontal_form) do |f| / Note the shenanigans to get the select2 to redisplay the patient after a validation error / or on an edit. Selected: 1 means just select the option at index 1 - option at index 0 is always / the blank option. Selecting index 1 fails silently if there is nothing there (no patient / selected yet) otherwise it will display the selected patient who will always be / at option index 1. = f.input :patient_id, wrapper: :horizontal_medium, collection: [[consult.patient&.to_s(:long), consult.patient&.id]], selected: 1, input_html: { \ class: "patient-id-select2 patient-ajax-search", data: { "ajax--url" => search_patients_path(format: :json), placeholder: "Search by patient name or hospital/NHS no." } \ } = f.input :consult_site_id, collection: Renalware::Admissions::ConsultSite.all, wrapper: :horizontal_medium, include_blank: "Select local site (or enter other site below)", label: "Site" = ward_dropdown_grouped_by_hospital_unit(f, :hospital_ward_id, include_blank: "Select local ward (or enter other ward below)") = f.input :other_site_or_ward, wrapper: :horizontal_medium = f.input :started_on, as: :date_picker, wrapper: :horizontal_datepicker = f.input :consult_type, wrapper: :horizontal_medium = f.input :decided_on, as: :date_picker, wrapper: :horizontal_datepicker = f.input :transfer_priority, include_blank: false, wrapper: :horizontal_small = f.input :priority, include_blank: true, collection: Renalware::Admissions::Consult::PRIORITY_VALUES, wrapper: :horizontal_tiny = f.input :transferred_on, as: :date_picker, wrapper: :horizontal_datepicker = f.association :seen_by, as: :user_picker, collection: Renalware::User.ordered, wrapper: :horizontal_medium = f.input :contact_number, wrapper: :horizontal_medium = f.input :aki_risk, include_blank: "Please select", wrapper: :horizontal_small = f.input :requires_aki_nurse, as: :inline_radio_buttons, wrapper: :horizontal_small = f.input :rrt, as: :inline_radio_buttons, wrapper: :horizontal_small = f.input :description, wrapper: :horizontal_large, input_html: { rows: 10 } = f.submit class: :button span= " or " = link_to "Cancel", admissions_consults_path