MDL-69166 core_payment: Add paymentarea to the payment subsystem
[moodle.git] / enrol / fee / templates / payment_region.mustache
CommitLineData
2427b921
SR
1{{!
2 This file is part of Moodle - http://moodle.org/
3
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.
8
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.
13
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/>.
16}}
17{{!
18 @template enrol_fee/payment_region
19
20 This template will render information about course fee along with a button for payment.
21
22 Classes required for JS:
23 * none
24
25 Data attributes required for JS:
2427b921 26 * data-component
7d10f352 27 * data-paymentarea
2427b921 28 * data-componentid
7e112616 29 * data-cost
2427b921
SR
30 * data-description
31
32 Context variables required for this template:
33 * cost - Human readable cost string including amount and currency
2427b921
SR
34 * instanceid - Id of the enrolment instance
35 * description - The description for this purchase
36
37 Example context (json):
38 {
39 "cost": "$108.50",
2427b921
SR
40 "instanceid": 11,
41 "description": "Enrolment in course Introduction to algorithms",
42 "isguestuser": false
43 }
44
45}}
46<div class="enrol_fee_payment_region text-center">
47 {{#isguestuser}}
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>
52 </div>
53 {{/isguestuser}}
54 {{^isguestuser}}
55 <p>{{# str }} paymentrequired {{/ str}}</p>
56 <p><b>{{cost}}</b></p>
57 <button
58 class="btn btn-secondary"
59 type="button"
60 id="gateways-modal-trigger-{{ uniqid }}"
2427b921 61 data-component="enrol_fee"
7d10f352 62 data-paymentarea="fee"
2427b921 63 data-componentid="{{instanceid}}"
7e112616 64 data-cost="{{cost}}"
2427b921
SR
65 data-description={{# quote }}{{description}}{{/ quote }}
66 >
67 {{# str }} sendpaymentbutton, enrol_fee {{/ str }}
68 </button>
69 {{/isguestuser}}
70</div>
71{{#js}}
72 require(['core_payment/gateways_modal'], function(modal) {
73 modal.registerEventListeners(document.querySelector('#gateways-modal-trigger-{{ uniqid }}'));
74 });
75{{/js}}