<% property = Property.where(id: @data['property_id']).first%> <% email_set = property.hire_email_sets.select{|v| v.field_name == 'p_hire'} %> <% if email_set.length != 0 %> <% if !(email_set[0].content.nil?) %> <%= email_set[0].content[@data['locale']].html_safe %> <% end %> <% else %> <%= t('property_hire.email_p_hire_content') %> <% end %>
<% I18n.with_locale(@data['locale']) do %>

<%= property.title rescue nil %>

<% if !@data['hire_id'].nil? %> <% hire = PHire.where(id: @data['hire_id']).first %> <% extra_fields_name = ["organization" ,"person_in_charge" , "tel_of_person_in_charge" , "department" , "contact_person" , "tel_of_contact_person" , "mobile_phone_of_contact_person" , "contact_person_Email" , "contact_person_department"] %> <% keys = ['hiring_person_name','hiring_person_email','start_time','end_time','recurring','recurring_interval','recurring_end_date','passed','reason_for_hire','note_for_hire'] %> <% used_extra_fields_name = extra_fields_name.select{|field_name| (property[field_name]["enable"] == "1" rescue false) } %> <% all_trans = keys.map{|k| t("property_hire.#{k}")} %> <% all_trans += used_extra_fields_name.map{|k| property.custom_text(k,"name")} %> <% keys.concat( used_extra_fields_name ) %> <% keys.each_with_index do |k,i| %> <% v = hire.send(k) %> <% if !v.nil? && !(k.include?('recurring') && hire.recurring != true)%> <% end %> <% end %> <% hire.p_hire_field_values.each do |v| %> <% field_info = v.get_field_value rescue {} %> <% if field_info["title"].present? && !field_info["value"].nil? %> <% end%> <% end%>
<%= all_trans[i] %>:  <% if ['start_time','end_time','recurring','recurring_interval','recurring_end_date','passed'].exclude?(k) %> <%= v.to_s.html_safe %> <% elsif ['start_time','end_time','recurring_end_date'].include?(k) %> <%= v.strftime('%Y/%m/%d %H:%M') rescue nil %> <% elsif k == 'recurring_interval' %> <%= t("property_hire.recurring_interval_types.#{v}") %> <% elsif 'recurring' == k %> <%= v ? t('property_hire.yes') : t('property_hire.no') %> <% else %> <%= v ? t('property_hire.yes') : t('property_hire.wait_for_permit') %> <% end %>
<%=field_info["title"]%>:  <%=field_info["value"]%>
<% end %> <% end %>