src/Aqarmap/Bundle/ListingBundle/Resources/views/Listing/listingContact.html.twig line 1

  1. {# constants #}
  2. {% set LISTING_CATEGORIES_SCRAPPED = constant('Aqarmap\\Bundle\\ListingBundle\\Constant\\ListingCategories::SCRAPPED') %}
  3. {# Toggles #}
  4. {% set isExcludeWhatsappFromListing = isEnabledFeature('web.whatsapp.chat.exclude') and listing.getIsExcludedFromWhatsApp %}
  5. {% set isWhatsappDisabled = isExcludeWhatsappFromListing or not isEnabledFeature('web.whatsapp.chat.exclude') %}
  6. {% set isEnabledSendByWhatsapp = isEnabledFeature('web.whats.app.chat') and isWhatsappDisabled %}
  7. {# listing variables #}
  8. {% set isListingTopPicks = listing.isTopPicks %}
  9. {% set leadSources = []%}
  10. {% set leadSources = app.request.query.get("source") ? leadSources|merge([app.request.query.get("source")]) : leadSources %}
  11. {% set leadSources = source is defined ? leadSources|merge([source]) : leadSources %}
  12. {% set leadSources = isListingTopPicks ? leadSources|merge(["top-picks"]) : leadSources %}
  13. {% set leadIsCreatedFromSlider = "slider" in leadSources %}
  14. {% set enableMessageForm = false %}
  15. {% set isScrapped = listing.category == LISTING_CATEGORIES_SCRAPPED %}
  16. {% set isLeadFromAdvertiserSection = "advertiserSection" in leadSources %}
  17. {% set listingPhones = isEnabledFeature('listing_user_phones') ? listing.phones : listing.listingPhones %}
  18. {% if isEnabledSendByWhatsapp %}
  19. {% if (listing.user.getWhatsAppNumber) %}
  20. {% set whatsAppNumber = listing.user.getWhatsAppNumber.getPhone.getNumber %}
  21. {% endif %}
  22. {% set hasWhatsapp = listing.user.getWhatsAppNumber %}
  23. {% else %}
  24. {% set hasWhatsapp = false %}
  25. {% endif %}
  26. {% set ctaItemClass = 'cta-item' %}
  27. {% set gtmClassSuffix = null %}
  28. {% if isLeadFromAdvertiserSection %}
  29. {% set gtmClassSuffix = 'advertiser-section' %}
  30. {% elseif leadIsCreatedFromSlider %}
  31. {% set gtmClassSuffix = 'slider-section' %}
  32. {% endif %}
  33. {% set labelLeadSource = '' %}
  34. {% if isTopFavourited %}
  35. {% set labelLeadSource = 'top-favourite' %}
  36. {% set leadSources = leadSources|merge([labelLeadSource]) %}
  37. {% elseif isValidPrice %}
  38. {% set labelLeadSource = 'valid-price' %}
  39. {% set leadSources = leadSources|merge([labelLeadSource]) %}
  40. {% elseif isTopViewed %}
  41. {% set labelLeadSource = 'top-viewed' %}
  42. {% set leadSources = leadSources|merge([labelLeadSource]) %}
  43. {% endif %}
  44. {% set btnStyleClasses = ' btn btn-block cta-btn listing-cta-btn cta-btn_mb' %}
  45. {% set phoneAnalyticsClasses = gtmClassSuffix ? 'gtm-btn-listing-call-' ~ gtmClassSuffix : '' %}
  46. {% set requestPhoneAnalyticsClasses = gtmClassSuffix ? 'gtm-btn-listing-call-request-' ~ gtmClassSuffix : '' %}
  47. {% set whatsappAnalyticsClasses = gtmClassSuffix ? 'gtm-btn-listing-whatsapp-' ~ gtmClassSuffix : '' %}
  48. {% set phoneBtnStyleClasses = 'btn-blue rounded-pill' ~ btnStyleClasses %}
  49. {% set mesageBtnStyleClasses = 'btn-gray rounded-pill' ~ btnStyleClasses %}
  50. {% set whatsappBtnStyleClasses = ' btn-default rounded-pill btn-whatsapp' ~ btnStyleClasses %}
  51. {% set btnHiddenText = "" %}
  52. {% set isMessageTextHidden = "" %}
  53. {% set iconSize = 24 %}
  54. {% set leadSourcePage = leadSourcePage is defined ? leadSourcePage : "listing_details_fixed_buttons"%}
  55. <div class="cta-list">
  56. {% if hasWhatsapp %}
  57. <div class="{{ctaItemClass}} {{ whatsappAnalyticsClasses }}">
  58. <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,{
  59. leadType:'email' ,
  60. actionType:'{{ SEND_WHATSAPP_CONSTANT }}' ,
  61. leadSourcePage: '{{leadSourcePage}}' ,
  62. propertySection: '{{propertySectionSlug}}' ,
  63. propertyCategory: '{{propertyCategory}}',
  64. depthProduct: '{{depthProduct}}',
  65. insideCompound: '{{insideCompound}}',
  66. listingType: {{leadSources|serialize('json')}} ,
  67. listingId: '{{ listing.id }}' ,
  68. })">
  69. <img src="/images/BrandsIcons/ic_whatsapp_white.svg" class="cta-icon" width="{{iconSize}}" height="{{iconSize}}"/>
  70. <span>
  71. {{ 'label.lead.whatsApp'|trans }}
  72. </span>
  73. </a>
  74. </div>
  75. {% endif %}
  76. <div class="{{ctaItemClass}}">
  77. {% if listingPhones is not empty and not isListingCallRequest %}
  78. {% set listingPhone = listingPhones|first %}
  79. <a href="javascript:void(0)" ng-click="onSendLead($event,{
  80. leadType:'call' ,
  81. actionType:'{{ SHOW_PHONE_CONSTANT }}' ,
  82. listingType: {{leadSources|serialize('json')}} ,
  83. leadSourcePage: '{{leadSourcePage}}' ,
  84. propertyCategory: '{{propertyCategory}}',
  85. propertySection: '{{propertySectionSlug}}' ,
  86. depthProduct: '{{depthProduct}}',
  87. insideCompound: '{{insideCompound}}',
  88. listingId: '{{ listing.id }}' ,
  89. });" 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 }}">
  90. <img src="/images/BrandsIcons/ic_phone_white.svg" class="cta-icon rtl-flip-icon" width="{{iconSize}}" height="{{iconSize}}"/>
  91. <span {{btnHiddenText}}>{{ 'listing.show_seller_phone'|trans }}</span>
  92. </a>
  93. {% else %}
  94. <!-- Request a Call form -->
  95. {{ form_start(call_request, {attr: {'onsubmit': 'return false;'}})
  96. }}
  97. {# {{ form_widget(call_request._token, {'attr': {'ng-init': 'data.call_request._token="'~ call_request._token.vars.value ~'"' }}) }} #}
  98. <button type="button" ng-click="onSendLead($event,{
  99. leadType:'request_call' ,
  100. actionType:'{{ CALL_REQUEST_CONSTANT }}' ,
  101. leadSourcePage: '{{leadSourcePage}}' ,
  102. propertyCategory: '{{propertyCategory}}',
  103. propertySection: '{{propertySectionSlug}}' ,
  104. depthProduct: '{{depthProduct}}',
  105. insideCompound: '{{insideCompound}}',
  106. listingType: {{leadSources|serialize('json')}} ,
  107. listingId: '{{ listing.id }}' ,
  108. });" 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">
  109. <img src="/images/BrandsIcons/ic_phone_white.svg" class="cta-icon rtl-flip-icon" ng-hide="callRequested[{{listing.id}}]" width="{{iconSize}}" height="{{iconSize}}"/>
  110. <span class="fa fa-check-sign" ng-show="callRequested[{{listing.id}}]"></span>
  111. <span {{btnHiddenText}}>
  112. {{ 'label.lead.call_request'|trans }}
  113. </span>
  114. </button>
  115. {{ form_end(call_request) }}
  116. {% endif %}
  117. </div>
  118. {% if not isScrapped and enableMessageForm %}
  119. {% if not listing.user.hasRole('ROLE_TROOP') and (not isEnabledFeature('web.chat.app') or IS_PROJECT) %}
  120. <div class="listingForm p-0">
  121. <div>
  122. <div class="col-xs-12 padding-md-zero hidden-lg hidden-md">
  123. <span class='listing-details'>
  124. <div class="page-header ">
  125. <h5 class="section-title__header">
  126. {{ 'listing.send_message_to'|trans }}
  127. (
  128. <a href="{{ path('aqarmap_user_listings', {'id': listing.user.id}) }}">{{ listing.user.fullName|default(listing.user.username) }}
  129. </a>
  130. ).
  131. </h5>
  132. </div>
  133. </span>
  134. </div>
  135. <!-- end col12-->
  136. {{ form_start(contact_seller_form) }}
  137. {{ form_row(contact_seller_form.subject, {value : 'Re: '~ listing.title|striptags}) }}
  138. {{ form_row(contact_seller_form.type, {value : SEND_MESSAGE_CONSTANT}, {attr: {'ng-model': 'sellerMessageType', 'ng-init': 'sellerMessageType={{SEND_MESSAGE_CONSTANT}}'}}) }}
  139. {% set textAreaPlaceholder = 'layout.write_question'|trans %}
  140. {{ form_widget(contact_seller_form.message,{attr: {'class': 'form-control mb-md', 'placeholder': textAreaPlaceholder, 'ng-model': '$root.sellerMessageContent'}}) }}
  141. {{ form_end(contact_seller_form) }}
  142. </div>
  143. </div>
  144. {% endif %}
  145. {% endif %}
  146. </div>