<%page args="section_data" expression_filter="h"/>
<%! from django.utils.translation import ugettext as _ %>
%if section_data['access']['staff'] or section_data['access']['instructor']:
<div class="action-type-container">
    %if section_data['is_small_course']:
        <br><br>
        <h4 class="hd hd-4">${_("View gradebook for enrolled learners")}</h4>
        <br>
        <label for="gradebook-link">${_("Note: This feature is available only to courses with a small number of enrolled learners.")}</label>
        <br><br>
        <span name="gradebook-link"><a href="${ section_data['spoc_gradebook_url'] }" class="gradebook-link"> ${_("View Gradebook")} </a></span>
        <br><br>
        <hr>
    %endif
</div>

<div class="student-specific-container action-type-container">
    <h4 class="hd hd-4">${_("View a specific learner's grades and progress")}</h4>
    <div class="request-response-error"></div>
    <label for="student-select-progress">
        ${_("Learner's {platform_name} email address or username").format(platform_name=settings.PLATFORM_NAME)}
    </label>
    <br>
    <input type="text" name="student-select-progress" placeholder="${_('Learner email address or username')}" >
    <br><br>
    <div class="progress-link-wrapper">
        <span name="progress-link">
            <a href="" class="progress-link" data-endpoint="${ section_data['get_student_progress_url_url'] }">
                ${_("View Progress Page")}
            </a>
        </span>
    </div>
  <hr>
</div>

<div class="student-grade-container action-type-container">
    <h4 class="hd hd-4">${_("Adjust a learner's grade for a specific problem")}</h4>
    <div class="request-response-error"></div>
    <label for="student-select-grade">
        ${_("Learner's {platform_name} email address or username").format(platform_name=settings.PLATFORM_NAME)}
    </label>
    <br>
    <input type="text" name="student-select-grade" placeholder="${_('Learner email address or username')}">
    </label>
    <br><br>

    <label for="problem-select-single">
        ${_("Location of problem in course")}<br>
        <span class="location-example">${_("Example")}: block-v1:edX+DemoX+2015+type@problem+block@618c5933b8b544e4a4cc103d3e508378</span>
    </label>
    <br>
    <input type="text" name="problem-select-single" placeholder="${_('Problem location')}">
    <br><br><br>

    <h5 class="hd hd-5">${_("Attempts")}</h5>
    <label for="reset-attempts-single">${_("Allow a learner who has used up all attempts to work on the problem again.")}</label>
    <br>
    <input type="button" name="reset-attempts-single" value="${_('Reset Attempts to Zero')}" data-endpoint="${ section_data['reset_student_attempts_url'] }">

    <br><br>

    %if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'):
        <h5 class="hd hd-5">${_("Rescore")}</h5>
        <label for="rescore-actions-single">${_("For the specified problem, rescore the learner's responses. The 'Rescore Only If Score Improves' option updates the learner's score only if it improves in the learner's favor.")}</label>
        <br>
        <span name="rescore-actions-single">
            <input type="button" name="rescore-problem-single" value="${_('Rescore Learner\'s Submission')}" data-endpoint="${ section_data['rescore_problem_url'] }">
            <input type="button" name="rescore-problem-if-higher-single" value="${_('Rescore Only If Score Improves')}" data-endpoint="${ section_data['rescore_problem_url'] }">
        </span>
    %endif

    <br><br>

    %if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'):
        <h5 class="hd hd-5">${_("Score Override")}</h5>
        <label for="override-problem-score-single">${_("For the specified problem, override the learner's score.")}</label>
        <br><br>
        <label for="score-select-single">
            ${_("New score for problem, out of the total points available for the problem")}<br>
        </label>
        <br>
        <input type="text" name="score-select-single" placeholder="${_('Score')}">
        <br><br>
        <span name="override-actions-single">
            <input type="button" name="override-problem-score-single" value="${_('Override Learner\'s Score')}" data-endpoint="${ section_data['override_problem_score_url'] }">
        </span>
    %endif

    <br><br>

    <h5 class="hd hd-5">${_("Problem History")}</h5>
    <label for="delete-state-single">${_("For the specified problem, permanently and completely delete the learner's answers and scores from the database.")}</label>
    <br>
    <input type="button" class="molly-guard" name="delete-state-single" value="${_('Delete Learner\'s State')}" data-endpoint="${ section_data['reset_student_attempts_url'] }">

    <br><br>

    %if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'):
        <h5 class="hd hd-5">${_("Task Status")}</h5>
        <label for="task-history-single">${_("Show the status for the rescoring tasks that you submitted for this learner and problem.")}</label>
        <br>
        <input type="button" name="task-history-single" value="${_('Show Task Status')}" data-endpoint="${ section_data['list_instructor_tasks_url'] }" aria-describedby="task-history-single-help">
        <div class="task-history-single-table"></div>
    %endif
  <hr>
</div>

% if course.entrance_exam_enabled:
<div class="entrance-exam-grade-container action-type-container">
    <h4 class="hd hd-4">${_("Adjust a learner's entrance exam results")}</h4>
    <div class="request-response-error"></div>

    <label for="entrance-exam-student-select-grade">
        ${_("Learner's {platform_name} email address or username").format(platform_name=settings.PLATFORM_NAME)}
    </label>
    <br>
    <input type="text" name="entrance-exam-student-select-grade" placeholder="${_('Learner email address or username')}">
    <br><br><br>

    <h5 class="hd hd-5">${_("Attempts")}</h5>
    <label for="reset-entrance-exam-attempts">${_("Allow the learner to take the exam again.")}</label>
    <br>
    <input type="button" name="reset-entrance-exam-attempts" value="${_('Reset Attempts to Zero')}" data-endpoint="${ section_data['reset_student_attempts_for_entrance_exam_url'] }">
    <br><br>

    <h5 class="hd hd-5">${_("Allow Skip")}</h5>
    <label for="skip-entrance-exam">${_("Waive the requirement for the learner to take the exam.")}</label>
    <br>
    <input type="button" name="skip-entrance-exam" value="${_('Let Learner Skip Entrance Exam')}" data-endpoint="${ section_data['student_can_skip_entrance_exam_url'] }">
    <br><br>

    %if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS') and section_data['access']['instructor']:
        <h5 class="hd hd-5">${_("Rescore")}</h5>
        <label for="rescore-actions-entrance-exam">
            ${_("Rescore any responses that have been submitted. The 'Rescore All Problems Only If Score Improves' option updates the learner's scores only if it improves in the learner's favor.")}
        </label>
        <br>
        <span name="rescore-actions-entrance-exam">
            <input type="button" name="rescore-entrance-exam" value="${_('Rescore All Problems')}" data-endpoint="${ section_data['rescore_entrance_exam_url'] }">
            <input type="button" name="rescore-entrance-exam-if-higher" value="${_('Rescore All Problems Only If Score Improves')}" data-endpoint="${ section_data['rescore_entrance_exam_url'] }">
        </span>
        <br><br>
    %endif

    <h5 class="hd hd-5">${_("Entrance Exam History")}</h5>
    <label for="delete-entrance-exam-state">
        ${_("For the entire entrance exam, permanently and completely delete the learner's answers and scores from the database.")}
    </label>
    <br>
    <input type="button" class="molly-guard" name="delete-entrance-exam-state" value="${_('Delete Learner\'s State')}" data-endpoint="${ section_data['reset_student_attempts_for_entrance_exam_url'] }"></label>
    <br><br>


    %if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'):
        <h5 class="hd hd-5">${_("Task Status")}</h5>
        <label for="entrance-exam-task-history">
            ${_("Show the status for the rescoring tasks that you submitted for this learner and entrance exam.")}
        </label>
        <br>
        <p><input type="button" name="entrance-exam-task-history" value="${_('Show Task Status')}" data-endpoint="${ section_data['list_entrace_exam_instructor_tasks_url'] }" aria-describedby="entrance-exam-task-history-help"></p>
        <div class="entrance-exam-task-history-table"></div>
    %endif
    <hr>
</div>
%endif

%endif

%if section_data['access']['instructor']:
%if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'):
<div class="course-specific-container action-type-container">
    <h4 class="hd hd-4">${_("Adjust all enrolled learners' grades for a specific problem")}</h4>
    <div class="request-response-error"></div>

    <label for="problem-select-all">
        ${_("Location of problem in course")}<br>
        <span class="location-example">${_("Example")}: block-v1:edX+DemoX+2015+type@problem+block@618c5933b8b544e4a4cc103d3e508378</span>
    </label>
    <br>
    <input type="text" name="problem-select-all" placeholder="${_('Problem location')}">
    <br><br><br>

    <h5 class="hd hd-5">${_("Attempts")}</h5>
    <label for="reset-attempts-all">${_("Allows all learners to work on the problem again.")}</label>
    <br>
    <input type="button" class="molly-guard" name="reset-attempts-all" value="${_('Reset Attempts to Zero')}" data-endpoint="${ section_data['reset_student_attempts_url'] }">
    <br><br>

    <h5 class="hd hd-5">${_("Rescore")}</h5>
    <label for="rescore-actions-all">${_("Rescore submitted responses. The 'Rescore Only If Scores Improve' option updates a learner's score only if it improves in the learner's favor.")}</label>
    <br>
    <span name="rescore-actions-all">
        <input type="button" class="molly-guard" name="rescore-problem-all" value="${_('Rescore All Learners\' Submissions')}" data-endpoint="${ section_data['rescore_problem_url'] }">
        <input type="button" class="molly-guard" name="rescore-problem-all-if-higher" value="${_('Rescore Only If Scores Improve')}" data-endpoint="${ section_data['rescore_problem_url'] }">
    </span>
    <br><br>

    <h5 class="hd hd-5">${_("Task Status")}</h5>
    <label for="task-history-all">${_("Show the status for the tasks that you submitted for this problem.")}</label>
    <br>
    <input type="button" name="task-history-all" value="${_('Show Task Status')}" data-endpoint="${ section_data['list_instructor_tasks_url'] }" aria-describedby="task-history-all-help">
    <div class="task-history-all-table"></div>
    <hr>
</div>
%endif

%if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'):
<div class="running-tasks-container action-type-container">
    <h4 class="hd hd-4">${_("Pending Tasks")}</h4>
    <div class="running-tasks-section">
        <label>${_("The status for any active tasks appears in a table below.")}</label>
        <br>
        <div class="running-tasks-table" data-endpoint="${ section_data['list_instructor_tasks_url'] }"></div>
    </div>
    <div class="no-pending-tasks-message"></div>
</div>
%endif

%endif
