.columns.large-12
  = field_set_tag do
    legend Patient Demographics

    = f.input :nhs_number, wrapper: :horizontal_small

    - Renalware.config.patient_hospital_identifiers.each do |key, field|
      = f.input field,
                as: :string,
                label: "#{key} No",
                wrapper: :horizontal_small

    = f.input :external_patient_id, wrapper: :horizontal_small
    = f.input :title, wrapper: :horizontal_tiny
    = f.input :family_name, wrapper: :horizontal_small
    = f.input :given_name, wrapper: :horizontal_small
    = f.input :suffix, wrapper: :horizontal_small
    = f.input :email, wrapper: :horizontal_small
    = f.input :telephone1, wrapper: :horizontal_small
    = f.input :telephone2, wrapper: :horizontal_small
    = f.input :sex,
        selected: patient.sex.code,
        placeholder: "Please select gender",
        collection: Renalware::Gender.all,
        label_method: :name, value_method: :code,
        include_blank: "Please select gender",
        wrapper: :horizontal_small
    = f.association :ethnicity,
        label_method: :name, value_method: :id,
        include_blank: "Please select",
        wrapper: :horizontal_small
    = f.association :country_of_birth,
        include_blank: "Please select",
        wrapper: :horizontal_small
    = f.association :religion,
        label_method: :name, value_method: :id,
        include_blank: "Please select",
        wrapper: :horizontal_small
    = f.association :language,
        label_method: :name, value_method: :id,
        include_blank: "Please select main language",
        wrapper: :horizontal_small
    = f.input :marital_status,
                    include_blank: "Please select marital status",
                    wrapper: :horizontal_small
    = f.input :born_on, as: :date_picker, label: "DoB", wrapper: :horizontal_datepicker
    = f.input :paediatric_patient_indicator,
        as: :inline_radio_buttons,
        label: "If under 18 years, is the recipient being treated in a paediatric unit?",
        wrapper: :horizontal_small

    - if patient.persisted?
      .row
        .section-underliner
      .row
        .large-12.columns
          | To enter date of death please set 'Death' modality:
          |  
          = link_to "Change Modal",
                    new_patient_modality_path(patient),
                    title: "Patient Modality",
                    class: "death-update"

.columns.large-12
  = field_set_tag do
    legend Letter Preferences

    = f.input :cc_on_all_letters,  as: :inline_radio_buttons, wrapper: :horizontal_small
    = f.input :cc_decision_on, as: :date_picker, wrapper: :horizontal_datepicker

.columns.large-12
  = field_set_tag do
    legend UKRDC Preferences

    = f.input :send_to_renalreg, as: :inline_radio_buttons, wrapper: :horizontal_small
    = f.input :renalreg_decision_on, as: :date_picker, wrapper: :horizontal_datepicker
    = f.input :renalreg_recorded_by, wrapper: :horizontal_medium
    = f.input :send_to_rpv, as: :inline_radio_buttons, wrapper: :horizontal_small
    = f.input :rpv_decision_on, as: :date_picker, wrapper: :horizontal_datepicker
    = f.input :rpv_recorded_by, wrapper: :horizontal_medium

.columns.large-12
  = field_set_tag do
    legend Notes

    = f.simple_fields_for :document, patient.document do |patient_doc|
      = patient_doc.input :interpreter_notes,
                          as: :text,
                          wrapper: :horizontal_large,
                          input_html: { rows: 3 }
      = patient_doc.input :admin_notes,
                          as: :text,
                          wrapper: :horizontal_large,
                          input_html: { rows: 3 }
      = patient_doc.input :special_needs_notes,
                          as: :text,
                          wrapper: :horizontal_large,
                          input_html: { rows: 3 }

.columns.large-12
  = f.simple_fields_for :current_address_attributes, patient.current_address do |a|
    fieldset id="current_address"
      legend Current Address
      = a.input :id, as: :hidden
      = render "renalware/addresses/form", a: a

.columns.large-12
  = field_set_tag do
    legend Referral Info

    = f.simple_fields_for :document, patient.document do |patient_doc|
      = patient_doc.simple_fields_for :referral, patient.document.referral do |referral_doc|
        = referral_doc.input :referring_physician_name, wrapper: :horizontal_medium
        = referral_doc.input :referral_date, as: :date_picker, wrapper: :horizontal_datepicker
        = referral_doc.input :referral_type, wrapper: :horizontal_medium
        = referral_doc.input :referral_notes,
                             as: :text,
                             wrapper: :horizontal_large,
                             input_html: { rows: 3 }