{{!
    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/bookingoption_description_view

    Classes required for JS:
    * none

    Data attributes required for JS:
    * data-region

    Example context (json):
    {
        "identifier": "2345",
        "title": "AERIAL YOGA",
        "titleprefix": "pf2345",
        "modalcounter": 1,
        "invisible": "0",
        "annotation": "",
        "userid": "2",
        "description": "Flow Yoga Multistyle MindestteilnehmerInnen: 6",
        "statusdescription": "v",
        "imageurl": "http://localhost:58000/pluginfile.php/22/mod_booking/bookingimages/1/Aerial_yoga.png",
        "location": "1",
        "address": "1090 Wien Tendlergasse 11",
        "institution": "TENDLERGASSE",
        "duration": "0 days  1 hours  0 minutes",
        "booknowbutton": null,
        "teachers": [
            "Maxima Yoga"
        ],
        "price": "79.00",
        "priceformulaadd": "0.00",
        "priceformulamultiply": "1.00",
        "currency": "EUR",
        "pricecategoryname": "Price",
        "dayofweektime": "FR, 10:30 - 11:45",
        "sport": "Aerial Yoga",
        "customfields": {
            "sport": [
            "AERIAL YOGA"
            ],
            "botags": [
            ""
            ]
        },
        "bookinginformation": {
            "waiting": 0,
            "booked": 1,
            "reserved": 0,
            "onnotifylist": false,
            "maxanswers": "12",
            "freeonlist": 11,
            "fullybooked": false,
            "showmanageresponses": true,
            "manageresponsesurl": "http://localhost:58000/mod/booking/report.php?id=7&optionid=1"
        },
        "usertobuyfor": {
            "id": "2",
            "auth": "manual",
            "confirmed": "1",
            "policyagreed": "0",
            "deleted": "0",
            "suspended": "0",
            "mnethostid": "1",
            "username": "admin",
            "password": "$2y$10$pAVtIFwAUH\bNSuVXjTgouqEjgxoYMb74bTiF0UEEoHJkKhrK0QdG",
            "idnumber": "",
            "firstname": "Admin",
            "lastname": "User",
            "email": "install@wunderbyte.at",
            "emailstop": "0",
            "phone1": "",
            "phone2": "",
            "institution": "",
            "department": "",
            "address": "",
            "city": "",
            "country": "",
            "lang": "en",
            "calendartype": "gregorian",
            "theme": "",
            "timezone": "99",
            "firstaccess": "1669485049",
            "lastaccess": "1678538409",
            "lastlogin": "1678350420",
            "currentlogin": "1678533798",
            "lastip": "10.0.2.2",
            "secret": "",
            "picture": "0",
            "description": "",
            "descriptionformat": "1",
            "mailformat": "1",
            "maildigest": "0",
            "maildisplay": "1",
            "autosubscribe": "1",
            "trackforums": "0",
            "timecreated": "0",
            "timemodified": "1669485103",
            "trustbitmask": "0",
            "imagealt": null,
            "lastnamephonetic": "",
            "firstnamephonetic": "",
            "middlename": "",
            "alternatename": "",
            "moodlenetprofile": null,
            "profile": []
        },
        "bookitsection": " HTML of Booked button",
        "unitstring": "Units: 1.3",
        "showmanageresponses": true,
        "manageresponsesurl": "http://site/mod/booking/report.php?id=7&optionid=1"
    }
}}


<div class="container-fluid">
    <div class="row">
        <div class="col-md-12 d-flex mb-3">
            <!-- Left Button -->
            <span class="spanhidemobile">
            {{#returnurl}}
                <a href="{{returnurl}}" role="button" class="btn mr-auto d-flex justify-content-start align-items-center">
                    <i class="fa-solid fa-arrow-left smallericon" style="margin-right: 8px"></i>
                    {{#str}} back, mod_booking {{/str}}
                </a>
            {{/returnurl}}
            </span>
            <!-- Right Button -->
            {{#editurl}}
                <a href="{{editurl}}" role="button" class="btn btn-light ml-auto">
                    <i class="fa-solid fa-pen smallericon" style="margin-right: 8px"></i>
                    {{#str}} edit {{/str}}
                </a>
            {{/editurl}}
        </div>
    </div>
    <div class="row mod-booking-row">
        <div class="col-md-7">
            <h2 class="title" >{{{title}}}</h2>
            {{#invisible}}
                <div class="booking-option-info-invisible">{{#str}} invisibleoption, mod_booking {{/str}}</div>
            {{/invisible}}
            {{#statusdescription}}<div class="bo_statusdescription"><p>{{{.}}}</p></div>{{/statusdescription}}
            <h6 class="h6-category">
                {{sport}}
            </h6>
            {{#description}}<div class="content"><p>{{{.}}}</p></div>{{/description}}
            {{#optionviewcustomfields}}{{{.}}}{{/optionviewcustomfields}}
            {{#attachments}}{{{.}}}{{/attachments}}
            {{> mod_booking/bookingoption_description_teachers }}
            {{> mod_booking/bookingoption_description_dates }}
            {{#selflearningcourseshowdurationinfo}}
                <div>
                    <i class="fa fa-fw fa-clock-o" aria-hidden="true"></i>&nbsp;
                    {{^timeremaining}}
                        {{#str}}selflearningcoursedurationinfo, mod_booking, {{duration}}{{/str}}
                    {{/timeremaining}}
                    {{#timeremaining}}
                        {{#str}}selflearningcoursetimeremaininginfo, mod_booking, {{timeremaining}}{{/str}}
                    {{/timeremaining}}
                </div>
            {{/selflearningcourseshowdurationinfo}}
            {{#selflearningcourseshowdurationinfoexpired}}
                <i class="fa fa-fw fa-clock-o" aria-hidden="true"></i>&nbsp;
                {{#str}} selflearningcoursetimeremaininginfoexpired, booking {{/str}}
            {{/selflearningcourseshowdurationinfoexpired}}
        </div>
        <div class="col-md-5">
            <div class="card price-card">
                {{#imageurl}}
                <img class="w-100" src="{{imageurl}}" alt="{{{title}}}">
                {{/imageurl}}
                {{{ bookitsection }}}
                <div class="card-body">
                    <ul class="infolist" style="list-style: none;">
                        {{#dayofweektime}}
                        <li>
                            <span>
                                <i class="fa fa-fw fa-clock-o" aria-hidden="true"></i>
                            </span>
                            <span class="d-md-none">
                                {{#str}} dayofweektime, mod_booking {{/str}}
                            </span>
                                {{.}}
                            <span>
                                {{#unitstring}} ({{.}}) {{/unitstring}}
                            </span>
                        </li>
                        {{/dayofweektime}}
                        {{#location}}
                        <li>
                            <span>
                                <i class="fa fa-fw fa-map-marker" aria-hidden="true"></i>
                            </span>
                            <span class="d-md-none">
                                {{#str}} location, mod_booking {{/str}}:
                            </span>
                            <span>
                                {{{.}}}
                            </span>
                        </li>
                        {{/location}}
                        {{#institution}}
                        <li>
                            <span>
                                <i class="fa fa-fw fa-building-o" aria-hidden="true"></i>
                            </span>
                            <span class="d-md-none">
                                {{#str}} institution, mod_booking {{/str}}:
                            </span>
                            <span>
                                {{{.}}}
                            </span>
                        </li>
                        {{/institution}}
                        {{#responsiblecontactuser}}
                        <li>
                            <span>
                                <i class="fa fa-fw fa-user" aria-hidden="true"></i>
                            </span>
                            <span>
                                {{#str}} responsible, mod_booking {{/str}}: <a href="{{link}}" target="_blank">{{firstname}} {{lastname}}</a>
                            </span>
                        </li>
                        {{/responsiblecontactuser}}
                        {{#bookingopeningtime}}
                        <li>
                            <span>
                                <i class="fa fa-fw fa-forward" aria-hidden="true"></i>
                            </span>
                            <span>
                                {{#str}} bookingopeningtime, mod_booking {{/str}}: {{{.}}}
                            </span>
                        </li>
                        {{/bookingopeningtime}}
                        {{#bookingclosingtime}}
                        <li>
                            <span>
                                <i class="fa fa-fw fa-step-forward" aria-hidden="true"></i>
                            </span>
                            <span>
                                {{#str}} bookingclosingtime, mod_booking {{/str}}: {{{.}}}
                            </span>
                        </li>
                        {{/bookingclosingtime}}
                        {{#bookinginformation}}
                        <li>
                            <div class="col-ap-availableplaces">
                                <span><i class="fa fa-fw fa-ticket" aria-hidden="true"></i></span>
                                {{> booking/col_availableplaces }}
                            </div>
                        </li>
                        {{#minanswers}}
                        <li>
                            <div class="col-ap-minanswers">
                                <span><i class="fa fa-fw fa-arrow-up" aria-hidden="true"></i></span>
                                {{#str}} minanswers, mod_booking {{/str}}: {{.}}
                            </div>
                        </li>
                        {{/minanswers}}
                        {{#canceluntil}}
                        <li>
                            <div class="col-ap-canceluntilinfo">
                                <span><i class="fa fa-fw fa-sign-out" aria-hidden="true"></i></span>
                                {{#canstillbecancelled}}
                                    {{#str}}bookingoptioncanbecancelleduntil, mod_booking, {{canceluntil}}{{/str}}
                                {{/canstillbecancelled}}
                                {{^canstillbecancelled}}
                                    {{#str}}bookingoptioncantbecancelledanymore, mod_booking, {{canceluntil}}{{/str}}
                                {{/canstillbecancelled}}
                            </div>
                        </li>
                        {{/canceluntil}}
                        {{/bookinginformation}}
                    </ul>
                    {{#subpluginstemplatedata}}
                            <div class="col-ap-{{label}}">
                                <div>
                                    {{description}}
                                </div>
                                <div id={{key}}>
                                  {{{value}}}
                                </div>
                            </div>
                        {{/subpluginstemplatedata}}
                </div>
            </div>
        </div>
        {{#competencyheader}}
            <details class="competency">
                <summary class="competencyheader">
                    {{competencyheader}}
                </summary>
                <div class="competencycontent">
                    {{{competencies}}}
                </div>
            </details>
        {{/competencyheader}}
    </div>
</div>

{{#js}}
    require(['local_shopping_cart/cart'], function(cart) {
    cart.buttoninit({{modalcounter}}, "mod_booking");
    });
{{/js}}