fixed polyfill issue and added some for label radio

This commit is contained in:
rulingcom 2025-01-08 22:08:27 +08:00
parent 833e156206
commit e0c96b2f54
6 changed files with 30 additions and 4 deletions

View File

@ -61,7 +61,8 @@ class PHire
viewButton = true
end
end
title = startt.strftime("%H:%M") + " ~ " + endt.strftime("%H:%M") + " " + self.reason_for_hire
label = self.send(self.property.calendar_label_field_name) rescue ""
title = startt.strftime("%H:%M") + " ~ " + endt.strftime("%H:%M") + " " + label
{
:id => self.id.to_s,
# :title => (self.reason_for_hire.to_s + " "+ self.tmp_reason_for_hire.to_s).html_safe,

View File

@ -72,6 +72,7 @@ class Property
field :custom_field_names, type: Array
field :default_field_names, type: Array
field :copy_id
field :calendar_label_field_name
field :except_clone_relations, :type=>Array, :default => []
belongs_to :property_location
has_many :p_hires

View File

@ -64,6 +64,9 @@
.apply_default_time_settings{
margin-bottom: 1em;
}
.hide{
display: none;
}
</style>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
@ -596,6 +599,7 @@
<th><%= t('property_hire.placeholder') %></th>
<th><%= t('property_hire.disable') %></th>
<th><%= t('property_hire.required') %></th>
<th><%= t('property_hire.for_label') %></th>
</thead>
<tbody>
<% fields_name.each do |field_name| %>
@ -615,7 +619,11 @@
</td>
<td>
<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)) %>
<%= 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 %>
</td>
<td>
<%= f.radio_button :calendar_label_field_name, field_name, {:class => "for_label_selection #{(for_label == true ? '' : 'hide')}" } %>
</td>
</tr>
<% end %>
@ -759,7 +767,19 @@
}else{
$("#selector_block").css("display","");
}
// adding for label selector
$("input.for_required").on("click", function() {
var dom = $(this).parent().parent().find(".for_label_selection")
if($(this).is(":checked")){
dom.removeClass("hide");
}else{
dom.addClass("hide");
dom.removeAttr("checked");
}
})
})
$("#property_set_unavailibility").on("click",function(){
if($(this).is(":checked")){
$("#set_unavailibility_div").show();
@ -896,6 +916,8 @@
$("#selector_block").css("display","");
}
})
var setting_count = <%=setting_count%>;
var default_time_settings = <%= PropertyHireSetting.first.default_time_settings.map{|s| s.attributes.except("_id","created_at","updated_at")}.to_s.gsub("=>",": ").html_safe rescue "[]" %>
<% property_day_setting = f.object.property_day_settings.new(:id=>nil) %>

View File

@ -1,6 +1,6 @@
<% OrbitHelper.render_css_in_head(["basic/bootstrap-datetimepicker.css","property_hire_fullcalendar.css","property_hire_calendar"]) %>
<%= javascript_include_tag "validator.js" %>
<script src="https://polyfill.io/v3/polyfill.min.js?features=Intl.DateTimeFormat,Intl.DateTimeFormat.~locale.en,Intl.NumberFormat.~locale.en"></script>
<!--<script src="https://polyfill.io/v3/polyfill.min.js?features=Intl.DateTimeFormat,Intl.DateTimeFormat.~locale.en,Intl.NumberFormat.~locale.en"></script>-->
<script type="text/javascript" src="/assets/property_hire_fullcalendar.min.js"></script>
<script type="text/javascript" src="/assets/property_hire_calendar_frontend.js"></script>
<script type="text/javascript" src="/assets/locale-all.min.js"></script>

View File

@ -211,3 +211,4 @@ en:
month: Month
all_properties: All Properties
export_reservation_data: Export data
for_label: For Label

View File

@ -233,3 +233,4 @@ zh_tw:
month: 月模式
all_properties: All Properties
export_reservation_data: Export data
for_label: For Label