{% extends '@RxConnexion/Admin/content.html.twig' %}
{% set userData = app.session.get('userData') %}
{% block content %}
    <div class="row max-width-initial">
        <div class="small-12 columns">
            <div class="content-container">
                <div id="chat-main-section">
                    <div class="chat-child" id="chat-list-container">
                        <div style="margin-bottom:5px" class="input-group">
                            <input id="chat-search-box" placeholder="Search conversation" type="text">
                            <div class="input-group-button">
                                <button id="chat-search-btn" class="button secondary"><i class="fa fa-search"></i></button>
                            </div>
                        </div>
                        <a href="{{ path('chat_form') }}">New Chat</a>
                        <hr style="margin: 0px;">
                        <ul id="chat-conversation-list">
                            {% for c in conversations %}
                                <li data-id="{{ c.id }}"><i class="fa {{ c.chat_type == 'Private' ? 'fa-user-circle' : 'fa-users' }}"></i> <span style="text-transform: capitalize"> {{ c.chat_type == 'Private' and c.account_user_id != userData.id ? c.creatorFullName  : c.description }}</span> <span class="badge float-right hide">1</span></li>
                            {% endfor %}
                        </ul>
                    </div>

                    <div class="chat-child" id="chat-conversation-container">
                        <div style="display: table;width: 100%;height: 100%;text-align: center">
                            <div style="display: table-cell;vertical-align: middle;letter-spacing: 3px;font-size: 1.2em;color: #777;"><i class="fa fa-comments"></i>
                                <br><span style="color:#047bd5 !important">RX</span>CONNEXION CHAT </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {% include '@RxConnexion/Admin/js.html.twig' %}
    <script language="javascript">
        //<![CDATA[
        jQ(document).ready(function(){
            chat.settings.chat_listUrl = '{{ path('conversation_message_list') }}';
            chat.settings.chat_add_msgUrl = '{{ path('chat_send_message') }}';
            chat.userId = {{ userData.id }};
            chat.init();
        });
        //]]>
    </script>
{% endblock %}