{% set PRIMARY_ID_CONST = constant('Aqarmap\\Bundle\\ListingBundle\\Constant\\MarketPropertyTypes::PRIMARY')%}
{% set PRIMARY_LABEL_CONST = constant('Aqarmap\\Bundle\\ListingBundle\\Constant\\MarketPropertyTypes::PRIMARY_LABEL')%}
{% set RESALE_LABEL_CONST = constant('Aqarmap\\Bundle\\ListingBundle\\Constant\\MarketPropertyTypes::RESALE_LABEL')%}
{% set listing_attributes = listing.getAttributesList() %}
{% set country = get_setting('general', 'country') %}
{% set hasPaymentMethod = listing.paymentMethod and not isListingForRent %}
{% set showPricePerMeter = listing.price and listing.area and not isListingForRent %}
<div class="listing-info-container listing-details-item">
<p class="section-title__header">
{{ 'listing.listing_details'|trans }}
</p>
<ul class="list-group">
{% if listing.area %}
<li class="list-group-item d-flex ">
<span class="col-md-3 col-5"> {{ 'listing.sizes'|trans }} </span>
<span class="col-md-9 col-7">
<span class="count badge badge-default">{{ listing.area|trans }} {{ get_setting('general', 'measurement_unit')|trans }}</span>
</span>
</li>
{% endif %}
{% if listing.attributes|length > 0 %}
{% set listing_rooms = (listing_attributes["rooms"]) is defined ? getRoomsLabel(listing_attributes["rooms"]) : '' %}
{% if listing_rooms %}
<li class="list-group-item d-flex ">
<span class="col-md-3 col-5"> {{ 'listing.rooms'|trans }} </span>
<span class="col-md-9 col-7">
<span class="count badge badge-default">{{ listing_rooms }}</span>
</span>
</li>
{% endif %}
{% set listing_baths = (listing_attributes["baths"]) is defined ? getRoomsLabel(listing_attributes["baths"]) : '' %}
{% if listing_baths %}
<li class="list-group-item d-flex ">
<span class="col-md-3 col-5"> {{ 'listing.baths'|trans }}</span>
<span class="col-md-9 col-7">
<span class="count badge badge-default">{{ listing_baths }}</span>
</span>
</li>
{% endif %}
{% set listing_floor = (listing_attributes["floor"]) is defined ? getFloorLabel(listing_attributes["floor"])|trans : '' %}
{% if listing_floor %}
<li class="list-group-item d-flex ">
<span class="col-md-3 col-5">{{ 'listing.floor'|trans }}</span>
<span class="col-md-9 col-7">
<span class="count badge badge-default">{{ listing_floor }}</span>
</span>
</li>
{% endif %}
{% set listing_finish_type = (listing_attributes["finish-type"]) is defined ? listing_attributes["finish-type"] : '' %}
{% if listing_finish_type %}
<li class="list-group-item d-flex ">
<span class="col-md-3 col-5"> {{ 'listing.finish-type'|trans }}</span>
<span class="col-md-9 col-7">
<span class="count badge badge-default">{{ listing_finish_type|trans }}</span>
</span>
</li>
{% endif %}
{% if listing.propertyView %}
<li class="list-group-item d-flex ">
<span class="col-md-3 col-5"> {{ 'layout.property_view'|trans }} </span>
<span class="col-md-9 col-7">
<span class="count badge badge-default">{{ listing.propertyViewLabel|trans }}</span>
</span>
</li>
{% endif %}
{% set listing_year_built = (listing_attributes["year-built"]) is defined ? listing_attributes["year-built"] : '' %}
{% set sectionId = listing.section.id %}
{% if listing_year_built and sectionId != forRent %}
<li class="list-group-item d-flex ">
<span class="col-md-3 col-5"> {{ 'listing.year-built'|trans }} </span>
<span class="col-md-9 col-7">
<span class="count badge badge-default">{{ listing_year_built }}</span>
</span>
</li>
{% endif %}
{% endif %}
<li class="list-group-item d-flex ">
<span class="col-md-3 col-5"> {{ 'listing.listing_id'|trans }} </span>
<span class="col-md-9 col-7">
<span class="count badge badge-default">{{ get_setting('general', 'country') }}-{{ listing.id }}</span>
</span>
</li>
{% if showPricePerMeter %}
<li class="list-group-item d-flex ">
<span class="col-md-3 col-5"> {{ 'listing.price_per_meter'|trans }} </span>
<span class="col-md-9 col-7">
{% set unitPricePerMeter = get_setting('general', 'currency')|trans ~ "/" ~ get_setting('general', 'measurement_unit')|trans %}
<span class="count badge badge-default">{{ listing.calculatePricePerMeter|number_format }} {{ unitPricePerMeter }}</span>
</span>
</li>
{% endif %}
{% if hasPaymentMethod %}
<li class="list-group-item d-flex ">
<span class="col-md-3 col-5"> {{ 'layout.payment_method'|trans }} </span>
<span class="col-md-9 col-7">
<span class="count badge badge-default">{{ listing.paymentMethodLabel|trans }}</span>
</span>
</li>
{% endif %}
<li class="list-group-item d-flex ">
<span class="col-md-3 col-5"> {{ 'listing.seller_role'|trans }} </span>
<span class="col-md-9 col-7">
<span class="count badge badge-default">{{ listing.sellerRoleLabel|trans }}</span>
</span>
</li>
{% if isEligibleForMortgage %}
{% set mortgageData = listing.eligibleForMortgageWithLabel %}
{% set mortgageDataLength = mortgageData|length %}
<li class="list-group-item d-flex ">
<span class="col-md-3 col-5"> {{ 'listing.mortgage'|trans }} </span>
<span class="col-md-9 col-7">
<span class="count badge badge-default">
{% for data in mortgageData %}
{% set comma = mortgageDataLength > 1 and loop.index != mortgageDataLength ? "," : "" %}
{{data.title|trans }}
{{comma}}
{% endfor %}
</span>
</span>
</li>
{% endif %}
{% if listing.advertiserNumber and country == 'SA' %}
<li class="list-group-item d-flex ">
<span class="col-md-3 col-5"> {{ 'listing.advertiser_number'|trans }} </span>
<span class="col-md-9 col-7">
<span class="count badge badge-default">{{ listing.advertiserNumber }}</span>
</span>
</li>
{% endif %}
{% if listing.authorizationNumber and country == 'SA' %}
<li class="list-group-item d-flex ">
<span class="col-md-3 col-5"> {{ 'listing.authorization_number'|trans }} </span>
<span class="col-md-9 col-7">
<span class="count badge badge-default">{{ listing.authorizationNumber }}</span>
</span>
</li>
{% endif %}
{% if listing.marketPropertyType %}
{% set typeInMarketLabel = listing.marketPropertyType == PRIMARY_ID_CONST ? 'listing.primary' : 'listing.resale'%}
<li class="list-group-item d-flex ">
<span class="col-md-3 col-5"> {{ 'listing.market_property_type'|trans }} </span>
<span class="col-md-9 col-7">
<span class="count badge badge-default">{{ typeInMarketLabel|trans }}</span>
</span>
</li>
{% endif %}
</ul>
</div>