% OrbitHelper.render_css_in_head(["basic/bootstrap-datetimepicker.css","property_hire_fullcalendar.css","property_hire_calendar"]) %>
<%= javascript_include_tag "validator.js" %>
<%= javascript_include_tag "basic/jquery.nanoscroller.js" %>
<%
data = action_data
hire = data["hire"]
property = data["property"]
is_user_manager = data["is_user_manager"]
url = data["page"]
current_user = data["current_user"]
allow_no_logins_user = data["allow_no_logins_user"]
all_day_settings = data["all_day_settings"]
recover = data["recover"]
calendar_type = property.calendar_type.to_i rescue 0
right_col = 12
label_col = 2
input_col = 10
if calendar_type == 0
right_col -= 7
label_col += 2
input_col -= 2
end
%>
<% if !property.can_be_hired %>
<% end %>
<% if !allow_no_logins_user && current_user.nil? %>
<% else %>
<% if property.can_reserve === true || is_user_manager %>
<%= form_for hire, :url => "/xhr/property_hires/make_booking", html: { class: "form-horizontal", id: "hire_form" } do |f| %>
<% if property.set_availability %>
<% else %>
<% end %>
<% if property.recurring_enable %>
<% end %>
<% default_values = {"hiring_person_email" => ( current_user.member_profile.email rescue ""),
"hiring_person_number" => ( current_user.member_profile.mobile_no rescue ""),
"hiring_person_name" => ( current_user.name rescue "")
} %>
<% if recover
default_values = default_values.merge(Property::FIELDSNAME.map{|f| [f,hire.send(f)]}.to_h)
end %>
<%= f.hidden_field :hiring_person_id, :value => (current_user.member_profile.id.to_s rescue "") %>
<% custom_field_inputs = {} %>
<% custom_field_type = {"note_for_hire"=>"text_area"} %>
<% if(property.enable_notes_selector rescue false) %>
<% custom_field_inputs["note_for_hire"] = render(:partial=>"property_hires/notes_selector",:locals=>{:f=>f,:property=>property,:label_col=>label_col,:input_col=>input_col,:hire=>nil}) %>
<% end %>
<% fields_name = property.get_all_fields %>
<% has_p_hire_fields = property.p_hire_fields_enabled.count != 0
p_hire_fields = {}
if has_p_hire_fields
p_hire_fields = property.p_hire_fields_enabled.map{|rf| [rf.id.to_s,rf]}.to_h
end
%>
<% @form_index = 0 %>
<% fields_name.each do |field_name| %>
<% if has_p_hire_fields && field_name.include?("p_hire_fields") %>
<% rf = p_hire_fields[field_name.sub("p_hire_fields.",'')] %>
<% next if rf.nil? %>
<%= rf.block_helper(property,@form_index,false,"p_hire",hire, rf.to_require,label_col) %>
<% @form_index = @form_index +1 %>
<% else %>
<% if(property[field_name]["enable"] == "1" rescue true) %>
<% required = (property[field_name]["required"] == "true" rescue false) %>
<% if custom_field_inputs[field_name] %>
<%= custom_field_inputs[field_name] %>
<% else %>
<% end %>
<% end %>
<% end %>
<% end %>
<% if allow_no_logins_user && current_user.nil? %>
<% end %>
<% end %>
<% end %>