Bug 2720: (follow-up) improve data entry form for manual restrictions
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / borrower_debarments.inc
1 <script type="text/javascript">
2    //<![CDATA[
3         $(document).ready(function(e){
4             $("#remove_restriction").on("click",function(){
5                 return confirm(_("Remove restriction?"));
6             });
7             var mrform = $("#manual_restriction_form");
8             var mrlink = $("#add_manual_restriction");
9             mrform.hide();
10             mrlink.on("click",function(e){
11                 $(this).hide();
12                 mrform.show();
13                 e.preventDefault();
14             });
15             $("#cancel_manual_restriction").on("click",function(e){
16                 mrlink.show();
17                 mrform.hide();
18                 e.preventDefault();
19             });
20         })
21     //]]>
22 </script>
23
24 <div id="reldebarments">
25     [% IF ( debarments.size < 1 ) %]
26         <p>Patron is currently unrestricted.</p>
27     [% ELSE %]
28         <table>
29             <thead>
30                 <tr>
31                      <th>Type</th>
32                      <th>Comment</th>
33                      <th>Expiration</th>
34                      [% IF ( CAN_user_borrowers ) %]
35                          <th>&nbsp;</th>
36                      [% END %]
37                 </tr>
38             </thead>
39             <tbody>
40                 [% FOREACH d IN debarments %]
41                     <tr>
42                         <td>[% d.type %]</td>
43                         <td>[% d.comment %]</td>
44                         <td>[% IF d.expiration %] [% d.expiration | $KohaDates %] [% ELSE %] <i>Indefinite</i> [% END %]</td>
45                         [% IF ( CAN_user_borrowers )%]
46                             <td>
47                                 <a id="remove_restriction" href="/cgi-bin/koha/members/mod_debarment.pl?borrowernumber=[% borrowernumber %]&amp;borrower_debarment_id=[% d.borrower_debarment_id %]&amp;action=del">
48                                     Remove
49                                 </a>
50                             </td>
51                         [% END %]
52                     </tr>
53                 [% END %]
54             </tbody>
55         </table>
56     [% END %]
57     <p><a href="#" id="add_manual_restriction">Add manual restriction</a></p>
58     [% IF ( CAN_user_borrowers )%]
59         <form method="post" action="/cgi-bin/koha/members/mod_debarment.pl" class="clearfix">
60             <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
61             <input type="hidden" name="action" value="add" />
62             <fieldset class="rows" id="manual_restriction_form">
63                 <legend>Add manual restriction</legend>
64                 <ol>
65                     <li><label for="rcomment">Comment:</label> <input type="text" id="rcomment" name="comment" /></li>
66                     <li><label for="rexpiration">Expiration:</label> <input name="expiration" id="rexpiration" size="10" readonly="readonly" value="" class="datepicker" />
67                         <a href='#' onclick="document.getElementById('expiration').value='';">Clear date</a></li>
68                 </ol>
69             <fieldset class="action"><input type="submit" value="Add restriction" /> <a href="#" class="cancel" id="cancel_manual_restriction">Cancel</a></fieldset>
70             </fieldset>
71         </form>
72     [% END %]
73 </div>