add content to edit email

This commit is contained in:
chiu 2020-05-20 17:34:30 +08:00
parent 86cf5f9a13
commit b7efc22d1d
2 changed files with 79 additions and 2 deletions

View File

@ -5,3 +5,43 @@
<% end %> <% end %>
<br> <br>
<%= @data['content'].html_safe %> <%= @data['content'].html_safe %>
<% property = Property.where(id: @data['property_id']).first %>
<% if !property.nil? %>
<h3><%= property['title'].collect{|k,v| v}.uniq.join('/') rescue nil %></h3>
<% I18n.with_locale(@data['locale']) do %>
<table>
<thead>
<tr>
<td></td>
<td></td>
</tr>
</thead>
<tbody>
<% ['property_usage','note','category','property_location','property_number','can_be_hired','purchase_date','owners','other_owner','owner_email','owner_phone','price'].each do |k| %>
<% v = property.send(k) %>
<tr>
<td>
<%= k=='category' ? t('category') : t("property_hire.#{k}") %>:&nbsp;
</td>
<td>
<% if ['purchase_date'].include?(k) %>
<%= v.strftime('%Y/%m/%d %H:%M') rescue nil %>
<% elsif ['property_usage','note'].include?(k) %>
<%= property[k].collect{|k,v| v}.uniq.join('/') rescue nil %>
<% elsif k=='owners' %>
<%= property.owner_profiles.collect{|v| v.name}.join(', ') %>
<% elsif k == 'category' %>
<%= v.title %>
<% elsif k == 'can_be_hired' %>
<%= v ? t('yes_') : t('no_') %>
<% else %>
<%= v %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% end %>

View File

@ -1,4 +1,5 @@
<% email_set = Property.where(id: @data['property_id']).first.hire_email_sets.select{|v| v.field_name == 'edit'} %> <% property = Property.where(id: @data['property_id']).first %>
<% email_set = property.hire_email_sets.select{|v| v.field_name == 'edit'} %>
<% if email_set.length != 0 %> <% if email_set.length != 0 %>
<% if !(email_set[0].content.nil?) %> <% if !(email_set[0].content.nil?) %>
<%= email_set[0].content[@data['locale']].html_safe %> <%= email_set[0].content[@data['locale']].html_safe %>
@ -6,3 +7,39 @@
<% else %> <% else %>
<%= t('property_hire.email_edit_success') %> <%= t('property_hire.email_edit_success') %>
<% end %> <% end %>
<h3><%= property['title'].collect{|k,v| v}.uniq.join('/') rescue nil %></h3>
<% I18n.with_locale(@data['locale']) do %>
<table>
<thead>
<tr>
<td></td>
<td></td>
</tr>
</thead>
<tbody>
<% ['property_usage','note','category','property_location','property_number','can_be_hired','purchase_date','owners','other_owner','owner_email','owner_phone','price'].each do |k| %>
<% v = property.send(k) %>
<tr>
<td>
<%= k=='category' ? t('category') : t("property_hire.#{k}") %>:&nbsp;
</td>
<td>
<% if ['purchase_date'].include?(k) %>
<%= v.strftime('%Y/%m/%d %H:%M') rescue nil %>
<% elsif ['property_usage','note'].include?(k) %>
<%= property[k].collect{|k,v| v}.uniq.join('/') rescue nil %>
<% elsif k=='owners' %>
<%= property.owner_profiles.collect{|v| v.name}.join(', ') %>
<% elsif k == 'category' %>
<%= v.title %>
<% elsif k == 'can_be_hired' %>
<%= v ? t('yes_') : t('no_') %>
<% else %>
<%= v %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>