src/Aqarmap/Bundle/ListingBundle/Resources/views/ListingSearch/listingCardHorizontal.html.twig line 1

Open in your IDE?
  1. {# Constants #}
  2. {% set SHOW_PHONE_CONSTANT = constant('Aqarmap\\Bundle\\ListingBundle\\Constant\\LeadTypes::SHOW_PHONE') %}
  3. {% for listing in listings %}
  4.     {% if agent is defined %}
  5.         {% set listing = listing['listing'] %}
  6.     {% endif %}
  7.     {# Listing Vars #}
  8.     {% set isListingPhotosDefined = listingPhotos[listing.id] is defined and listingPhotos[listing.id].main is defined %}
  9.     {% set listingPhotoSize = 110 %}
  10.     {% set disableLazyLoadImgIndex = loop.index in [1, 2] %}
  11.     {% if isEnabledFeature('listing_card.lead.button') %}
  12.         {% set listingPhones = isEnabledFeature('listing_user_phones') ? listing.phones : listing.listingPhones %}
  13.     {% else %}
  14.         {% set listingPhones = [] %}
  15.     {% endif %}
  16.     {% set listingPhone = null %}
  17.     {% if listingPhones is not empty %}
  18.         {% set listingPhone = listingPhones|first %}
  19.     {% endif %}
  20.     {% if (listing.user.getWhatsAppNumber) %}
  21.         {% set whatsAppNumber = listing.user.getWhatsAppNumber.getPhone.getNumber %}
  22.     {% endif %}
  23.     {% set hasWhatsapp = listing.user.getWhatsAppNumber %}
  24.     {% if listing.slug %}
  25.         {% 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}) %}
  26.     {% else %}
  27.         {% set LISTING_URL = isRelatedResults ? path('listing_view', {'id': listing.id}|merge({'relatedseaarchlisting': true})) : path('listing_view', {'id': listing.id}) %}
  28.     {% endif %}
  29.     {% set callBtnClass = not hasWhatsapp ? 'big': '' %}
  30.     {% set urlSource = app.request.query.get("source") ? app.request.query.get("source") : ''%}
  31.     {% set containerSource = source is defined ? source : null %}
  32.     {% set leadSources = containerSource ? [containerSource] : [urlSource] %}
  33.     {% set encodedSellerPhones = []%}
  34.     {% for phone in listingPhones %}
  35.         {% set encodedSellerPhones = encodedSellerPhones | merge([{'number': phone.number|phoneNumberEncode}]) %}
  36.     {% endfor %}
  37.     {% set listingUser = listing.user %}
  38.     {% set sellerName =  listingUser.fullName %}
  39.     {% set userLogo = listingUser.logo ? listingUser.logo.file : null %}
  40.     {% set logo = listing.validUserLogo %}
  41.     {% set financeFeatureValue = get_setting('features', 'finance_service') %}
  42.     {% set activeListingsCount = liveListingsPerUser[listing.user.id] is defined ? liveListingsPerUser[listing.user.id] : 0 %}
  43.     {% set leadsCount = listingUser.getClientServedCount() %}
  44.     <div class="col-12 horizontal-listing-card horizontal-listing-card_mb-l"
  45.         ng-init='setListingDetail("{{listing.id}}",{
  46.             "section": "{{listing.section.id}}",
  47.             "sellerPhones": {{encodedSellerPhones|serialize('json')}},
  48.             "sellerPhone": "{{hasWhatsapp  ? whatsAppNumber|phoneNumberEncode : listingPhone ? listingPhone.number|phoneNumberEncode : "" }}",
  49.             "financeUrl":"{{listing.getFinancialAidURL()}}",
  50.             "userEmail": {{currentUserEmail|json_encode()}},
  51.             "financeFeatureValue": "{{financeFeatureValue}}",
  52.             "listingName" : "{{listing.customSlug|default(listing.id)}}",
  53.             "listingTitle" : "{{listing.title}}",
  54.             "listingUser": {
  55.                 "sellerName" : "{{sellerName}}",
  56.                 "sellerLogo": "",
  57.                 "sellerUrl": "{{sellerUrl}}",
  58.                 "joinedData":"{{joinedData}}",
  59.                 "activeListingsCount": "{{activeListingsCount}}",
  60.                 "leadsCount":"{{leadsCount}}"
  61.             }
  62.         })'>
  63.         <div class="horizontal-listing-card__container">
  64.             <a class="horizontal-listing-card__container__link "
  65.                 itemprop="url"
  66.                 ng-click="onCardClick({{leadSources|serialize('json')}})"
  67.                 href="{{ LISTING_URL }}">
  68.                 <div class="horizontal-listing-card__wrapper">
  69.                     <div class="horizontal-listing-card__img">
  70.                         <div class="horizontal-listing-card__img__wrapper">
  71.                             {% if isListingPhotosDefined %}
  72.                                 {% if disableLazyLoadImgIndex %}
  73.                                     <picture>
  74.                                         <source src="{{ custom_vich_uploader_asset(listingPhotos[listing.id].main.file, 'file')|thumbnail('search-thumb-webp') }}"
  75.                                             type="image/webp">
  76.                                         <source src="{{ custom_vich_uploader_asset(listingPhotos[listing.id].main.file, 'file')|thumbnail('search-thumb') }}"
  77.                                             type="image/jpg">
  78.                                         <img itemprop="photo"
  79.                                             src="{{ custom_vich_uploader_asset(listingPhotos[listing.id].main.file, 'file')|thumbnail('search-thumb') }}"
  80.                                             alt="{{ listing.title|excludeNumbers }}"
  81.                                             width="{{ listingPhotoSize }}" height="{{ listingPhotoSize }}" />
  82.                                     </picture>
  83.                                 {% else %}
  84.                                     <img itemprop="photo"
  85.                                         src="/images/placeholder.svg"
  86.                                         data-src="{{ custom_vich_uploader_asset(listingPhotos[listing.id].main.file, 'file')|thumbnail('search-thumb') }}"
  87.                                         class="lazyload" alt="{{ listing.title|excludeNumbers }}"
  88.                                         width="{{ listingPhotoSize }}" height="{{ listingPhotoSize }}" />
  89.                                 {% endif %}
  90.                             {% elseif listing.mainPhoto %}
  91.                                 {% if disableLazyLoadImgIndex %}
  92.                                     <picture>
  93.                                         <source  src="{{ custom_vich_uploader_asset(listing.mainPhoto.file, 'file')|thumbnail('search-thumb-webp') }}"
  94.                                             type="image/webp"
  95.                                             class="lazyload">
  96.                                         <source  src="{{ custom_vich_uploader_asset(listing.mainPhoto.file, 'file')|thumbnail('search-thumb') }}"
  97.                                             type="image/jpg"
  98.                                             class="lazyload">
  99.                                         <img itemprop="photo"
  100.                                             src="{{ custom_vich_uploader_asset(listing.mainPhoto.file, 'file')|thumbnail('search-thumb') }}"
  101.                                             alt="{{ listing.title|excludeNumbers }}"
  102.                                             width="{{ listingPhotoSize }}" height="{{ listingPhotoSize }}" />
  103.                                     </picture>
  104.                                 {% else %}
  105.                                     <img itemprop="photo"
  106.                                         src="/images/placeholder.svg"
  107.                                         data-src="{{ custom_vich_uploader_asset(listing.mainPhoto.file, 'file')|thumbnail('search-thumb') }}"
  108.                                         class="lazyload" alt="{{ listing.title|excludeNumbers }}"
  109.                                         width="{{ listingPhotoSize }}" height="{{ listingPhotoSize }}" />
  110.                                 {% endif %}
  111.                             {% else %}
  112.                                 <div class="horizontal-listing-card__img__no-photo">{{ 'layout.no_listing_photo'|trans }}</div>
  113.                             {% endif %}
  114.                         </div>
  115.                     </div>
  116.                     <div class="horizontal-listing-card__details">
  117.                         <div class="horizontal-listing-card__details__wrapper">
  118.                             <div class="horizontal-listing-card__price">
  119.                                 {% if listing.price %}
  120.                                     <span class="integer">{{ listing.price|number_format }}</span>
  121.                                     <span class="mx-2">{{ get_setting('general', 'currency')|trans }}</span>
  122.                                 {% elseif listing.section.searchable %}
  123.                                     {{ 'listing.call_for_price'|trans }}
  124.                                 {% endif %}
  125.                             </div>
  126.                             <p class="horizontal-listing-card__address">
  127.                                 <img
  128.                                     src="/images/BrandsIcons/listing/ic_location.svg"
  129.                                     class="horizontal-listing-card__attributes_icon"
  130.                                 />
  131.                                 {{ listing.address }}
  132.                             </p>
  133.                             <div class="horizontal-listing-card__attributes">
  134.                                 <label class="horizontal-listing-card__attributes_item">
  135.                                     <img
  136.                                         src="/images/BrandsIcons/listing/ic_size.svg"
  137.                                         class="horizontal-listing-card__attributes_icon"
  138.                                     />
  139.                                     {{ listing.area}} {{ get_setting('general', 'measurement_unit')|trans }}
  140.                                 </label>
  141.                                 {% set listing_attributes = listing.getAttributesList() %}
  142.                                 {% if listing_attributes|length > 0 %}
  143.                                     {% set listing_rooms = (listing_attributes["rooms"]) is defined ? getRoomsLabel(listing_attributes["rooms"]) : '' %}
  144.                                     {% set listing_baths = (listing_attributes["baths"]) is defined ? getBathsLabel(listing_attributes["baths"]) : '' %}
  145.                                     {% if listing_rooms %}
  146.                                         <label class="horizontal-listing-card__attributes_item">
  147.                                         <img
  148.                                             src="/images/BrandsIcons/listing/ic_bedroom.svg"
  149.                                             class="horizontal-listing-card__attributes_icon"
  150.                                         />
  151.                                              {{ listing_rooms }}
  152.                                         </label>
  153.                                     {% endif %}
  154.                                     {% if listing_baths %}
  155.                                         <label class="horizontal-listing-card__attributes_item">
  156.                                             <img
  157.                                                 src="/images/BrandsIcons/listing/ic_bathroom.svg"
  158.                                                 class="horizontal-listing-card__attributes_icon"
  159.                                             />
  160.                                             {{ listing_baths }}
  161.                                         </label>
  162.                                     {% endif %}
  163.                                 {% endif %}
  164.                             </div>
  165.                         </div>
  166.                     </div>
  167.                 </div>
  168.             </a>
  169.             <div class="horizontal-listing-card__footer">
  170.                 <hr class="desktop-separator">
  171.                 <div class="horizontal-listing-card__cta w-100">
  172.                     {% if listingPhones is not empty and not listing.isCallRequest %}
  173.                         {% if hasWhatsapp %}
  174.                             <a class="horizontal-listing-card__cta-button horizontal-listing-card__cta-button_whatsapp whatsapp big"
  175.                                 href="javascript:void(0);"
  176.                                 ng-click="onSendLead($event,{
  177.                                     actionType:'{{ SEND_WHATSAPP_CONSTANT }}' ,
  178.                                     listingType:  {{leadSources|serialize('json')}} ,
  179.                                     listingId: '{{ listing.id }}' ,
  180.                                 });"
  181.                                 >
  182.                                 <img
  183.                                     src="/images/BrandsIcons/listing/ic_whatsapp.svg"
  184.                                     class="horizontal-listing-card__cta-button_whatsapp_icon"
  185.                                 />
  186.                                 {{ 'label.lead.whatsApp'|trans }}
  187.                             </a>
  188.                             <div class="vertical-separator"></div>
  189.                         {% endif %}
  190.                         {% set phoneBtnClass = 'horizontal-listing-card__cta-button horizontal-listing-card__cta-button_call ' ~ callBtnClass %}
  191.                         <a class="{{ phoneBtnClass }}"
  192.                             href="javascript:void(0);"
  193.                             submit-text="{{ 'listing.show_seller_phone'|trans }}"
  194.                             ng-click="searchActionType = 'showNumber';
  195.                                     onSendLead($event,{
  196.                                         actionType:'{{ SHOW_PHONE_CONSTANT }}' ,
  197.                                         listingType:  {{leadSources|serialize('json')}} ,
  198.                                         listingId: '{{ listing.id }}' ,
  199.                                     });"
  200.                             ng-if="!phoneShowed[{{listing.id}}]"
  201.                             data-gtm-listing-id="{{ listing.id }}">
  202.                             <img
  203.                                 src="/images/BrandsIcons/listing/ic_phone.svg"
  204.                                 class="horizontal-listing-card__cta-button_call_icon"
  205.                             />
  206.                             <span class="cta-button-text"> {{ 'listing.show_seller_phone'|trans }}</span>
  207.                         </a>
  208.                         <a class="{{ phoneBtnClass }}"
  209.                             href="javascript:void(0);"
  210.                             ng-cloak
  211.                             ng-click="showPhoneModalByListingId({{listing.id}})"
  212.                             ng-if="phoneShowed[{{listing.id}}]">
  213.                             <img
  214.                                 src="/images/BrandsIcons/listing/ic_phone.svg"
  215.                                 class="horizontal-listing-card__cta-button_call_icon"
  216.                             />
  217.                             <span class="cta-button-text"> {{ 'listing.show_seller_phone'|trans }}</span>
  218.                         </a>
  219.                     {% else %}
  220.                         <a href=""
  221.                             class="horizontal-listing-card__cta-button horizontal-listing-card__cta-button_call-request big m-0"
  222.                             ng-hide="callRequested[{{listing.id}}]"
  223.                             ng-click="searchActionType = 'sendRequest';
  224.                                 onSendLead($event,{
  225.                                     actionType:'{{ CALL_REQUEST_CONSTANT }}' ,
  226.                                     listingType:  {{leadSources|serialize('json')}} ,
  227.                                     listingId: '{{ listing.id }}' ,
  228.                                 });"
  229.                             >
  230.                             <img
  231.                                 src="/images/BrandsIcons/listing/ic_phone.svg"
  232.                                 class="horizontal-listing-card__cta-button_call_icon"
  233.                             />
  234.                             <span ng-hide="callRequested[{{listing.id}}]" class="cta-button-text"> {{ 'label.lead.call_request'|trans }} </span>
  235.                         </a>
  236.                         <a href=""
  237.                             class="horizontal-listing-card__cta-button big success ng-hide"
  238.                             ng-show="callRequested[{{listing.id}}]"
  239.                             type= "button"
  240.                             disabled
  241.                             >
  242.                             <i class="fa fa-check circle-badge success"></i>
  243.                             <span class="mx-1"> {{ 'label.lead.call_requested'|trans }}  </span>
  244.                         </a>
  245.                     {% endif %}
  246.                 </div>
  247.             </div>
  248.         </div>
  249.     </div>
  250. {% endfor %}