{{!
    @template local_kid/admin_evaluations

    * addurl - string
    * hasevals - bool
    * evals - array of { id, titre, sourcelabel, competencycount, statuslabel,
      statusclass, editurl, toggleurl, deleteurl, openurl }
    * sesskey - string
}}
<div class="fr-scope">
<p class="fr-mb-4w">
    <a class="fr-btn" href="{{addurl}}">{{#str}}eval_add, local_kid{{/str}}</a>
</p>

{{^hasevals}}
    {{> local_kid/empty_state}}
{{/hasevals}}

{{#hasevals}}
<div class="fr-table">
    <table>
        <caption>{{#str}}eval_titre, local_kid{{/str}}</caption>
        <thead>
            <tr>
                <th scope="col">{{#str}}eval_titre, local_kid{{/str}}</th>
                <th scope="col">{{#str}}eval_col_source, local_kid{{/str}}</th>
                <th scope="col">{{#str}}eval_col_competencies, local_kid{{/str}}</th>
                <th scope="col">{{#str}}promotion_col_status, local_kid{{/str}}</th>
                <th scope="col">{{#str}}eval_col_sync, local_kid{{/str}}</th>
                <th scope="col">{{#str}}promotion_col_actions, local_kid{{/str}}</th>
            </tr>
        </thead>
        <tbody>
            {{#evals}}
            <tr>
                <td><a class="fr-link" href="{{openurl}}">{{titre}}</a></td>
                <td>{{sourcelabel}}</td>
                <td>{{competencycount}}</td>
                <td><span class="{{statusclass}}">{{statuslabel}}</span></td>
                <td>
                    {{#ismoodledevoir}}
                    <span class="{{syncclass}}">{{synclabel}}</span><br>
                    <span class="fr-text--sm">{{#str}}eval_sync_last, local_kid, {{lastsynclabel}}{{/str}}</span>
                    {{/ismoodledevoir}}
                </td>
                <td>
                    <a class="fr-link" href="{{editurl}}">{{#str}}action_edit, local_kid{{/str}}</a>
                    · <a class="fr-link" href="{{toggleurl}}">{{#str}}action_toggle_active, local_kid{{/str}}</a>
                    {{#ismoodledevoir}}· <a class="fr-link" href="{{syncurl}}">{{#str}}eval_sync_action, local_kid{{/str}}</a>{{/ismoodledevoir}}
                    · <form class="kid-inline-form" method="post" action="{{deleteurl}}" onsubmit="return confirm('{{#str}}eval_delete_confirm, local_kid{{/str}}');">
                        <input type="hidden" name="sesskey" value="{{sesskey}}">
                        <button type="submit" class="fr-link">{{#str}}action_delete, local_kid{{/str}}</button>
                    </form>
                </td>
            </tr>
            {{/evals}}
        </tbody>
    </table>
</div>
{{/hasevals}}
</div>
