{{!
    @template local_kid/stage_grid_student

    Student-mode fragment of local_kid/stage_grid, extracted so it can be
    re-rendered on its own by the AJAX student-switch endpoint
    (classes/external/get_grid_student_view.php) without re-rendering the
    "<h2>libelle</h2>" or the summary-mode table.

    Context: same as local_kid/stage_grid's student-mode branch, plus
    studentnav (see templates/student_nav.mustache).

    Note: this partial is the CONTENT of [data-region="kid-grid-student"],
    not the wrapper itself — the wrapper div lives in local_kid/stage_grid
    so amd/src/student_nav.js can replace this partial's output via
    innerHTML without nesting an extra wrapper on every student switch.
}}
<p class="fr-mb-2w"><a class="fr-link" href="{{backurl}}" data-kid-guard-nav="1">{{#str}}entry_back_to_summary, local_kid{{/str}}</a></p>
{{#studentnav}}{{> local_kid/student_nav}}{{/studentnav}}
{{> local_kid/workflow_stepper}}
<div class="kid-publication fr-mb-2w">
    <ul class="fr-btns-group fr-btns-group--inline-md fr-mb-0">
        {{#canvalidate}}<li><a class="fr-btn fr-btn--secondary" href="{{validateurl}}">{{#str}}workflow_action_validate, local_kid{{/str}}</a></li>{{/canvalidate}}
        {{#canfinalise}}<li><a class="fr-btn fr-btn--secondary" href="{{finaliseurl}}">{{#str}}workflow_action_finalise, local_kid{{/str}}</a></li>{{/canfinalise}}
        {{#canreopen}}<li><a class="fr-btn fr-btn--secondary" href="{{reopenurl}}">{{#str}}workflow_action_reopen, local_kid{{/str}}</a></li>{{/canreopen}}
    </ul>
    {{#ispublished}}<span class="fr-badge fr-badge--success">{{#str}}published_yes, local_kid{{/str}}</span>{{/ispublished}}
</div>

{{#canimport}}
<p class="fr-mb-2w">
    <a class="fr-link" href="{{templateoneurl}}">{{#str}}stage_template_student, local_kid{{/str}}</a>
    · <a class="fr-link" href="{{importurl}}">{{#str}}stage_import_action, local_kid{{/str}}</a>
</p>
{{/canimport}}

{{#fichestudenturl_docx}}
<ul class="fr-btns-group fr-btns-group--inline-md fr-btns-group--sm fr-mb-2w">
    <li><a class="fr-btn fr-btn--tertiary fr-btn--sm" href="{{fichestudenturl_docx}}">{{#str}}fiche_download_student, local_kid{{/str}} ({{#str}}fiche_format_docx, local_kid{{/str}})</a></li>
    <li><a class="fr-btn fr-btn--tertiary fr-btn--sm" href="{{fichestudenturl_pdf}}">{{#str}}fiche_download_student, local_kid{{/str}} ({{#str}}fiche_format_pdf, local_kid{{/str}})</a></li>
</ul>
{{/fichestudenturl_docx}}

<div class="fr-card fr-mb-2w" data-region="kid-entry-form">
    <div class="fr-card__body">
        <div class="fr-card__content">
            {{{formhtml}}}
        </div>
    </div>
</div>

<div class="fr-card">
    <div class="fr-card__body">
        <div class="fr-card__content">
            <h3 class="fr-card__title">{{#str}}stagedoc_heading, local_kid{{/str}}</h3>
            {{^hasdocs}}<p class="fr-text--sm">{{#str}}stagedoc_none, local_kid{{/str}}</p>{{/hasdocs}}
            {{#hasdocs}}
            <ul class="kid-doc-list">
                {{#docs}}
                <li>
                    <a class="fr-link" href="{{downloadurl}}">{{filename}}</a> ({{filesize}})
                    {{#candocedit}}<a class="fr-link" href="{{deleteurl}}">{{#str}}action_delete, local_kid{{/str}}</a>{{/candocedit}}
                </li>
                {{/docs}}
            </ul>
            {{/hasdocs}}
            {{#candocedit}}
            <p class="fr-text--sm">{{#str}}stagedoc_help, local_kid{{/str}}</p>
            <form method="post" action="{{uploadurl}}" enctype="multipart/form-data">
                <input type="hidden" name="sesskey" value="{{sesskey}}">
                <input type="hidden" name="entryid" value="{{entryid}}">
                <div class="fr-upload-group fr-mb-2w">
                    <label class="fr-label" for="kid-stagedoc-upload">{{#str}}stagedoc_upload, local_kid{{/str}}</label>
                    <input class="fr-upload" type="file" id="kid-stagedoc-upload" name="files[]" multiple accept=".pdf,.doc,.docx,.xls,.xlsx">
                </div>
                <button type="submit" class="fr-btn">{{#str}}stagedoc_upload, local_kid{{/str}}</button>
            </form>
            {{/candocedit}}
        </div>
    </div>
</div>
