Bug 25166: Add "aria-hidden = true" to Font Awesome icons in the OPAC
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / clubs / clubs-tab.tt
1 [% USE KohaDates %]
2
3 [% IF enrollments %]
4
5     <h4>Clubs currently enrolled in</h4>
6
7     <table id="clubs-table-enrolled" class="table table-bordered table-striped">
8         <thead>
9             <tr>
10                 <th>Name</th>
11                 <th>Description</th>
12                 <th>Date enrolled</th>
13                 <th>&nbsp;</th>
14             </tr>
15         </thead>
16
17         <tbody>
18             [% FOREACH e IN enrollments %]
19                 <tr>
20                     <td>[% e.club.name | html %]</td>
21                     <td>[% e.club.description | html %]</td>
22                     <td>[% e.date_enrolled | $KohaDates %]</td>
23                     <td>
24                         [% IF e.club.club_template.is_enrollable_from_opac %]
25                             <button class="btn btn-xs btn-default" onclick="cancelEnrollment( [% e.id | html %] )">
26                                 <i class="fa fa-remove" aria-hidden="true"></i> Cancel enrollment
27                             </button>
28                         [% ELSE %]
29                             Contact your library to be disenrolled from this club.
30                         [% END %]
31                     </td>
32                 </tr>
33             [% END %]
34         </tbody>
35     </table>
36 [% END %]
37
38 [% IF clubs %]
39
40     <h4>Clubs you can enroll in</h4>
41
42     <table id="clubs-table-unenrolled" class="table table-bordered table-striped">
43         <thead>
44             <tr>
45                 <th>Name</th>
46                 <th>Description</th>
47                 <th>&nbsp;</th>
48             </tr>
49         </thead>
50
51         <tbody>
52             [% FOREACH c IN clubs %]
53                 <tr>
54                     <td>[% c.name | html %]</td>
55                     <td>[% c.description | html %]</td>
56                     <td>
57                         [% IF !c.club_template.is_email_required || ( c.club_template.is_email_required && borrower.first_valid_email_address ) %]
58                             <button class="btn btn-xs btn-default" onclick="loadEnrollmentForm([% c.id | html%])">
59                                 <i class="fa fa-plus" aria-hidden="true"></i> Enroll
60                             </button>
61                         [% ELSE %]
62                             <span class="hint">You must have an email address to enroll</span>
63                         [% END %]
64                     </td>
65                 </tr>
66             [% END %]
67         </tbody>
68     </table>
69 [% END %]
70
71 <script>
72 function loadEnrollmentForm( id ) {
73     $("body").css("cursor", "progress");
74     $('#opac-user-clubs').load('/cgi-bin/koha/clubs/enroll.pl?borrowernumber=[% borrower.borrowernumber | html %]&id=' + id, function() {
75         $("body").css("cursor", "default");
76     });
77
78     return false;
79 }
80
81 function cancelEnrollment( id ) {
82     $("body").css("cursor", "progress");
83     $.ajax({
84         type: "POST",
85         url: '/cgi-bin/koha/svc/club/cancel_enrollment',
86         data: { id: id },
87         success: function( data ) {
88             if ( data.success ) {
89                 $('#opac-user-clubs').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrower.borrowernumber | html %]', function() {
90                     $("body").css("cursor", "default");
91                 });
92             } else {
93                 alert(_("Unable to cancel enrollment!"));
94             }
95         },
96         dataType: 'json'
97     });
98     return false;
99 }
100 </script>