{{!
    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 local_wunderbyte_table/table
    Template which defines a mooduell view page.
    Classes required for JS:
    * none
    Data attributes required for JS:
    * none
    Context variables required for this template:
    * statistics - array: An array with values.
    * opengames - array: empty array, will be filled with JS.
    * finishedgames - array: empty array, will be filled with JS.
    * highscores - array: empty array, will be filled with JS.

    Example context (json):
    {
          "listheaderclass": "listheaderclass",
          "cardheaderclass": "cardheaderclass",
          "cardfooterclass": "cardfooterclass",
          "cardimageclass": "cardimageclass",
          "cardheader": [
          {
               "columnclass": "columnclass",
               "columnkeyclass": "columnkeyclass",
               "key": "columnname",
               "keystring": "localized column name",
               "columnvalueclass": "columnvalueclass",
               "value": "value"
          }
          ],
          "cardbody": [
          {
               "columnclass": "columnclass",
               "columnkeyclass": "columnkeyclass",
               "key": "columnname",
               "keystring": "localized column name",
               "columnvalueclass": "columnvalueclass",
               "value": "value"
          }
          ],
          "cardfooter": [
          {
               "columnclass": "columnclass",
               "columnkeyclass": "columnkeyclass",
               "key": "columnname",
               "keystring": "localized column name",
               "columnvalueclass": "columnvalueclass",
               "value": "value"
          }
          ],
          "cardimage": [
          {
               "value": "value"
          }
          ]
     }
}}
{{#norecords}}
    <div class="norecordsfound">
        <div class="alert alert-warning" role="alert">{{#str}} norecords, local_wunderbyte_table {{/str}}</div>
    </div>
{{/norecords}}
{{^norecords}}
     {{#table}}
     {{#infinitescroll}}
          {{^displayelementsontop}}
               <div class="notontop infinite">
               {{> local_wunderbyte_table/component_actionbutton }}
               </div>
          {{/displayelementsontop}}
     {{/infinitescroll}}
     {{#displayelementsontop}}
          <div class="ontop">
          {{> local_wunderbyte_table/component_actionbutton }}
          </div>
          <br>
          <div>
               {{> local_wunderbyte_table/component_pagination }}
               <div class="float-end">{{> local_wunderbyte_table/component_selectrows }}</div>
          </div>
     {{/displayelementsontop}}
     <div class="wunderbyte-table-table {{moodleversionminfourtwo}}">
          {{> local_wunderbyte_table/component_countlabel }}
          <div {{#stickyheader}} class="scroll-y" {{#tableheight}}
          style="height: {{tableheight}}px;" {{/tableheight}}{{/stickyheader}}>
               <table class="table" id="{{uniqueid}}">
                    <thead>
                         <tr>
                              {{#header}}
                                   {{#headers}}
                                        <th class="{{key}} wb-table-column {{sortclass}}"
                                        data-columnname="{{key}}"
                                        {{#sortable}}
                                        data-sortable="{{sortable}}"
                                        {{/sortable}}>
                                             {{{localized}}}
                                        </th>
                                   {{/headers}}
                              {{/header}}
                         </tr>
                    </thead>
                    <tbody class="rows-container">
                         {{#rows}}
                              {{> local_wunderbyte_table/twtable_list_row }}
                         {{/rows}}
                    </tbody>
               </table>
          </div>
     </div>
     {{/table}}
{{#js}}
    require(['local_wunderbyte_table/init'], function(init) {
    init.init('{{idstring}}', '{{encodedtable}}');
    });
{{/js}}
{{/norecords}}

{{^infinitescroll}}
{{^displayelementsontop}}
<div class="float-end notontop">{{> local_wunderbyte_table/component_selectrows }}</div>
          {{> local_wunderbyte_table/component_pagination }}
          {{> local_wunderbyte_table/component_actionbutton }}
{{/displayelementsontop}}
{{/infinitescroll}}
{{#errormessage}}
     <div class="alert alert-danger" role="alert">
          {{errormessage}}
     </div>
{{/errormessage}}