{{!
    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_booking/table_cards
    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):
   {
   "table": {
      "rows": {
         "rowid": "allbookingoptionstable_r1",
         "rowclasses": "rowclasses",
         "datafields": [
            {
               "key": "field1",
               "value": "value1"
            }
            ],
         "leftside": {
            "invisibleoption": {
               "columnkeyclass": "d-none",
               "columnvalueclass": "booking-option-info-invisible"
            },
            "text": {
               "columnkeyclass": "d-none",
               "columnclass": "text-left m-0 mb-1 h5",
               "keystring": "Course name"
            },
            "action": {
               "columnkeyclass": "d-none",
               "columnclass": "text-right"
            },
            "teacher": {
               "columnkeyclass": "d-none",
               "columnclass": "text-left font-size-sm",
               "keystring": "Teacher(s)"
            },
            "statusdescription": {
               "columnkeyclass": "d-none"
            },
            "description": {
               "columnkeyclass": "d-none"
            }
         },
         "footer": {
            "bookings": {
               "columnkeyclass": "d-none",
               "columnclass": "text-left text-gray pe-2 font-size-sm",
               "columniclassbefore": "fa fa-ticket fa-fw text-gray font-size-sm"
            },
            "minanswers": {
               "columnkeyclass": "d-none",
               "columnclass": "text-left text-gray pe-2 font-size-sm",
               "columniclassbefore": "fa fa-arrow-up fa-fw text-gray font-size-sm"
            },
            "dayofweektime": {
               "columnkeyclass": "d-none",
               "columnclass": "text-left text-gray pe-2 font-size-sm",
               "columniclassbefore": "fa fa-clock-o fa-fw text-gray font-size-sm"
            },
            "location": {
               "columnkeyclass": "d-none",
               "columnclass": "text-left text-gray  pe-2 font-size-sm",
               "columniclassbefore": "fa fa-map-marker fa-fw text-gray font-size-sm"
            },
            "institution": {
               "columnkeyclass": "d-none",
               "columnclass": "text-left text-gray  pe-2 font-size-sm",
               "columniclassbefore": "fa fa-building-o fa-fw text-gray font-size-sm"
            },
            "responsiblecontact": {
               "columnkeyclass": "d-none",
               "columnclass": "text-left text-gray  pe-2 font-size-sm",
               "columniclassbefore": "fa fa-user fa-fw text-gray font-size-sm"
            },
            "showdates": {
               "columnkeyclass": "d-none",
               "columnclass": "text-left pe-2 text-gray font-size-sm"
            },
            "comments": {
               "columnkeyclass": "d-none"
            }
         },
         "rightside": {
            "booknow": {
               "columnclass": "text-right"
            },
            "course": [],
            "progressbar": {
               "columnclass": "text-left mt-1 text-gray font-size-sm"
            },
            "ratings": {
               "columnclass": "mt-1"
            }
         }
      },
      "nopages" : "nopages",
      "previouspage": "1",
      "disableprevious": "disabled",
      "nextpage": "3",
      "disablenext": "disabled",
      "pages" : [
        {
           "active" : "active",
           "pagenumber" : "2",
           "ellipsis" : "ellipsis"
         }
      ]
   },
   "js": {
      "idstring": "example_idstring",
      "encodedtable": "example_encodedtable",
      "shoppingcartisavailable": true
   }
   }
}}
{{#norecords}}
     <div class="norecordsfound">{{#str}} norecords, local_wunderbyte_table {{/str}}</div>
{{/norecords}}
{{^norecords}}
   {{#table}}
      {{> local_wunderbyte_table/component_countlabel }}
      <div class="wunderbyte-table-grid no-overflow rows-container">
         {{#rows}}
            {{> mod_booking/table_cards_row }}
         {{/rows}}
      </div>
      {{> local_wunderbyte_table/component_pagination }}
   {{/table}}

   {{#js}}
      require(['local_wunderbyte_table/init'], function(fn) {
         fn.init('{{idstring}}', '{{encodedtable}}');
      });

      require(['mod_booking/view_actions'], function(fn) {
         fn.setup();
      });

      {{#shoppingcartisavailable}}
      require(['local_shopping_cart/cart'], function(cart) {
         cart.buttoninit(null, 'mod_booking');
      });
      {{/shoppingcartisavailable}}

      require(['mod_booking/modal_init'], function(fn) {
         fn.init();
      });

      require(['mod_booking/button_notifyme'], function(fn) {
         fn.init();
      });

      require(['mod_booking/bookit'], function(fn) {
         fn.initbookitbutton(null, null);
      });

      require(['mod_booking/bookit'], function(fn) {
         fn.initprepagemodal(null, null, null, null);
      });

      require(['mod_booking/bookit'], function(fn) {
         fn.initprepageinline(null, null, null, null);
      });
   {{/js}}
{{/norecords}}