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

Open in your IDE?
  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 isMessageEnabled =  not IS_PROJECT or listing.isSendEmail %}
  27. {% set ctaItemClass = 'cta-item' %}
  28. {% set gtmClassSuffix = null %}
  29. {% if isLeadFromAdvertiserSection %}
  30.     {% set gtmClassSuffix = 'advertiser-section' %}
  31. {% elseif leadIsCreatedFromSlider %}
  32.     {% set gtmClassSuffix = 'slider-section' %}
  33. {% endif %}
  34. {% set labelLeadSource = '' %}
  35. {% if isTopFavourited %}
  36.     {% set labelLeadSource = 'top-favourite' %}
  37.     {% set leadSources = leadSources|merge([labelLeadSource]) %}
  38. {% elseif isValidPrice %}
  39.     {% set labelLeadSource = 'valid-price' %}
  40.         {% set leadSources = leadSources|merge([labelLeadSource]) %}
  41. {% elseif isTopViewed %}
  42.     {% set labelLeadSource = 'top-viewed' %}
  43.     {% set leadSources = leadSources|merge([labelLeadSource]) %}
  44. {% endif %}
  45. {% set btnStyleClasses = ' btn btn-block cta-btn listing-cta-btn cta-btn_mb' %}
  46. {% set phoneAnalyticsClasses = gtmClassSuffix ? 'gtm-btn-listing-call-' ~ gtmClassSuffix : '' %}
  47. {% set requestPhoneAnalyticsClasses = gtmClassSuffix ? 'gtm-btn-listing-call-request-' ~ gtmClassSuffix : '' %}
  48. {% set whatsappAnalyticsClasses = gtmClassSuffix ? 'gtm-btn-listing-whatsapp-' ~ gtmClassSuffix : '' %}
  49. {% set phoneBtnStyleClasses =  'btn-blue rounded-pill' ~ btnStyleClasses %}
  50. {% set mesageBtnStyleClasses = 'btn-gray rounded-pill' ~ btnStyleClasses %}
  51. {% set whatsappBtnStyleClasses =  ' btn-default rounded-pill btn-whatsapp' ~  btnStyleClasses %}
  52. {% set btnHiddenText = "" %}
  53. {% set isMessageTextHidden = "" %}
  54. {% set iconSize = 24 %}
  55. {% set leadSourcePage = leadSourcePage is defined ? leadSourcePage : "listing_details_fixed_buttons"%}
  56. <div class="cta-list">
  57.     {% if hasWhatsapp %}
  58.         <div class="{{ctaItemClass}} {{ whatsappAnalyticsClasses }}">
  59.             <a href="javascript:void(0);"
  60.                 class="{{whatsappBtnStyleClasses}} custom-collapse__toggle-btn"
  61.                 data-img-src="/images/BrandsIcons/ic_whatsapp_white.svg"
  62.                 data-img-class="cta-icon"
  63.                 data-color="btn-whatsapp"
  64.                 submit-text="{{ 'label.lead.whatsapp_now'|trans }}"
  65.                 ng-click="onSendLead($event,{
  66.                         leadType:'email' ,
  67.                         actionType:'{{ SEND_WHATSAPP_CONSTANT }}' ,
  68.                         leadSourcePage: '{{leadSourcePage}}' ,
  69.                         propertySection: '{{propertySectionSlug}}' ,
  70.                         propertyCategory: '{{propertyCategory}}',
  71.                         depthProduct: '{{depthProduct}}',
  72.                         insideCompound: '{{insideCompound}}',
  73.                         listingType:  {{leadSources|serialize('json')}} ,
  74.                         listingId: '{{ listing.id }}' ,
  75.                     })"
  76.                 >
  77.                     <img
  78.                         src="/images/BrandsIcons/ic_whatsapp_white.svg"
  79.                         class="cta-icon" width="{{iconSize}}" height="{{iconSize}}"
  80.                     />
  81.                     <span > {{ 'label.lead.whatsApp'|trans }} </span>
  82.             </a>
  83.         </div>
  84.     {% endif %}
  85.     <div class="{{ctaItemClass}}">
  86.         {% if listingPhones is not empty and not isListingCallRequest %}
  87.             {% set listingPhone = listingPhones|first %}
  88.                 <a href="javascript:void(0)"
  89.                     ng-click="onSendLead($event,{
  90.                             leadType:'call' ,
  91.                             actionType:'{{ SHOW_PHONE_CONSTANT }}' ,
  92.                             listingType:  {{leadSources|serialize('json')}} ,
  93.                             leadSourcePage: '{{leadSourcePage}}' ,
  94.                             propertyCategory: '{{propertyCategory}}',
  95.                             propertySection: '{{propertySectionSlug}}' ,
  96.                             depthProduct: '{{depthProduct}}',
  97.                             insideCompound: '{{insideCompound}}',
  98.                             listingId: '{{ listing.id }}' ,
  99.                         });"
  100.                     class="gtm-btn-listing-phone {{ phoneBtnStyleClasses }} {{ phoneAnalyticsClasses }} custom-collapse__toggle-btn "
  101.                     data-gtm-listing-id="{{ listing.id }}"
  102.                     data-img-class="cta-icon rtl-flip-icon"
  103.                     data-img-src="/images/BrandsIcons/ic_phone_white.svg"
  104.                     data-color="btn-blue"
  105.                     submit-text="{{'label.lead.call_now'|trans }}"
  106.                 >
  107.                     <img
  108.                         src="/images/BrandsIcons/ic_phone_white.svg"
  109.                         class="cta-icon rtl-flip-icon" width="{{iconSize}}" height="{{iconSize}}"
  110.                     />
  111.                     <span {{btnHiddenText}}>{{ 'listing.show_seller_phone'|trans }}</span>
  112.                 </a>
  113.         {% else %}
  114.             <!-- Request a Call form -->
  115.             {{ form_start(call_request, {attr: {'onsubmit': 'return false;'}})
  116.             }}
  117.             {# {{ form_widget(call_request._token, {'attr': {'ng-init': 'data.call_request._token="'~ call_request._token.vars.value ~'"' }}) }}  #}
  118.             <button type="button"
  119.                 ng-click="onSendLead($event,{
  120.                         leadType:'request_call' ,
  121.                         actionType:'{{ CALL_REQUEST_CONSTANT }}' ,
  122.                         leadSourcePage: '{{leadSourcePage}}' ,
  123.                         propertyCategory: '{{propertyCategory}}',
  124.                         propertySection: '{{propertySectionSlug}}' ,
  125.                         depthProduct: '{{depthProduct}}',
  126.                         insideCompound: '{{insideCompound}}',
  127.                         listingType:  {{leadSources|serialize('json')}} ,
  128.                         listingId: '{{ listing.id }}' ,
  129.                     });"
  130.                 class="{{ phoneBtnStyleClasses }} {{ requestPhoneAnalyticsClasses }} gtm-btn-listing-call-request btn-primary"
  131.                 ng-disabled="callRequested[{{listing.id}}]"
  132.                 data-color="btn-primary"
  133.                 submit-text="{{'label.lead.call_request_now'|trans }}"
  134.                 data-img-class="cta-icon rtl-flip-icon"
  135.                 data-img-src="/images/BrandsIcons/ic_phone_white.svg"
  136.                 >
  137.                     <img
  138.                         src="/images/BrandsIcons/ic_phone_white.svg"
  139.                         class="cta-icon rtl-flip-icon"
  140.                         ng-hide="callRequested[{{listing.id}}]"
  141.                         width="{{iconSize}}" height="{{iconSize}}"
  142.                     />
  143.                     <span class="fa fa-check-sign" ng-show="callRequested[{{listing.id}}]"> </span>
  144.                     <span {{btnHiddenText}}> {{ 'label.lead.call_request'|trans }} </span>
  145.             </button>
  146.             {{ form_end(call_request) }}
  147.         {% endif %}
  148.     </div>
  149.     {% if not isPrimarySoldOutCta and not leadIsCreatedFromSlider %}
  150.         <div class="{{ctaItemClass}} cta-item__message-btn">
  151.             {% if isMessageEnabled %}
  152.                 <a href="javascript:void(0)" id="sendEmail"
  153.                     data-img-class="cta-icon"
  154.                     data-img-src="/images/BrandsIcons/ic_email_blue.svg"
  155.                     ng-click="showMessageForm($event, {{leadSources|serialize('json')}});"
  156.                     class="custom-collapse__toggle-btn messageBtn {{mesageBtnStyleClasses}}">
  157.                         <img
  158.                             src="/images/BrandsIcons/ic_email_blue.svg"
  159.                             class="cta-icon"
  160.                             ng-hide="callRequested[{{listing.id}}]"
  161.                             width="{{iconSize}}" height="{{iconSize}}"
  162.                         />
  163.                         <span {{isMessageTextHidden}}> {{ 'listing.seller_email'|trans }} </span>
  164.                 </a>
  165.             {% endif %}
  166.         </div>
  167.     {% endif %}
  168.     {% if not isScrapped and enableMessageForm %}
  169.         {% if not listing.user.hasRole('ROLE_TROOP') and (not isEnabledFeature('web.chat.app') or IS_PROJECT) %}
  170.             <div class="listingForm p-0">
  171.                 <div>
  172.                     <div class="col-xs-12 padding-md-zero hidden-lg hidden-md">
  173.                         <span class='listing-details'>
  174.                             <div class="page-header ">
  175.                                 <h5 class="section-title__header"> {{ 'listing.send_message_to'|trans }} (
  176.                                     <a
  177.                                         href="{{ path('aqarmap_user_listings', {'id': listing.user.id}) }}">{{ listing.user.fullName|default(listing.user.username) }}
  178.                                     </a> ).
  179.                                 </h5>
  180.                             </div>
  181.                         </span>
  182.                     </div> <!-- end col12-->
  183.                     {{ form_start(contact_seller_form) }}
  184.                     {{ form_row(contact_seller_form.subject, {value : 'Re: '~ listing.title|striptags}) }}
  185.                     {{ form_row(contact_seller_form.type, {value : SEND_MESSAGE_CONSTANT}, {attr: {'ng-model': 'sellerMessageType', 'ng-init': 'sellerMessageType={{SEND_MESSAGE_CONSTANT}}'}}) }}
  186.                     {% set textAreaPlaceholder = 'layout.write_question'|trans %}
  187.                     {{ form_widget(contact_seller_form.message,{attr: {'class': 'form-control mb-md', 'placeholder': textAreaPlaceholder, 'ng-model': '$root.sellerMessageContent'}}) }}
  188.                     <button type="submit"
  189.                     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 }}"
  190.                     ng-click="onSendLead($event,{
  191.                         leadType: 'email' ,
  192.                         actionType:'{{ SEND_MESSAGE_CONSTANT }}' ,
  193.                         leadSourcePage: '{{leadSourcePage}}' ,
  194.                         propertyCategory: '{{propertyCategory}}',
  195.                         propertySection: '{{propertySectionSlug}}' ,
  196.                         depthProduct: '{{depthProduct}}',
  197.                         insideCompound: '{{insideCompound}}',
  198.                         listingType:  {{leadSources|serialize('json')}} ,
  199.                         listingId: '{{ listing.id }}' ,
  200.                     });"
  201.                     ng-disabled="contact_seller.$invalid" >
  202.                         {{ 'listing.send_message'|trans }}
  203.                     </button>
  204.                     {{ form_end(contact_seller_form) }}
  205.                 </div>
  206.             </div>
  207.         {% endif %}
  208.     {% endif %}
  209. </div>