property_hire/app/views/email/p_hire_email.html.erb

48 lines
1.9 KiB
Plaintext

<% email_set = Property.where(id: @data['property_id']).first.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 %>
<br>
<% I18n.with_locale(@data['locale']) do %>
<h3><%= Property.where(id: @data['property_id']).first.title rescue nil %></h3>
<% if !@data['hire_id'].nil? %>
<% hire = PHire.where(id: @data['hire_id']).first %>
<table>
<thead>
<tr>
<td></td>
<td></td>
</tr>
</thead>
<tbody>
<% ['hiring_person_name','hiring_person_email','start_time','end_time','recurring','recurring_interval','recurring_end_date','passed','reason_for_hire','note_for_hire'].each do |k| %>
<% v = hire.send(k) %>
<% if !v.nil? && !(k.include?('recurring') && hire.recurring != true)%>
<tr>
<td>
<%= t("property_hire.#{k}") %>:&nbsp;
</td>
<td>
<% if ['start_time','end_time','recurring','recurring_interval','recurring_end_date','passed'].exclude?(k) %>
<%= v.to_s %>
<% 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 %>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<% end %>
<% end %>