{{!
    @template local_kid/dashboard_overview

    * studentcount, evalstocomplete, stagestocomplete, capptocomplete,
      cappfinalised - int
    * sessioncodes - string[]
    * students - array of { name, cappstatuses: [{code, statusbadge}], openurl }
    * hasnostudents - bool
    * exporturl - string
}}
<div class="kid-dashboard-overview fr-scope">
    <div class="fr-grid-row fr-grid-row--gutters fr-mb-4w kid-stat-row">
        <div class="fr-col-6 fr-col-md-2">
            <div class="fr-card fr-card--sm kid-stat-card kid-stat-card--neutral">
                <div class="fr-card__body">
                    <div class="fr-card__content fr-py-2w">
                        <div class="kid-stat-card__head">
                            <span class="kid-stat-card__icon fr-icon-user-search-line" aria-hidden="true"></span>
                        </div>
                        <p class="fr-h4 fr-mb-0 kid-stat-card__value">{{studentcount}}</p>
                        <p class="fr-text--sm fr-mb-0">{{#str}}dashboard_stat_students, local_kid{{/str}}</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="fr-col-6 fr-col-md-2">
            <div class="fr-card fr-card--sm kid-stat-card kid-stat-card--warning">
                <div class="fr-card__body">
                    <div class="fr-card__content fr-py-2w">
                        <div class="kid-stat-card__head">
                            <span class="kid-stat-card__icon fr-icon-book-2-line" aria-hidden="true"></span>
                            <span class="fr-badge fr-badge--warning fr-badge--sm">{{#str}}dashboard_badge_pending, local_kid{{/str}}</span>
                        </div>
                        <p class="fr-h4 fr-mb-0 kid-stat-card__value">{{evalstocomplete}}</p>
                        <p class="fr-text--sm fr-mb-0">{{#str}}dashboard_stat_evals, local_kid{{/str}}</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="fr-col-6 fr-col-md-2">
            <div class="fr-card fr-card--sm kid-stat-card kid-stat-card--warning">
                <div class="fr-card__body">
                    <div class="fr-card__content fr-py-2w">
                        <div class="kid-stat-card__head">
                            <span class="kid-stat-card__icon fr-icon-briefcase-line" aria-hidden="true"></span>
                            <span class="fr-badge fr-badge--warning fr-badge--sm">{{#str}}dashboard_badge_pending, local_kid{{/str}}</span>
                        </div>
                        <p class="fr-h4 fr-mb-0 kid-stat-card__value">{{stagestocomplete}}</p>
                        <p class="fr-text--sm fr-mb-0">{{#str}}dashboard_stat_stages, local_kid{{/str}}</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="fr-col-6 fr-col-md-2">
            <div class="fr-card fr-card--sm kid-stat-card kid-stat-card--warning">
                <div class="fr-card__body">
                    <div class="fr-card__content fr-py-2w">
                        <div class="kid-stat-card__head">
                            <span class="kid-stat-card__icon fr-icon-team-line" aria-hidden="true"></span>
                            <span class="fr-badge fr-badge--warning fr-badge--sm">{{#str}}dashboard_badge_pending, local_kid{{/str}}</span>
                        </div>
                        <p class="fr-h4 fr-mb-0 kid-stat-card__value">{{capptocomplete}}</p>
                        <p class="fr-text--sm fr-mb-0">{{#str}}dashboard_stat_capp_todo, local_kid{{/str}}</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="fr-col-6 fr-col-md-2">
            <div class="fr-card fr-card--sm kid-stat-card kid-stat-card--success">
                <div class="fr-card__body">
                    <div class="fr-card__content fr-py-2w">
                        <div class="kid-stat-card__head">
                            <span class="kid-stat-card__icon fr-icon-checkbox-circle-line" aria-hidden="true"></span>
                            <span class="fr-badge fr-badge--success fr-badge--sm">{{#str}}workflow_finalise, local_kid{{/str}}</span>
                        </div>
                        <p class="fr-h4 fr-mb-0 kid-stat-card__value">{{cappfinalised}}</p>
                        <p class="fr-text--sm fr-mb-0">{{#str}}dashboard_stat_capp_done, local_kid{{/str}}</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    {{#hasnostudents}}
        {{> local_kid/empty_state}}
    {{/hasnostudents}}

    {{^hasnostudents}}
    <div class="fr-table">
        <table>
            <caption>{{#str}}dashboard_stat_students, local_kid{{/str}}</caption>
            <thead>
                <tr>
                    <th scope="col">{{#str}}entry_col_student, local_kid{{/str}}</th>
                    {{#sessioncodes}}<th scope="col">{{.}}</th>{{/sessioncodes}}
                    <th scope="col">{{#str}}promotion_col_actions, local_kid{{/str}}</th>
                </tr>
            </thead>
            <tbody>
                {{#students}}
                <tr>
                    <td>{{name}}</td>
                    {{#cappstatuses}}<td>{{{statusbadge}}}</td>{{/cappstatuses}}
                    <td><a class="fr-link" href="{{openurl}}">{{#str}}dashboard_open_fiche, local_kid{{/str}}</a></td>
                </tr>
                {{/students}}
            </tbody>
        </table>
    </div>
    {{/hasnostudents}}
</div>
