added new field to show in the modal

This commit is contained in:
rulingcom 2025-01-21 21:31:47 +08:00
parent 6e6765e09d
commit fd09fa43f2
5 changed files with 25 additions and 14 deletions

View File

@ -354,7 +354,7 @@ var EventDialog = function(calendar,event){
'<h3>' + _event.title + '</h3>' + '<h3>' + _event.title + '</h3>' +
'</div>' + '</div>' +
'<div class="modal-body">' + '<div class="modal-body">' +
'<div class="event_summary">' + time_string + '</br>' + _event.reason_for_hire + '</div>' + _event.note + '<div class="event_summary">' + time_string + '</br>' + _event.stringToShow + '</div>' +
(_event.error_message ? ("<br><span style=\"color: #FC4040;\">" + _event.error_message + "</span>") : "") + (_event.error_message ? ("<br><span style=\"color: #FC4040;\">" + _event.error_message + "</span>") : "") +
'</div>' + '</div>' +
'<div class="modal-footer">' + '<div class="modal-footer">' +

View File

@ -63,6 +63,8 @@ class PHire
end end
label = self.send(self.property.calendar_label_field_name) rescue "" label = self.send(self.property.calendar_label_field_name) rescue ""
title = startt.strftime("%H:%M") + " ~ " + endt.strftime("%H:%M") + " " + label title = startt.strftime("%H:%M") + " ~ " + endt.strftime("%H:%M") + " " + label
fields_to_show = Property::FIELDSNAME.select{|k,v| self.property.send(k)["for_display"] == "true"}
string_to_show = fields_to_show.map{|k| "<b>" + self.property.send(k)["name"][I18n.locale] + "</b> : " + self.send(k)}.join(" <br /> ")
{ {
:id => self.id.to_s, :id => self.id.to_s,
# :title => (self.reason_for_hire.to_s + " "+ self.tmp_reason_for_hire.to_s).html_safe, # :title => (self.reason_for_hire.to_s + " "+ self.tmp_reason_for_hire.to_s).html_safe,
@ -84,6 +86,7 @@ class PHire
:classNames => classNames, :classNames => classNames,
:view_button => viewButton, :view_button => viewButton,
:color => self.property.property_color, :color => self.property.property_color,
:stringToShow => string_to_show,
:view_path => "/#{OrbitHelper.get_site_locale}/admin/property_hires/#{self.id.to_s}/show_booking_details", :view_path => "/#{OrbitHelper.get_site_locale}/admin/property_hires/#{self.id.to_s}/show_booking_details",
:view_path_name => I18n.t("property_hire.view") :view_path_name => I18n.t("property_hire.view")
} }

View File

@ -602,37 +602,43 @@
<div style="padding: 1.2em;"> <div style="padding: 1.2em;">
<table style="margin: 0;"> <table style="margin: 0;">
<thead> <thead>
<th><%= t('property_hire.field_name') %></th> <th style="padding:0 5px;"><%= t('property_hire.field_name') %></th>
<th><%= t('property_hire.name') %></th> <th style="padding:0 5px;"><%= t('property_hire.name') %></th>
<th><%= t('property_hire.placeholder') %></th> <th style="padding:0 5px;"><%= t('property_hire.placeholder') %></th>
<th><%= t('property_hire.disable') %></th> <th style="padding:0 5px;"><%= t('property_hire.disable') %></th>
<th><%= t('property_hire.required') %></th> <th style="padding:0 5px;"><%= t('property_hire.required') %></th>
<th><%= t('property_hire.for_label') %></th> <th style="padding:0 5px;"><%= t('property_hire.for_label') %></th>
<th style="padding:0 5px;"><%= t('property_hire.for_display') %></th>
</thead> </thead>
<tbody> <tbody>
<% fields_name.each do |field_name| %> <% fields_name.each do |field_name| %>
<tr> <tr>
<td> <td style="padding:0 5px;">
<%= t("property_hire.#{field_name}") %> <%= t("property_hire.#{field_name}") %>
</td> </td>
<td> <td style="padding:0 5px;">
<%= render_custom_text_field(f,field_name,"name") %> <%= render_custom_text_field(f,field_name,"name") %>
</td> </td>
<td> <td style="padding:0 5px;">
<%= render_custom_text_field(f,field_name,"placeholder") %> <%= render_custom_text_field(f,field_name,"placeholder") %>
</td> </td>
<td> <td style="padding:0 5px;">
<input type="hidden" name='<%= "#{f.object_name}[#{field_name}][enable]" %>' value="1"> <input type="hidden" name='<%= "#{f.object_name}[#{field_name}][enable]" %>' value="1">
<%= check_box_tag("#{f.object_name}[#{field_name}][enable]", "0" , (f.object.send(field_name)["enable"] == "0" rescue false)) %> <%= check_box_tag("#{f.object_name}[#{field_name}][enable]", "0" , (f.object.send(field_name)["enable"] == "0" rescue false)) %>
</td> </td>
<td> <td style="padding:0 5px;">
<input type="hidden" name='<%= "#{f.object_name}[#{field_name}][required]" %>' value="false"> <input type="hidden" name='<%= "#{f.object_name}[#{field_name}][required]" %>' value="false">
<%= check_box_tag("#{f.object_name}[#{field_name}][required]", "true" , (f.object.send(field_name)["required"] == "true" rescue false), class: "for_required") %> <%= check_box_tag("#{f.object_name}[#{field_name}][required]", "true" , (f.object.send(field_name)["required"] == "true" rescue false), class: "for_required") %>
<% for_label = f.object.send(field_name)["required"] == "true" ? true : false %> <% for_label = f.object.send(field_name)["required"] == "true" ? true : false %>
</td> </td>
<td> <td style="padding:0 5px;">
<%= f.radio_button :calendar_label_field_name, field_name, {:class => "for_label_selection #{(for_label == true ? '' : 'hide')}" } %> <%= f.radio_button :calendar_label_field_name, field_name, {:class => "for_label_selection #{(for_label == true ? '' : 'hide')}" } %>
</td> </td>
<td style="padding:0 5px;">
<input type="hidden" name='<%= "#{f.object_name}[#{field_name}][for_display]" %>' value="false">
<%= check_box_tag("#{f.object_name}[#{field_name}][for_display]", "true" , (f.object.send(field_name)["for_display"] == "true" rescue false), class: "for_display") %>
<% for_label = f.object.send(field_name)["for_display"] == "true" ? true : false %>
</td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

@ -213,3 +213,4 @@ en:
for_label: For Label for_label: For Label
property_color: Property color property_color: Property color
admin_reserve: Reserve admin_reserve: Reserve
for_display: Display

View File

@ -235,3 +235,4 @@ zh_tw:
export_reservation_data: Export data export_reservation_data: Export data
for_label: For Label for_label: For Label
property_color: Property color property_color: Property color
for_display: Display