2 This file is part of Moodle - http://moodle.org/
4 Moodle is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 Moodle is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 @template enrol_fee/payment_region
20 This template will render information about course fee along with a button for payment.
22 Classes required for JS:
25 Data attributes required for JS:
32 Context variables required for this template:
33 * cost - Human readable cost string including amount and currency
34 * instanceid - Id of the enrolment instance
35 * description - The description for this purchase
37 Example context (json):
41 "description": "Enrolment in course Introduction to algorithms",
46 <div class="enrol_fee_payment_region text-center">
48 <div class="mdl-align">
49 <p>{{# str }} paymentrequired {{/ str}}</p>
50 <p><b>{{cost}}</b></p>
51 <p><a href="{{config.wwwroot}}/login/">{{# str }} loginsite {{/ str }}</a></p>
55 <p>{{# str }} paymentrequired {{/ str}}</p>
56 <p><b>{{cost}}</b></p>
58 class="btn btn-secondary"
60 id="gateways-modal-trigger-{{ uniqid }}"
61 data-component="enrol_fee"
62 data-paymentarea="fee"
63 data-componentid="{{instanceid}}"
65 data-description={{# quote }}{{description}}{{/ quote }}
67 {{# str }} sendpaymentbutton, enrol_fee {{/ str }}
72 require(['core_payment/gateways_modal'], function(modal) {
73 modal.registerEventListeners(document.querySelector('#gateways-modal-trigger-{{ uniqid }}'));