{% 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 isMobile = isMobileAgent(app.request.headers.get('User-Agent')) %}
{% set isEligibleForMortgage = isEnabledFeature('web.mortgage.options') and listing.eligibleForMortgage %}
{% set listingMetaTitle = listing.metaTitle ? listing.metaTitle : "" %}
{% set listingTitle = listing.title ? listing.title : listingMetaTitle %}
{% set hasLastUpdatedDate = listing.isProjectOrUnit %}
{% set hasPublishedDate = listing.publishedAt is not null %}
<div class="listing-details-page__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.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>
{# Price container #}
{% include '@AqarmapListingBundle/Listing/listingPriceContainer.html.twig' %}
{# Title container #}
<h1 class="listing-details-page__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__title-section__address m-0">
<img
src="/images/BrandsIcons/listing/ic_location.svg"
class="listing-details-page__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>
</div>