Bug 23271: Improve library limitation selection for item types
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / itemtypes.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% USE AuthorisedValues %]
6 [% USE Price %]
7 [% USE TablesSettings %]
8 [% SET footerjs = 1 %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>
11 [% IF op == 'add_form' %]
12     [% IF ( itemtype ) %]
13         Modify item type '[% itemtype.itemtype | html %]'
14     [% ELSE %]
15         Add item type
16     [% END %] &rsaquo; [% END %]
17 [% IF op == 'delete_confirm' %]
18     [% IF ( total ) %]
19         Cannot delete item type '[% itemtype.itemtype | html %]'
20     [% ELSE %]
21         Delete item type '[% itemtype.itemtype | html %]'?
22     [% END %] &rsaquo; [% END %]
23 [% IF op == 'delete_confirmed' %]
24     Data deleted &rsaquo; [% END %]
25 Item types &rsaquo; Administration &rsaquo; Koha
26 </title>
27 [% INCLUDE 'doc-head-close.inc' %]
28 <style>
29         fieldset.rows div.toptabs li { clear:none;margin-right:.5em;padding-bottom:0;width:auto; }
30   fieldset.rows div.toptabs .ui-tabs-nav li.ui-tabs-active {background-color : #F4F8F9; }
31         fieldset.rows .ui-tabs-panel { margin-right : 10px; margin-left : 10px;margin-bottom:10px;}
32   fieldset.rows .ui-tabs-nav { margin-left : 10px; }
33 </style>
34 </head>
35
36 <body id="admin_itemtypes" class="admin">
37 [% INCLUDE 'header.inc' %]
38 [% INCLUDE 'prefs-admin-search.inc' %]
39
40 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
41     <ol>
42         <li>
43             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
44         </li>
45         <li>
46             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
47         </li>
48
49         [% IF op == 'add_form' %]
50             <li>
51                 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a>
52             </li>
53             [% IF itemtype %]
54                 <li>
55                     <a href="#" aria-current="page">
56                         Modify item type '[% itemtype.itemtype | html %]'
57                     </a>
58                 </li>
59             [% ELSE %]
60                 <li>
61                     <a href="#" aria-current="page">
62                         Add item type
63                     </a>
64                 </li>
65             [% END %]
66         [% END %]
67
68         [% IF op == 'delete_confirm' %]
69             <li>
70                 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a>
71             </li>
72             [% IF total %]
73                 <li>
74                     <a href="#" aria-current="page">
75                         Cannot delete item type '[% itemtype.itemtype | html %]'
76                     </a>
77                 </li>
78             [% ELSE %]
79                 <li>
80                     <a href="#" aria-current="page">
81                         Delete item type '[% itemtype.itemtype | html %]'?
82                     </a>
83                 </li>
84             [% END %]
85         [% END %]
86
87         [% IF op == 'delete_confirmed' %]
88             <li>
89                 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a>
90             </li>
91             <li>
92                 <a href="#" aria-current="page">
93                     Data deleted
94                 </a>
95             </li>
96         [% END %]
97
98         [% IF op == 'list' %]
99             <li>
100                 <a href="#" aria-current="page">
101                     Item types administration
102                 </a>
103             </li>
104         [% END %]
105     </ol>
106 </nav>
107
108 <div class="main container-fluid">
109     <div class="row">
110         <div class="col-sm-10 col-sm-push-2">
111             <main>
112
113 [% IF op == 'list' %]<div id="toolbar" class="btn-toolbar">
114     <a class="btn btn-default" id="newitemtype" href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form"><i class="fa fa-plus"></i> New item type</a>
115 </div>[% END %]
116
117 [% FOREACH m IN messages %]
118     <div class="dialog [% m.type | html %]">
119         [% SWITCH m.code %]
120         [% CASE 'error_on_update' %]
121             An error occurred when updating this item type. Perhaps the value already exists.
122         [% CASE 'error_on_insert' %]
123             An error occurred when inserting this item type. Perhaps the value already exists.
124         [% CASE 'error_on_delete' %]
125             An error occurred when deleting this item type. Check the logs.
126         [% CASE 'success_on_update' %]
127             Item type updated successfully.
128         [% CASE 'success_on_insert' %]
129             Item type inserted successfully.
130         [% CASE 'success_on_delete' %]
131             Item type deleted successfully.
132         [% CASE 'already_exists' %]
133             This item type already exists.
134         [% CASE 'cannot_be_deleted' %]
135             Cannot delete this item type. <p><strong>This record is in use</strong>. Deletion is not possible.</p>
136         [% CASE %]
137             [% m.code | html %]
138         [% END %]
139     </div>
140 [% END %]
141
142
143 [% IF op == 'add_form' %]
144     [% IF itemtype %]
145         <h3>Modify item type</h3>
146     [% ELSE %]
147         <h3>Add item type</h3>
148     [% END %]
149     <form action="/cgi-bin/koha/admin/itemtypes.pl" name="Aform" method="post" id="itemtypeentry">
150         <input type="hidden" name="op" value="add_validate" />
151         <fieldset class="rows">
152             <ol>
153                 [% IF itemtype %]
154                     <li>
155                         <input type="hidden" name="is_a_modif" value="1" />
156                         <span class="label">Item type: </span> <input type="hidden" name="itemtype" value="[% itemtype.itemtype | html %]" />
157                         [% itemtype.itemtype | html %]
158                     </li>
159                 [% ELSE %]
160                     <li>
161                         <label for="itemtype" class="required">Item type: </label>
162                         <input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" required="required" class="focus" /> <span class="required">Required</span>
163                     </li>
164                 [% END %]
165                 <li>
166                     <label for="parent_type">Parent item type: </label>
167                     [% IF !is_a_parent && parent_types %]
168                     <select name="parent_type" id="parent_type">
169                         <option value="">None</option>
170                         [% FOREACH pt IN parent_types %]
171                             [% IF parent_type == pt.itemtype %]
172                                 <option value="[% pt.itemtype | html %]" selected="selected">[% pt.description | html %]</option>
173                             [% ELSE %]
174                                 <option value="[% pt.itemtype | html %]">[% pt.description | html %]</option>
175                             [% END %]
176                         [% END %]
177                     </select>
178                     [% ELSIF is_a_parent %]
179                     <input type="text" id="parent_type" value="[% parent_type | html %]" name="parent_type" size="10" maxlength="10" disabled/>
180                     <p>Is a parent to another type, cannot have a parent</p>
181                     [% ELSE %]
182                     <input type="text" id="parent_type" value="[% parent_type | html %]" name="parent_type" size="10" maxlength="10" disabled/>
183                     <p>No available parent types</p>
184                     [% END %]
185                     <span class="hint">Defining a parent type will apply checkout limits for all children as described on the circulation rules page.</span>
186                 </li>
187                 <li>
188                     <label for="description" class="required">Description: </label>
189                     <input type="text" id="description" name="description" size="48" value="[% itemtype.description | html %]" required="required" /> <span class="required">Required</span>
190                     [% IF can_be_translated %]
191                         <a href="/cgi-bin/koha/admin/localization.pl?entity=itemtypes&code=[% itemtype.itemtype | uri %]" title="Translate item type [% itemtype.itemtype | html %]" rel="gb_page_center[600,500]"><i class="fa fa-pencil"></i> Translate into other languages</a>
192                     [% END %]
193                 </li>
194                 <li>
195                     <span class="label">Search category</span>
196                     <select id="searchcategory" name="searchcategory">
197                     <option value="">None</option>
198                         [% FOREACH cat IN searchcategory %]
199                             [% IF cat.authorised_value == itemtype.searchcategory %]
200                                 <option value="[% cat.authorised_value | html %]" selected="selected">
201                                     [% cat.lib | html %]
202                                 </option>
203                             [% ELSE %]
204                                 <option value="[% cat.authorised_value | html %]" >
205                                     [% cat.lib | html %]
206                                 </option>
207                             [% END %]
208                         [% END %]
209                     </select>
210                     <span class="hint">Options are defined as the authorized values for the ITEMTYPECAT category.</span>
211                 </li>
212                 [% IF ( Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') ) %]
213                     <li>
214                         <span class="label">Image: </span>Item type images are disabled. To enable them, turn off the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&amp;searchfield=noItemTypeImages">noItemTypeImages or OpacNoItemTypeImages system preferences</a>
215                     </li>
216                 [% END %]
217             </ol>
218             [% UNLESS Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') %]
219                 <div id="icons" class="toptabs" style="clear:both">
220                     <h5 style="margin-left:10px;">Choose an icon:</h5>
221                     <ul>
222                         <li><a href="#none">None</a></li>
223                         [% FOREACH imageset IN imagesets %]
224                             [% IF ( imageset.imagesetactive ) %]
225                                 <li class="ui-tabs-active">
226                             [% ELSE %]
227                                 <li>
228                             [% END %]
229                             <a href="#[% imageset.imagesetname | uri %]">[% imageset.imagesetname | html %]</a>
230                             </li>
231                         [% END %]
232                         [% IF itemtype.image_location('intranet').match('^http') %]<li class="ui-tabs-active">[% ELSE %]<li>[% END %]<a href="#remote">Remote image</a></li>
233                     </ul>
234                     <div id="none">
235                         <ul>
236                             <li><label for="noimage">No image: </label><input type="radio" name="image" id="noimage" value="removeImage" /></li>
237                         </ul>
238                         <br class="clear" />
239                     </div>
240
241                     [% FOREACH imageset IN imagesets %]
242                         <div id="[% imageset.imagesetname | html %]">
243                             <ul>
244                                 [% FOREACH image IN imageset.images %]
245                                     <li style="float: none; display: inline-block; clear : none; width: auto;">
246                                         <label>
247                                             [% IF image.StaffImageUrl %]
248                                                 <img src="[% image.StaffImageUrl | html %]" alt="[% image.StaffImageUrl | html %]" title="[% image.StaffImageUrl | html %]" />
249                                             [% END %]
250                                             [% IF image.checked %]
251                                                 <input type="radio" name="image" value="[% image.KohaImage | html %]" checked="checked" />
252                                             [% ELSIF image.KohaImage %] <!-- to delete the radio button if there is no image after -->
253                                                 <input type="radio" name="image" value="[% image.KohaImage | html %]" />
254                                             [% END %]
255                                         </label>
256                                     </li>
257                                 [% END %]
258                             </ul>
259                             <br class="clear" />
260                         </div>
261                     [% END %]
262
263                     <div id="remote">
264                         <ul>
265                             <li>
266                                 <label for="remote_image_check"> Remote image:</label>
267                                 [% SET image_location = itemtype.image_location('intranet') %]
268                                 [% IF image_location.match('^http') %]
269                                     <input type="radio" id="remote_image_check" name="image" value="remoteImage" checked="checked" />
270                                     <input type="text" name="remoteImage" size="48" maxlength="200" value="[% image_location | html %]" onmousedown="document.getElementById('remote_image_check').checked = true;" />
271                                     [% IF itemtype.imageurl %]
272                                         <img src="[% image_location | html %]" alt="" />
273                                     [% END %]
274                                 [% ELSE %]
275                                     <input type="radio" id="remote_image_check" name="image" value="remoteImage" />
276                                     <input type="text" name="remoteImage" size="48" maxlength="200" value="" onmousedown="document.getElementById('remote_image_check').checked = true;" />
277                                 [% END %]
278                             </li>
279                         </ul>
280                         <br class="clear" />
281                     </div>
282                 </div>
283             [% END %]
284             <ol class="oladditemtype">
285                 <li>
286                     <label for="hideinopac">Hide in OPAC: </label>
287                     [% IF ( itemtype.hideinopac ) %]
288                         <input type="checkbox" id="hideinopac" name="hideinopac" checked="checked" value="1" />
289                     [% ELSE %]
290                         <input type="checkbox" id="hideinopac" name="hideinopac" value="1" />
291                     [% END %]
292                     <span class="hint">If checked, items of this type will be hidden as filters in OPAC's advanced search.</span>
293                 </li>
294                 <li>
295                     <label for="notforloan">Not for loan: </label>
296                         [% IF itemtype.notforloan %]
297                             <input type="checkbox" id="notforloan" name="notforloan" checked="checked" value="1" />
298                         [% ELSE %]
299                             <input type="checkbox" id="notforloan" name="notforloan" value="1" />
300                         [% END %]
301                         <span class="hint">If checked, no item of this type can be issued. If not checked, every item of this type can be issued unless notforloan is set for a specific item.</span>
302                 </li>
303                 <li>
304                     <label for="rentalcharge">Rental charge: </label>
305                     <input type="text" id="rentalcharge" name="rentalcharge" size="10" value="[% itemtype.rentalcharge | $Price on_editing => 1 %]" />
306                     <span class="hint">This fee is charged once per checkout/renewal per item</span>
307                 </li>
308                 <li>
309                     <label for="rentalcharge_daily">Daily rental charge: </label>
310                     <input type="text" id="rentalcharge_daily" name="rentalcharge_daily" size="10" value="[% itemtype.rentalcharge_daily | $Price on_editing => 1 %]" />
311                     <span class="hint">This fee is charged at checkout/renewal time for each day between the checkout/renewal date and due date for loans specified in days.</span>
312                 </li>
313                 <li>
314                     <label for="rentalcharge_daily_calendar">Daily rentals use calendar: </label>
315                         [% IF itemtype.rentalcharge_daily_calendar %]
316                             <input type="checkbox" id="rentalcharge_daily_calendar" name="rentalcharge_daily_calendar" checked="checked" value="1" />
317                         [% ELSE %]
318                             <input type="checkbox" id="rentalcharge_daily_calendar" name="rentalcharge_daily_calendar" value="1" />
319                         [% END %]
320                         <span class="hint">If checked, daily charge will be calculated using the calendar to exclude holidays. If not checked, the fee will be calculated based on the number of days until due, directly.</span>
321                 </li>
322                 <li>
323                     <label for="rentalcharge_hourly">Hourly rental charge: </label>
324                     <input type="text" id="rentalcharge_hourly" name="rentalcharge_hourly" size="10" value="[% itemtype.rentalcharge_hourly | $Price on_editing => 1 %]" />
325                     <span class="hint">This fee is charged at checkout/renewal time for each hour between the checkout/renewal date and due date for loans specified in hours.</span>
326                 </li>
327                 <li>
328                     <label for="rentalcharge_hourly_calendar">Hourly rentals use calendar: </label>
329                         [% IF itemtype.rentalcharge_hourly_calendar %]
330                             <input type="checkbox" id="rentalcharge_hourly_calendar" name="rentalcharge_hourly_calendar" checked="checked" value="1" />
331                         [% ELSE %]
332                             <input type="checkbox" id="rentalcharge_hourly_calendar" name="rentalcharge_hourly_calendar" value="1" />
333                         [% END %]
334                         <span class="hint">If checked, hourly charge will be calculated using the calendar to exclude holidays. If not checked, the fee will be calculated based on the number of hours until due, directly.</span>
335                 </li>
336                 <li>
337                     <label for="defaultreplacecost">Default replacement cost: </label>
338                     <input type="text" id="defaultreplacecost" name="defaultreplacecost" size="10" value="[% itemtype.defaultreplacecost | html %]" />
339                 </li>
340                 <li>
341                     <label for="processfee">Processing fee (when lost): </label>
342                     <input type="text" id="processfee" name="processfee" size="10" value="[% itemtype.processfee | html %]" />
343                 </li>
344                 <li>
345                     <label for="checkinmsg">Checkin message: </label>
346                     <textarea id="checkinmsg" name="checkinmsg" cols="55" rows="5">[% itemtype.checkinmsg | html %]</textarea>
347                 </li>
348                 <li>
349                     <label for="checkinmsgtype">Checkin message type: </label>
350                     <select type="text" id="checkinmsgtype" name="checkinmsgtype">
351                         [% IF itemtype.checkinmsgtype == 'message' %]
352                             <option value="message" selected="selected">Message</option>
353                         [% ELSE %]
354                             <option value="message">Message</option>
355                         [% END %]
356                         [% IF itemtype.checkinmsgtype == 'alert' %]
357                             <option value="alert" selected="selected">Alert</option>
358                         [% ELSE %]
359                             <option value="alert">Alert</option>
360                         [% END %]
361                     </select>
362                 </li>
363                 <li>
364                     <label for="sip_media_type">SIP media type: </label>
365                     <select id="sip_media_type" name="sip_media_type">
366                         <option value=""></option>
367                         [% FOREACH a IN AuthorisedValues.Get('SIP_MEDIA_TYPE') %]
368                             [% IF a.authorised_value == itemtype.sip_media_type %]
369                                 <option value="[% a.authorised_value | html %]" selected="selected">[% a.lib | html %]</option>
370                             [% ELSE %]
371                                 <option value="[% a.authorised_value | html %]">[% a.lib | html %]</option>
372                             [% END %]
373                         [% END %]
374                     </select>
375                 </li>
376                 <li><label for="branches">Library limitation: </label>
377                     <select id="branches" name="branches" multiple size="10">
378                         <option value="">All libraries</option>
379                         [% PROCESS options_for_libraries libraries => Branches.all( selecteds => itemtype.get_library_limits, unfiltered => 1, do_not_select_my_library => 1 ) %]
380                     </select>
381                     <span class="hint">Select 'All libraries' if all libraries use this item type. Otherwise, select the specific libraries that use this item type.</span>
382                 </li>
383                 <li>
384                     <label for="summary">Summary: </label>
385                    <textarea id="summary" name="summary" cols="55" rows="5">[% itemtype.summary | html %]</textarea>
386                     <p>Enter a summary that will overwrite the default one in search results lists. Example, for a website itemtype : </p>
387                     <p><strong>&lt;a href="[856u]"&gt;open site&lt;/a&gt;</strong> will show the link just below the title</p>
388                 </li>
389             </ol>
390         </fieldset>
391
392         <fieldset class="action">
393             <input type="submit" value="Save changes" />
394             <a href="/cgi-bin/koha/admin/itemtypes.pl" class="cancel">Cancel</a>
395         </fieldset>
396     </form>
397 [% END %]
398
399 [% IF op == 'delete_confirm' %]
400     <div class="dialog alert">
401         <h3>Delete item type '[% itemtype.itemtype | html %]'?</h3>
402         <table>
403             <tr>
404                 <th scope="row">Item type</th>
405                 <td>[% itemtype.itemtype | html %]</td>
406             </tr>
407             <tr><th scope="row">Description</th><td>[% itemtype.translated_description | html %]</td></tr>
408             [% UNLESS Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') %]
409                 <tr>
410                     <th scope="row">Image</th>
411                     <td>
412                         [% SET image_location = itemtype.image_location('intranet') %]
413                         [% IF image_location %]<img src="[% image_location | html %]" alt="" />[% END %]
414                     </td>
415                 </tr>
416             [% END %]
417             <tr><th scope="row">Rental charge</th><td>[% itemtype.rentalcharge | $Price %]</td></tr>
418         </table>
419         <form action="/cgi-bin/koha/admin/itemtypes.pl" method="post">
420             <input type="hidden" name="op" value="delete_confirmed" /><input type="hidden" name="itemtype" value="[% itemtype.itemtype | html %]" />
421             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this item type</button>
422         </form>
423         <form action="/cgi-bin/koha/admin/itemtypes.pl" method="post">
424             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
425         </form>
426     </div>
427 [% END %]
428
429 [% IF op == 'list' %]
430     <h2>Item types administration</h2>
431     [% IF itemtypes %]
432         <table id="table_item_type">
433           <thead>
434             [% UNLESS Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') %]<th class="noExport">Image</th>[% END %]
435             <th>Description</th>
436             <th>Code</th>
437             <th>Parent code</th>
438             <th>Search category</th>
439             <th>Not for loan</th>
440             <th>Hide in OPAC</th>
441             <th>Rental charge</th>
442             <th>Daily rental charge</th>
443             <th>Hourly rental charge</th>
444             <th>Default replacement cost</th>
445             <th>Processing fee (when lost)</th>
446             <th>Checkin message</th>
447             <th>Library limitations</th>
448             <th class="noExport NoSort">Actions</th>
449           </thead>
450           [% FOREACH itemtype IN itemtypes %]
451             <tr>
452                 [% UNLESS Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') %]
453                     <td>
454                         [% SET image_location = itemtype.image_location('intranet') %]
455                         [% IF image_location %]<img src="[% image_location | html %]" alt="" />[% ELSE %]&nbsp;[% END %]
456                     </td>
457                 [% END %]
458             <td>
459                 [% IF itemtype.parent_type %]
460                     [% IF itemtype.parent.translated_descriptions.size %]
461                         [% itemtype.parent.description | html %] (default)<br/>
462                     [% ELSE %]
463                         [% itemtype.parent.description | html %]
464                     [% END %]
465                     </br>
466                     [% IF itemtype.translated_descriptions.size %]
467                         [% itemtype.description | html %] (default)<br/>
468                         [% FOR description IN itemtype.translated_descriptions %]
469                             [% IF description.translation == itemtype.translated_description %]
470                             --    <strong>[% description.translation | html %]</strong>
471                             [% ELSE %]
472                             --    [% description.translation | html %] ([% description.lang | html %])
473                             [% END %]
474                             <br/>
475                         [% END %]
476                     [% ELSE %]
477                     --    [% itemtype.description | html %]
478                     [% END %]
479                 [% ELSE %]
480                     [% IF itemtype.translated_descriptions.size %]
481                         [% itemtype.description | html %] (default)<br/>
482                         [% FOR description IN itemtype.translated_descriptions %]
483                             [% IF description.translation == itemtype.translated_description %]
484                                 <strong>[% description.translation | html %]</strong>
485                             [% ELSE %]
486                                 [% description.translation | html %] ([% description.lang | html %])
487                             [% END %]
488                             <br/>
489                         [% END %]
490                     [% ELSE %]
491                         [% itemtype.description | html %]
492                     [% END %]
493                 [% END %]
494             </td>
495             <td>
496               <a href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form&amp;itemtype=[% itemtype.itemtype | uri %]">
497                 [% itemtype.itemtype | html %]
498               </a>
499             </td>
500             <td>
501                 [% itemtype.parent_type | html %]
502             </td>
503             <td>[% AuthorisedValues.GetByCode( 'ITEMTYPECAT', itemtype.searchcategory ) | html %]</td>
504             <td>[% IF ( itemtype.notforloan ) %]Yes[% ELSE %]&nbsp;[% END %]</td>
505             <td>[% IF ( itemtype.hideinopac ) %]Yes[% ELSE %]&nbsp;[% END %]</td>
506             <td>
507             [% UNLESS ( itemtype.notforloan ) %]
508               [% itemtype.rentalcharge | $Price %]
509             [% END %]
510             </td>
511             <td>
512             [% UNLESS ( itemtype.notforloan ) %]
513               [% itemtype.rentalcharge_daily | $Price %]
514             [% END %]
515             </td>
516             <td>
517             [% UNLESS ( itemtype.notforloan ) %]
518               [% itemtype.rentalcharge_hourly | $Price %]
519             [% END %]
520             </td>
521
522             <td>[% itemtype.defaultreplacecost | $Price %]</td>
523             <td>[% itemtype.processfee | $Price %]</td>
524             <td>[% itemtype.checkinmsg | html_line_break | $raw %]</td>
525             <td>
526                 [% SET library_limits = itemtype.library_limits %]
527                 [% IF library_limits.count > 0 %]
528                     [% library_str = "" %]
529                     [% FOREACH library IN library_limits %]
530                         [%- IF loop.first -%]
531                             [% library_str = library.branchname _ " (" _ library.branchcode _ ")" %]
532                         [% ELSE %]
533                             [% library_str = library_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
534                         [% END %]
535                     [% END %]
536                     <span class="library_limitation" title="[% library_str | html %]">
537                         [% IF library_limits.count > 1 %]
538                             [% library_limits.count | html %] library limitations
539                         [% ELSE %]
540                             [% library_limits.count | html %] library limitation
541                         [% END %]
542                 [% ELSE %]
543                     No limitation
544                 [% END %]
545             </td>
546             <td class="actions">
547               <a href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form&amp;itemtype=[% itemtype.itemtype | uri %]" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
548               <a href="/cgi-bin/koha/admin/itemtypes.pl?op=delete_confirm&amp;itemtype=[% itemtype.itemtype | uri %]" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a>
549             </td>
550           </tr>
551           [% END %]
552         </table>
553     [% ELSE %]
554         <div class="dialog message">There are no itemtypes defined</div>
555     [% END %]
556 [% END %]
557
558             </main>
559         </div> <!-- /.col-sm-10.col-sm-push-2 -->
560
561         <div class="col-sm-2 col-sm-pull-10">
562             <aside>
563                 [% INCLUDE 'admin-menu.inc' %]
564             </aside>
565         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
566      </div> <!-- /.row -->
567
568 [% MACRO jsinclude BLOCK %]
569     [% Asset.js("js/admin-menu.js") | $raw %]
570     [% INCLUDE 'greybox.inc' %]
571     [% INCLUDE 'datatables.inc' %]
572     [% INCLUDE 'columns_settings.inc' %]
573     <script>
574          $(document).ready(function() {
575             $('#icons').tabs();
576             var columns_settings = [% TablesSettings.GetColumns( 'admin', 'itemtypes', 'table_item_type', 'json' ) | $raw %];
577             [% IF ( Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') ) %]
578                 columns_settings.shift(); // Remove item type image column from configuration
579             [% END %]
580
581             $(document).ready(function() {
582                 KohaTable("table_item_type", {
583                 "aaSorting": [[ 1, "asc" ]],
584                 "iDisplayLength": 10,
585                 "sPaginationType": "full"
586                 }, columns_settings);
587             });
588
589             $( "#itemtypeentry" ).validate({
590                 rules: {
591                     itemtype: { required: true },
592                     description: { required: true },
593                     rentalcharge: { number: true }
594                 }
595             });
596             $("#itemtype").on("blur",function(){
597                 toUC(this);
598             });
599             $(".library_limitation").tooltip();
600          });
601     </script>
602 [% END %]
603
604 [% INCLUDE 'intranet-bottom.inc' %]