{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template core_message/message_drawer_view_conversation_header_content_type_self

    This template will render the header content of the conversation page in
    the message message drawer.

    Classes required for JS:
    * none

    Data attributes required for JS:
    * All data attributes are required

    Context variables required for this template:
    * urls The URLs for the popover
    * name
    * subname
    * imageurl
    * isfavourite
    * showonlinestatus


    Example context (json):
    {}

}}

<div class="rui-message-header-margin">
    <div class="d-flex align-items-start">
        <div class="align-self-stretch" >
            <a class="ml-3 d-flex align-items-center btn-msg mr-3" href="#" data-route-back>
                {{> core_message/message_drawer_icon_back }}
            </a>
        </div>
        <div class="d-inline-flex">
            <a class="rui-message-header-info d-inline-flex text-decoration-none" href="#" data-action="view-group-info">
                {{#imageurl}}
                    <div class="d-block">
                        <img
                            class="rui-message-avatar rounded mr-3"
                            src="{{{.}}}"
                            alt="{{name}}"
                            aria-hidden="true"
                            style="height: 40px"
                        >
                        <span class="{{^isfavourite}}hidden{{/isfavourite}} {{#isfavourite}}d-grid{{/isfavourite}} rui-message-name-favorite" data-region="favourite-icon-container">
                            <svg width="16" height="16" fill="none" viewBox="0 0 24 24">
                                <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M12 4.75L13.75 10.25H19.25L14.75 13.75L16.25 19.25L12 15.75L7.75 19.25L9.25 13.75L4.75 10.25H10.25L12 4.75Z"></path>
                            </svg>
                        </span>
                    </div>
                {{/imageurl}}
                 <div>
                    <div class="d-block">
                        <h4 class="rui-message-name mb-0 pr-2">{{name}}</h4>
                    </div>
                    {{#subname}}
                    <div class="rui-message-user-status">
                        <span class="badge-xs badge-success">{{subname}}</span>
                    </div>
                    {{/subname}}
                    <span class="badge-sm badge-light mt-2">
                        <svg class="mr-2" width="16" height="16" fill="none" viewBox="0 0 24 24">
                            <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5.78168 19.25H13.2183C13.7828 19.25 14.227 18.7817 14.1145 18.2285C13.804 16.7012 12.7897 14 9.5 14C6.21031 14 5.19605 16.7012 4.88549 18.2285C4.773 18.7817 5.21718 19.25 5.78168 19.25Z"></path>
                            <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M15.75 14C17.8288 14 18.6802 16.1479 19.0239 17.696C19.2095 18.532 18.5333 19.25 17.6769 19.25H16.75"></path>
                            <circle cx="9.5" cy="7.5" r="2.75" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle>
                            <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M14.75 10.25C16.2688 10.25 17.25 9.01878 17.25 7.5C17.25 5.98122 16.2688 4.75 14.75 4.75"></path>
                        </svg>
                        {{#str}} numparticipants, core_message, {{totalmembercount}} {{/str}}
                    </span>
                </div>
            </a>
        </div>
        <div class="ml-auto dropdown mr-2">
            <button class="btn-msg px-0" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <svg width="32" height="32" fill="none" viewBox="0 0 24 24">
                    <path fill="currentColor" d="M13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11C12.5523 11 13 11.4477 13 12Z"></path>
                    <path fill="currentColor" d="M13 8C13 8.55228 12.5523 9 12 9C11.4477 9 11 8.55228 11 8C11 7.44772 11.4477 7 12 7C12.5523 7 13 7.44772 13 8Z"></path>
                    <path fill="currentColor" d="M13 16C13 16.5523 12.5523 17 12 17C11.4477 17 11 16.5523 11 16C11 15.4477 11.4477 15 12 15C12.5523 15 13 15.4477 13 16Z"></path>
                </svg>
            </button>
            <div class="dropdown-menu dropdown-menu-right">
                <a class="dropdown-item" href="#" data-action="view-group-info">
                    {{#str}} groupinfo, core_message {{/str}}
                </a>
                <a class="dropdown-item {{#isfavourite}}hidden{{/isfavourite}}" href="#" data-action="confirm-favourite">
                    {{#str}} addtofavourites, core_message {{/str}}
                </a>
                <a class="dropdown-item {{^isfavourite}}hidden{{/isfavourite}}" href="#" data-action="confirm-unfavourite">
                    {{#str}} removefromfavourites, core_message {{/str}}
                </a>
            </div>
        </div>
    </div>
</div>
