Bug 31095: Remove borrower_debarments and patron_restrictions includes
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / restrictions.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% IF op == 'add_form' %][% IF ( restriction ) %]Modify restriction '[% PROCESS restriction_type_description %]'[% ELSE %]New restriction[% END %][% END %]
7 [% IF op == 'delete_confirm' %]Confirm deletion of restriction '[% PROCESS restriction_type_description %]'[% END %] &rsaquo; Patron restrictions &rsaquo; Administration &rsaquo; Koha
8 </title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 </head>
11
12 <body id="admin_restrictions" class="admin">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'patrons-admin-search.inc' %]
15
16 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
17     <ol>
18     <li>
19         <a href="/cgi-bin/koha/mainpage.pl">Home</a>
20     </li>
21     <li>
22         <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
23     </li>
24
25     [% IF op == 'list' %]
26         <li>
27             <a href="#" aria-current="page">
28                 Patron restrictions
29             </a>
30         </li>
31     [% END %]
32
33     [% IF op == 'add_form' %]
34         <li>
35             <a href="/cgi-bin/koha/admin/restrictions.pl">Patron restrictions</a>
36         </li>
37         [% IF restriction %]
38             <li>
39                 <a href="#" aria-current="page">
40                     Modify restriction '[% PROCESS restriction_type_description %]'
41                 </a>
42             </li>
43         [% ELSE %]
44             <li>
45                 <a href="#" aria-current="page">
46                     New restriction
47                 </a>
48             </li>
49         [% END %]
50     [% END %]
51
52     [% IF op == 'delete_confirm' %]
53         <li>
54             <a href="/cgi-bin/koha/admin/restrictions.pl">Patron restrictions</a>
55         </li>
56         <li>
57             <a href="#" aria-current="page">
58                 Delete restriction?
59             </a>
60         </li>
61     [% END %]
62     </ol>
63 </nav>
64
65 <div class="main container-fluid">
66     <div class="row">
67         <div class="col-sm-10 col-sm-push-2">
68             <main>
69
70 [% FOR m IN messages %]
71     <div class="dialog [% m.type | html %]">
72         [% SWITCH m.code %]
73         [% CASE 'add_success' %]
74             Type added
75         [% CASE 'update_success' %]
76             Type updated
77         [% CASE 'duplicate_display_text' %]
78             Another restriction already has this label
79         [% CASE 'duplicate_code' %]
80             Another restriction already has this code
81         [% CASE 'delete_success' %]
82             Type deleted
83         [% CASE 'delete_default' %]
84             Cannot delete the default type
85         [% CASE 'delete_system' %]
86             Cannot delete a system type
87         [% CASE %]
88             [% m.code | html %]
89         [% END %]
90     </div>
91 [% END %]
92
93 [% IF op == 'add_form' %]
94     <form id="restriction_form" action="/cgi-bin/koha/admin/restrictions.pl" method="post">
95         <input type="hidden" name="op" value="add_validate" />
96         <input type="hidden" name="checked" value="0" />
97         [% IF restriction %]
98             <h1>Modify restriction [% PROCESS restriction_type_description %]</h1>
99             <input type="hidden" name="is_a_modif" value="1" />
100         [% ELSE %]
101             <h1>New restriction</h1>
102         [% END %]
103         <fieldset class="rows">
104             <ol>
105                 [% IF restriction %]
106                     <li>
107                         <span class="label">Code: </span>[% restriction.code | html %]
108                         <input type="hidden" name="code" value="[% restriction.code | html %]" />
109                     </li>
110                     <li>
111                         <label for="display_text" class="required">Label: </label>
112                         <input type="text" value="[% restriction.display_text | html %]" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" />
113                         <span class="required">Required</span>
114                     </li>
115                 [% ELSE %]
116                     <li>
117                         <label for="code" class="required">Code: </label>
118                         <input type="text" name="code" id="code" size="50" maxlength="50" class="required type_input " required="required" />
119                         <span class="required">Required</span>
120                     </li>
121                     <li>
122                         <label for="display_text" class="required">Label: </label>
123                         <input type="text" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" />
124                         <span class="required">Required</span>
125                     </li>
126                 [% END %]
127             </ol>
128         </fieldset>
129
130         <fieldset class="action">
131             <input type="submit" class="btn btn-primary" value="Save" />
132             <a href="/cgi-bin/koha/admin/restrictions.pl" class="cancel">Cancel</a>
133         </fieldset>
134     </form>
135 [% END %]
136
137 [% IF op == 'delete_confirm' %]
138     <form action="/cgi-bin/koha/admin/restrictions.pl" method="post">
139         <fieldset>
140             <legend>
141                 Confirm restriction deletion
142             </legend>
143
144             <p>Are you sure you want to delete "[% PROCESS restriction_type_description %]"?</p>
145
146             <fieldset class="action">
147                 <input type="hidden" name="op" value="delete_confirmed" />
148                 <input type="hidden" name="code" value="[% restriction.code | html %]" />
149                 <input type="submit" class="btn btn-primary" value="Delete this restriction" />
150                 <a class="cancel" href="/cgi-bin/koha/admin/restrictions.pl">Cancel</a>
151             </fieldset>
152         </fieldset>
153     </form>
154 [% END %]
155
156 [% IF op == 'list' %]
157
158     <div id="toolbar" class="btn-toolbar">
159         <a class="btn btn-default" id="newrestriction" href="/cgi-bin/koha/admin/restrictions.pl?op=add_form"><i class="fa fa-plus"></i> New restriction</a>
160     </div>
161
162     <h1>Patron restrictions</h1>
163     [% IF searchfield %]
164         You Searched for [% searchfield | html %]</span>
165     [% END %]
166     [% IF restrictions %]
167         <div class="page-section">
168             <table id="restriction_types">
169                 <thead>
170                     <tr>
171                         <th scope="col">Code</th>
172                         <th scope="col">Label</th>
173                         <th scope="col">Default</th>
174                         <th scope="col">Actions</th>
175                     </tr>
176                 </thead>
177                 <tbody>
178                     [% FOREACH restriction IN restrictions %]
179                         <tr>
180                             <td>
181                                 [% restriction.code | html %]
182                             </td>
183                             <td>
184                                 [% PROCESS restriction_type_description %]
185                             </td>
186                             <td>
187                                 [% IF restriction.is_default %]Yes[% END %]
188                             </td>
189                             <td class="actions">
190                                 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/restrictions.pl?op=add_form&amp;code=[% restriction.code | uri %]"><i class="fa fa-pencil"></i> Edit</a>
191                                 [% IF !restriction.is_system && !restriction.is_default %]
192                                     <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/restrictions.pl?op=delete_confirm&amp;code=[% restriction.code | uri %]"><i class="fa fa-trash"></i> Delete</a>
193                                 [% END %]
194                                 [% IF !restriction.is_system && !restriction.is_default %]
195                                     <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/restrictions.pl?op=make_default&amp;code=[% restriction.code | uri %]"><i class="fa fa-archive"></i> Make default</a>
196                                 [% END %]
197                             </td>
198                         </tr>
199                     [% END %]
200                 </tbody>
201             </table>
202         </div><!-- /.page-section -->
203     [% ELSE %]
204         <div class="dialog alert">No restrictions have been defined. <a href="/cgi-bin/koha/admin/restrictions.pl?op=add_form">Create a new restriction</a>.</div>
205     [% END %]
206 [% END %]
207
208             </main>
209         </div> <!-- /.col-sm-10.col-sm-push-2 -->
210
211         <div class="col-sm-2 col-sm-pull-10">
212             <aside>
213                 [% INCLUDE 'admin-menu.inc' %]
214             </aside>
215         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
216      </div> <!-- /.row -->
217
218 [% MACRO jsinclude BLOCK %]
219     [% Asset.js("js/admin-menu.js") | $raw %]
220     [% INCLUDE 'datatables.inc' %]
221     [% INCLUDE 'columns_settings.inc' %]
222     <script>
223         var MSG_DUPLICATE_CODE = _("Restriction code is already in use");
224         var MSG_DUPLICATE_DISPLAY_TEXT = _("Label is already in use");
225         var existing = {
226         [% FOREACH ex IN existing %]
227             [% ex.code | $raw %]: '[% ex.display_text | $raw %]',
228         [% END %]
229         };
230     </script>
231     [% Asset.js("js/restrictiontypes.js") | $raw %]
232 [% END %]
233 [% INCLUDE 'intranet-bottom.inc' %]