{{!
    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_user/upcoming_activities_due_insight_body

    Template for the upcoming activity due insight

    Context variables required for this template:
    * activitiesdue array - Data for each activity due.
    * userfirstname string - The user firstname.

    Example context (json):
    {
        "userfirstname": "John",
        "activitiesdue": [
            {
                "name": "Introduction to ASP is due",
                "formattedtime": "31 January 2018",
                "coursename": "Programming I",
                "url": "https://www.google.com"
            }
        ]
    }
}}

{{! The styles defined here will be included in the Moodle web UI and in emails. Emails do not include Moodle
stylesheets so we want these styles to be applied to emails. However, they will also be included in the Moodle web UI.
The styles defined in the class .table have precedence over general styles at tag level, so these styles are only
applied to emails.}}
<head><style>
table {
    text-align: justify;
    margin-bottom: 1rem;
    margin-top: 1rem;
}
table tr.when {
    background-color: #e9ecef;
}
table th {
    padding: 1rem .75rem 1rem .75rem;
    font-weight: 400;
    font-size: larger;
    border-top: 1px solid #dee2e6;
}
table td {
    padding: .75rem;
}
table td.link {
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
}
</style></head>

<div>
    {{#str}} youhaveupcomingactivitiesdueinfo, moodle, {{userfirstname}} {{/str}}
    <br/><br/>

    {{#activitiesdue}}
        <table class="table upcoming-activity-due">
            <thead>
                <tr>
                    <th scope="col" class="h5">
                        {{#icon}}
                            {{#pix}} {{key}}, {{component}}, {{title}} {{alttext}} {{/pix}}
                        {{/icon}}
                        {{name}}
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr class="when">
                    <td><strong>{{#str}} whendate, calendar, {{formattedtime}} {{/str}}</strong></td>
                </tr>
                <tr>
                    <td>{{#str}} coursetitle, moodle, {"course": "{{coursename}}" } {{/str}}</td>
                </tr>
                <tr>
                    <td class="link"><a href="{{url}}">{{#str}} gotoactivity, calendar{{/str}}</a></td>
                </tr>
            </tbody>
        </table>
    {{/activitiesdue}}
</div>
