diff --git a/app/models/p_hire.rb b/app/models/p_hire.rb
index 65c9684..463bae2 100644
--- a/app/models/p_hire.rb
+++ b/app/models/p_hire.rb
@@ -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,
diff --git a/app/models/property.rb b/app/models/property.rb
index 1747eb3..59194d6 100644
--- a/app/models/property.rb
+++ b/app/models/property.rb
@@ -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
diff --git a/app/views/admin/property_hires/_form.html.erb b/app/views/admin/property_hires/_form.html.erb
index 97ef17e..fffbf0b 100644
--- a/app/views/admin/property_hires/_form.html.erb
+++ b/app/views/admin/property_hires/_form.html.erb
@@ -64,6 +64,9 @@
.apply_default_time_settings{
margin-bottom: 1em;
}
+ .hide{
+ display: none;
+ }
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
@@ -596,6 +599,7 @@
<%= t('property_hire.placeholder') %> |
<%= t('property_hire.disable') %> |
<%= t('property_hire.required') %> |
+ <%= t('property_hire.for_label') %> |
<% fields_name.each do |field_name| %>
@@ -615,7 +619,11 @@
- <%= 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 %>
+ |
+
+ <%= f.radio_button :calendar_label_field_name, field_name, {:class => "for_label_selection #{(for_label == true ? '' : 'hide')}" } %>
|
<% 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) %>
diff --git a/app/views/property_hires/hire.html.erb b/app/views/property_hires/hire.html.erb
index ffa1636..96ee609 100644
--- a/app/views/property_hires/hire.html.erb
+++ b/app/views/property_hires/hire.html.erb
@@ -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" %>
-
+
diff --git a/config/locales/en.yml b/config/locales/en.yml
index c7c4add..ebbb84a 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -211,3 +211,4 @@ en:
month: Month
all_properties: All Properties
export_reservation_data: Export data
+ for_label: For Label
diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml
index 51dbfbf..7bb1fdd 100644
--- a/config/locales/zh_tw.yml
+++ b/config/locales/zh_tw.yml
@@ -232,4 +232,5 @@ zh_tw:
week: 週模式
month: 月模式
all_properties: All Properties
- export_reservation_data: Export data
\ No newline at end of file
+ export_reservation_data: Export data
+ for_label: For Label
\ No newline at end of file