{% set DOWNLOAD_BROCHURE_CONSTANT = constant('Aqarmap\\Bundle\\ListingBundle\\Constant\\LeadTypes::DOWNLOAD_BROCHURE') %}
{% set leadSourcePage = leadSourcePage is defined ? leadSourcePage : "listing_details_fixed_buttons"%}
{% 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 listingBrochure = IS_PROJECT_PARENT ? listing.brochure : listing.parent.brochure %}
{% set allowDownloadBrochure = IS_PROJECT and listingBrochure %}
{% if allowDownloadBrochure %}
{% set downloadFile = listingBrochure.id %}
{% set downloadName = listingBrochure.name %}
<button id="download-brochure-btn" hidden ng-click="onSendLead($event,{
leadType:'brochure' ,
actionType:'{{ DOWNLOAD_BROCHURE_CONSTANT }}' ,
leadSourcePage: '{{leadSourcePage}}' ,
propertyCategory: '{{propertyCategory}}',
propertySection: '{{propertySectionSlug}}' ,
depthProduct: '{{depthProduct}}',
insideCompound: '{{insideCompound}}',
listingType: {{leadSources|serialize('json')}} ,
listingId: '{{ listing.id }}' ,
});" data-name="{{ downloadName }}"
data-url="{{ path('download_brochure', {'file': downloadFile}) }}"
data-img-src="/images/activites/ic_download_white.svg" data-img-class="cta-icon"
submit-text="{{ 'label.lead.download_brochure_now'|trans }}"
></button>
{% endif %}
<one-listing-cta :listing='{
"isEnabledActivity":{{isEnabledActivityListingPage ? 1 : 0}},
"allowDownloadBrochure":{{allowDownloadBrochure ? 1 : 0 }},
"phones":{{encodedSellerPhones|serialize('json')}},
"id": {{ listing.id }},
"is_favourite": {{ listing.isfavourite ? 1 : 0 }},
"note": `{{ listing.usernote|default(' ')}}`,
"listingTitle" : {{listing.title|serialize()}},
"locationTitle": {{listing.location.title|serialize()}},
"propertyTypeTitle": {{listing.propertyType.title|serialize()}},
"price": "{{listing.price}}",
"image": "{{ listingMainPhoto }}",
"pricePerMeter": "{{listing.calculatePricePerMeter }}",
"baths": "{{ listing_baths }}",
"rooms": "{{ listing_rooms }}",
"yearBuilt": "{{ listing_year_built }}",
"finishType": "{{ listing_finish_type }}",
"view": {{ listing.propertyViewLabel|trans|serialize() }},
"area": "{{listing.area}}",
}' :show-call="false"></one-listing-cta>