{{!
    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 format_remuiformat/card_general_section


    Example context (json):
    {
        "editing: "0",
        "defaultview: "1/0",
        "expanded: "1/0",
        "collapsed: "1/0",
        "user_id: "1",
        "courseid: "1",
        "generalsection": [
         {
            "generalsectiontitle": "General Section Title",
            "activities": [
                {
                    "index": "index",
                    "id": "id",
                    "completion": "completion",
                    "viewurl": "viewurl",
                    "title": "title",
                    "modulename": "modulename",
                    "summary": "summary",
                    "completed": "completed",
                    "hidden": "hidden",
                    "availstatus": "availstatus",
                    "modicons": "modicons",
                }
            ],
            "generalsectionsummary": "General Section Summary",
         }
        ],
    }
}}
{{^showgeneralsectionintrodata}}
{{^activityexists}}
<style>
    #page-course-view-remuiformat .courseindex-section:first-child {
        display: none !important;
    }
</style>
{{/activityexists}}
{{/showgeneralsectionintrodata}}

{{^activityexists}}
<style>
    #page-course-view-remuiformat .sections.generalsection-container{
        margin-bottom: 0px !important;
    }
    #page-course-view-remuiformat  .section-details{
        margin-bottom: 24px;
    }
</style>
{{/activityexists}}

<li id="section-{{{index}}}" class="section border-0 col-12 p-0">
    <div class="general-section d-flex flex-column">
        {{>format_remuiformat/optional_secheader}}
        <div class="d-none hidden course-prgress-container" data-courseid="{{courseid}}"></div>
        {{#showgeneralsection}}
        <div class="section-details">
            {{#showgeneralsectionintrodata}}
            <div class="generaldetails content d-flex flex-column">
                <h2 class="section-title pt-0 p-t-0 m-0">{{{title}}}</h2>
                <div class='generalsectioninfo'>
                    {{{availability}}}
                    {{#fullsummary}}
                    {{! <input type="checkbox" class="read-more-state" id="read-more-summary" /> }}
                    <div class="read-more-target coursesummary" >{{{fullsummary}}}
                    </div>
                    <a id="readmorebtn" class="d-none readbtn">{{#str}} showmore, format_remuiformat{{/str}}</a>
                    <a id="readlessbtn" class="d-none readbtn">{{#str}} showless, format_remuiformat{{/str}}</a>
                    {{! <label for="read-more-summary" class=" text-primary small read-more-trigger"></label> }}
                    {{/fullsummary}}
                </div>
            </div>
            {{/showgeneralsectionintrodata}}
        </div>
        {{#activityexists}}
        <div class="activities-wrapper d-flex flex-column">
            <h4 class="activitieshead m-0 d-none">{{#str}} generalactivities, format_remuiformat{{/str}}</h4>
            <ul class="general-section-activities justify-content-start text-center ">
                {{#activities}}
                    {{^isdelegatedsection}}
                        <li class="activity d-flex flex-column justify-content-between  list-unstyled {{{modulename}}} modtype_{{{modulename}}}"
                            id="module-{{id}}">
                            <div class="generalsecactivitiescontent d-flex flex-column justify-content-between w-100 p-0 h-100">
                                {{#editing}}
                                {{{leftside}}}
                                {{/editing}}
                                {{! <div> }}
                                    <div class="activityinstance p-0 m-0 d-flex h-100 flex-column">
                                        <div class="title-activity-container text-break w-100 erf-text-left ">
                                            {{{title}}}
                                        </div>
                                        {{#modhiddenfromstudents}}
                                        <div data-region="sectionbadges" class="sectionbadges d-flex align-items-center">
                                            {{!> core_courseformat/local/content/section/badges }}
                                            {{>format_remuiformat/edwbadges}}
                                        </div>
                                        {{/modhiddenfromstudents}}
                                        {{#modstealth}}
                                        <div class=" d-flex align-items-center">
                                            <span
                                                class="badge badge-pill badge-warning">{{#str}}hiddenoncoursepage{{/str}}</span>
                                        </div>
                                        {{/modstealth}}
                                        {{#summary}}
                                        <div class="contentafterlink">
                                            {{{summary}}}
                                        </div>
                                        {{/summary}}
                                    </div>
                                    <div class="p-0 action-availstatus-wrapper">
                                        {{#hasopenduedata}}
                                        <div class="description erf-text-left">
                                            <div data-region="activity-dates" class="activity-dates small course-description-item">
                                                <div class="description-inner">
                                                    {{#opendue}}
                                                    <div>
                                                        <strong>{{label}}</strong> {{timestamp}}
                                                    </div>
                                                    {{/opendue}}
                                                </div>
                                            </div>
                                        </div>
                                        {{/hasopenduedata}}
                                        {{{availstatus}}}

                                        {{#completion}}
                                        <div class="actions">
                                            {{{completion}}}
                                        </div>
                                        {{/completion}}
                                    </div>
                                    {{!
                                </div> }}
                            </div>
                        </li>
                    {{/isdelegatedsection}}
                    {{#isdelegatedsection}}
                        {{>format_remuiformat/card_section_summary}}
                    {{/isdelegatedsection}}
                {{/activities}}
            </ul>
        </div>
        {{/activityexists}}
        <div class="text-center showactivitywrapper">
            <span class="showactivity text-primary show">
                {{#str}}showmore, format_remuiformat{{/str}}
            </span>
        </div>
    </div>
    {{/showgeneralsection}}
</li>
