{{!
    @template local_kid/capp_grid

    Summary mode: libelle, rows[], hasrows, studentcount, finalisedcount,
      publishedcount, hasbulkactions, canexport, canbulkpublish,
      bulkscreen, bulkitemid, sesskey, hasprevious, previouslabel,
      recoverbulkurl, canimport, importmode, bilanmode,
      bilan: {studentcount, cols: [{label, bgcolor, fgcolor}],
        rows: [{libelle, cells: [{value}]}]} (null unless bilanmode),
      tabs[], templatecompetencesurl,
      importcompetencesurl, templateappreciationsurl,
      importappreciationsurl
    Student mode: libelle, steps[], formhtml, canvalidate, canfinalise,
      canreopen, ispublished, validateurl, finaliseurl, reopenurl, backurl,
      hasprevious, previouslabel, recoveroneurl
}}
<div class="fr-scope">
<h2>{{libelle}}</h2>

{{#summarymode}}
    {{^hasrows}}{{> local_kid/empty_state}}{{/hasrows}}
    {{#hasrows}}
    {{#canimport}}
    {{> local_kid/tabs}}
    {{/canimport}}

    {{#bilanmode}}
    {{#bilan}}
    <div class="fr-table fr-table--no-caption fr-mb-4w">
        <table>
            <caption>{{#str}}capp_rapport_bilan_heading, local_kid{{/str}}</caption>
            <thead>
                <tr>
                    <th scope="col">{{#str}}grid_competence, local_kid{{/str}}</th>
                    {{#cols}}
                    <th scope="col" style="background-color:{{bgcolor}};color:{{fgcolor}};">{{label}}</th>
                    {{/cols}}
                </tr>
            </thead>
            <tbody>
                {{#rows}}
                <tr>
                    <td>{{libelle}}</td>
                    {{#cells}}
                    <td style="text-align:center;">{{value}}</td>
                    {{/cells}}
                </tr>
                {{/rows}}
            </tbody>
        </table>
    </div>
    <p class="fr-text--sm">{{#str}}capp_rapport_studentcount, local_kid, {{studentcount}}{{/str}}</p>
    {{/bilan}}
    {{/bilanmode}}

    {{^bilanmode}}
    {{^importmode}}
    <div class="fr-grid-row fr-grid-row--gutters fr-mb-4w">
        <div class="fr-col-12 fr-col-md-4">
            <div class="fr-card">
                <div class="fr-card__body">
                    <div class="fr-card__content fr-py-2w">
                        <p class="fr-display--xs fr-mb-0">{{studentcount}}</p>
                        <p class="fr-text--sm fr-mb-0">{{#str}}entry_col_student, local_kid{{/str}}</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="fr-col-12 fr-col-md-4">
            <div class="fr-card">
                <div class="fr-card__body">
                    <div class="fr-card__content fr-py-2w">
                        <p class="fr-display--xs fr-mb-0">{{finalisedcount}}</p>
                        <p class="fr-text--sm fr-mb-0">{{#str}}workflow_finalise, local_kid{{/str}}</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="fr-col-12 fr-col-md-4">
            <div class="fr-card">
                <div class="fr-card__body">
                    <div class="fr-card__content fr-py-2w">
                        <p class="fr-display--xs fr-mb-0">{{publishedcount}}</p>
                        <p class="fr-text--sm fr-mb-0">{{#str}}published_yes, local_kid{{/str}}</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    {{#hasprevious}}
    <div class="fr-callout fr-py-2w fr-mb-4w">
        <p class="fr-callout__text fr-text--sm">
            {{#str}}capp_recover_bulk_notice, local_kid, {{previouslabel}}{{/str}}
            <a class="fr-btn fr-btn--sm fr-ml-2w" href="{{recoverbulkurl}}">{{#str}}capp_recover_action, local_kid{{/str}}</a>
        </p>
    </div>
    {{/hasprevious}}

    {{> local_kid/selectable_entry_table}}
    {{#hasbulkactions}}
    {{> local_kid/bulk_actions_bar}}
    {{/hasbulkactions}}
    {{/importmode}}

    {{#importmode}}
    <div class="kid-import-panel">
        <h3>{{#str}}capp_import_competences_heading, local_kid{{/str}}</h3>
        <p class="fr-mb-2w">
            <a class="fr-link" href="{{templatecompetencesurl}}">{{#str}}capp_template_action, local_kid{{/str}}</a>
            · <a class="fr-link" href="{{importcompetencesurl}}">{{#str}}capp_import_competences_action, local_kid{{/str}}</a>
        </p>
        <h3>{{#str}}capp_import_appreciations_heading, local_kid{{/str}}</h3>
        <p class="fr-mb-2w">
            <a class="fr-link" href="{{templateappreciationsurl}}">{{#str}}capp_template_action, local_kid{{/str}}</a>
            · <a class="fr-link" href="{{importappreciationsurl}}">{{#str}}capp_import_appreciations_action, local_kid{{/str}}</a>
        </p>
    </div>
    {{/importmode}}
    {{/bilanmode}}
    {{/hasrows}}
{{/summarymode}}

{{^summarymode}}
<div data-region="kid-grid-student"{{#conflictjson}} data-conflict="{{conflictjson}}"{{/conflictjson}}>
{{> local_kid/capp_grid_student}}
</div>
{{/summarymode}}
</div>
