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

    Classes required for JS:
    * none

    Data attributes required for JS:
    * data-action
    * data-id
    * data-bookingcampaigntype
    * data-name

    Example context (json):
    {
        "campaigns" : {
            "id" : "1",
            "bookingcampaigntype" : "campaign_customfield",
            "name" : "My campaign",
            "description" : "Affects: Booking option custom field 'sport' having the value 'TAUCHEN'.",
            "localizedtype" : "Change price or booking limit",
            "localizedstart" : "Apr 04 2023, 15:52",
            "localizedend" : "Apr 30 2023, 15:52"
        }
    }
}}

<div class="booking-campaigns-container">
    <div class="btn btn-success booking-campaigns-addnewcampaignbtn" data-action="edit-or-new" data-id="0">
        <i class="fa fa-plus-square" aria-hidden="true"></i>&nbsp;{{#str}} addbookingcampaign, mod_booking {{/str}}
    </div>
    <ul class="mt-3 list-group booking-campaigns-list">
        {{#campaigns}}
        <li class="list-group-item">
            <div class="d-flex justify-content-between">
                <h5>{{name}}</h5>
                <div class="btn-group" role="group" aria-label="Booking campaign buttons">
                    <div class="btn btn-sm btn-outline-danger" data-action="delete" data-id="{{id}}" data-bookingcampaigntype="{{bookingcampaigntype}}" data-name="{{name}}">
                        <i class="fa fa-trash" aria-hidden="true"></i> {{#str}} delete {{/str}}
                    </div>
                    <div class="btn btn-sm btn-outline-primary" data-action="edit-or-new" data-id="{{id}}" data-bookingcampaigntype="{{bookingcampaigntype}}">
                        <i class="fa fa-pencil" aria-hidden="true"></i> {{#str}} edit {{/str}}
                    </div>
                </div>
            </div>
            <div class="container">
                <div class="row">
                    <div class="col-sm-1 text-right">
                        <small><i class="fa fa-circle" aria-hidden="true"></i></small>
                    </div>
                    <div class="col-sm-11">
                        <small>{{localizedtype}}</small>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-1 text-right">
                        <small><i class="fa fa-info-circle" aria-hidden="true"></i></small>
                    </div>
                    <div class="col-sm-11">
                        <small>{{description}}</small>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-1 text-right">
                        <small><i class="fa fa-play" aria-hidden="true"></i></small>
                    </div>
                    <div class="col-sm-11">
                        <small>{{localizedstart}}</small>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-1 text-right">
                        <small><i class="fa fa-stop" aria-hidden="true"></i></small>
                    </div>
                    <div class="col-sm-11">
                        <small>{{localizedend}}</small>
                    </div>
                </div>
            </div>
        </li>
        {{/campaigns}}
    </ul>
</div>
