{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template aiprovider_datacurso/consumption_row

    Template for rendering consumption history rows.

        Example context (json):
    {
    }
}}

<table class="generaltable w-100" data-region="aiprovider_datacurso/consumption-table-table">
    <thead>
        <tr>
            <th>{{#str}}id, aiprovider_datacurso{{/str}}</th>
            <th>{{#str}}user, core{{/str}}</th>
            <th>{{#str}}action, aiprovider_datacurso{{/str}}</th>
            <th>{{#str}}service, aiprovider_datacurso{{/str}}</th>
            <th class="sortable" data-sort="cantidad_tokens" style="cursor:pointer;">
                {{#str}}tokensused, aiprovider_datacurso{{/str}}
                <i class="fa fa-sort sort-icon"></i>
            </th>
            <th>{{#str}}remainingtokens, aiprovider_datacurso{{/str}}</th>
            <th class="sortable" data-sort="fecha" style="cursor:pointer;">
                {{#str}}date, core{{/str}}
                <i class="fa fa-sort sort-icon"></i>
            </th>
        </tr>
    </thead>
    <tbody id="consumption-table-body">
        {{^initialized}}
            <tr>
                <td colspan="7" class="text-center">
                    {{#str}}loading, core{{/str}}
                </td>
            </tr>
        {{/initialized}}
        {{#initialized}}
            {{#consumptions}}
                <tr>
                    <td>{{id_consumption}}</td>
                    <td>{{#username}}{{username}}{{/username}}{{^username}}-{{/username}}</td>
                    <td>{{action}}</td>
                    <td>{{id_service}}</td>
                    <td>{{cant_tokens}}</td>
                    <td>{{balance}}</td>
                    <td>{{date}}</td>
                </tr>
            {{/consumptions}}
            {{^consumptions}}
                <tr>
                    <td colspan="7" class="text-center text-danger">
                        {{#str}}nodata, aiprovider_datacurso{{/str}}
                    </td>
                </tr>
            {{/consumptions}}
        {{/initialized}}
    </tbody>
</table>
