{{!
    @template local_dttutor/manage_course

    AI Tutor course management page

    Context variables required for this template:
    * courseid - Course ID
    * tutor_enabled - Boolean for tutor enabled status

    Example context (json):
    {
        "courseid": 123,
        "tutor_enabled": true
    }
}}

<div class="dttutor-manage-page">
    <div class="row">
        <div class="col-lg-8">
            {{! Tutor Enable/Disable Card }}
            <div class="card mb-4 shadow-sm">
                <div class="card-header bg-primary text-white">
                    <h4 class="mb-0">
                        <i class="fa fa-toggle-on mr-2"></i>
                        {{#str}}tutor_status, local_dttutor{{/str}}
                    </h4>
                </div>
                <div class="card-body">
                    <div class="custom-control custom-switch mb-3">
                        <input type="checkbox"
                               class="custom-control-input"
                               id="tutor-enabled"
                               data-action="toggle-tutor"
                               data-courseid="{{courseid}}"
                               {{#tutor_enabled}}checked{{/tutor_enabled}}>
                        <label class="custom-control-label" for="tutor-enabled">
                            <strong>{{#str}}enable_tutor_for_course, local_dttutor{{/str}}</strong>
                        </label>
                    </div>
                    <p class="text-muted small mb-2">
                        {{#str}}enable_tutor_for_course_help, local_dttutor{{/str}}
                    </p>
                    {{^tutor_enabled}}
                    <div class="alert alert-warning mb-0 mt-3">
                        <i class="fa fa-exclamation-triangle mr-1"></i>
                        {{#str}}tutor_disabled_notice, local_dttutor{{/str}}
                    </div>
                    {{/tutor_enabled}}
                </div>
            </div>
        </div>

        {{! Sidebar }}
        <div class="col-lg-4">
            <div class="card shadow-sm">
                <div class="card-header bg-light">
                    <h5 class="mb-0">
                        <i class="fa fa-question-circle mr-2"></i>
                        {{#str}}help{{/str}}
                    </h5>
                </div>
                <div class="card-body">
                    <h6><i class="fa fa-lightbulb mr-1 text-warning"></i>{{#str}}tutor_status, local_dttutor{{/str}}</h6>
                    <p class="small text-muted">
                        {{#str}}enable_tutor_for_course_help, local_dttutor{{/str}}
                    </p>
                </div>
            </div>
        </div>
    </div>
</div>
{{#js}}
require(['local_dttutor/course_materials'], function(CourseMaterials) {
    CourseMaterials.init({{courseid}});
});
{{/js}}