{% set EXPIRED_LISTING_STATUS = constant('Aqarmap\\Bundle\\ListingBundle\\Constant\\ListingStatus::EXPIRED') %}
{% set USER_DELETED_LISTING_STATUS = constant('Aqarmap\\Bundle\\ListingBundle\\Constant\\ListingStatus::USER_DELETED') %}
{% set isValidListing = not listing.status in ([EXPIRED_LISTING_STATUS, USER_DELETED_LISTING_STATUS]) %}
{% set isListingOwner = is_granted("ROLE_OWNER", listing) %}
{% set listingMetaTitle = listing.metaTitle ? listing.metaTitle : "" %}
{% set listingTitle = listing.title ? listing.title : listingMetaTitle %}
{% set hasLastUpdatedDate = listing.isProjectOrUnit %}
{% set hasPublishedDate = listing.publishedAt is not null %}
{% set isCompoundHasLastUpdatedDate = listing.compoundField and listing.compoundField.updatedAt %}
<div class="listing-details-page__project-title-section">
<span hidden itemprop="url">{{ url(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) }}</span>
{# Publish date #}
<div class="listing-details-page__title-section__sub">
<span>
{{ listing.propertyType.title }}
</span>
{% if hasLastUpdatedDate %}
{% set lastUpdate = listing.isProject ? isCompoundHasLastUpdatedDate ? listing.compoundField.updatedAt : listing.updatedAt : listing.parent.updatedAt %}
<i class="mx-1">.</i>
<span class="m-0">
{{ lastUpdate|date("d-m-Y")|localizeddate('long', 'none') }}
</span>
{% elseif hasPublishedDate %}
<i class="mx-1">.</i>
<span class="m-0">
{{ listing.publishedAt|date("d-m-Y")|localizeddate('long', 'none') }}
</span>
{% endif %}
</div>
{# Title container #}
<h1 class="listing-details-page__project-title-section__title __default_font_family" itemprop="name">
{{ listingTitle|striptags|fixArabicNumbers|raw }}
{% if isValidListing %}
{% if isListingOwner %}
<a class="_link" href="{{ path('listing_edit', {'id': listing.id}) }}">
{{ 'layout.edit_Listing'|trans }}
</a>
{% endif %}
{% endif %}
</h1>
{# Location container #}
<p itemprop="address" class="listing-details-page__project-title-section__address">
<img
src="/images/BrandsIcons/listing/ic_location.svg"
class="listing-details-page__project-title-section__address-icon"
width="24" height="24"
/>
{% if not listing.isProject %}
<a class="text-inherit"
href="{{ generate_search_url(
{
'section': listing.section.id,
'propertyType': listing.propertyType.id,
'location': listing.location.id
}
) }}">
{{ listing.address }}
</a>
{% else %}
{{ listing.address }}
{% endif %}
</p>
{# Price container #}
{% set hasMinimumUnitPrice = listing.compoundField and listing.compoundField.minPrice %}
<div class="listing-details-page__project-title-section__starting-price">
{% if hasMinimumUnitPrice %}
{{ 'listing.starting_from'|trans }}
<span class="integer">
{{ listing.compoundField.minPrice|number_format }}
</span>
<span class="mx-2">
{{ get_setting('general', 'currency')|trans }}
</span>
{% else %}
{{ 'listing.call_for_price'|trans }}
{% endif %}
</div>
</div>