{{!
    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 theme_adaptable/block_timeline/event-list-item

    This template renders an event list item for the timeline block.

    Example context (json):
    {
        "name": "Assignment 1 is due",
        "activityname": "Assignment",
        "activitystr": "Assignment is due",
        "courseview": true,
        "url": "https://www.google.com",
        "timesort": 1490320388,
        "course": {
            "fullnamedisplay": "Course 1"
        },
        "action": {
            "name": "Submit assignment",
            "url": "https://www.google.com",
            "itemcount": 1,
            "showitemcount": true,
            "actionable": true
        },
        "icon": {
            "key": "icon",
            "component": "mod_assign",
            "alttext": "Assignment icon",
            "iconurl": "#"
        },
        "overdue": false,
        "purpose": "assessment"
    }
}}
<div class="list-group-item timeline-event-list-item flex-column pt-2 pb-0 border-0 {{#courseview}}px-0{{/courseview}}{{^courseview}}px-2{{/courseview}}"
        data-region="event-list-item">
    <div class="d-flex flex-wrap pb-1">
        <div class="d-flex me-auto pb-1 mw-100 timeline-name">
            <small class="text-end text-nowrap align-self-center ms-1">
                {{#userdate}} {{timesort}}, {{#str}} strftimetime24, core_langconfig {{/str}} {{/userdate}}
            </small>
            <div class="activityiconcontainer small courseicon align-self-top align-self-center mx-3  mb-1 mb-sm-0 text-nowrap">
                {{#icon}}
                {{#iconurl}}
                    <img alt="{{alttext}}" title="{{alttext}}" src="{{{ iconurl }}}" class="icon {{iconclass}}">
                {{/iconurl}}
                {{^iconurl}}
                    {{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}
                {{/iconurl}}
                {{/icon}}
            </div>
            <div class="event-name-container flex-grow-1 line-height-3 nowrap text-truncate">
                <div class="d-flex">
                    <h6 class="event-name mb-0 pb-1 text-truncate">
                        {{#overdue}}<span class="badge rounded-pill text-bg-danger ms-1 float-end">{{#str}} overdue, block_timeline {{/str}}</span>{{/overdue}}
                        <a href="{{url}}"
                                title="{{name}}"
                                aria-label='{{#cleanstr}} ariaeventlistitem, block_timeline, { "name": {{#quote}}{{{activityname}}}{{/quote}}, "course": {{#quote}}{{{course.fullnamedisplay}}}{{/quote}}, "date": "{{#userdate}} {{timesort}}, {{#str}} strftimedatetime, core_langconfig {{/str}} {{/userdate}}" } {{/cleanstr}}'>
                            {{{activityname}}}</a>
                    </h6>
                </div>
                <small class="mb-0">
                    {{#courseview}}
                        {{activitystr}}
                    {{/courseview}}
                    {{^courseview}}
                        {{activitystr}}{{#course.fullnamedisplay}} &middot; {{{course.fullnamedisplay}}}{{/course.fullnamedisplay}}
                    {{/courseview}}
                </small>
            </div>
        </div>
        {{#action.actionable}}
        <div class="d-flex timeline-action-button">
            <h6 class="event-action">
                <a class="list-group-item-action btn btn-outline-secondary btn-sm text-nowrap"
                    href="{{action.url}}"
                    aria-label="{{action.name}}"
                    title="{{action.name}}">
                {{{action.name}}}
                {{#action.showitemcount}}
                <span class="badge text-bg-secondary">{{action.itemcount}}</span>
                {{/action.showitemcount}}
                </a>
            </h6>
        </div>
        {{/action.actionable}}
    </div>
    <div class="pt-2 border-bottom"></div>
</div>
