{# constants #}
{% set LISTING_CATEGORIES_SCRAPPED = constant('Aqarmap\\Bundle\\ListingBundle\\Constant\\ListingCategories::SCRAPPED') %}
{# Toggles #}
{% set isExcludeWhatsappFromListing = isEnabledFeature('web.whatsapp.chat.exclude') and listing.getIsExcludedFromWhatsApp %}
{% set isWhatsappDisabled = isExcludeWhatsappFromListing or not isEnabledFeature('web.whatsapp.chat.exclude') %}
{% set isEnabledSendByWhatsapp = isEnabledFeature('web.whats.app.chat') and isWhatsappDisabled %}
{# listing variables #}
{% set isListingTopPicks = listing.isTopPicks %}
{% set leadSources = []%}
{% set leadSources = app.request.query.get("source") ? leadSources|merge([app.request.query.get("source")]) : leadSources %}
{% set leadSources = source is defined ? leadSources|merge([source]) : leadSources %}
{% set leadSources = isListingTopPicks ? leadSources|merge(["top-picks"]) : leadSources %}
{% set leadIsCreatedFromSlider = "slider" in leadSources %}
{% set enableMessageForm = false %}
{% set isScrapped = listing.category == LISTING_CATEGORIES_SCRAPPED %}
{% set isLeadFromAdvertiserSection = "advertiserSection" in leadSources %}
{% set listingPhones = isEnabledFeature('listing_user_phones') ? listing.phones : listing.listingPhones %}
{% if isEnabledSendByWhatsapp %}
{% if (listing.user.getWhatsAppNumber) %}
{% set whatsAppNumber = listing.user.getWhatsAppNumber.getPhone.getNumber %}
{% endif %}
{% set hasWhatsapp = listing.user.getWhatsAppNumber %}
{% else %}
{% set hasWhatsapp = false %}
{% endif %}
{% set isMessageEnabled = not IS_PROJECT or listing.isSendEmail %}
{% set ctaItemClass = 'cta-item' %}
{% set gtmClassSuffix = null %}
{% if isLeadFromAdvertiserSection %}
{% set gtmClassSuffix = 'advertiser-section' %}
{% elseif leadIsCreatedFromSlider %}
{% set gtmClassSuffix = 'slider-section' %}
{% endif %}
{% set labelLeadSource = '' %}
{% if isTopFavourited %}
{% set labelLeadSource = 'top-favourite' %}
{% set leadSources = leadSources|merge([labelLeadSource]) %}
{% elseif isValidPrice %}
{% set labelLeadSource = 'valid-price' %}
{% set leadSources = leadSources|merge([labelLeadSource]) %}
{% elseif isTopViewed %}
{% set labelLeadSource = 'top-viewed' %}
{% set leadSources = leadSources|merge([labelLeadSource]) %}
{% endif %}
{% set btnStyleClasses = ' btn btn-block cta-btn listing-cta-btn cta-btn_mb' %}
{% set phoneAnalyticsClasses = gtmClassSuffix ? 'gtm-btn-listing-call-' ~ gtmClassSuffix : '' %}
{% set requestPhoneAnalyticsClasses = gtmClassSuffix ? 'gtm-btn-listing-call-request-' ~ gtmClassSuffix : '' %}
{% set whatsappAnalyticsClasses = gtmClassSuffix ? 'gtm-btn-listing-whatsapp-' ~ gtmClassSuffix : '' %}
{% set phoneBtnStyleClasses = 'btn-blue rounded-pill' ~ btnStyleClasses %}
{% set mesageBtnStyleClasses = 'btn-gray rounded-pill' ~ btnStyleClasses %}
{% set whatsappBtnStyleClasses = ' btn-default rounded-pill btn-whatsapp' ~ btnStyleClasses %}
{% set btnHiddenText = "" %}
{% set isMessageTextHidden = "" %}
{% set iconSize = 24 %}
{% set leadSourcePage = leadSourcePage is defined ? leadSourcePage : "listing_details_fixed_buttons"%}
<div class="cta-list">
{% if hasWhatsapp %}
<div class="{{ctaItemClass}} {{ whatsappAnalyticsClasses }}">
<a href="javascript:void(0);"
class="{{whatsappBtnStyleClasses}} custom-collapse__toggle-btn"
data-img-src="/images/BrandsIcons/ic_whatsapp_white.svg"
data-img-class="cta-icon"
data-color="btn-whatsapp"
submit-text="{{ 'label.lead.whatsapp_now'|trans }}"
ng-click="onSendLead($event,{
leadType:'email' ,
actionType:'{{ SEND_WHATSAPP_CONSTANT }}' ,
leadSourcePage: '{{leadSourcePage}}' ,
propertySection: '{{propertySectionSlug}}' ,
propertyCategory: '{{propertyCategory}}',
depthProduct: '{{depthProduct}}',
insideCompound: '{{insideCompound}}',
listingType: {{leadSources|serialize('json')}} ,
listingId: '{{ listing.id }}' ,
})"
>
<img
src="/images/BrandsIcons/ic_whatsapp_white.svg"
class="cta-icon" width="{{iconSize}}" height="{{iconSize}}"
/>
<span > {{ 'label.lead.whatsApp'|trans }} </span>
</a>
</div>
{% endif %}
<div class="{{ctaItemClass}}">
{% if listingPhones is not empty and not isListingCallRequest %}
{% set listingPhone = listingPhones|first %}
<a href="javascript:void(0)"
ng-click="onSendLead($event,{
leadType:'call' ,
actionType:'{{ SHOW_PHONE_CONSTANT }}' ,
listingType: {{leadSources|serialize('json')}} ,
leadSourcePage: '{{leadSourcePage}}' ,
propertyCategory: '{{propertyCategory}}',
propertySection: '{{propertySectionSlug}}' ,
depthProduct: '{{depthProduct}}',
insideCompound: '{{insideCompound}}',
listingId: '{{ listing.id }}' ,
});"
class="gtm-btn-listing-phone {{ phoneBtnStyleClasses }} {{ phoneAnalyticsClasses }} custom-collapse__toggle-btn "
data-gtm-listing-id="{{ listing.id }}"
data-img-class="cta-icon rtl-flip-icon"
data-img-src="/images/BrandsIcons/ic_phone_white.svg"
data-color="btn-blue"
submit-text="{{'label.lead.call_now'|trans }}"
>
<img
src="/images/BrandsIcons/ic_phone_white.svg"
class="cta-icon rtl-flip-icon" width="{{iconSize}}" height="{{iconSize}}"
/>
<span {{btnHiddenText}}>{{ 'listing.show_seller_phone'|trans }}</span>
</a>
{% else %}
<!-- Request a Call form -->
{{ form_start(call_request, {attr: {'onsubmit': 'return false;'}})
}}
{# {{ form_widget(call_request._token, {'attr': {'ng-init': 'data.call_request._token="'~ call_request._token.vars.value ~'"' }}) }} #}
<button type="button"
ng-click="onSendLead($event,{
leadType:'request_call' ,
actionType:'{{ CALL_REQUEST_CONSTANT }}' ,
leadSourcePage: '{{leadSourcePage}}' ,
propertyCategory: '{{propertyCategory}}',
propertySection: '{{propertySectionSlug}}' ,
depthProduct: '{{depthProduct}}',
insideCompound: '{{insideCompound}}',
listingType: {{leadSources|serialize('json')}} ,
listingId: '{{ listing.id }}' ,
});"
class="{{ phoneBtnStyleClasses }} {{ requestPhoneAnalyticsClasses }} gtm-btn-listing-call-request btn-primary"
ng-disabled="callRequested[{{listing.id}}]"
data-color="btn-primary"
submit-text="{{'label.lead.call_request_now'|trans }}"
data-img-class="cta-icon rtl-flip-icon"
data-img-src="/images/BrandsIcons/ic_phone_white.svg"
>
<img
src="/images/BrandsIcons/ic_phone_white.svg"
class="cta-icon rtl-flip-icon"
ng-hide="callRequested[{{listing.id}}]"
width="{{iconSize}}" height="{{iconSize}}"
/>
<span class="fa fa-check-sign" ng-show="callRequested[{{listing.id}}]"> </span>
<span {{btnHiddenText}}> {{ 'label.lead.call_request'|trans }} </span>
</button>
{{ form_end(call_request) }}
{% endif %}
</div>
{% if not isPrimarySoldOutCta and not leadIsCreatedFromSlider %}
<div class="{{ctaItemClass}} cta-item__message-btn">
{% if isMessageEnabled %}
<a href="javascript:void(0)" id="sendEmail"
data-img-class="cta-icon"
data-img-src="/images/BrandsIcons/ic_email_blue.svg"
ng-click="showMessageForm($event, {{leadSources|serialize('json')}});"
class="custom-collapse__toggle-btn messageBtn {{mesageBtnStyleClasses}}">
<img
src="/images/BrandsIcons/ic_email_blue.svg"
class="cta-icon"
ng-hide="callRequested[{{listing.id}}]"
width="{{iconSize}}" height="{{iconSize}}"
/>
<span {{isMessageTextHidden}}> {{ 'listing.seller_email'|trans }} </span>
</a>
{% endif %}
</div>
{% endif %}
{% if not isScrapped and enableMessageForm %}
{% if not listing.user.hasRole('ROLE_TROOP') and (not isEnabledFeature('web.chat.app') or IS_PROJECT) %}
<div class="listingForm p-0">
<div>
<div class="col-xs-12 padding-md-zero hidden-lg hidden-md">
<span class='listing-details'>
<div class="page-header ">
<h5 class="section-title__header"> {{ 'listing.send_message_to'|trans }} (
<a
href="{{ path('aqarmap_user_listings', {'id': listing.user.id}) }}">{{ listing.user.fullName|default(listing.user.username) }}
</a> ).
</h5>
</div>
</span>
</div> <!-- end col12-->
{{ form_start(contact_seller_form) }}
{{ form_row(contact_seller_form.subject, {value : 'Re: '~ listing.title|striptags}) }}
{{ form_row(contact_seller_form.type, {value : SEND_MESSAGE_CONSTANT}, {attr: {'ng-model': 'sellerMessageType', 'ng-init': 'sellerMessageType={{SEND_MESSAGE_CONSTANT}}'}}) }}
{% set textAreaPlaceholder = 'layout.write_question'|trans %}
{{ form_widget(contact_seller_form.message,{attr: {'class': 'form-control mb-md', 'placeholder': textAreaPlaceholder, 'ng-model': '$root.sellerMessageContent'}}) }}
<button type="submit"
class=" col cta-btn-col btn btn-block cta-btn listing-cta-btn btn-blue rounded-pill gtm-btn-listing-message " data-gtm-listing-id="{{ listing.id }}"
ng-click="onSendLead($event,{
leadType: 'email' ,
actionType:'{{ SEND_MESSAGE_CONSTANT }}' ,
leadSourcePage: '{{leadSourcePage}}' ,
propertyCategory: '{{propertyCategory}}',
propertySection: '{{propertySectionSlug}}' ,
depthProduct: '{{depthProduct}}',
insideCompound: '{{insideCompound}}',
listingType: {{leadSources|serialize('json')}} ,
listingId: '{{ listing.id }}' ,
});"
ng-disabled="contact_seller.$invalid" >
{{ 'listing.send_message'|trans }}
</button>
{{ form_end(contact_seller_form) }}
</div>
</div>
{% endif %}
{% endif %}
</div>