{{!
    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 mod_mooduell/modal_open_this_game
    Template which defines the id column in a list.
    Classes required for JS:
    * none
    Data attributes required for JS:
    * none
    Context variables required for this template:
    * counter - int
    * deleteLink - string
    * thisgametable - string of HTML

    Example context (json):
    {
        "counter": 1,
        "deletelink": "https://mod/mooduell/deletethis.php",
        "thisgametable": "<table><tr><td>emptytable</td></tr></table>"
    }
}}


<a href="#" id="mooduellModalLabel" data-bs-toggle="modal" data-bs-target="#mooduell-modal{{counter}}"
    data-toggle="modal" data-target="#mooduell-modal{{counter}}"
    >
    <i class="fa fa-info"></i>
</a>

<div id="mooduell-modal{{counter}}" class="modal in" tabindex="-1" role="dialog"
     aria-labelledby="mooduellModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header bg-primary justify-content-end">
                <button type="button" class="btn btn-closex text-white" data-dismiss="modal" data-bs-dismiss="modal">X</button>
            </div>
            <div class="modal-body">
                <!-- The actual content goes here. -->
                <div id="mooduell-table-results">
                    {{{thisgametable}}}
                </div>
            </div>
            <div class="modal-footer bg-primary">
                <button type="button" class="btn btn-secondary" data-dismiss="modal" data-bs-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

<script>
    require(['local_wunderbyte_table/init'], function(init) {
     init.init('{{idstring}}', '{{encodedtable}}');
    });
</script>