<% OrbitHelper.render_css_in_head(["basic/bootstrap-datetimepicker.css","property_hire_fullcalendar.css","property_hire_calendar"]) %> <%= javascript_include_tag "validator.js" %> <% data = action_data hire = data["hire"] property = data["property"] 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 %>

<%= property.title.html_safe %>

<% if property.display_img %>
<%=property.title%> <%=property.title.html_safe%>
<% end %>

<%= property.property_usage.html_safe %>

<% property_carousel_images = property.property_carousel_images %> <% if property_carousel_images.count != 0 %> <% end %>
<%= property.note.html_safe %>
<% if session["hire-save-msg"].present? %> <% session.delete("hire-save-msg") %> <% end %>
<% if property.calendar_type == 0 %>

<%= fields_for :timepicker do |f|%> <%= f.time_picker :timepicker, :no_label => true, :new_record => hire.new_record? && !recover,:format=>"HH:mm", :class => "pull-left", :data=>{"picker-type" => "range", "range" => "end", "fv-validation" => "required;", "fv-messages" => "Cannot be empty;"} %> <% end %>

<% end %>
<%= form_for hire, :url => "/xhr/property_hires/make_booking", html: { class: "form-horizontal", id: "hire_form" } do |f| %> <% if property.set_availability %>
<%= f.label :date, "*"+t("property_hire.date"), :class => "col-sm-#{label_col} control-label" %>
<% if calendar_type == 0 %> <%= f.text_field :date, :value=>(recover ? f.object.date.to_s : t("property_hire.please_choose_date")),:readonly=>"",:onclick=>"goto_calendar()" %> <% else %> <%= f.datetime_picker :date, :no_label => true, :new_record => hire.new_record? && !recover ,:class => "pull-left", :picker_type => "date", :format=>"yyyy/MM/dd", :data=>{ "fv-validation" => "required;", "fv-messages" => "Cannot be empty;"} %> <% end %>
<%= f.label :time, "*"+t("property_hire.time"), :class => "col-sm-#{label_col} control-label" %>
<% property_day_setting = recover ? hire.property_day_setting : nil %> <% if property_day_setting %> <%= select_tag "#{f.object_name}[time]", options_for_select([[t("property_hire.please_select"),""],[property_day_setting.title,property_day_setting.id.to_s]],hire.property_day_setting_id), :required=>"required" %> <% else %> <% if property.calendar_type == 0 %> <%= f.text_field :time, :value=>t("property_hire.please_choose_date"),:readonly=>"",:onclick=>"goto_calendar()" %> <% else %> <%= select_tag "#{f.object_name}[time]", options_for_select([[t("property_hire.please_choose_date"),""]]), :required=>"required" %> <% end %> <% end %>
<% else %>
<%= f.label :start_time, "*"+t("property_hire.start_time"), :class => "col-sm-#{label_col} control-label" %> <% if property.calendar_type == 0 %>
<%= f.datetime_picker :start_time, :no_label => true, :new_record => hire.new_record? && !recover,:class => "pull-left", :data=>{"picker-type" => "range", "range" => "start", "fv-validation" => "required;", "fv-messages" => "Cannot be empty;"} %>
<% end %>
<%= f.label :end_time, "*"+t("property_hire.end_time"), :class => "col-sm-#{label_col} control-label" %>
<%= f.datetime_picker :end_time, :no_label => true, :new_record => hire.new_record? && !recover,:class => "pull-left", :data=>{"picker-type" => "range", "range" => "end", "fv-validation" => "required;", "fv-messages" => "Cannot be empty;"} %>
<% end %>
<%= f.label :recurring, t("property_hire.recurring"), :class => "col-sm-#{label_col} control-label" %>
<%= f.check_box :recurring %>
>
<%= f.label :recurring_interval, t("property_hire.recurring_interval"), :class => "col-sm-#{label_col} control-label" %>
<%= f.select :recurring_interval, PHire::INTERVALS.collect{|int| [t("property_hire.recurring_interval_types.#{int}"), int] }, {:prompt => t('property_hire.select_interval')}, {:data => {"fv-validation" => "requiredifrecurring;" , "fv-messages" => "Cannot be empty;"}} %>
<%= f.label :recurring_end_date, "*"+t("property_hire.recurring_end_date"), :class => "col-sm-#{label_col} control-label" %>
<%= f.datetime_picker :recurring_end_date, :no_label => true, :new_record => hire.new_record? && !recover, :class=>"pull-left", :data=>{"fv-validation" => "requiredifrecurring;", "fv-messages" => "Cannot be empty;"} %> <% if calendar_type == 0 %> <% end %>
<% if property.set_unavailibility %>
<%= t("property_hire.Unavailibility_Schedule") %>
<%= property.render_unavailable_message%>
<% end %>
<%= f.label :hiring_person_email, "*"+t("property_hire.hiring_person_email"), :class => "col-sm-#{label_col} control-label" %>
<%= f.text_field :hiring_person_email, :class => "form-control", :value => (recover ? hire.hiring_person_email : ( current_user.member_profile.email rescue "")), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty;"} %>
<%= f.label :hiring_person_number, "*"+t("property_hire.hiring_person_number"), :class => "col-sm-#{label_col} control-label" %>
<%= f.text_field :hiring_person_number, :class => "form-control", :value => (recover ? hire.hiring_person_number : ( current_user.member_profile.mobile_no rescue "")), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty;"} %>
<%= f.label :hiring_person_name, "*"+t("property_hire.hiring_person_name"), :class => "col-sm-#{label_col} control-label" %>
<%= f.text_field :hiring_person_name, :class => "form-control", :value => (recover ? hire.hiring_person_name : ( current_user.name rescue "")), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty;"} %> <%= f.hidden_field :hiring_person_id, :value => (current_user.member_profile.id.to_s rescue "") %>
<%= f.label :reason_for_hire, "*"+t("property_hire.reason_for_hire"), :class => "col-sm-#{label_col} control-label" %>
<%= f.text_field :reason_for_hire, :class => "form-control", :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty;"} %>
<% if(property.enable_notes_selector rescue false) %> <% property.notes_selector.each do |index,sub_hash| %> <% name = sub_hash["name"][I18n.locale.to_s] %> <% name = sub_hash["name"].values.select{|v| v.present?}.first.to_s if name.blank? %> <% values = sub_hash["value"][I18n.locale.to_s] %> <% values = sub_hash["value"].values.select{|v| v.present?}.first.to_s if values.blank? %> <% type = sub_hash["type"] %>
<%= f.label "notes_selector[#{index}]", name, :class => "col-sm-#{label_col} control-label" %>
<% values.each_with_index do |v,i| %> <% end %> <% if type == "checkbox" && (values.count > 1) %> <%= t("property_hire.checkbox_hint") %> <% end %>
<% end %> <% else %>
<%= f.label :note_for_hire, t("property_hire.note_for_hire"), :class => "col-sm-#{label_col} control-label" %>
<%= f.text_area :note_for_hire, :class => "form-control" %>
<% end %> <% fields_name = ["organization" ,"person_in_charge" , "tel_of_person_in_charge" , "department" , "contact_person" , "tel_of_contact_person" , "mobile_phone_of_contact_person" , "contact_person_Email" , "contact_person_department"] %> <% fields_name.each do |field_name| %> <% if(property[field_name]["enable"] == "1" rescue false) %> <% required = (property[field_name]["required"] == "true" rescue false) %>
<%= f.label field_name, (required ? "*" : "") + property.custom_text(field_name,"name"), :class => "col-sm-#{label_col} control-label" %>
<% placeholder = property.custom_text(field_name,"placeholder") %> <% if required %> <%= f.text_field field_name, :class => "form-control", :placeholder => placeholder, :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty;"} %> <% else %> <%= f.text_field field_name, :class => "form-control", :placeholder => placeholder %> <% end %>
<% end %> <% end %> <% if property.p_hire_fields.count != 0 %> <% p_hire = PHire.new(:id=>nil) %> <% @form_index = 0 %> <% property.p_hire_fields.asc(:_id).each do |rf| %>
<%= rf.block_helper(property,@form_index,false,"p_hire",p_hire, rf.to_require,label_col) %>
<% @form_index = @form_index +1 %> <% end %> <% end %> <% if allow_no_logins_user && current_user.nil? %>
<%= gotcha_error %> <%= gotcha %>
<% end %>
<%= f.hidden_field :id %> <%= f.submit t("property_hire.save"), :class => "btn btn-primary" %> <%= f.hidden_field :property_id, :value => property.id %>
<% end %>
<% end %>