% reference = reference_question.response(@answer_sheet) %>
<% reference ||= Fe::ReferenceSheet.new %>
<% css_class = reference_question.required?(@answer_sheet, @page) ? 'required' : '' %>
<% email_css_class = reference_question.required?(@answer_sheet, @page) ? 'required email email' : '' %>
<% phone_css_class = reference_question.required?(@answer_sheet, @page) ? 'required phone phone' : '' %>
<%#= hidden_field_tag "reference[#{reference.id}]", :class => reference_question.required? && !reference.email_sent? ? 'required' : '' %>
" class="desc"><%= _('First Name') %>
<%= text_field_tag "reference[#{reference.id}][first_name]", reference.first_name, :class => "text #{css_class}", :id => "name_#{reference.id}", :readonly => !@answer_sheet.try(:can_change_references?), :disabled => !@answer_sheet.try(:can_change_references?) %>
" class="desc"><%= _('Last Name') %>
<%= text_field_tag "reference[#{reference.id}][last_name]", reference.last_name, :class => "text #{css_class}", :id => "name_#{reference.id}", :readonly => !@answer_sheet.try(:can_change_references?), :disabled => !@answer_sheet.try(:can_change_references?) %>
" class="desc"><%= _('Relationship to You') %>
<%= text_field_tag "reference[#{reference.id}][relationship]", reference.relationship, :class => "text #{css_class}", :id => "name_#{reference.id}", :readonly => !@answer_sheet.try(:can_change_references?), :disabled => !@answer_sheet.try(:can_change_references?) %>
" class="desc"><%= _('E-mail') %>
<% if (!reference.email.blank?) %>
<%= _('Please be aware that any changes to this email address after your reference has started filling out their form will cause their answers to be lost.') %>
<% end %>
<%= text_field_tag "reference[#{reference.id}][email]", reference.email, :class => "text #{email_css_class}", :id => "email_#{reference.id}", :readonly => !@answer_sheet.try(:can_change_references?), :disabled => !@answer_sheet.try(:can_change_references?) %>
" class="desc"><%= _('Phone') %>
<%= text_field_tag "reference[#{reference.id}][phone]", reference.phone, :class => "text #{phone_css_class}", :id => "phone_#{reference.id}", :readonly => !@answer_sheet.try(:can_change_references?), :disabled => !@answer_sheet.try(:can_change_references?) %>
<%= _("An invitation will be sent to this reference when you submit your application. If you would " \
"like to get a head start, please feel free to click 'Send Email Invitation' below.") %>
<%= _('If you already submitted your application and have returned to update your reference information - you must click "Send Email Invitation" after you ' \
'have edited the information in order for your reference to receive another email.') %>
<%= link_to(_('Send Email Invitation'), @answer_sheet ? send_reference_invite_fe_answer_sheet_path(@answer_sheet, :reference_id => reference.id) : '#', :class => 'reference_send_invite button no-left-margin') %>
<%= _('Invitation last sent:') %> <% if reference.email_sent_at.nil? -%><%= _('Never') %><% else %><%= reference.email_sent_at.strftime("%Y-%m-%d @ %I:%M%p") %><% end %>