{{!
    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_courseformat/local/overview/overviewtable

    Shows an activity plugin overview table.

    Example context (json):
    {
        "caption": "Activity completion overview table",
        "headers": [
            {
                "key": "name",
                "name": "Activity Name",
                "textalign": "text-start"
            },
            {
                "key": "completion",
                "name": "Completion",
                "textalign": "text-center"
            }
        ],
        "activities": [
            {
                "cmid": 1,
                "overviews": [
                    {
                        "overview": "name",
                        "value": "Assignment 1",
                        "content": "Assignment 1",
                        "textalign": "text-start"
                    },
                    {
                        "overview": "completion",
                        "value": "1",
                        "content": "Complete",
                        "textalign": "text-center",
                        "alertcount": 1,
                        "alertlabel": "Assignment 1 has 1 alert"
                    }
                ]
            },
            {
                "cmid": 2,
                "overviews": [
                    {
                        "overview": "name",
                        "value": "Quiz 1",
                        "content": "Quiz 1",
                        "textalign": "text-start"
                    },
                    {
                        "overview": "completion",
                        "value": "0",
                        "content": "Incomplete",
                        "textalign": "text-center",
                        "alertcount": 0,
                        "alertlabel": ""
                    }
                ]
            }
        ]
    }
}}
<div class="course-overview border table-responsive border-secondary border-1 rounded pt-2">
    <table
        class="course-overview-table boxaligncenter {{!
            }} table w-100 d-block d-md-table"
    >
    <caption class="accesshide">{{caption}}</caption>
    <thead>
        <tr>
            {{#headers}}
            <th
                class="{{textalign}} border-top-0"
                scope="col"
                data-mdl-overview-column="{{key}}"
            >{{{name}}}</th>
            {{/headers}}
        </tr>
    </thead>
    <tbody>
        {{#activities}}
        <tr data-mdl-overview-cmid="{{cmid}}">
            {{#overviews}}
            <td
                class="{{textalign}}"
                data-mdl-overview-item="{{overview}}"
                data-mdl-overview-value="{{value}}"
                {{#alertcount}}
                data-mdl-overview-alertcount="{{alertcount}}"
                data-mdl-overview-alertlabel="{{alertlabel}}"
                {{/alertcount}}
            >
                {{{content}}}
            </td>
            {{/overviews}}
        </tr>
        {{/activities}}
    </tbody>
    </table>
</div>
