{{!
    @template local_kid/dashboard_global

    * promotioncount, activecount, totalstudents - int
    * haspromotions - bool
    * adminpromotionsurl - string
    * promotions - array of { name, statuslabel, statusclass, cohortlinked,
      studentcount, evalstocomplete, stagestocomplete, capptocomplete,
      cappfinalised, openurl }
}}
<div class="kid-dashboard-global fr-scope">
    <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">{{promotioncount}}</p>
                        <p class="fr-text--sm fr-mb-0">{{#str}}dashboard_global_stat_promotions, 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">{{activecount}}</p>
                        <p class="fr-text--sm fr-mb-0">{{#str}}dashboard_global_stat_active, 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">{{totalstudents}}</p>
                        <p class="fr-text--sm fr-mb-0">{{#str}}dashboard_stat_students, local_kid{{/str}}</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    {{^haspromotions}}
        {{> local_kid/empty_state}}
        <p class="fr-mt-2w"><a class="fr-btn" href="{{adminpromotionsurl}}">{{#str}}promotion_add, local_kid{{/str}}</a></p>
    {{/haspromotions}}

    {{#haspromotions}}
    <div class="fr-table">
        <table>
            <caption>{{#str}}dashboard_global_stat_promotions, local_kid{{/str}}</caption>
            <thead>
                <tr>
                    <th scope="col">{{#str}}promotion_col_name, local_kid{{/str}}</th>
                    <th scope="col">{{#str}}promotion_col_status, local_kid{{/str}}</th>
                    <th scope="col">{{#str}}promotion_col_cohort, local_kid{{/str}}</th>
                    <th scope="col">{{#str}}dashboard_stat_students, local_kid{{/str}}</th>
                    <th scope="col">{{#str}}dashboard_stat_evals, local_kid{{/str}}</th>
                    <th scope="col">{{#str}}dashboard_stat_stages, local_kid{{/str}}</th>
                    <th scope="col">{{#str}}dashboard_stat_capp_todo, local_kid{{/str}}</th>
                    <th scope="col">{{#str}}dashboard_stat_capp_done, local_kid{{/str}}</th>
                    <th scope="col">{{#str}}promotion_col_actions, local_kid{{/str}}</th>
                </tr>
            </thead>
            <tbody>
                {{#promotions}}
                <tr>
                    <td>{{name}}</td>
                    <td><span class="{{statusclass}}">{{statuslabel}}</span></td>
                    <td>{{#cohortlinked}}{{#str}}promotion_status_active, local_kid{{/str}}{{/cohortlinked}}{{^cohortlinked}}—{{/cohortlinked}}</td>
                    <td>{{studentcount}}</td>
                    <td>{{evalstocomplete}}</td>
                    <td>{{stagestocomplete}}</td>
                    <td>{{capptocomplete}}</td>
                    <td>{{cappfinalised}}</td>
                    <td><a class="fr-link" href="{{openurl}}">{{#str}}dashboard_global_open, local_kid{{/str}}</a></td>
                </tr>
                {{/promotions}}
            </tbody>
        </table>
    </div>
    {{/haspromotions}}
</div>
