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