{{!
    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 mod_forum/inpage_reply

    Template which defines a forum post for sending in a single-post HTML email.

    Classes required for JS:
    * none

    Data attributes required for JS:
    * none

    Example context (json):
    {
        "postid": 0,
        "reply_url": "",
        "sesskey": "",
        "parentsubject": "",
        "throttlingwarningmsg": "You are approaching the posting threshold. You have posted 3 times in the last 1 week and the limit is 4 posts."
    }
}}
<div data-content="inpage-reply-content" style="display: none;">
    <div class="card card-body">
        {{#throttlingwarningmsg}}
            <div class="alert alert-danger alert-block fade in " role="alert">
                {{throttlingwarningmsg}}
            </div>
        {{/throttlingwarningmsg}}
        <form data-post-id="{{postid}}" id="inpage-reply-{{postid}}" data-content="inpage-reply-form" action="{{{reply_url}}}">
            <div class="pb-2">
                <span>
                    <textarea rows="5" name="post" title="{{#str}} message, mod_forum {{/str}}" class="form-control" placeholder="{{#str}} replyplaceholder, forum {{/str}}"></textarea>
                    <input type="hidden" name="postformat" value="{{postformat}}"/>
                </span>
                <input type="hidden" name="subject" value="{{parentsubject}}"/>
                <input type="hidden" name="reply" value="{{postid}}"/>
                <input type="hidden" name="sesskey" value="{{sesskey}}"/>
            </div>
            <div class="d-flex flex-wrap align-items-center gap-1">
                <button class="btn btn-primary" data-action="forum-inpage-submit">
                    <span data-region="submit-text">{{#str}} posttoforum, mod_forum {{/str}}</span>
                    <span data-region="loading-icon-container" class="hidden">{{> core/loading }}</span>
                </button>
                <button class="btn btn-secondary" data-action="collapsible-link" name="cancelbtn">
                    {{#str}} cancel, core {{/str}}
                </button>
                {{#canreplyprivately}}
                <div class="form-check form-check-inline">
                    <input type="checkbox" class="form-check-input" id="private-reply-checkbox-{{uniqid}}" title="{{#str}} privatereply, forum {{/str}}" name="privatereply"/>
                    <label class="form-check-label" for="private-reply-checkbox-{{uniqid}}">{{#str}} privatereply, forum {{/str}}</label>
                </div>
                {{/canreplyprivately}}
                <button data-action="forum-advanced-reply" class="btn btn-link ms-auto" type="submit">
                    {{#str}} advanced, core {{/str}}
                </button>
            </div>
        </form>
    </div>
</div>
