{{!
    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_heeader_content

    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:
    * userid The logged in user id
    * urls The URLs for the popover

    Example context (json):
    {}

}}

<div class="rui-message-header-margin">
    <div class="d-flex align-items-start">
        {{#showrouteback}}
        <div class="align-self-stretch" >
            <a href="#" class="ml-3 d-flex align-items-center btn-msg mr-3" data-route-back role="button">
                {{> core_message/message_drawer_icon_back }}
            </a>
        </div>
        {{/showrouteback}}
        <div class="d-inline-flex">
            <a class="rui-message-header-info d-inline-flex text-decoration-none" href="#" data-action="view-group-info" role="button">
                {{#imageurl}}
                    <div class="d-block">
                        <img
                            class="rui-message-avatar rounded mr-3"
                            src="{{{.}}}"
                            alt="{{name}}"
                            aria-hidden="true"
                            style="height: 40px"
                        >
                    </div>
                {{/imageurl}}

                <div>
                    <div class="d-block">
                        <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>
                        <h4 class="rui-message-name mb-0 pr-2">
                        {{name}}
                            <span
                                class="{{^ismuted}}hidden{{/ismuted}} ml-1 text-primary"
                                data-region="muted-icon-container"
                            >
                                {{#pix}} i/muted, core, {{#str}} mutedconversation, core_message {{/str}} {{/pix}}
                            </span>
                        </h4>
                    </div>
                    {{#subname}}
                    <div class="rui-message-user-status">
                        <span class="badge-sm badge-light">
                            <svg class="mr-2" width="17" height="17" fill="none" viewBox="0 0 24 24">
                                <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19.25 5.75C19.25 5.19772 18.8023 4.75 18.25 4.75H14C12.8954 4.75 12 5.64543 12 6.75V19.25L12.8284 18.4216C13.5786 17.6714 14.596 17.25 15.6569 17.25H18.25C18.8023 17.25 19.25 16.8023 19.25 16.25V5.75Z"></path>
                                <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.75 5.75C4.75 5.19772 5.19772 4.75 5.75 4.75H10C11.1046 4.75 12 5.64543 12 6.75V19.25L11.1716 18.4216C10.4214 17.6714 9.40401 17.25 8.34315 17.25H5.75C5.19772 17.25 4.75 16.8023 4.75 16.25V5.75Z"></path>
                            </svg>
                            <span class="text-truncate" style="max-width: 100px;" title="{{!}}{{.}}{{!}}" data-toggle="tooltip">{{.}}</span>
                        </span>
                    </div>
                    {{/subname}}
                    <span class="mt-2 badge-sm badge-info">
                        <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="2" 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="2" 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="2"></circle>
                            <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" 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 id="conversation-actions-menu-button" class="btn-msg px-0" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" role="menu"
            aria-label="{{#str}} conversationactions, core_message {{/str}}" aria-controls="conversation-actions-menu">
                <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  id="conversation-actions-menu" class="dropdown-menu dropdown-menu-right">
                <a class="dropdown-item" href="#" data-action="view-group-info" role="menu">
                    {{#str}} groupinfo, core_message {{/str}}
                </a>
                <a class="dropdown-item {{#isfavourite}}hidden{{/isfavourite}}" href="#" data-action="confirm-favourite"
                role="menuitem">
                    {{#str}} addtofavourites, core_message {{/str}}
                </a>
                <a class="dropdown-item {{^isfavourite}}hidden{{/isfavourite}}" href="#" data-action="confirm-unfavourite"
                role="menuitem">
                    {{#str}} removefromfavourites, core_message {{/str}}
                </a>
                <a class="dropdown-item {{#ismuted}}hidden{{/ismuted}}" href="#" data-action="confirm-mute"
                role="menuitem">
                    {{#str}} muteconversation, core_message {{/str}}
                </a>
                <a class="dropdown-item {{^ismuted}}hidden{{/ismuted}}" href="#" data-action="confirm-unmute"
                role="menuitem">
                    {{#str}} unmuteconversation, core_message {{/str}}
                </a>
            </div>
        </div>
    </div>

</div>
