Bug 34478: Rename action with op - mod_debarment
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / patron-restrictions-tab.inc
1 [% USE raw %]
2 [% USE Koha %]
3 [% PROCESS 'restriction-types.inc' %]
4
5 [% IF ( patron.restrictions.count == 0 ) %]
6     <p>Patron is currently unrestricted.</p>
7 [% ELSE %]
8     <table>
9         <thead>
10             <tr>
11                     <th>Type</th>
12                     <th>Comment</th>
13                     <th>Expiration</th>
14                     <th>Created</th>
15                     [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
16                         <th>&nbsp;</th>
17                     [% END %]
18             </tr>
19         </thead>
20         <tbody>
21             [% FOREACH restriction IN patron.restrictions %]
22                 [% IF restriction.is_expired %]<tr class="expired">[% ELSE %]<tr>[% END %]
23                     <td>
24                         [% PROCESS restriction_type_description restriction_type=restriction.type %]
25                     </td>
26                     <td>
27                         [% IF restriction.comment.search('OVERDUES_PROCESS') %]
28                             <span>Restriction added by overdues process [% restriction.comment.remove('OVERDUES_PROCESS ') | $raw %]</span>
29                         [% ELSE %]
30                             [% restriction.comment | $raw %]
31                         [% END %]
32                     </td>
33                     <td>
34                         [% IF restriction.expiration %]
35                             [% restriction.expiration | $KohaDates %]
36                             [% IF restriction.is_expired %](<span>expired</span>)[% END %]
37                         [% ELSE %]
38                             <em>Indefinite</em>
39                         [% END %]
40                     </td>
41                     <td>[% restriction.created | $KohaDates %]</td>
42                     [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
43                         <td>
44                             <form method="post" action="/cgi-bin/koha/members/mod_debarment.pl">
45                                 [% INCLUDE 'csrf-token.inc' %]
46                                 <input type="hidden" name="op" value="cud-del" />
47                                 <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | uri %]" />
48                                 <input type="hidden" name="borrower_debarment_id" value="[% restriction.borrower_debarment_id | uri %]" />
49                                 <button type="submit" class="remove_restriction btn btn-default btn-xs"><i class="fa fa-trash-can"></i> Remove</button>
50                             </form>
51                         </td>
52                     [% END %]
53                 </tr>
54             [% END %]
55         </tbody>
56     </table>
57 [% END %]
58 [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
59     <p><a href="#" id="add_manual_restriction"><i class="fa fa-plus"></i> Add manual restriction</a></p>
60     <form method="post" action="/cgi-bin/koha/members/mod_debarment.pl" class="clearfix">
61         [% INCLUDE 'csrf-token.inc' %]
62         <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
63         <input type="hidden" name="op" value="cud-add" />
64         <fieldset class="rows" id="manual_restriction_form">
65             <legend>Add manual restriction</legend>
66             <ol>
67                 [% IF Koha.Preference('PatronRestrictionTypes') %]
68                 <li>
69                     <label for="debarred_type">Type:</label>
70                     <select name="debarred_type">
71                         [% FOREACH restriction_type IN restriction_types %]
72                             [% IF !restriction_type.is_system %]
73                                 [% IF restriction_type.is_default %]
74                                 <option value="[% restriction_type.code | html %]" selected>[% PROCESS restriction_type_description %]</option>
75                                 [% ELSE %]
76                                 <option value="[% restriction_type.code | html %]">[% PROCESS restriction_type_description %]</option>
77                                 [% END %]
78                             [% END %]
79                         [% END %]
80                     </select>
81                 </li>
82                 [% END %]
83                 <li><label for="rcomment">Comment:</label> <input type="text" id="rcomment" name="comment" /></li>
84                 <li>
85                     <label for="rexpiration">Expiration:</label>
86                     <input name="expiration" id="rexpiration" size="20" value="" class="flatpickr" data-flatpickr-futuredate="true" type="text" />
87                 </li>
88             </ol>
89         <fieldset class="action"><input type="submit" value="Add restriction" /> <a href="#" class="cancel" id="cancel_manual_restriction">Cancel</a></fieldset>
90         </fieldset>
91     </form>
92 [% END %]