{{!
    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/content/cm/activity

    Display the activity content of a cm.

    Example context (json):
    {
        "cmname": {
            "displayvalue" : "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Activity example</span></a>"
        },
        "hasname": "true",
        "afterlink": "<span class=\"resourcelinkdetails\">24.7&nbsp;KB · Uploaded 26/05/23, 16:29</span>",
        "activitybadge": {
            "badgecontent": "PDF",
            "badgestyle": "badge-none",
            "badgeurl": "http://example.org/help",
            "badgeelementid": "myelementid",
            "badgeextraattributes": [
                {
                    "name": "data-el1name",
                    "value": "el1value"
                },
                {
                    "name": "data-el2name",
                    "value": "el2value"
                }
            ]
        },
        "hasextras": true,
        "extras": ["<span class=\"badge badge-secondary\">[extras]</span>"],
        "activityinfo": {
            "hasmodavailability": true,
            "activityname": "Activity example",
            "hascompletion": true,
            "uservisible": true,
            "hasdates": true,
            "isautomatic": true,
            "istrackeduser": true,
            "activitydates": [
                {
                    "label": "Opens:",
                    "datestring": "6 April 2021, 6:46 PM"
                }
            ],
            "completiondetails": [
                {
                    "statuscomplete": 1,
                    "description": "Viewed"
                },
                {
                    "statusincomplete": 1,
                    "description": "Receive a grade"
                }
            ]
        },
        "visibility": {
            "isInteractive": false,
            "modhiddenfromstudents": true
        }
    }
}}
<div class="d-grid align-items-center {{^isautomatic}}rui--activity-notautomatic {{/isautomatic}}{{#isautomatic}}rui--activity-is-automatic{{/isautomatic}}{{#hascompletion}}rui--activity-is-manual{{/hascompletion}}">
    
    {{#moveicon}} {{{moveicon}}} {{/moveicon}}

    <div>
        {{! Dates }}
        {{#dates}}
            {{#hasdates}}
                <div data-region="activity-dates" class="rui-activity-dates activity-dates course-description-item">
                    {{#activitydates}}
                        {{$core_course/activity_date}}
                            {{>core_course/activity_date}}
                        {{/core_course/activity_date}}
                    {{/activitydates}}
                </div>
            {{/hasdates}}
        {{/dates}}

        {{$ core_courseformat/local/content/cm/badges }}
            {{> core_courseformat/local/content/cm/badges }}
        {{/ core_courseformat/local/content/cm/badges }}
        
        <div class="activity-basis d-flex align-items-center flex-wrap">
            <div class="d-flex flex-row align-items-center mr-auto">
                {{#cmname}}
                {{$ core_courseformat/local/content/cm/cmname }}
                    {{> core_courseformat/local/content/cm/cmname }}
                {{/ core_courseformat/local/content/cm/cmname }}
                {{/cmname}}
            </div>
            {{! Completion }}
            {{! Group mode }}
            {{#groupmodeinfo}}
                <div
                    class="activity-groupmode-info align-self-center"
                    data-region="groupmode"
                >
                    {{$ core_courseformat/local/content/cm/groupmode}}
                        {{> core_courseformat/local/content/cm/groupmode}}
                    {{/ core_courseformat/local/content/cm/groupmode}}
                </div>
            {{/groupmodeinfo}}
            {{#completion}}
                {{#hascompletion}}
                    <div class="activity-completion align-self-center mt-2 mt-md-0 ml-0 ml-md-2">
                        {{$ core_courseformat/local/content/cm/activity_info}}
                            {{> core_courseformat/local/content/cm/activity_info}}
                        {{/ core_courseformat/local/content/cm/activity_info}}
                    </div>
                {{/hascompletion}}
            {{/completion}}
            {{#controlmenu}}
                <div class="activity-actions align-self-start">
                    {{$ core_courseformat/local/content/cm/controlmenu }}
                        {{> core_courseformat/local/content/cm/controlmenu }}
                    {{/ core_courseformat/local/content/cm/controlmenu }}
                </div>
            {{/controlmenu}}
        </div>
    
        {{#altcontent}}
        <div class="rui-contentafterlink contentafterlink description {{^completion}}rui--nocompletion{{/completion}}">
            <div class="activity-altcontent {{#hasname}}mt-2 course-description-item {{/hasname}}{{^hasname}}contentwithoutlink{{/hasname}} d-flex text-break">
                <div class="flex-fill description-inner">
                    {{{altcontent}}}
                </div>
            </div>            
        </div>
        {{/altcontent}}

        {{#modavailability}}
        <div class="rui-modavailability description">
                {{$ core_courseformat/local/content/cm/availability }}
                    {{> core_courseformat/local/content/cm/availability }}
                {{/ core_courseformat/local/content/cm/availability }}
        </div>
        {{/modavailability}}

        {{! Afterlink }}
        {{#afterlink}}
            <div class="rui-contentafterlink afterlink mt-2">
                {{{afterlink}}}
            </div>
        {{/afterlink}}

    </div>    


</div>