Merge branch 'master' into 'revert-e1e90a83'

# Conflicts:
#   app/controllers/property_hires_controller.rb
This commit is contained in:
wmcheng 2019-11-08 18:53:50 +08:00
commit 6970c099cf
3 changed files with 45 additions and 30 deletions

View File

@ -153,7 +153,7 @@ var EventDialog = function(calendar,event){
'<h3>' + _event.title + '</h3>' + '<h3>' + _event.title + '</h3>' +
'</div>' + '</div>' +
'<div class="modal-body">' + '<div class="modal-body">' +
'<div class="event_summary">' + time_string + '</div>' + '<div class="event_summary">' + time_string + '<br>' + _event.hiring_person_name + '</div>'
_event.note + _event.note +
'</div>' + '</div>' +
'<div class="modal-footer" />' + '<div class="modal-footer" />' +

View File

@ -69,43 +69,57 @@ class PropertyHiresController < ApplicationController
"value" => property.note "value" => property.note
} }
end end
data << { if !property.property_number.blank?
"header" => t("property_hire.property_number"), data << {
"value" => property.property_number "header" => t("property_hire.property_number"),
} "value" => property.property_number
}
end
data << { data << {
"header" => t("property_hire.can_be_hired"), "header" => t("property_hire.can_be_hired"),
"value" => (property.can_be_hired ? "<span class='label label-success'>Yes</span>" : "<span class='label label-danger'>No</span>") "value" => (property.can_be_hired ? "<span class='label label-success'>Yes</span>" : "<span class='label label-danger'>No</span>")
} }
data << { if !property.purchase_date.to_s.blank?
"header" => t("property_hire.purchase_date"), data << {
"value" => property.purchase_date.strftime("%Y-%m-%d") "header" => t("property_hire.purchase_date"),
} "value" => property.purchase_date.strftime("%Y-%m-%d")
}
end
if property.owners.empty? if property.owners.empty?
owners = property.other_owner owners = property.other_owner
else else
owners = property.owner_profiles.collect{|mp| mp.name}.join(",") owners = property.owner_profiles.collect{|mp| mp.name}.join(",")
end end
data << { if !owners.blank?
"header" => t("property_hire.owners"), data << {
"value" => owners "header" => t("property_hire.owners"),
} "value" => owners
data << { }
"header" => t("property_hire.owner_email"), end
"value" => property.owner_email if !property.owner_email.blank?
} data << {
data << { "header" => t("property_hire.owner_email"),
"header" => t("property_hire.owner_phone"), "value" => property.owner_email
"value" => property.owner_phone }
} end
data << { if !property.owner_phone.blank?
"header" => t("property_hire.price"), data << {
"value" => property.price "header" => t("property_hire.owner_phone"),
} "value" => property.owner_phone
data << { }
"header" => t("property_hire.location"), end
"value" => property.get_location_name if !property.price.blank?
} data << {
"header" => t("property_hire.price"),
"value" => property.price
}
end
if !property.get_location_name.blank?
data << {
"header" => t("property_hire.location"),
"value" => property.get_location_name
}
end
actions = [] actions = []
if property.can_be_hired if property.can_be_hired
actions << { actions << {
@ -211,4 +225,3 @@ end

View File

@ -23,6 +23,8 @@ class PHire
{ {
:id => self.id.to_s, :id => self.id.to_s,
:title => self.reason_for_hire, :title => self.reason_for_hire,
:hiring_person_id => self.hiring_person_id,
:hiring_person_name => self.hiring_person_name,
:note => self.note_for_hire || "", :note => self.note_for_hire || "",
:start => self.start_time.rfc822, :start => self.start_time.rfc822,
:end => self.end_time.rfc822, :end => self.end_time.rfc822,