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

    Classes required for JS:
    * none

    Data attributes required for JS:
    * data-region

    Example context (json):
    {
        "itemname" : "myitem",
        "price" : "10",
        "currency" : "EUR",
        "componentname" : "local_shoppingcart",
        "description" : "description",
        "imageurl" : "https://mypic.jpg",
        "pricecategoryidentifier" : "categoryid",
        "pricecategoryname" : "student"
    }
}}
{{#onlist}}
    <div class="booking-button-notifyarea mb-3">
        {{> mod_booking/button_notifyme }}
    </div>
{{/onlist}}
{{#price}}
<div class="w-100 d-flex justify-content-center booking-button-area"
    data-itemid="{{itemid}}"
    data-area="{{area}}"
    data-results="{{results}}"
    {{#dataaction}}data-action="{{dataaction}}"{{/dataaction}} >
    {{#top}}
        <div class="booking-button-toparea mb-2 {{class}}" role="{{role}}">
            {{{label}}}
        </div>
    {{/top}}
    <div class="pricecontainer mb-2 {{#fullwidth}}w-100{{/fullwidth}}">
        <span class="pricecurrency h5 text-nowrap">
            {{#priceformatted}}{{priceformatted}} {{currency}}{{/priceformatted}}
            {{^priceformatted}}{{price}} {{currency}}{{/priceformatted}}
        </span>
        {{#shoppingcartisavailable}}
            {{#link}}<a href="{{link}}" target="_blank" data-action='bookondetails'>{{/link}}
            <div class="bookit-addtocartbtn-area">
                {{> local_shopping_cart/addtocartdb }}
            </div>
            {{#link}}</a>{{/link}}
        {{/shoppingcartisavailable}}
        {{#priceitems}}
            <p><i>{{pricecategoryname}}</i></p>
        {{/priceitems}}
    </div>
    {{#sub}}
        <div class="booking-button-subarea mb-2 h6 {{class}}" role="{{role}}">
            {{{label}}}
        </div>
    {{/sub}}
</div>
{{/price}}
{{^price}}
    {{#priceitems}}
        <div class="pricecurrency mb-2">
            {{#priceformatted}}{{priceformatted}} {{currency}}{{/priceformatted}}
            {{^priceformatted}}{{price}} {{currency}}{{/priceformatted}}
        <i>{{pricecategoryname}}</i>
        </div>
    {{/priceitems}}
{{/price}}
{{^price}}
    {{#str}} nopriceisset, mod_booking, {{pricecategoryidentifier}} {{/str}}
{{/price}}