]> git.koha-community.org Git - koha.git/blob - koha-tmpl/opac-tmpl/bootstrap/en/modules/clubs/enroll.tt
Bug 35941: Limit club list to those from the logged in user
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / clubs / enroll.tt
1 [% USE AuthorisedValues %]
2
3 <h2>
4     Enroll in <em>[% club.name | html %]</em>
5 </h2>
6
7 <div class="container">
8     <form id="patron-enrollment-form">
9         <legend class="sr-only">Enrollment</legend>
10         <input type="hidden" name="id" value="[% club.id | html %]" />
11         <fieldset class="rows">
12             <ol>
13                 [% FOREACH f IN club.club_template.club_template_enrollment_fields %]
14                     <li>
15                         <label>[% f.name | html %]</label>
16                         [% IF f.authorised_value_category %]
17                             <select name="[% f.id | html %]">
18                                 [% FOREACH a IN AuthorisedValues.Get( f.authorised_value_category ) %]
19                                     <option value="[% a.authorised_value | html %]">[% a.lib | html %]</option>
20                                 [% END %]
21                             </select>
22                         [% ELSE %]
23                             <input type="text" name="[% f.id | html %]" />
24                         [% END %]
25                         <span class="hint">[% f.description | html %]</span>
26                     </li>
27                 [% END %]
28             </ol>
29         </fieldset>
30         <fieldset class="action">
31             <button class="btn btn-primary add_enrollment">Finish enrollment</button>
32             <a href="#" class="cancel show_clubs">Cancel</a>
33         </fieldset>
34     </form>
35 </div>
36
37 <script>
38 function addEnrollment() {
39     $("body").css("cursor", "progress");
40     $.ajax({
41         type: "POST",
42         url: '/cgi-bin/koha/svc/club/enroll',
43         data: $( "#patron-enrollment-form" ).serialize(),
44         success: function( data ) {
45             if ( data.success ) {
46                 $('#opac-user-clubs_panel').load('/cgi-bin/koha/clubs/clubs-tab.pl?id=[% club.id | html %]', function() {
47                     $("body").css("cursor", "default");
48                 });
49             } else {
50                 alert(_("Unable to create enrollment!"));
51             }
52         },
53         dataType: 'json'
54     });
55     return false;
56 }
57
58 function showClubs() {
59     $("body").css("cursor", "progress");
60     $('#opac-user-clubs_panel').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrowernumber | html %]&id=[% club.id | html %]', function() {
61         $("body").css("cursor", "default");
62     });
63 }
64
65     $(document).ready(function(){
66         $(".add_enrollment").on("click", function(e){
67             e.preventDefault();
68             addEnrollment();
69         });
70
71         $(".show_clubs").on("click", function(e){
72             e.preventDefault();
73             showClubs();
74         });
75     });
76 </script>