<div class="categorieslist">
{{#categories}}
<div data-category-id="{{id}}" id="category-{{id}}" class="mt-2">
    <div class="row justify-content-between align-items-end">
        <div class="col-6 categoryinstance">
            <h3>{{{name}}}</h3>
        </div>
        <div class="col-auto text-right">
            <a href="{{azione}}" class="btn btn-primary">{{#str}}questionnew, mtcontabilita{{/str}}</a>
        </div>
    </div>

    <table class="generaltable fullwidth profilefield">
        {{#hasfields}}
            <thead>
                <tr>
                    <!--<th scope="col" class="col-1">#</th>-->
                    <th scope="col" class="col-2">{{#str}}name{{/str}}</th>
                    <th scope="col" class="col-7">{{description}}</th>
                    <th scope="col" class="col-3 text-right">{{#str}}action{{/str}}</th>
                    <!-- <th scope="col" class="col-2 text-right">{{#str}}action{{/str}}</th> -->
                </tr>
            </thead>
            <tbody>
                {{#fields}}
                    <tr>
                        <!--<td class="col-1">{{{sortorder}}}</td>-->
                        <td class="col-2"><a href="edit.php?cmid={{cmid}}&id={{id}}">{{{name}}}</a></td>
                        <td class="col-7">{{{description}}}</td>

                        <td class="col-3 text-right">
                            <select id="menu-navigazione">
                                <option value="">{{#str}}selezione, mtcontabilita{{/str}}</option>
                                {{#binit}}
                                <option value="init.php?sez=1&cmid={{cmid}}&id={{id}}&sesskey={{sesskey}}">{{#str}}binit, mtcontabilita{{/str}}</option>
                                <option value="excel.php?tp=1&cmid={{cmid}}&id={{id}}">{{#str}}situazionefinale, mtcontabilita{{/str}}</option>
                                {{/binit}}
                                <option value="details.php?cmid={{cmid}}&id={{id}}&sesskey={{sesskey}}">{{#str}}scritture, mtcontabilita{{/str}}</option>
                                <option value="{{{config.wwwroot}}}/mod/mtcontabilita/evaluation/index.php?cmid={{cmid}}&id={{id}}">{{#str}}evaluation, mtcontabilita{{/str}}</option>
                            </select>
                            {{#hidden}}
                            <a href="{{baseurl}}?action=show&id={{cmid}}&iid={{id}}&sesskey={{sesskey}}">
                                {{#pix}}t/show, core, {{#str}}show{{/str}}{{/pix}}</a>
                            {{/hidden}}
                            {{^hidden}}
                            <a href="{{baseurl}}?action=hide&id={{cmid}}&iid={{id}}&sesskey={{sesskey}}">
                                {{#pix}}t/hide, core, {{#str}}hide{{/str}}{{/pix}}</a>
                            {{/hidden}}
                            {{^isfirst}}
                                <a href="{{baseurl}}?id={{cmid}}&iid={{id}}&action=movefield&dir=up&amp;sesskey={{sesskey}}">
                                {{#pix}}t/up, core, {{#str}}moveup{{/str}}{{/pix}}</a>
                            {{/isfirst}}
                            {{#isfirst}}{{#pix}}spacer, moodle{{/pix}}{{/isfirst}}
                            {{^islast}}
                                <a href="{{baseurl}}?id={{cmid}}&iid={{id}}&action=movefield&dir=down&amp;sesskey={{sesskey}}">
                                {{#pix}}t/down, core, {{#str}}movedown{{/str}}{{/pix}}</a>
                            {{/islast}}
                            {{#islast}}{{#pix}}spacer, moodle{{/pix}}{{/islast}}
                            <a href="{{baseurl}}?action=deletefield&id={{cmid}}&iid={{id}}&sesskey={{sesskey}}">
                                {{#pix}}t/delete, core, {{#str}}delete{{/str}}{{/pix}}</a>

                        </td>
                    </tr>
                {{/fields}}
            </tbody>
        {{/hasfields}}
        {{^hasfields}}
            <thead>
                <tr class="nofields alert alert-danger alert-block fade in">
                    <td>
                        {{#str}}questionno, mtcontabilita{{/str}}
                    </td>
                </tr>
            </thead>
        {{/hasfields}}
    </table>
</div>
{{/categories}}
</div>

<script>
document.addEventListener("DOMContentLoaded", function () {
    var selectMenu = document.getElementById("menu-navigazione");
    if (selectMenu) {
        selectMenu.addEventListener("change", function () {
            var url = this.value;
            if (url) {
                window.location.href = url;
            }
        });
    }
});
</script>
