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

    Classes required for JS:
    * none

    Example context (json):
    {
        "actions": [
            {
                "id": 14,
                "name": "my name",
                "localizedactionname": "Localized action name 1"
            }
        ]
    }
}}

<div class="booking-actions-container">
    <div class="btn btn-success bookingaction-button"
        data-action="edit-or-new"
        data-id="0"
        data-optionid="{{optionid}}"
        data-cmid="{{cmid}}">
        <i class="fa fa-plus-square" aria-hidden="true"></i>&nbsp;{{#str}} bookingactionadd, mod_booking {{/str}}
    </div>
    <ul class="mt-3 list-group booking-actions-list">
        {{#actions}}
        <li class="list-group-item">
            <div class="d-flex justify-content-between">
                <h5><i class="fa fa-puzzle-piece" aria-hidden="true"></i> {{name}}</h5>
                <div class="btn-group" role="group" aria-label="Booking action buttons">
                    <div class="btn btn-sm btn-outline-danger bookingaction-button"
                        data-action="delete"
                        data-id="{{id}}"
                        data-cmid="{{cmid}}"
                        data-optionid="{{optionid}}"
                        data-name="{{name}}">
                        <i class="fa fa-trash" aria-hidden="true"></i> {{#str}} delete {{/str}}
                    </div>
                    <div class="btn btn-sm btn-outline-primary bookingaction-button"
                        data-action="edit-or-new"
                        data-id="{{id}}"
                        data-cmid="{{cmid}}"
                        data-optionid="{{optionid}}"
                        data-name="{{name}}">
                        <i class="fa fa-pencil" aria-hidden="true"></i> {{#str}} edit {{/str}}
                    </div>
                </div>
            </div>
            <div class="container">
                <div class="row">
                    <small>{{localizedactionname}}</small>
                </div>
            </div>
        </li>
        {{/actions}}
    </ul>
</div>

{{#js}}
    require(['mod_booking/dynamicactionsform'], function(init) {
    init.init(['div.bookingaction-button']);
    });
{{/js}}