{% extends "base.html.twig" %}
{% form_theme quick_registration_form 'Form/form_div_layout.html.twig' %}
{% set SHARING_IMAGE = constant('Aqarmap\\Bundle\\DiscussionBundle\\Constant\\SharingConstant::IMAGE') %}
{# Page title #}
{% block title %}{{ discussion.content|length > 50 ? discussion.content|slice(0, 50) ~ '...' : discussion.content }} - {{ parent() }}{% endblock %}
{% block meta_description %}
{% trans with {'%area%': discussion.location.title } %}
neighborhoods.discussion.meta_description
{% endtrans %} {% if discussion.comments|length > 0 %}({{ "neighborhoods.comment.answers"|trans({'%count%' : discussion.comments|length}) }}) - {{ discussion.comments[0].content|length > 120 ? discussion.comments[0].content|slice(0, 120) ~ '...' : discussion.comments[0].content }}{% else %}{{ '' }}{% endif %}
{% endblock %}
{% block htmlhead %}
<link rel="alternate" hreflang="ar"
href="{{ url(app.request.get('_route'), app.request.get('_route_params')|merge({'_locale': 'ar'})) }}"/>
<link rel="alternate" hreflang="en"
href="{{ url(app.request.get('_route'), app.request.get('_route_params')|merge({'_locale': 'en'})) }}"/>
<link rel="alternate" hreflang="x-default"
href="{{ url(app.request.get('_route'), app.request.get('_route_params')|merge({'_locale': 'ar'})) }}"/>
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="{{ "%s%s"|format('@', 'layout.app_name'|trans) }}" />
<meta name="twitter:creator" content="{{ "%s%s"|format('@', 'layout.app_name'|trans) }}" />
<meta property="og:title" content="{{ discussion.content|length > 50 ? discussion.content|slice(0, 50) ~ '...' : discussion.content }} - {{ 'layout.app_name'|trans }}"/>
<meta property="og:description" content="{{ 'neighborhoods.discussion.sharing.description'|trans }}" />
<meta property="og:image" content="{{ SHARING_IMAGE }}" />
<meta property="og:site_name" content="{{ 'layout.app_name'|trans }}" />
<meta property="fb:app_id" content="{{ facebook_app_id }}"/>
{% endblock %}
{% block body %}
{% set COMMENT_TYPE_LIKE = constant('Aqarmap\\Bundle\\DiscussionBundle\\Constant\\CommentLikeTypes::LIKE') %}
{% set COMMENT_TYPE_UNLIKE = constant('Aqarmap\\Bundle\\DiscussionBundle\\Constant\\CommentLikeTypes::UNLIKE') %}
{% set sharingEvent = "ask-neighbors" %}
<section id="{{ app.request.get('_route') }}">
<div class="discussions" ng-controller="neighborhoodDiscussionController" itemscope itemtype="https://schema.org/QAPage" data-sticky-container>
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-12">
<div class="row" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 hidden-sm hidden-xs">
{% set discussion_breadcrumb = knp_menu_get( 'aqarmap.discussion.breadcrumb' , [], {'location': discussion.location, "discussion" : discussion, 'userAgent': app.request.headers.get('User-Agent')}) %}
{{ knp_menu_render(discussion_breadcrumb , {
'allow_safe_labels': true,
'template': 'knp_breadcrumbs.html.twig',
'currentAsLink': true,
'currentClass': 'active'
}) }}
</div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="main-comment-discussion-container">
<div class="page-header">
<span itemprop="name" class="hidden">{{ discussion.content|trim(10) }}</span>
<h1 class="comment-discussion" itemprop="text">
{{ discussion.content }}
{% if app.user and app.user == discussion.user %}
<div class="pull-right flip comment-discussion-setting">
<a id="discussion-{{ discussion.id }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" ><i class="fa fa-ellipsis-v" aria-hidden="true"></i></a>
<ul class="dropdown-menu pull-right flip" aria-labelledby="discussion-{{ discussion.id }}">
<li><a class="dropdown-item" href="{{ path('neighborhood_discussion_edit' , {'discussion' : discussion.id}) }}">{{ "layout.admin.edit"|trans }}</a></li>
<li><a id="delete_discussion" onclick="return confirm('{{ "neighborhoods.discussion.delete_message"|trans }}');" href="{{ path('discussion_delete', {'discussion': discussion.id}) }}" >{{ "listing.delete"|trans }}</a></li>
</ul>
</div>
{% endif %}
</h1>
</div>
<div class="discussion-replies-header"`>
<div class="discussion-main-data">
<small>
<div itemprop="author" itemscope itemtype="https://schema.org/Person">
<span itemprop="name" class="comment-author">{% if discussion.user.fullName %}{{ discussion.user.fullName }} {% else %}{{ discussion.user.username }}{% endif %}</span>
</div>
<time itemprop="dateCreated" datetime="{{ discussion.createdAt|date }}">{{ discussion.createdAt|date("d-m-Y") }}</time>
{% if discussion.category %}, <a target="_blank" href="{{ path('neighborhood_discussion_list' , {'category': discussion.category.id }) }}">{{ discussion.category.title }}</a>{% endif %}
{% if discussion.location %}, <a
href="{{ path('neighborhood_discussion_list' , {'location':discussion.location.id }) }}">{{ discussion.location.title }}</a>{% endif %}
</small>
</div>
<div class="pull-left flip">
<div>
{% if app.user %}
{% if app.user in discussion.subscribers %}
<label>
<i class="fa fa-user" aria-hidden="true"></i>
<a id="subscribe_button"
href="{{ path('neighborhood_discussion_remove_subscriber',{'discussion' : discussion.id }) }}"
class="">
{{ "neighborhoods.discussion.unsubscribe"|trans }}
</a>
</label>
{% else %}
<label>
<i class="fa fa-user" aria-hidden="true"></i>
<a id="subscribe_button"
href="{{ path('neighborhood_discussion_add_subscriber',{'discussion' : discussion.id }) }}"
class="">
{{ "neighborhoods.discussion.subscribe"|trans }}
</a>
</label>
{% endif %}
{% endif %}
</div>
</div>
<div class="pull-right flip">
{% if isEnabledFeature('web.sharing.page') %}
<a class="action-btn" data-toggle="modal" data-target="#discussionSharingModal">
<i class="fa fa-share-alt" aria-hidden="true"></i>
{{ "layout.share"|trans }}</a>
{% endif %}
<a class="action-btn" href="#reply"><i class="fa fa-reply-all" aria-hidden="true"></i>
{{ "neighborhoods.comment.reply"|trans }}</a>
</div>
</div>
</div>
<hr/>
<div>
<h2 class="answers-count"><span itemprop="answerCount" class="hidden">{{ discussion.comments|length }}</span>{{ "neighborhoods.comment.answers"|trans({'%count%' : discussion.comments|length}) }}</h2>
</div>
</div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
{% if discussion.comments|length > 0 %}
<div>
{% for discussionComment in discussionComments %}
{% set comment = discussionComment[0] %}
{% set likesCount = discussionComment['likesCount'] %}
{% set unlikesCount = discussionComment['unLikesCount'] %}
<div id="comment-{{ comment.id }}" class="media">
<div class="media-body" itemscope itemtype="https://schema.org/Answer" itemprop="{% if loop.index == 1 %}acceptedAnswer{% else %}suggestedAnswer{% endif %}">
<link itemprop="url" href="{{ url('neighborhood_discussion_comments', {'discussion': discussion.id}) }}#{{ 'comment-' ~ comment.id }}" />
<div class="comment-heading">
<small>
<div itemprop="author" itemscope itemtype="https://schema.org/Person">
<span
class="comment-author" itemprop="name">{% if comment.user %}{{ comment.user.fullName }}{% endif %}</span>
</div>
<time itemprop="dateCreated" datetime="{{ comment.createdAt|date }}">{{ comment.createdAt|date("d-m-Y") }}</time>
</small>
{% if app.user and app.user == comment.user %}
<div class="pull-right flip">
<a id="comment-{{ comment.id }}" data-toggle="dropdown"
role="menu" class="pull-right flip"><i
class="fa fa-ellipsis-v" aria-hidden="true"></i></a>
<ul class="dropdown-menu pull-right flip"
aria-labelledby="comment-{{ comment.id }}">
<li><a target="_blank" class="dropdown-item"
href="{{ path('neighborhood_comment_edit' , {'discussion' : discussion.id, 'comment' : comment.id}) }}">{{ "layout.admin.edit"|trans }}</a></li>
<li><a id="delete_comment" onclick="return confirm('{{ "neighborhoods.comment.delete_message"|trans }}');" href="{{ path('comment_delete', {'discussion': discussion.id, 'comment' : comment.id}) }}" >{{ "listing.delete"|trans }}</a></li>
</ul>
</div>
{% endif %}
</div>
<p class="media-heading comment-content comment-discussion" itemprop="text">
{{ comment.content }}
</p>
<div class="likes-container" >
<a {% if app.user and comment.isUserLike(app.user, COMMENT_TYPE_LIKE) %}
class="comment-like active" id="like_{{ comment.id }}" ng-click='setCurrentAction("removeLike");toggleLikeEvents($event, data);'
{% else %}
class="comment-like" id="like_{{ comment.id }}" ng-click="setCurrentAction('removeLike');toggleLikeEvents($event, data);"
{% endif %}
href=""><i class="fa fa-thumbs-up" aria-hidden="true"></i>
<span id="likeCounter_{{ comment.id }}" class="likesCount" itemprop="upvoteCount">{{ likesCount }}</span>
</a>
<input type="hidden" class="commentId" value="{{ comment.id }}">
<a {% if app.user and comment.isUserLike(app.user, COMMENT_TYPE_UNLIKE) %}
class="comment-unlike active" id="unlike_{{ comment.id }}" ng-click="setCurrentAction('removeUnLike');toggleLikeEvents($event, data);"
{% else %}
class="comment-unlike" id="unlike_{{ comment.id }}" ng-click="setCurrentAction('removeUnLike');toggleLikeEvents($event, data);"
{% endif %}
href=""><i class="fa fa-thumbs-down" aria-hidden="true"></i>
<span id="unlikeCounter_{{ comment.id }}" class="likesCount">{{ unlikesCount }}</span></a>
</div>
</div>
</div>
<hr/>
{% endfor %}
</div>
{% endif %}
{{ form_start(commentForm, {attr: {'ng-submit': 'submitDiscussion($event, data)' }}) }}
<div class="reply_content" id="reply">
{{ form_row(commentForm.content, {'attr': {'placeholder': "neighborhoods.comment.content"|trans } }) }}
</div>
<button type="submit" id="discussion-submit-btn"
class="btn btn-lg btn-primary pull-right flip ">{{ "neighborhoods.comment.reply"|trans }}</button>
{{ form_end(commentForm) }}
</div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 mobile-breadcrumb visible-sm visible-xs">
{% set discussion_breadcrumb = knp_menu_get( 'aqarmap.discussion.breadcrumb' , [], {'location': discussion.location, "discussion" : discussion, 'userAgent': app.request.headers.get('User-Agent')}) %}
{{ knp_menu_render(discussion_breadcrumb , {
'allow_safe_labels': true,
'template': 'knp_menu_ordered.html.twig',
'currentClass': 'active'
}) }}
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 panel-white padding-md-zero small-container">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
{% if interestsListings|length > 0 %}
<div class="page-header">
<p class="custom-small-header">{{ 'advice.Properties_intersted_in'|trans }}
</p>
</div>
{% endif %}
<div class="interested-listings">
{% include "@AqarmapDiscussionBundle/Discussion/ListingsYouMaybeInterestedIn.html.twig" %}
</div>
</div>
{% if popularArticles|length > 0 %}
{% include '@AqarmapDiscussion/Discussion/popularArticles.html.twig' %}
{% endif %}
</div>
<div class="container ask-question-container-parent">
<div class="ask-question-container sticky" data-sticky-class="sticky-on">
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
<div class="header">
<h2 class="custom-header white">{{ "neighborhoods.discussion.main_title"|trans }}</h2>
<p class="responsive_style">
{{ 'neighborhoods.discussion.location_sub_title'|trans }}
{% if discussion.location %}
{% trans with {'%location%': discussion.location.title } %}
neighborhoods.discussion.about_sub_title
{% endtrans %}
{% endif %}
</p>
<div class="ask-question-btn-container">
<a class="btn btn-block btn-warning"
href="{{ path('neighborhood_discussion_list', {'location': discussion.location.id ? discussion.location.id : discussion.location.parent.id, 'category': discussion.category ? discussion.category.id : null}) }}">
{{ "neighborhoods.discussion.explore_more"|trans }}
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
{% if isEnabledFeature('web.sharing.page') %}
{% include "@AqarmapDiscussionBundle/Discussion/discussionSharingModal.html.twig" %}
{% endif %}
{% endblock %}
{% block footer %}
{% include "footer.v2.html.twig" %}
{% endblock %}
{% block javascripts %}
<script src="//maps.google.com/maps/api/js?v=3.2&sensor=false&key={{ google_maps_key }}"></script>
{{ parent() }}
<script>
$("#explore-more").click(function () {
$(this).hide();
});
$(document).ready(function () {
if ($(window).width() > mobileWindowSize){
var sticky = new Sticky('.sticky');
}
});
</script>
{% endblock %}