{# Constants #}
{% set SHOW_PHONE_CONSTANT = constant('Aqarmap\\Bundle\\ListingBundle\\Constant\\LeadTypes::SHOW_PHONE') %}
{% for listing in listings %}
{% if agent is defined %}
{% set listing = listing['listing'] %}
{% endif %}
{# Listing Vars #}
{% set isListingPhotosDefined = listingPhotos[listing.id] is defined and listingPhotos[listing.id].main is defined %}
{% set listingPhotoSize = 110 %}
{% set disableLazyLoadImgIndex = loop.index in [1, 2] %}
{% if isEnabledFeature('listing_card.lead.button') %}
{% set listingPhones = isEnabledFeature('listing_user_phones') ? listing.phones : listing.listingPhones %}
{% else %}
{% set listingPhones = [] %}
{% endif %}
{% set listingPhone = null %}
{% if listingPhones is not empty %}
{% set listingPhone = listingPhones|first %}
{% endif %}
{% if (listing.user.getWhatsAppNumber) %}
{% set whatsAppNumber = listing.user.getWhatsAppNumber.getPhone.getNumber %}
{% endif %}
{% set hasWhatsapp = listing.user.getWhatsAppNumber %}
{% if listing.slug %}
{% set LISTING_URL = isRelatedResults ? path("listing_slug", {id: listing.id, slug: listing.slug}|merge({'relatedseaarchlisting': true})) : path("listing_slug", {id: listing.id, slug: listing.slug}) %}
{% else %}
{% set LISTING_URL = isRelatedResults ? path('listing_view', {'id': listing.id}|merge({'relatedseaarchlisting': true})) : path('listing_view', {'id': listing.id}) %}
{% endif %}
{% set callBtnClass = not hasWhatsapp ? 'big': '' %}
{% set urlSource = app.request.query.get("source") ? app.request.query.get("source") : ''%}
{% set containerSource = source is defined ? source : null %}
{% set leadSources = containerSource ? [containerSource] : [urlSource] %}
{% set encodedSellerPhones = []%}
{% for phone in listingPhones %}
{% set encodedSellerPhones = encodedSellerPhones | merge([{'number': phone.number|phoneNumberEncode}]) %}
{% endfor %}
{% set listingUser = listing.user %}
{% set sellerName = listingUser.fullName %}
{% set userLogo = listingUser.logo ? listingUser.logo.file : null %}
{% set logo = listing.validUserLogo %}
{% set financeFeatureValue = get_setting('features', 'finance_service') %}
{% set activeListingsCount = liveListingsPerUser[listing.user.id] is defined ? liveListingsPerUser[listing.user.id] : 0 %}
{% set leadsCount = listingUser.getClientServedCount() %}
<div class="col-12 horizontal-listing-card horizontal-listing-card_mb-l"
ng-init='setListingDetail("{{listing.id}}",{
"section": "{{listing.section.id}}",
"sellerPhones": {{encodedSellerPhones|serialize('json')}},
"sellerPhone": "{{hasWhatsapp ? whatsAppNumber|phoneNumberEncode : listingPhone ? listingPhone.number|phoneNumberEncode : "" }}",
"financeUrl":"{{listing.getFinancialAidURL()}}",
"userEmail": {{currentUserEmail|json_encode()}},
"financeFeatureValue": "{{financeFeatureValue}}",
"listingName" : "{{listing.customSlug|default(listing.id)}}",
"listingTitle" : "{{listing.title}}",
"listingUser": {
"sellerName" : "{{sellerName}}",
"sellerLogo": "",
"sellerUrl": "{{sellerUrl}}",
"joinedData":"{{joinedData}}",
"activeListingsCount": "{{activeListingsCount}}",
"leadsCount":"{{leadsCount}}"
}
})'>
<div class="horizontal-listing-card__container">
<a class="horizontal-listing-card__container__link "
itemprop="url"
ng-click="onCardClick({{leadSources|serialize('json')}})"
href="{{ LISTING_URL }}">
<div class="horizontal-listing-card__wrapper">
<div class="horizontal-listing-card__img">
<div class="horizontal-listing-card__img__wrapper">
{% if isListingPhotosDefined %}
{% if disableLazyLoadImgIndex %}
<picture>
<source src="{{ custom_vich_uploader_asset(listingPhotos[listing.id].main.file, 'file')|thumbnail('search-thumb-webp') }}"
type="image/webp">
<source src="{{ custom_vich_uploader_asset(listingPhotos[listing.id].main.file, 'file')|thumbnail('search-thumb') }}"
type="image/jpg">
<img itemprop="photo"
src="{{ custom_vich_uploader_asset(listingPhotos[listing.id].main.file, 'file')|thumbnail('search-thumb') }}"
alt="{{ listing.title|excludeNumbers }}"
width="{{ listingPhotoSize }}" height="{{ listingPhotoSize }}" />
</picture>
{% else %}
<img itemprop="photo"
src="/images/placeholder.svg"
data-src="{{ custom_vich_uploader_asset(listingPhotos[listing.id].main.file, 'file')|thumbnail('search-thumb') }}"
class="lazyload" alt="{{ listing.title|excludeNumbers }}"
width="{{ listingPhotoSize }}" height="{{ listingPhotoSize }}" />
{% endif %}
{% elseif listing.mainPhoto %}
{% if disableLazyLoadImgIndex %}
<picture>
<source src="{{ custom_vich_uploader_asset(listing.mainPhoto.file, 'file')|thumbnail('search-thumb-webp') }}"
type="image/webp"
class="lazyload">
<source src="{{ custom_vich_uploader_asset(listing.mainPhoto.file, 'file')|thumbnail('search-thumb') }}"
type="image/jpg"
class="lazyload">
<img itemprop="photo"
src="{{ custom_vich_uploader_asset(listing.mainPhoto.file, 'file')|thumbnail('search-thumb') }}"
alt="{{ listing.title|excludeNumbers }}"
width="{{ listingPhotoSize }}" height="{{ listingPhotoSize }}" />
</picture>
{% else %}
<img itemprop="photo"
src="/images/placeholder.svg"
data-src="{{ custom_vich_uploader_asset(listing.mainPhoto.file, 'file')|thumbnail('search-thumb') }}"
class="lazyload" alt="{{ listing.title|excludeNumbers }}"
width="{{ listingPhotoSize }}" height="{{ listingPhotoSize }}" />
{% endif %}
{% else %}
<div class="horizontal-listing-card__img__no-photo">{{ 'layout.no_listing_photo'|trans }}</div>
{% endif %}
</div>
</div>
<div class="horizontal-listing-card__details">
<div class="horizontal-listing-card__details__wrapper">
<div class="horizontal-listing-card__price">
{% if listing.price %}
<span class="integer">{{ listing.price|number_format }}</span>
<span class="mx-2">{{ get_setting('general', 'currency')|trans }}</span>
{% elseif listing.section.searchable %}
{{ 'listing.call_for_price'|trans }}
{% endif %}
</div>
<p class="horizontal-listing-card__address">
<img
src="/images/BrandsIcons/listing/ic_location.svg"
class="horizontal-listing-card__attributes_icon"
/>
{{ listing.address }}
</p>
<div class="horizontal-listing-card__attributes">
<label class="horizontal-listing-card__attributes_item">
<img
src="/images/BrandsIcons/listing/ic_size.svg"
class="horizontal-listing-card__attributes_icon"
/>
{{ listing.area}} {{ get_setting('general', 'measurement_unit')|trans }}
</label>
{% set listing_attributes = listing.getAttributesList() %}
{% if listing_attributes|length > 0 %}
{% set listing_rooms = (listing_attributes["rooms"]) is defined ? getRoomsLabel(listing_attributes["rooms"]) : '' %}
{% set listing_baths = (listing_attributes["baths"]) is defined ? getBathsLabel(listing_attributes["baths"]) : '' %}
{% if listing_rooms %}
<label class="horizontal-listing-card__attributes_item">
<img
src="/images/BrandsIcons/listing/ic_bedroom.svg"
class="horizontal-listing-card__attributes_icon"
/>
{{ listing_rooms }}
</label>
{% endif %}
{% if listing_baths %}
<label class="horizontal-listing-card__attributes_item">
<img
src="/images/BrandsIcons/listing/ic_bathroom.svg"
class="horizontal-listing-card__attributes_icon"
/>
{{ listing_baths }}
</label>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
</a>
<div class="horizontal-listing-card__footer">
<hr class="desktop-separator">
<div class="horizontal-listing-card__cta w-100">
{% if listingPhones is not empty and not listing.isCallRequest %}
{% if hasWhatsapp %}
<a class="horizontal-listing-card__cta-button horizontal-listing-card__cta-button_whatsapp whatsapp big"
href="javascript:void(0);"
ng-click="onSendLead($event,{
actionType:'{{ SEND_WHATSAPP_CONSTANT }}' ,
listingType: {{leadSources|serialize('json')}} ,
listingId: '{{ listing.id }}' ,
});"
>
<img
src="/images/BrandsIcons/listing/ic_whatsapp.svg"
class="horizontal-listing-card__cta-button_whatsapp_icon"
/>
{{ 'label.lead.whatsApp'|trans }}
</a>
<div class="vertical-separator"></div>
{% endif %}
{% set phoneBtnClass = 'horizontal-listing-card__cta-button horizontal-listing-card__cta-button_call ' ~ callBtnClass %}
<a class="{{ phoneBtnClass }}"
href="javascript:void(0);"
submit-text="{{ 'listing.show_seller_phone'|trans }}"
ng-click="searchActionType = 'showNumber';
onSendLead($event,{
actionType:'{{ SHOW_PHONE_CONSTANT }}' ,
listingType: {{leadSources|serialize('json')}} ,
listingId: '{{ listing.id }}' ,
});"
ng-if="!phoneShowed[{{listing.id}}]"
data-gtm-listing-id="{{ listing.id }}">
<img
src="/images/BrandsIcons/listing/ic_phone.svg"
class="horizontal-listing-card__cta-button_call_icon"
/>
<span class="cta-button-text"> {{ 'listing.show_seller_phone'|trans }}</span>
</a>
<a class="{{ phoneBtnClass }}"
href="javascript:void(0);"
ng-cloak
ng-click="showPhoneModalByListingId({{listing.id}})"
ng-if="phoneShowed[{{listing.id}}]">
<img
src="/images/BrandsIcons/listing/ic_phone.svg"
class="horizontal-listing-card__cta-button_call_icon"
/>
<span class="cta-button-text"> {{ 'listing.show_seller_phone'|trans }}</span>
</a>
{% else %}
<a href=""
class="horizontal-listing-card__cta-button horizontal-listing-card__cta-button_call-request big m-0"
ng-hide="callRequested[{{listing.id}}]"
ng-click="searchActionType = 'sendRequest';
onSendLead($event,{
actionType:'{{ CALL_REQUEST_CONSTANT }}' ,
listingType: {{leadSources|serialize('json')}} ,
listingId: '{{ listing.id }}' ,
});"
>
<img
src="/images/BrandsIcons/listing/ic_phone.svg"
class="horizontal-listing-card__cta-button_call_icon"
/>
<span ng-hide="callRequested[{{listing.id}}]" class="cta-button-text"> {{ 'label.lead.call_request'|trans }} </span>
</a>
<a href=""
class="horizontal-listing-card__cta-button big success ng-hide"
ng-show="callRequested[{{listing.id}}]"
type= "button"
disabled
>
<i class="fa fa-check circle-badge success"></i>
<span class="mx-1"> {{ 'label.lead.call_requested'|trans }} </span>
</a>
{% endif %}
</div>
</div>
</div>
</div>
{% endfor %}