.row
  .col
    %p
      %strong School:
      = link_to @school.name, legacy_school_admin_path(@school)
    %p
      %strong Recipient:
      = @recipient.name

    - if @recipient.phone.present?
      %p
        %strong Phone:
        = @recipient.phone

    - if @recipient.birth_date.present?
      %p
        %strong Birth date:
        = @recipient.birth_date

    - if @recipient.gender.present?
      %p
        %strong Gender:
        = @recipient.gender

    - if @recipient.race.present?
      %p
        %strong Race:
        = @recipient.race

    - if @recipient.ethnicity.present?
      %p
        %strong Ethnicity:
        = @recipient.ethnicity

    - if @recipient.home_language_id.present?
      %p
        %strong Home language:
        = @recipient.home_language_id

    - if @recipient.income.present?
      %p
        %strong Income:
        = @recipient.income

    %p
      %strong Opted out:
      = @recipient.opted_out

    - if (recipient_schedule = @recipient.recipient_schedules.first).present?
      %p
        %strong Last Attempt At:
        = recipient_schedule.last_attempt_at.in_time_zone('Eastern Time (US & Canada)').strftime('%m-%e-%y %H:%M')

      %p
        %strong Next Attempt At:
        = recipient_schedule.next_attempt_at.in_time_zone('Eastern Time (US & Canada)').strftime('%m-%e-%y %H:%M')

= link_to 'Edit', edit_legacy_school_legacy_recipient_path(@school, @recipient)
|
= link_to 'Back', legacy_school_path(@school)


%br
%br
%br
%h4 Attempts
%table{style: 'width: 100%;'}
  %tbody
    %thead{style: 'font-weight: bold;'}
      %th Date
      %th Question
      %th Response
    - @recipient.attempts.each do |attempt|
      %tr.attempt
        %td
          = attempt.sent_at.strftime('%x') if attempt.sent_at.present?
        %td= link_to truncate(attempt.question.text, length: 60), [@school, attempt.question], title: attempt.question.text
        %td= "(#{attempt.answer_index_with_reverse}) #{attempt.response}"
