Bug 15091: DEBT is IMPOSSIBLE, not NEEDSCONFIRMATION
[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             $("div#reldebarments .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 ( not debarments.defined || 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 && CAN_user_circulate_manage_restrictions %]
35                          <th>&nbsp;</th>
36                      [% END %]
37                 </tr>
38             </thead>
39             <tbody>
40                 [% FOREACH d IN debarments %]
41                     <tr>
42                         <td>
43                             [% SWITCH d.type %]
44                                 [% CASE 'MANUAL' %]
45                                     Manual
46                                 [% CASE 'OVERDUES' %]
47                                     Overdues
48                                 [% CASE 'SUSPENSION' %]
49                                     Suspension
50                                 [% CASE 'DISCHARGE' %]
51                                     Discharge
52                             [% END %]
53                         </td>
54                         <td>[% d.comment %]</td>
55                         <td>[% IF d.expiration %] [% d.expiration | $KohaDates %] [% ELSE %] <i>Indefinite</i> [% END %]</td>
56                         [% IF CAN_user_borrowers && CAN_user_circulate_manage_restrictions %]
57                             <td>
58                                 <a class="remove_restriction" href="/cgi-bin/koha/members/mod_debarment.pl?borrowernumber=[% borrowernumber %]&amp;borrower_debarment_id=[% d.borrower_debarment_id %]&amp;action=del">
59                                     Remove
60                                 </a>
61                             </td>
62                         [% END %]
63                     </tr>
64                 [% END %]
65             </tbody>
66         </table>
67     [% END %]
68     [% IF CAN_user_borrowers && CAN_user_circulate_manage_restrictions %]
69         <p><a href="#" id="add_manual_restriction">Add manual restriction</a></p>
70         <form method="post" action="/cgi-bin/koha/members/mod_debarment.pl" class="clearfix">
71             <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
72             <input type="hidden" name="action" value="add" />
73             <fieldset class="rows" id="manual_restriction_form">
74                 <legend>Add manual restriction</legend>
75                 <ol>
76                     <li><label for="rcomment">Comment:</label> <input type="text" id="rcomment" name="comment" /></li>
77                     <li><label for="rexpiration">Expiration:</label> <input name="expiration" id="rexpiration" size="10" readonly="readonly" value="" class="datepicker" />
78                         <a href='#' onclick="document.getElementById('expiration').value='';">Clear date</a></li>
79                 </ol>
80             <fieldset class="action"><input type="submit" value="Add restriction" /> <a href="#" class="cancel" id="cancel_manual_restriction">Cancel</a></fieldset>
81             </fieldset>
82         </form>
83     [% END %]
84 </div>