{{!
    @template local_kid/admin_stages

    * addurl - string
    * hasstages - bool
    * stages - array of { id, libelle, periode, scopelabel, statuslabel,
      statusclass, editurl, toggleurl, deleteurl, openurl }
    * sesskey - string
}}
<div class="fr-scope">
<p class="fr-mb-4w">
    <a class="fr-btn" href="{{addurl}}">{{#str}}stage_add, local_kid{{/str}}</a>
</p>

{{^hasstages}}
    {{> local_kid/empty_state}}
{{/hasstages}}

{{#hasstages}}
<div class="fr-table">
    <table>
        <caption>{{#str}}stage_col_libelle, local_kid{{/str}}</caption>
        <thead>
            <tr>
                <th scope="col">{{#str}}stage_col_libelle, local_kid{{/str}}</th>
                <th scope="col">{{#str}}stage_col_periode, local_kid{{/str}}</th>
                <th scope="col">{{#str}}stage_col_scope, local_kid{{/str}}</th>
                <th scope="col">{{#str}}promotion_col_status, local_kid{{/str}}</th>
                <th scope="col">{{#str}}promotion_col_actions, local_kid{{/str}}</th>
            </tr>
        </thead>
        <tbody>
            {{#stages}}
            <tr>
                <td><a class="fr-link" href="{{openurl}}">{{libelle}}</a></td>
                <td>{{periode}}</td>
                <td>{{scopelabel}}</td>
                <td><span class="{{statusclass}}">{{statuslabel}}</span></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>
                    · <form class="kid-inline-form" method="post" action="{{deleteurl}}" onsubmit="return confirm('{{#str}}stage_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>
            {{/stages}}
        </tbody>
    </table>
</div>
{{/hasstages}}
</div>
