diff --git a/app/controllers/admin/property_hires_controller.rb b/app/controllers/admin/property_hires_controller.rb
index 1c512bb..4d17a86 100644
--- a/app/controllers/admin/property_hires_controller.rb
+++ b/app/controllers/admin/property_hires_controller.rb
@@ -6,8 +6,7 @@ class Admin::PropertyHiresController < OrbitAdminController
@filter_fields = filter_fields(@categories, @tags)
@table_fields = ["property_hire.title", :category, "property_hire.location", "property_hire.available_for_hire"]
- @properties = Property.where(:title.ne => "")
- .order_by(sort)
+ @properties = Property.order_by(sort)
.with_categories(filters("category"))
.with_tags(filters("tag"))
@@ -60,9 +59,9 @@ class Admin::PropertyHiresController < OrbitAdminController
email = User.all.select{|v| v.is_admin? && v.user_name != 'rulingcom'}.collect{|v| v.member_profile.email} if email.length == 0
Admin::PropertyHiresHelper::HireMethod.send_mail('edit',email,property.id,nil,nil,current_user.id)
if params[:page]
- redirect_to admin_property_hires_path(:page => params[:page])
+ redirect_to admin_property_hires_path(:page => params[:page],:locale => params[:locale])
else
- redirect_to admin_property_hires_path
+ redirect_to admin_property_hires_path(:locale => params[:locale])
end
end
diff --git a/app/controllers/property_hires_controller.rb b/app/controllers/property_hires_controller.rb
index 68acab8..80f726b 100644
--- a/app/controllers/property_hires_controller.rb
+++ b/app/controllers/property_hires_controller.rb
@@ -18,8 +18,8 @@ class PropertyHiresController < ApplicationController
end
{
"title" => property.title,
- "image" => property.image.url,
- "image-thumb" => property.image.thumb.url,
+ "image" => (property.image.url.blank? ? '" style="display: none;' : property.image.url),
+ "image-thumb" => (property.image.thumb.url.blank? ? '" style="display: none;' : property.image.thumb.url),
"url_to_show" => OrbitHelper.url_to_show(property.to_param),
"location" => property.get_location_name,
"actions" => actions
@@ -30,7 +30,7 @@ class PropertyHiresController < ApplicationController
"column" => t("property_hire.title")
},
{
- "column" => t("property_hire.image")
+ "column" => ""
},
{
"column" => t("property_hire.location")
diff --git a/app/models/p_hire.rb b/app/models/p_hire.rb
index 5e2336e..8c8e311 100644
--- a/app/models/p_hire.rb
+++ b/app/models/p_hire.rb
@@ -16,7 +16,15 @@ class PHire
field :recurring, type: Boolean, :default => false
field :recurring_end_date, type: DateTime
field :recurring_interval
-
+ field :organization
+ field :person_in_charge
+ field :tel_of_person_in_charge
+ field :department
+ field :contact_person
+ field :tel_of_contact_person
+ field :mobile_phone_of_contact_person
+ field :contact_person_Email
+ field :contact_person_department
belongs_to :property
def as_json(options = {})
diff --git a/app/models/property.rb b/app/models/property.rb
index 393ed16..42e9232 100644
--- a/app/models/property.rb
+++ b/app/models/property.rb
@@ -30,7 +30,15 @@ class Property
field :end_date, type: DateTime
field :description, :localize => true
field :unavailibility_note, :localize => true
-
+ field :organization
+ field :person_in_charge
+ field :tel_of_person_in_charge
+ field :department
+ field :contact_person
+ field :tel_of_contact_person
+ field :mobile_phone_of_contact_person
+ field :contact_person_Email
+ field :contact_person_department
belongs_to :property_location
has_many :p_hires
has_many :hire_email_sets, :autosave => true, :dependent => :destroy, :inverse_of => :property
diff --git a/app/views/admin/property_hires/_form.html.erb b/app/views/admin/property_hires/_form.html.erb
index b70bcbf..9db8708 100644
--- a/app/views/admin/property_hires/_form.html.erb
+++ b/app/views/admin/property_hires/_form.html.erb
@@ -38,6 +38,7 @@
<%= t(:image) %>
<%= t('property_hire.unavailability')%>
<%= t('property_hire.auto_send_email_set') %>
+ <%= t('property_hire.settings') %>
@@ -291,7 +292,7 @@
<% end %>
<% end %>
<% @site_in_use_locales.each do |locale| %>
- <%= f.fields_for :unavailibility_note do |f| %>
+ <%= f.fields_for :unavailibility_note_translations do |f| %>
@@ -302,6 +303,28 @@
<% 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| %>
+
+
+
+
+
+
+
+ <%= f.fields_for field_name do |sub_f|%>
+
+
+ <% end %>
+
+
+ <% end %>
+
diff --git a/app/views/admin/property_hires/manage_locations.html.erb b/app/views/admin/property_hires/manage_locations.html.erb
index 158fa1c..5fd15f7 100644
--- a/app/views/admin/property_hires/manage_locations.html.erb
+++ b/app/views/admin/property_hires/manage_locations.html.erb
@@ -61,7 +61,7 @@
<%= content_tag(:div, paginate(@locations), class: "pagination pagination-centered") %>
- <%= link_to t(:add), add_location_admin_property_hires_path, :class => "btn btn-primary", :data => {"toggle" => "modal", "target" => "#location-modal"} %>
+ <%= link_to t(:add), add_location_admin_property_hires_path, :id=>'create_new_location', :class => "btn btn-primary", :data => {"toggle" => "modal", "target" => "#location-modal"} %>
@@ -72,4 +72,10 @@
$("#edit-location-btn").on("click",function(){
$("#edit-location-modal form").submit();
})
+ $("#create_new_location").on("click",function(){
+ var url = $(this).attr("href");
+ $.get(url).done(function(data){
+ $("#location-modal .modal-body").html(data);
+ })
+ })
\ No newline at end of file
diff --git a/app/views/admin/property_hires/show_booking_details.html.erb b/app/views/admin/property_hires/show_booking_details.html.erb
index 4aecfd4..edf5ac0 100644
--- a/app/views/admin/property_hires/show_booking_details.html.erb
+++ b/app/views/admin/property_hires/show_booking_details.html.erb
@@ -36,6 +36,15 @@
<%= t("property_hire.note_for_hire") %> |
<%= @booking.note_for_hire %> |
+ <% 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(@booking.property[field_name]["enable"] == "1" rescue false) %>
+
+ <%= t("property_hire.#{field_name}") %> |
+ <%= @booking[field_name].to_s %> |
+
+ <% end %>
+ <% end %>
<%= t("property_hire.passed") %> |
diff --git a/app/views/email/p_hire_email.html.erb b/app/views/email/p_hire_email.html.erb
index e486a83..0e4932a 100644
--- a/app/views/email/p_hire_email.html.erb
+++ b/app/views/email/p_hire_email.html.erb
@@ -1,4 +1,5 @@
-<% email_set = Property.where(id: @data['property_id']).first.hire_email_sets.select{|v| v.field_name == 'p_hire'} %>
+<% property = Property.where(id: @data['property_id']).first%>
+<% email_set = property.hire_email_sets.select{|v| v.field_name == 'p_hire'} %>
<% if email_set.length != 0 %>
<% if !(email_set[0].content.nil?) %>
<%= email_set[0].content[@data['locale']].html_safe %>
@@ -8,7 +9,7 @@
<% end %>
<% I18n.with_locale(@data['locale']) do %>
- <%= Property.where(id: @data['property_id']).first.title rescue nil %>
+ <%= property.title rescue nil %>
<% if !@data['hire_id'].nil? %>
<% hire = PHire.where(id: @data['hire_id']).first %>
@@ -19,7 +20,11 @@
- <% ['hiring_person_name','hiring_person_email','start_time','end_time','recurring','recurring_interval','recurring_end_date','passed','reason_for_hire','note_for_hire'].each do |k| %>
+ <% extra_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"] %>
+ <% keys = ['hiring_person_name','hiring_person_email','start_time','end_time','recurring','recurring_interval','recurring_end_date','passed','reason_for_hire','note_for_hire'] %>
+ <% used_extra_fields_name = extra_fields_name.select{|field_name| (property[field_name]["enable"] == "1" rescue false) } %>
+ <% keys.concat( used_extra_fields_name ) %>
+ <% keys.each do |k| %>
<% v = hire.send(k) %>
<% if !v.nil? && !(k.include?('recurring') && hire.recurring != true)%>
diff --git a/app/views/property_hires/hire.html.erb b/app/views/property_hires/hire.html.erb
index 035e4c3..215ee1b 100644
--- a/app/views/property_hires/hire.html.erb
+++ b/app/views/property_hires/hire.html.erb
@@ -28,13 +28,13 @@
<% end %>
<%= form_for hire, :url => "/xhr/property_hires/make_booking", html: { class: "form-horizontal" } do |f| %>
<% if property.set_unavailibility %>
- Unavailibility Schedule
+ <%= t("property_hire.Unavailibility_Schedule") %>
This property is unavaliable <%= !property.start_date.nil? ? " from " + property.start_date.strftime("%Y-%m-%d") : "" %> <%= !property.end_date.nil? ? " to " + property.end_date.strftime("%Y-%m-%d") : "" %> every
<% property.weekdays.each_with_index do |d,i| %>
@@ -94,26 +94,26 @@
+ <% 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) %>
+
+ <% end %>
+ <% end %>
|