{#

 This file is part of the FOSCommentBundle package.

 (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>

 This source file is subject to the MIT license that is bundled
 with this source code in the file LICENSE.

#}

{% set first = first|default(false) %}

{% set url_parameters = {'id': id } %}
{% if parent is not null %}
    {% set url_parameters = url_parameters|merge({'parentId': parent.id}) %}
{% endif %}

{% block fos_comment_comment_form_holder %}
    <div class="fos_comment_comment_form_holder">
        {% block fos_comment_comment_new_form %}
            <form class="fos_comment_comment_new_form" action="{{ url('fos_comment_post_thread_comments', url_parameters) }}" data-parent="{{ parent.id|default() }}" method="POST">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        {% block fos_comment_form_title %}
                            {% if first %}
                                <h3 class="panel-title">{% trans from 'FOSCommentBundle' %}fos_comment_comment_new_headline_first{% endtrans %}</h3>
                            {% elseif parent is not null %}
                                <h3 class="panel-title">{% trans with {"%name%": parent.authorName } from 'FOSCommentBundle' %}fos_comment_comment_reply_reply_to{% endtrans %}</h3>
                            {% else %}
                                <h3 class="panel-title">{% trans from 'FOSCommentBundle' %}fos_comment_comment_new_headline{% endtrans %}</h3>
                            {% endif %}
                        {% endblock %}
                    </div>

                    <div class="panel-body">
                        {% block fos_comment_form_fields %}
                            <div class="row">
                                {% if form.authorName is defined %}
                                    <div class="col-sm-3">
                                        {{ form_label(form.authorName, 'form_label_author_name'|trans({}, 'SonataCommentBundle'), {'horizontal_label_class': ''}) }}
                                        {{ form_widget(form.authorName, {'horizontal_input_wrapper_class': ''}) }}
                                    </div>
                                {% endif %}

                                <div class="col-sm-3">
                                    {{ form_label(form.website, 'form_label_website'|trans({}, 'SonataCommentBundle'), {'horizontal_label_class': ''}) }}
                                    {{ form_widget(form.website, {'horizontal_input_wrapper_class': ''}) }}
                                </div>

                                <div class="col-sm-3">
                                    {{ form_label(form.email, 'form_label_email'|trans({}, 'SonataCommentBundle'), {'horizontal_label_class': ''}) }}
                                    {{ form_widget(form.email, {'horizontal_input_wrapper_class': ''}) }}
                                </div>

                                <div class="col-sm-3">
                                    {{ form_label(form.note, 'form_label_note'|trans({}, 'SonataCommentBundle'), {'horizontal_label_class': ''}) }}
                                    {{ form_widget(form.note, {'horizontal_input_wrapper_class': ''}) }}
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-12">
                                    {{ form_label(form.body, 'form_label_body'|trans({}, 'SonataCommentBundle'), {'horizontal_label_class': ''}) }}
                                    {{ form_widget(form.body, {'horizontal_input_wrapper_class': ''}) }}
                                </div>
                            </div>

                            {{ form_rest(form) }}
                        {% endblock %}

                        <div class="fos_comment_submit">
                            {% block fos_comment_form_submit %}
                                {% if parent is not null %}
                                    <input class="btn" type="button" value="{% trans from 'FOSCommentBundle' %}fos_comment_comment_reply_cancel{% endtrans %}" class="fos_comment_comment_reply_cancel" />
                                {% endif %}
                                <input class="btn btn-primary" type="submit" value="{% trans from 'FOSCommentBundle' %}fos_comment_comment_new_submit{% endtrans %}" />
                            {% endblock %}
                        </div>
                    </div>
                </div>
            </form>
        {% endblock fos_comment_comment_new_form %}
    </div>
{% endblock fos_comment_comment_form_holder %}
