Bug 30718: Use flatpickr's altInput
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / categories.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% USE KohaDates %]
6 [% USE Price %]
7 [% USE TablesSettings %]
8 [% SET footerjs = 1 %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>[% IF op == 'add_form' %][% IF ( categorycode ) %]Modify category '[% categorycode | html %]'[% ELSE %]New category[% END %][% END %]
11 [% IF op == 'delete_confirm' %][% IF ( patrons_in_category > 0 ) %]Cannot delete: category [% categorycode | html %] in use[% ELSE %]Confirm deletion of category '[% categorycode | html %]'[% END %][% END %] &rsaquo; Patron categories &rsaquo; Administration &rsaquo; Koha
12 </title>
13 [% INCLUDE 'doc-head-close.inc' %]
14 <style>#enrolmentmessage.hint { display : none; }</style>
15 </head>
16
17 <body id="admin_categorie" class="admin">
18 [% INCLUDE 'header.inc' %]
19 [% INCLUDE 'patrons-admin-search.inc' %]
20
21 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
22     <ol>
23         <li>
24             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
25         </li>
26         <li>
27             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
28         </li>
29
30         [% IF op == 'add_form' %]
31             <li>
32                 <a href="/cgi-bin/koha/admin/categories.pl">Patron categories</a>
33             </li>
34             [% IF ( categorycode ) %]
35                 <li>
36                     <a href="#" aria-current="page">
37                         Modify category '[% categorycode | html %]'
38                     </a>
39                 </li>
40             [% ELSE %]
41                 <li>
42                     <a href="#" aria-current="page">
43                         New category
44                     </a>
45                 </li>
46             [% END %]
47         [% END %]
48
49         [% IF op == 'delete_confirm' %]
50             <li>
51                 <a href="/cgi-bin/koha/admin/categories.pl">Patron categories</a>
52             </li>
53             [% IF ( patrons_in_category > 0 ) %]
54                 <li>
55                     <a href="#" aria-current="page">
56                         Cannot delete: Category [% categorycode | html %] in use
57                     </a>
58                 </li>
59             [% ELSE %]
60                 <li>
61                     <a href="#" aria-current="page">
62                         Confirm deletion of category '[% categorycode | html %]'
63                     </a>
64                 </li>
65             [% END %]
66         [% END %]
67
68         [% IF op == 'delete_confirmed' %]
69             <li>
70                 <a href="/cgi-bin/koha/admin/categories.pl">Patron categories</a>
71             </li>
72             <li>
73                 <a href="#" aria-current="page">
74                     Category deleted
75                 </a>
76             </li>
77         [% END %]
78
79         [% IF op == 'list' %]
80             <li>
81                 <a href="#" aria-current="page">
82                     Patron categories
83                 </a>
84             </li>
85         [% END %]
86     </ol>
87 </nav>
88
89 <div class="main container-fluid">
90     <div class="row">
91         <div class="col-sm-10 col-sm-push-2">
92             <main>
93
94 [% FOR m IN messages %]
95     <div class="dialog [% m.type | html %]">
96         [% SWITCH m.code %]
97         [% CASE 'error_on_update' %]
98             <span>An error occurred when updating this patron category. Perhaps it already exists.</span>
99         [% CASE 'error_on_insert' %]
100             <span>An error occurred when inserting this patron category. The patron category might already exist.</span>
101         [% CASE 'error_on_delete' %]
102             <span>An error occurred when deleting this patron category. Check the logs.</span>
103         [% CASE 'success_on_update' %]
104             <span>Patron category updated successfully.</span>
105         [% CASE 'success_on_insert' %]
106             <span>Patron category inserted successfully.</span>
107         [% CASE 'success_on_delete' %]
108             <span>Patron category deleted successfully.</span>
109         [% CASE 'already_exists' %]
110             <span>This patron category already exists.</span>
111         [% CASE %]
112             <span>[% m.code | html %]</span>
113         [% END %]
114     </div>
115 [% END %]
116
117 [% IF op == 'add_form' %]
118     <form id="category_form" action="/cgi-bin/koha/admin/categories.pl" method="post">
119         <input type="hidden" name="op" value="add_validate" />
120         <input type="hidden" name="checked" value="0" />
121         [% IF category %]
122             <h1>Modify category [% categorycode | html %]</h1>
123         [% ELSE %]
124             <h1>New category</h1>
125         [% END %]
126         <fieldset class="rows">
127             <ol>
128                 [% IF category %]
129                     <li>
130                         <span class="label">Category code: </span>[% categorycode | html %]
131                         <input type="hidden" name="categorycode" value="[% category.categorycode | html %]" /><input type="hidden" name="is_a_modif" value="1" />
132                     </li>
133                 [% ELSE %]
134                     <li>
135                         <label for="categorycode" class="required">Category code: </label>
136                         <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" class="required" required="required" />
137                         <span class="required">Required</span>
138                     </li>
139                 [% END %]
140                 <li>
141                     <label for="description" class="required">Description: </label>
142                     <input type="text" name="description" id="description" size="40" maxlength="80" class="required" required="required" value="[% category.description | html %]" />
143                     <span class="required">Required</span>
144                 </li>
145                 <li>
146                     <span class="label">Enrollment period: </span>
147                     <fieldset>
148                         <legend>Choose one</legend>
149                         <ol>
150                             <li>
151                                 <label for="enrolmentperiod">In months: </label>
152                                 [% IF category.enrolmentperiod %]
153                                     <input type="text" class="enrollmentperiod" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% category.enrolmentperiod | html %]" /> months
154                                [% ELSE %]
155                                     <input type="text" class="enrollmentperiod" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="" /> months
156                                [% END %]
157                             </li>
158                             <li>
159                                 <label for="enrolmentperioddate">Until date: </label>
160                                 <input type="text" class="enrollmentperiod flatpickr" data-flatpickr-futuredate="true" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | html %]" />
161                             </li>
162                         </ol>
163                     </fieldset>
164                 </li>
165                 <li>
166                     <label for="password_expiry_days">Password expiration: </label>
167                     <input type="text" name="password_expiry_days" id="password_expiry_days" value="[% category.password_expiry_days | html %]" size="3" maxlength="5" /> days
168                 </li>
169                 <li>
170                     <label for="dateofbirthrequired">Age required: </label>
171                     <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="[% category.dateofbirthrequired | html %]" size="3" maxlength="3" /> years
172                 </li>
173                 <li>
174                     <label for="upperagelimit">Upperage limit: </label>
175                     <input type="text" name="upperagelimit" id="upperagelimit" size="3" maxlength="3" value="[% category.upperagelimit | html %]" /> years
176                 </li>
177                 <li>
178                     <label for="enrolmentfee">Enrollment fee: </label>
179                     <input type="text" name="enrolmentfee" id="enrolmentfee" size="6" value="[% category.enrolmentfee | $Price on_editing => 1 %]" />
180                 </li>
181                 <li>
182                     <label for="overduenoticerequired">Overdue notice required: </label>
183                     <select name="overduenoticerequired" id="overduenoticerequired">
184                         [% IF category.overduenoticerequired %]
185                             <option value="0">No</option>
186                             <option value="1" selected="selected">Yes</option>
187                         [% ELSE %]
188                             <option value="0" selected="selected">No</option>
189                             <option value="1">Yes</option>
190                         [% END %]
191                     </select>
192                 </li>
193                 <li>
194                     <label for="hidelostitems">Lost items in staff interface: </label>
195                     <select name="hidelostitems" id="hidelostitems">
196                         [% IF category.hidelostitems %]
197                             <option value="0">Shown</option>
198                             <option value="1" selected="selected">Hidden by default</option>
199                         [% ELSE %]
200                             <option value="0" selected="selected">Shown</option>
201                             <option value="1">Hidden by default</option>
202                         [% END %]
203                     </select>
204                 </li>
205                 <li>
206                     <label for="reservefee">Hold fee: </label>
207                     <input type="text" name="reservefee" id="reservefee" size="6" value="[% category.reservefee | $Price on_editing => 1 %]" />
208                 </li>
209                 <li>
210                     <label for="category_type" class="required">Category type: </label>
211                     <select name="category_type" id="category_type">
212                         [% UNLESS category %]<option value="" selected="selected">Select a category type</option>[% ELSE %]<option value="">Select a category type</option>[% END %]
213                         [% IF category and category.category_type == 'A' %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %]
214                         [% IF category and category.category_type == 'C' %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %]
215                         [% IF category and category.category_type == 'S' %]<option value="S" selected="selected">Staff</option>[% ELSE %]<option value="S">Staff</option>[% END %]
216                         [% IF category and category.category_type == 'I' %]<option value="I" selected="selected">Organization</option>[% ELSE %]<option value="I">Organization</option>[% END %]
217                         [% IF category and category.category_type == 'P' %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
218                         [% IF category and category.category_type == 'X' %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
219                     </select>
220                     <span class="required">Required</span>
221                 </li>
222                 <li>
223                     <label for="can_be_guarantee">Can be guarantee</label>
224                     <select name="can_be_guarantee" id="can_be_guarantee">
225                         [% IF category.can_be_guarantee %]
226                             <option value="1" selected>Yes</option>
227                             <option value="0">No</option>
228                         [% ELSE %]
229                             <option value="1">Yes</option>
230                             <option value="0" selected>No</option>
231                         [% END %]
232                     <select>
233                 </li>
234                 <li><label for="branches">Library limitations: </label>
235                     <select id="branches" name="branches" multiple size="10">
236                         <option value="">All libraries</option>
237                         [% PROCESS options_for_libraries libraries => Branches.all( selected => category.get_library_limits, unfiltered => 1, do_not_select_my_library => 1 ) %]
238                     </select>
239                     <div class="hint">Select <em>All libraries</em> if this category type must to be displayed all the time. Otherwise select libraries you want to associate with this value.
240                     </div>
241                 </li>
242                 <li>
243                     <label for="reset_password">Password reset in OPAC: </label>
244                     <select name="reset_password" id="reset_password">
245                       [% IF category.reset_password.defined %]
246                         [% IF category.reset_password %]
247                           [% IF Koha.Preference('OpacResetPassword') %]
248                             <option value="-1">Follow system preference OpacResetPassword (enabled)</option>
249                           [% ELSE %]
250                             <option value="-1">Follow system preference OpacResetPassword (disabled)</option>
251                           [% END %]
252                             <option value="1" selected="selected">Allowed</option>
253                             <option value="0">Not allowed</option>
254                         [% ELSE %]
255                           [% IF Koha.Preference('OpacResetPassword') %]
256                             <option value="-1">Follow system preference OpacResetPassword (enabled)</option>
257                           [% ELSE %]
258                             <option value="-1">Follow system preference OpacResetPassword (disabled)</option>
259                           [% END %]
260                             <option value="1">Allowed</option>
261                             <option value="0" selected="selected">Not allowed</option>
262                         [% END %]
263                       [% ELSE %]
264                           [% IF Koha.Preference('OpacResetPassword') %]
265                             <option value="-1" selected="selected">Follow system preference OpacResetPassword (enabled)</option>
266                           [% ELSE %]
267                             <option value="-1" selected="selected">Follow system preference OpacResetPassword (disabled)</option>
268                           [% END %]
269                             <option value="1">Allowed</option>
270                             <option value="0">Not allowed</option>
271                       [% END %]
272                     </select>
273                 </li>
274                 <li>
275                     <label for="change_password">Password change in OPAC: </label>
276                     <select name="change_password" id="change_password">
277                       [% IF category.change_password.defined %]
278                         [% IF category.change_password %]
279                           [% IF Koha.Preference('OpacPasswordChange') %]
280                             <option value="-1">Follow system preference OpacPasswordChange (enabled)</option>
281                           [% ELSE %]
282                             <option value="-1">Follow system preference OpacPasswordChange (disabled)</option>
283                           [% END %]
284                             <option value="1" selected="selected">Allowed</option>
285                             <option value="0">Not allowed</option>
286                         [% ELSE %]
287                           [% IF Koha.Preference('OpacPasswordChange') %]
288                             <option value="-1">Follow system preference OpacPasswordChange (enabled)</option>
289                           [% ELSE %]
290                             <option value="-1">Follow system preference OpacPasswordChange (disabled)</option>
291                           [% END %]
292                             <option value="1">Allowed</option>
293                             <option value="0" selected="selected">Not allowed</option>
294                         [% END %]
295                       [% ELSE %]
296                           [% IF Koha.Preference('OpacPasswordChange') %]
297                             <option value="-1" selected="selected">Follow system preference OpacPasswordChange (enabled)</option>
298                           [% ELSE %]
299                             <option value="-1" selected="selected">Follow system preference OpacPasswordChange (disabled)</option>
300                           [% END %]
301                             <option value="1">Allowed</option>
302                             <option value="0">Not allowed</option>
303                       [% END %]
304                     </select>
305                 </li>
306                 <li>
307                     <label for="min_password_length">Minimum password length:</label>
308                     <input id="min_password_length" type="text" inputmode="numeric" name="min_password_length" value="[% category.min_password_length | html %]"/>
309                     <div class="hint">Leave blank to use system default ([% Koha.Preference('minPasswordLength') | html %])</div>
310                 </li>
311                 <li class="pwd_setting_wrapper">
312                     <label for="require_strong_password">Require strong password:</label>
313                     <select id="require_strong_password" name="require_strong_password">
314                     [% IF category.require_strong_password.defined %]
315                         [% IF category.require_strong_password %]
316                           [% IF Koha.Preference('RequireStrongPassword') %]
317                             <option value="-1">Follow system preference RequireStrongPassword (yes)</option>
318                           [% ELSE %]
319                             <option value="-1">Follow system preference RequireStrongPassword (no)</option>
320                           [% END %]
321                             <option value="1" selected="selected">Yes</option>
322                             <option value="0">No</option>
323                         [% ELSE %]
324                           [% IF Koha.Preference('RequireStrongPassword') %]
325                             <option value="-1">Follow system preference RequireStrongPassword (yes)</option>
326                           [% ELSE %]
327                             <option value="-1">Follow system preference RequireStrongPassword (no)</option>
328                           [% END %]
329                             <option value="1">Yes</option>
330                             <option value="0" selected="selected">No</option>
331                         [% END %]
332                       [% ELSE %]
333                           [% IF Koha.Preference('RequireStrongPassword') %]
334                             <option value="-1">Follow system preference RequireStrongPassword (yes)</option>
335                           [% ELSE %]
336                             <option value="-1">Follow system preference RequireStrongPassword (no)</option>
337                           [% END %]
338                             <option value="1">Yes</option>
339                             <option value="0">No</option>
340                       [% END %]
341                     </select>
342                 </li>
343                 <li><label for="block_expired">Block expired patrons:</label>
344                     <select name="BlockExpiredPatronOpacActions" id="block_expired">
345                         [% IF not category or category.BlockExpiredPatronOpacActions == -1%]
346                             <option value="-1" selected="selected"> Follow system preference BlockExpiredPatronOpacActions </option>
347                         [% ELSE %]
348                             <option value="-1"> Follow system preference BlockExpiredPatronOpacActions </option>
349                         [% END %]
350
351                         [% IF category and category.BlockExpiredPatronOpacActions == 1 %]
352                             <option value="1" selected="selected"> Block </option>
353                         [% ELSE %]
354                             <option value="1"> Block </option>
355                         [% END %]
356
357                         [% IF category and category.BlockExpiredPatronOpacActions == 0 %]
358                             <option value="0" selected="selected"> Don't block </option>
359                         [% ELSE %]
360                             <option value="0"> Don't block </option>
361                         [% END %]
362                     </select>
363                     <div class="hint">
364                         Choose whether patrons of this category be blocked from public catalog actions such as renewing and placing holds when their cards have expired.
365                     </div>
366                 </li>
367                 [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' )  %]
368                   <li><label for="checkprevcheckout">Check for previous checkouts: </label>
369                       <select name="checkprevcheckout" id="checkprevcheckout">
370                           [% IF category.checkprevcheckout == 'yes' %]
371                           <option value="yes" selected="selected">Yes and try to override system preferences</option>
372                           <option value="no">No and try to override system preferences</option>
373                           <option value="inherit">Inherit from system preferences</option>
374                           [% ELSIF category.checkprevcheckout == 'no' %]
375                           <option value="yes">Yes and try to override system preferences</option>
376                           <option value="no" selected="selected">No and try to override system preferences</option>
377                           <option value="inherit">Inherit from system preferences</option>
378                           [% ELSE %]
379                           <option value="yes">Yes and try to override system preferences</option>
380                           <option value="no">No and try to override system preferences</option>
381                           <option value="inherit" selected="selected">Inherit from system preferences</option>
382                           [% END %]
383                       </select>
384                       <div class="hint">
385                           Choose whether patrons of this category by default are reminded if they try to borrow an item they borrowed before.
386                       </div>
387                   </li>
388                 [% END %]
389                 <li>
390                     <label for="default_privacy">Default privacy: </label>
391                     <select id="default_privacy" name="default_privacy">
392                         [% SET default_privacy = 'default' %]
393                         [% IF category %][% SET default_privacy = category.default_privacy %][% END %]
394                         [% SWITCH default_privacy %]
395                         [% CASE 'forever' %]
396                             <option value="default">Default</option>
397                             <option value="never">Never</option>
398                             <option value="forever" selected="selected">Forever</option>
399                         [% CASE 'never' %]
400                             <option value="default">Default</option>
401                             <option value="never" selected="selected">Never</option>
402                             <option value="forever">Forever</option>
403                         [% CASE %]
404                             <option value="default" selected="selected">Default</option>
405                             <option value="never">Never</option>
406                             <option value="forever">Forever</option>
407                         [% END %]
408                     </select>
409                     <div class="hint">Controls how long a patrons checkout history is kept for new patrons of this category. "Never" anonymizes checkouts on return, and "Forever" keeps a patron's checkout history indefinitely. When set to "Default", the amount of history kept is controlled by the cronjob <em>batch_anonymise.pl</em> which should be set up by your system administrator.</div>
410                 </li>
411                 <li>
412                     <label for="exclude_from_local_holds_priority">Exclude from local holds priority:</label>
413                     <select id="exclude_from_local_holds_priority" name="exclude_from_local_holds_priority">
414                     [% IF category.exclude_from_local_holds_priority %]
415                         <option value="1" selected>Yes</option>
416                         <option value="0">No</option>
417                     [% ELSE %]
418                         <option value="1">Yes</option>
419                         <option value="0" selected>No</option>
420                     [% END %]
421                     </select>
422                     <div class="hint">If <i>Yes</i>, holds placed by patrons of this category will not be given priority</div>
423                 </li>
424             </ol>
425         </fieldset>
426
427         [% IF ( EnhancedMessagingPreferences ) %]
428             <fieldset class="rows">
429                 <legend>Default messaging preferences for this patron category</legend>
430                 [% INCLUDE 'messaging-preference-form.inc' %]
431             </fieldset>
432         [% END %]
433         <fieldset class="action">
434             <input type="submit" value="Save" />
435             <a href="/cgi-bin/koha/admin/categories.pl" class="cancel">Cancel</a>
436         </fieldset>
437     </form>
438 [% END %]
439
440 [% IF op == 'delete_confirm' %]
441     <form action="/cgi-bin/koha/admin/categories.pl" method="post">
442         <fieldset>
443             <legend>
444                 <h1>
445                     [% IF patrons_in_category > 0 %]
446                         <span>Category [% categorycode | html %] is in use. Deletion not possible!</span>
447                     [% ELSE %]
448                         <span>Confirm deletion of category [% categorycode | html %]</span>
449                     [% END %]
450             </h1>
451             </legend>
452
453             [% IF patrons_in_category > 0  %]
454                 <div class="dialog alert">
455                     <strong>This category is used [% patrons_in_category | html %] times</strong>. Deletion not possible
456                 </div>
457             [% END %]
458             <table>
459                 <tr><th scope="row">Category code: </th><td>[% category.categorycode | html %]</td></tr>
460                 <tr><th scope="row">Description: </th><td>[% category.description | html %]</td></tr>
461                 <tr><th scope="row">Enrollment period: </th>
462                     <td>
463                         [% IF category.enrolmentperiod %]
464                             [% category.enrolmentperiod | html %] months
465                         [% ELSE %]
466                             until [% category.enrolmentperioddate | $KohaDates %]
467                         [% END %]
468                     </td>
469                 </tr>
470                 <tr><th scope="row">Password expiration: </th><td>[% category.password_expiry_days | html %] days</td></tr>
471                 <tr><th scope="row">Age required: </th><td>[% category.dateofbirthrequired | html %] years</td></tr>
472                 <tr><th scope="row">Upperage limit: </th><td>[% category.upperagelimit | html %] years</td></tr>
473                 <tr><th scope="row">Enrollment fee: </th><td>[% category.enrolmentfee | $Price %]</td></tr>
474                 <tr><th scope="row">Receives overdue notices: </th><td>[% IF category. overduenoticerequired %]Yes[% ELSE %]No[% END %]</td></tr>
475                 <tr><th scope="row">Lost items in staff interface</th><td>[% IF category.hidelostitems %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
476                 <tr><th scope="row">Hold fee: </th><td>[% category.reservefee | $Price %]</td></tr>
477
478                 [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
479                   <tr>
480                       <th scope="row">Check previous checkouts: </th>
481                       <td>
482                           [% SWITCH category.checkprevcheckout %]
483                           [% CASE 'yes' %]
484                               <span>Yes</span>
485                           [% CASE 'no' %]
486                               <span>No</span>
487                           [% CASE 'inherit' %]
488                               <span>Inherit</span>
489                           [% END %]
490                       </td>
491                   </tr>
492                 [% END %]
493                 <tr><th scope="row">Can be guarantee</th><td>[% IF category.can_be_guarantee %]Yes[% ELSE %]No[% END %]</td></tr>
494                 <tr>
495                     <th scope="row">Default privacy: </th>
496                     <td>
497                         [% SWITCH category.default_privacy %]
498                         [% CASE 'default' %]
499                             <span>Default</span>
500                         [% CASE 'never' %]
501                             <span>Never</span>
502                         [% CASE 'forever' %]
503                             <span>Forever</span>
504                         [% END %]
505                     </td>
506                 </tr>
507             </table>
508             <fieldset class="action">
509                 [% IF patrons_in_category > 0 %]
510                     <input type="submit" value="OK" />
511                 [% ELSE %]
512                     <input type="hidden" name="op" value="delete_confirmed" />
513                     <input type="hidden" name="categorycode" value="[% categorycode | html %]" />
514                     <input type="submit" value="Delete this category" />
515                     <a class="cancel" href="/cgi-bin/koha/admin/categories.pl">Cancel</a>
516                 [% END %]
517             </fieldset>
518         </fieldset>
519     </form>
520 [% END %]
521
522 [% IF op == 'list' %]
523
524     <div id="toolbar" class="btn-toolbar">
525         <a class="btn btn-default" id="newcategory" href="/cgi-bin/koha/admin/categories.pl?op=add_form"><i class="fa fa-plus"></i> New category</a>
526     </div>
527
528     <h1>Patron categories</h1>
529     [% IF searchfield %]
530         You searched for [% searchfield | html %]</span>
531     [% END %]
532     [% IF categories%]
533         <table id="patron_categories">
534             <thead>
535                 <tr>
536                     <th scope="col">Code</th>
537                     <th scope="col">Category name</th>
538                     <th scope="col">Type</th>
539                     <th scope="col">Enrollment period</th>
540                     <th scope="col">Password expiration</th>
541                     <th scope="col">Age required</th>
542                     <th scope="col">Upper age limit</th>
543                     <th scope="col">Enrollment fee</th>
544                     <th scope="col">Overdue</th>
545                     <th scope="col">Lost items</th>
546                     <th scope="col">Hold fee</th>
547                     [% IF ( EnhancedMessagingPreferences ) %]
548                     <th scope="col">Messaging</th>
549                     [% END %]
550                     <th scope="col">Library limitations</th>
551                     [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
552                     <th scope="col">Check previous checkout?</th>
553                     [% END %]
554                     <th scope="col">Can be guarantee</th>
555                     <th scope="col">Default privacy</th>
556                     <th scope="col">Exclude from local holds priority</th>
557                     <th scope="col">Actions</th>
558                 </tr>
559             </thead>
560             <tbody>
561                 [% FOREACH category IN categories %]
562                     <tr>
563                         <td>[% category.categorycode | html %]</td>
564                         <td>
565                             <a href="/cgi-bin/koha/admin/categories.pl?op=add_form&amp;categorycode=[% category.categorycode |uri %]">[% category.description | html %]</a>
566                         </td>
567                         <td>
568                             [% SWITCH category.category_type %]
569                                 [% CASE 'A' %]<span>Adult</span>
570                                 [% CASE 'C' %]<span>Child</span>
571                                 [% CASE 'P' %]<span>Prof.</span>
572                                 [% CASE 'I' %]<span>Org.</span>
573                                 [% CASE 'S' %]<span>Staff</span>
574                                 [% CASE 'X' %]<span>Statistical</span>
575                             [% END %]
576                         </td>
577                         <td>
578                             [% IF ( category.enrolmentperiod ) %]
579                                 [% category.enrolmentperiod | html %] months
580                             [% ELSE %]
581                                 until [% category.enrolmentperioddate | $KohaDates %]
582                             [% END %]
583                         </td>
584                         [% IF (category.password_expiry_days) %]
585                             <td>[% category.password_expiry_days | html %] days</td>
586                         [% ELSE %]
587                             <td>-</td>
588                         [% END %]
589                         [% IF (category.dateofbirthrequired) %]
590                             <td>[% category.dateofbirthrequired | html %] years</td>
591                         [% ELSE %]
592                             <td>-</td>
593                         [% END %]
594                         [% IF (category.upperagelimit) %]
595                             <td>[% category.upperagelimit | html %] years</td>
596                         [% ELSE %]
597                             <td>-</td>
598                         [% END %]
599                         [% IF (category.enrolmentfee > 0) %]
600                             <td>[% category.enrolmentfee | $Price %]</td>
601                         [% ELSE %]
602                             <td>-</td>
603                         [% END %]
604                         <td>[% IF ( category.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td>
605                         <td>[% IF ( category.hidelostitems ) %]Hidden[% ELSE %]Shown[% END %]</td>
606                         [% IF (category.reservefee > 0) %]
607                             <td>[% category.reservefee | $Price %]</td>
608                         [% ELSE %]
609                             <td>-</td>
610                         [% END %]
611                         [% IF Koha.Preference('EnhancedMessagingPreferences') %]
612                             <td style="white-space: nowrap; font-size:80%;">
613                                 [% SET default_messaging = category.default_messaging %]
614                                 [% IF default_messaging.size %]
615                                     [% FOREACH prefs IN default_messaging %]
616                                         [% NEXT IF !Koha.Preference( 'ILLModule' ) && prefs.message_name.match('^Ill_') %]
617                                         [% FOREACH transport IN prefs.transports %]
618                                             [% IF ( transport.transport ) %]
619                                                 [% IF ( prefs.Item_Due ) %]<span>Item due</span>
620                                                 [% ELSIF ( prefs.Advance_Notice ) %]<span>Advance notice</span>
621                                                 [% ELSIF ( prefs.Hold_Filled ) %]<span>Hold filled</span>
622                                                 [% ELSIF ( prefs.Item_Check_in ) %]<span>Item check-in</span>
623                                                 [% ELSIF ( prefs.Item_Checkout ) %]<span>Item checkout</span>
624                                                 [% ELSIF ( prefs.Ill_ready ) %]<span>Interlibrary loan ready</span>
625                                                 [% ELSIF ( prefs.Ill_unavailable ) %]<span>Interlibrary loan unavailable</span>
626                                                 [% ELSIF ( prefs.Auto_Renewals ) %]<span>Auto renewal</span>
627                                                 [% ELSIF ( prefs.Hold_Reminder ) %]<span>Hold reminder</span>
628                                                 [% ELSE %]<span>Unknown</span>
629                                                 [% END %]:
630                                                 <strong>[% transport.transport | html %]</strong><br />
631                                             [% ELSE %]<span>None</span><br />[% END %]
632                                         [% END %]
633                                     [% END %]
634                                 [% ELSE %]
635                                     <span>None</span>
636                                 [% END %]
637                             </td>
638                         [% END %]
639                         <td>
640                             [% SET library_limits = category.library_limits %]
641                             [% IF library_limits.count > 0 %]
642                                 [% library_str = "" %]
643                                 [% FOREACH library IN library_limits %]
644                                     [%- IF loop.first -%]
645                                         [% library_str = library.branchname _ " (" _ library.branchcode _ ")" %]
646                                     [% ELSE %]
647                                         [% library_str = library_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
648                                     [% END %]
649                                 [% END %]
650                                 <span class="library_limitation" title="[% library_str | html %]">
651                                     [% IF library_limits.count > 1 %]
652                                         <span>[% library_limits.count | html %] library limitations</span>
653                                     [% ELSE %]
654                                         <span>[% library_limits.count | html %] library limitation</span>
655                                     [% END %]
656                             [% ELSE %]
657                                 <span>No limitation</span>
658                             [% END %]
659                         </td>
660                         [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
661                           <td>
662                               [% SWITCH category.checkprevcheckout %]
663                               [% CASE 'yes' %]
664                               <span>Yes</span>
665                               [% CASE 'no' %]
666                               <span>No</span>
667                               [% CASE 'inherit' %]
668                               <span>Inherit</span>
669                               [% END %]
670                           </td>
671                         [% END %]
672                         <td>[% IF category.can_be_guarantee %] Yes [% ELSE %] no [% END %]</td>
673                         <td>
674                             [% SWITCH category.default_privacy %]
675                             [% CASE 'default' %]
676                                 <span>Default</span>
677                             [% CASE 'never' %]
678                                 <span>Never</span>
679                             [% CASE 'forever' %]
680                                 <span>Forever</span>
681                             [% END %]
682                         </td>
683                         <td>
684                             [% IF category.exclude_from_local_holds_priority %]
685                                 <span>Yes</span>
686                             [% ELSE %]
687                                 <span>No</span>
688                             [% END %]
689                         </td>
690                         <td class="actions">
691                             <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/categories.pl?op=add_form&amp;categorycode=[% category.categorycode |uri %]"><i class="fa fa-pencil"></i> Edit</a>
692                             <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/categories.pl?op=delete_confirm&amp;categorycode=[% category.categorycode |uri %]"><i class="fa fa-trash"></i> Delete</a>
693                         </td>
694                     </tr>
695                 [% END %]
696             </tbody>
697         </table>
698     [% ELSE %]
699         <div class="dialog alert">No categories have been defined. <a href="/cgi-bin/koha/admin/categories.pl?op=add_form">Create a new category</a>.</div>
700     [% END %]
701 [% END %]
702
703             </main>
704         </div> <!-- /.col-sm-10.col-sm-push-2 -->
705
706         <div class="col-sm-2 col-sm-pull-10">
707             <aside>
708                 [% INCLUDE 'admin-menu.inc' %]
709             </aside>
710         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
711      </div> <!-- /.row -->
712
713 [% MACRO jsinclude BLOCK %]
714     [% Asset.js("js/admin-menu.js") | $raw %]
715     [% Asset.js("js/messaging-preference-form.js") | $raw %]
716     [% INCLUDE 'calendar.inc' %]
717     [% INCLUDE 'datatables.inc' %]
718     [% INCLUDE 'columns_settings.inc' %]
719     <script>
720         var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'categories', 'patron_categories', 'json' ) | $raw %];
721     </script>
722     [% Asset.js("js/categories.js") | $raw %]
723 [% END %]
724 [% INCLUDE 'intranet-bottom.inc' %]