Bug 18529 - Template cleanup of patron clubs pages
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / clubs / enroll.tt
blob3d9d684810f1b8ef392476aa35296dea3977d5af
1 [% USE AuthorisedValues %]
2 [% SET AuthorisedValuesCategories = AuthorisedValues.GetCategories %]
4 <h3>
5     Enroll in <i>[% club.name %]</i>
6 </h3>
8 <div class="container">
9     <form id="patron-enrollment-form">
10         <input type="hidden" name="id" value="[% club.id %]" />
11         <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
12         <fieldset class="rows">
13             <ol>
14                 [% FOREACH f IN club.club_template.club_template_enrollment_fields %]
15                     <li>
16                         <label>[% f.name %]</label>
17                         [% IF f.authorised_value_category %]
18                             <select name="[% f.id %]">
19                                 [% FOREACH a IN AuthorisedValues.Get( f.authorised_value_category ) %]
20                                     <option value="[% a.authorised_value %]">[% a.lib %]</option>
21                                 [% END %]
22                             </select>
23                         [% ELSE %]
24                             <input type="text" name="[% f.id %]" />
25                         [% END %]
26                         <span class="hint">[% f.description %]</span>
27                     </li>
28                 [% END %]
30                 <li>
31                     <button class="btn btn-default" onclick="addEnrollment(); return false;">Finish enrollment</button>
32                     <a href="#" onclick="showClubs(); return false;">Cancel</a>
33                 </li>
34             </ol>
35         </fieldset>
36     </form>
37 </div>
39 <script type="text/javascript">
40 function addEnrollment() {
41     $("body").css("cursor", "progress");
42     $.ajax({
43         type: "POST",
44         url: '/cgi-bin/koha/svc/club/enroll',
45         data: $( "#patron-enrollment-form" ).serialize(),
46         success: function( data ) {
47             if ( data.success ) {
48                 $('#opac-user-clubs').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrowernumber %]&id=[% club.id %]', function() {
49                     $("body").css("cursor", "default");
50                 });
51             } else {
52                 alert(_("Unable to create enrollment!"));
53             }
54         },
55         dataType: 'json'
56     });
57     return false;
60 function showClubs() {
61     $("body").css("cursor", "progress");
62     $('#opac-user-clubs').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrowernumber %]&id=[% club.id %]', function() {
63         $("body").css("cursor", "default");
64     });
66 </script>