Fix show issue if no enough info. provided.

This commit is contained in:
wmcheng 2019-06-13 22:03:31 +08:00
parent 9c335f0a5f
commit e1e90a83cf
1 changed files with 36 additions and 24 deletions

View File

@ -69,39 +69,51 @@ class PropertyHiresController < ApplicationController
"value" => property.note "value" => property.note
} }
end end
data << { if !property_hire.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_hire.purchase_date.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 !property_hire.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_hire.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_hire.owner_phone.blank?
"header" => t("property_hire.price"), data << {
"value" => property.price "header" => t("property_hire.owner_phone"),
} "value" => property.owner_phone
}
end
if !property_hire.price.blank?
data << {
"header" => t("property_hire.price"),
"value" => property.price
}
end
data << { data << {
"header" => t("property_hire.location"), "header" => t("property_hire.location"),
"value" => property.get_location_name "value" => property.get_location_name