{% extends "base.html.twig" %}
{% form_theme quick_registration_form 'Form/form_div_layout.html.twig' %}
{% block stylesheets %}
{{ parent() }}
<link rel="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
{% endblock %}
{# Page title #}
{% set pageTitle = selectedCategory ? 'neighborhoods.discussion.explore_category_title_in'|trans({'%category%': selectedCategory.title}) : 'neighborhoods.discussion.main_title'|trans %}
{% set pageTitle = location ? 'neighborhoods.discussion.explore_title_in'|trans({'%location%': location.title}) : pageTitle %}
{% block title %}
{{ pageTitle }}
•
{{ parent() }}
{% endblock %}
{% block meta_description %}
{{ metaDescriptionContent }}
{% endblock %}
{% block metatags %}
{% if discussions|length == 0 %}
<meta name="robots" content="noindex">
{% endif %}
{% endblock %}
{% block htmlhead %}
<link rel="canonical" href="{{ url(app.request.get('_route'), app.request.query.all|merge({'_locale': app.request.get('_locale')})) }}"/>
<link rel="alternate" hreflang="ar" href="{{ url(app.request.get('_route'), app.request.query.all|merge({'_locale': 'ar'})) }}"/>
<link rel="alternate" hreflang="en" href="{{ url(app.request.get('_route'), app.request.query.all|merge({'_locale': 'en'})) }}"/>
<link rel="alternate" hreflang="x-default" href="{{ url(app.request.get('_route'), app.request.query.all|merge({'_locale': 'ar'})) }}"/>
{{ _self.pagination_meta(discussions) }}
{% endblock %}
{% block body %}
<section id="{{ app.request.get('_route') }}" ng-controller="neighborhoodDiscussionController">
{% set topSellerTrigger = 'gtm-action-topsellers-lead-ask-neighbors' %}
{% set topSellerEventAction = 'Top Sellers Ask Neighbors'%}
<div class="resposive-add-discussion-conatiner hidden-md hidden-lg hidden-sm">
<div class="container">
<div class="page-header">
<h2 class="custom-header">{{ "neighborhoods.discussion.main_title"|trans }}</h2>
<p class="discussion-form-sub-title responsive_style hidden-xs">{{ "neighborhoods.discussion.sub_title"|trans }}</p>
</div>
<div class="row">
<div class="col-xs-12" ng-init="showFormData = false;discussionContent='';">
{{ form_start(responsiveDiscussionForm, {attr: {'ng-submit': 'submitDiscussion($event, data)'}}) }}
<div class="discussion-form-textarea">
{{ form_widget(responsiveDiscussionForm.content, {'attr': {'placeholder': "neighborhoods.discussion.sub_title_placeholder"|trans({'%location%': ''}, 'messages'), 'ng-click' : 'showFormData = true;', 'ng-model' : 'discussionContent' } }) }}
</div>
<div id="discussion-form-content" class="discussion-form-containers" ng-show="showFormData">
<div id="location_search">
{{ form_widget(responsiveDiscussionForm.location, { 'attr' : { 'class' : 'chosen'}}) }}
</div>
{{ form_widget(responsiveDiscussionForm.category) }}
</div>
<button type="submit" id="discussion-submit-btn" class="darken btn btn-lg btn-primary btn-block">{{ "neighborhoods.discussion.share"|trans }}
</button>
{{ form_end(responsiveDiscussionForm) }}
<div class="cancel-button">
<a href="" class="text-center" ng-click="showFormData = false;discussionContent='';" ng-show="showFormData">{{ "terms_conditions.cancel"|trans }}</a>
</div>
</div>
</div>
</div>
</div>
<div class="discussions">
<div class="container">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 hidden-sm hidden-xs">
{% set discussions_breadcrumb = knp_menu_get( 'aqarmap.askNeighbors.breadcrumb' , [],{'location': app.request.get('location'), 'category': app.request.get('category')}) %}
{{ knp_menu_render(discussions_breadcrumb, {
'allow_safe_labels': true,
'template': 'knp_breadcrumbs.html.twig',
'currentAsLink': true,
'currentClass': 'active'
}) }}
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="page-header">
{% set discussionLocationTitle = location ? location.title : '' %}
{% if location %}
<h1 class="custom-header">{{
getDiscussionSearchTabsTitle(app.request.get('tab', 1))|trans ~
'layout.in'|trans ~ discussionLocationTitle }}
{% if discussions.currentPageNumber != 1 %}
{{ ' - ' ~ 'layout.description.page'|trans({'%page_number%' : discussions.currentPageNumber}) }}
{% endif %}
</h1>
{% elseif selectedCategory %}
<h1 class="custom-header">{{
getDiscussionSearchTabsTitle(app.request.get('tab', 1))|trans ~
'layout.in'|trans ~ selectedCategory.title }}
{% if discussions.currentPageNumber != 1 %}
{{ ' - ' ~ 'layout.description.page'|trans({'%page_number%' : discussions.currentPageNumber}) }}
{% endif %}
</h1>
{% else %}
<h1 class="custom-header">{{
getDiscussionSearchTabsTitle(app.request.get('tab', 1))|trans }}
{% if discussions.currentPageNumber != 1 %}
{{ ' - ' ~ 'layout.description.page'|trans({'%page_number%' : discussions.currentPageNumber}) }}
{% endif %}
</h1>
{% endif %}
</div>
<div class="discussion-form-containers">
{{ form_start(discussionSearchForm, {'attr' : {'class' : 'discussion-search-form'}}) }}
<div class="discussion-search-location">
{% if app.request.get('location') %}
{{ form_widget(discussionSearchForm.location, { value : app.request.get('location'), 'attr' : { 'class' : 'chosen', 'ng-init' : 'locationSelect=' ~ app.request.get('location') , 'ng-model' : 'locationSelect' }}) }}
{% else %}
{{ form_widget(discussionSearchForm.location, { value : app.request.get('location'), 'attr' : { 'class' : 'chosen', 'ng-model' : 'locationSelect' }}) }}
{% endif %}
</div>
<div class="discussion-search-category">
{% if app.request.get('category') %}
{{ form_widget(discussionSearchForm.category, {value : app.request.get('category', ''), 'attr' : { 'ng-init' : 'categorySelect=' ~ app.request.get('category'), 'ng-model' : 'categorySelect'}}) }}
{% else %}
{{ form_widget(discussionSearchForm.category, {value : app.request.get('category', ''), 'attr' : { 'ng-model' : 'categorySelect'}}) }}
{% endif %}
</div>
{{ form_end(discussionSearchForm) }}
</div>
<div class="discussions-table-container">
{% if discussions|length == 0 %}
<div class="discussions-no-result">
<div class="alert alert-warning no-result-container">
{% if location is defined and location is not empty and location.parent %}
<p class="no_result_text">{{ "neighborhoods.discussion.no_results_try_parent"|trans({'%location%': location, '%parent%': location.parent, '%url%': path(app.request.attributes.get('_route'),app.request.query.all|merge({'location': location.parent.id}))})|raw }}</p>
{% else %}
<p class="no_result_text">{{ "neighborhoods.discussion.no_results_try_trending"|trans({'%url%': path('neighborhood_discussion_list', {'category': app.request.get('category')})})|raw }}</p>
{% endif %}
</div>
</div>
{% endif %}
<div class="tabbable-panel">
<div class="tabbable-line">
<ul class="nav nav-tabs ">
{% for status, label in getDiscussionSearchTabs() %}
<li
{% if app.request.get('tab', 1) == status %} class="active" {% endif %}>
{#data-toggle="tab"#}
<a ng-init="currentTab={{ app.request.get('tab', 1) }};" href="{{ path('neighborhood_discussion_list', { 'tab' : status, 'location' : app.request.get('location'), 'category' : app.request.get('category')}) }}">{{ label|trans }}</a>
</li>
{% endfor %}
</ul>
<div class="tab-content">
{% if discussions|length == 0 %}
<div class="discussions-tabs-no-result">
<div class="discussions-tabs-no-result-holder">
<i class="fa fa-question-circle" aria-hidden="true"></i>
<p>{{ "neighborhoods.discussion.no_results_tabs_found"|trans }}</p>
</div>
</div>
{% else %}
<div class="tab-pane active" id="tab_1">
{% for discussion in discussions %}
<div class="media">
<div class="media-body">
<h4 class="media-heading">
<a id="title-link" target="_blank" href="{{ path('neighborhood_discussion_comments', {'discussion': discussion.id, 'utm_source': 'system', 'utm_medium': 'search', 'utm_campaign': 'view_question'}) }}" class="">
{{ discussion.content|slice(0, 87)|raw }}
</a>
</h4>
<div class="row">
<div class="col-xs-8 pull-left flip">
<p id="discussion-p">
{% if discussion.category %}
<a id="content-link" target="_blank" href="{{ path('neighborhood_discussion_list' , {'category': discussion.category.id }) }}" class="">
{{ discussion.category.title }}
</a>
{% endif %}
{% if discussion.location %}
<span id="discussion-location-category-parser">{{ 'layout.in'|trans }}</span>
<a id="content-link" target="_blank" href="{{ path('neighborhood_discussion_list' , {'location':discussion.location.id }) }}" class="">
{{ discussion.location.title }}
</a>
{% endif %}
</p>
</div>
<div class="col-xs-4 pull-right flip">
<small id="discussions_comment_label" class="">
<label>
<a target="_blank" href="{{ path('neighborhood_discussion_comments' , {'discussion': discussion.id }) }}" class="">
<i class="fa fa-comment-o" aria-hidden="true"></i>
{{ discussion.commentsCounter }}
{{ "neighborhoods.discussion.comments"|trans }}
</a>
</label>
</small>
</div>
</div>
</div>
</div>
<hr/>
{% endfor %}
{{ knp_pagination_render(discussions) }}
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
</div>
<!-- end col-md-12 (page-header) -->
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 panel-white padding-md-zero">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 hidden-xs">
<div class="page-header">
<h2 class="custom-header">{{ "neighborhoods.discussion.main_title"|trans }}</h2>
<p class="discussion-form-sub-title">{{ "neighborhoods.discussion.sub_title"|trans }}</p>
</div>
<div class="row">
<div class="col-xs-12" ng-init="showFormData = true;">
{{ form_start(discussionForm, {attr: {'ng-submit': 'submitDiscussion($event, data)'}}) }}
<div id="discussion-form-content" class="discussion-form-containers" ng-show="showFormData">
<div id="location_search">
{{ form_widget(discussionForm.location, { 'attr' : { 'class' : 'chosen'}}) }}
</div>
{{ form_widget(discussionForm.category) }}
</div>
<div class="discussion-form-textarea">
{{ form_widget(discussionForm.content,
{'attr': {'placeholder': "neighborhoods.discussion.sub_title_placeholder"|trans({'%location%': ''}, 'messages'), 'ng-click' : 'showFormData = true;'} })
}}
</div>
<button type="submit" id="discussion-submit-btn" class="btn btn-primary btn-block">{{ "neighborhoods.discussion.share"|trans }}
</button>
{{ form_end(discussionForm) }}
</div>
</div>
</div>
<!-- end col-md-12 (page-header) -->
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
{% if interestsListings|length > 0 %}
<div class="page-header">
<h2 class="custom-small-header">{{ 'advice.Properties_intersted_in'|trans }}
</h2>
</div>
{% endif %}
<div class="interested-listings ">
{% include "@AqarmapDiscussionBundle/Discussion/ListingsYouMaybeInterestedIn.html.twig" %}
</div>
</div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 mobile-breadcrumb visible-sm visible-xs">
{% set discussions_breadcrumb = knp_menu_get( 'aqarmap.askNeighbors.breadcrumb' , [],{'location': app.request.get('location'), 'category': app.request.get('category')}) %}
{{ knp_menu_render(discussions_breadcrumb, {
'allow_safe_labels': true,
'template': 'knp_breadcrumbs.html.twig',
'currentAsLink': true,
'currentClass': 'active'
}) }}
</div>
{% if not isLastPage(discussions) and location and isEnabledFeature('web.topsellers.section') %}
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 discussions-top-sellers-container">
<div>
{% include "@AqarmapListing/ListingSearch/topSellersResponsive.html.twig" with {'trigger': topSellerTrigger, 'eventAction': topSellerEventAction, leadSourcePage: 'ask_neighbors'}%}
</div>
</div>
<div ng-controller="listingLeadsWizardController" ng-init="initFormWizard()">
{{ include('@AqarmapUserBundle/User/listingMultiStepLeadModal.html.twig') }}
</div>
{% endif %}
{% if popularArticles|length > 0 %}
{% include '@AqarmapDiscussion/Discussion/popularArticles.html.twig' %}
{% endif %}
</div>
</div>
{% if isLastPage(discussions) and location and isEnabledFeature('web.topsellers.section') %}
<div class="row">
<div class="col visible-sm visible-lg">
<div class="top-sellers-warp-cards w-100">
{% include "@AqarmapListing/ListingSearch/topSellersResponsive.html.twig" with {'trigger': topSellerTrigger, 'eventAction': topSellerEventAction , 'position':'bottom', leadSourcePage: 'ask_neighbors'} %}
</div>
</div>
</div>
{{ include('@AqarmapUserBundle/User/listingQuickLeadModal.html.twig') }}
{% endif %}
<div class="tab-content searchResultsContainer interested-listings subsLinks more-locations-container">
{% include "@AqarmapMainBundle/Default/locationsSubLinks.html.twig" %}
</div>
</div>
</div>
{{ include('@AqarmapUserBundle/User/loginModal.html.twig') }}
</section>
{% endblock %}
{% block footer %}
{% include "footer.v2.html.twig" %}
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script>
jQuery(document).ready(function ($) {
loadMoreInit('.sectionLoadMore');
});
</script>
{% endblock %}
{% macro pagination_meta(pagination) %}
{% set total = pagination.totalItemCount %}
{% set items_per_age = pagination.itemNumberPerPage %}
{% set current = pagination.currentPageNumber %}
{% set last = (total / items_per_age) | round(0, 'ceil') %}
{% set page_parameter = pagination.paginatorOption('pageParameterName') %}
{% if current != 1 and total %}
<link rel="prev" href="{{ url(app.request.attributes.get('_route'), app.request.query.all|merge({ (page_parameter): (current - 1) })) }}"/>
{% endif %}
{% if current != last and total %}
<link rel="next" href="{{ url(app.request.attributes.get('_route'), app.request.query.all|merge({ (page_parameter): (current + 1) })) }}"/>
{% endif %}
{% endmacro %}