Bug 19623: (follow-up) Correct footer include in pop-up windows
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / itemtypes.tt
1 [% USE Koha %]
2 [% USE AuthorisedValues %]
3 [% USE Price %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Administration &rsaquo; Item types [% IF op == 'add_form' %]&rsaquo;
7   [% IF ( itemtype ) %]
8 Modify item type '[% itemtype.itemtype %]'
9   [% ELSE %]
10 Add item type
11   [% END %]
12 [% END %]
13 [% IF op == 'delete_confirm' %]&rsaquo;
14   [% IF ( total ) %]
15 Cannot delete item type '[% itemtype.itemtype %]'
16   [% ELSE %]
17 Delete item type '[% itemtype.itemtype %]'?
18   [% END %]
19 [% END %]
20 [% IF op == 'delete_confirmed' %]&rsaquo;
21 Data deleted
22 [% END %]
23 </title>
24 [% INCLUDE 'doc-head-close.inc' %]
25 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
26 <style type="text/css">
27         fieldset.rows div.toptabs li { clear:none;margin-right:.5em;padding-bottom:0;width:auto; }
28   fieldset.rows div.toptabs .ui-tabs-nav li.ui-tabs-active {background-color : #F4F8F9; }
29         fieldset.rows .ui-tabs-panel { margin-right : 10px; margin-left : 10px;margin-bottom:10px;}
30   fieldset.rows .ui-tabs-nav { margin-left : 10px; }
31 </style>
32 </head>
33
34 <body id="admin_itemtypes" class="admin">
35 [% INCLUDE 'header.inc' %]
36 [% INCLUDE 'prefs-admin-search.inc' %]
37
38 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; [% IF op == 'add_form' %]
39   [% IF itemtype %]
40 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Modify item type '[% itemtype.itemtype %]'
41   [% ELSE %]
42 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Add item type
43   [% END %]
44 [% END %]
45 [% IF op == 'delete_confirm' %]
46   [% IF total %]
47 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Cannot delete item type '[% itemtype.itemtype %]'
48   [% ELSE %]
49 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Delete item type '[% itemtype.itemtype %]'?
50   [% END %]
51 [% END %]
52 [% IF op == 'delete_confirmed' %]
53 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo;Data deleted
54 [% END %]
55 [% IF op == 'list' %]
56 Item types administration
57 [% END %]</div>
58
59 <div id="doc3" class="yui-t2">
60
61    <div id="bd">
62         <div id="yui-main">
63         <div class="yui-b">
64         
65
66 [% IF op == 'list' %]<div id="toolbar" class="btn-toolbar">
67     <a class="btn btn-default btn-sm" id="newitemtype" href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form"><i class="fa fa-plus"></i> New item type</a>
68 </div>[% END %]
69
70 [% FOREACH m IN messages %]
71     <div class="dialog [% m.type %]">
72         [% SWITCH m.code %]
73         [% CASE 'error_on_update' %]
74             An error occurred when updating this item type. Perhaps the value already exists.
75         [% CASE 'error_on_insert' %]
76             An error occurred when inserting this item type. Perhaps the value already exists.
77         [% CASE 'error_on_delete' %]
78             An error occurred when deleting this item type. Check the logs.
79         [% CASE 'success_on_update' %]
80             Item type updated successfully.
81         [% CASE 'success_on_insert' %]
82             Item type inserted successfully.
83         [% CASE 'success_on_delete' %]
84             Item type deleted successfully.
85         [% CASE 'already_exists' %]
86             This item type already exists.
87         [% CASE 'cannot_be_deleted' %]
88             Cannot delete this item type. <p><strong>This record is in use</strong>. Deletion is not possible.</p>
89         [% CASE %]
90             [% m.code %]
91         [% END %]
92     </div>
93 [% END %]
94
95
96 [% IF op == 'add_form' %]
97     [% IF itemtype %]
98         <h3>Modify item type</h3>
99     [% ELSE %]
100         <h3>Add item type</h3>
101     [% END %]
102     <form action="/cgi-bin/koha/admin/itemtypes.pl" name="Aform" method="post" id="itemtypeentry">
103         <input type="hidden" name="op" value="add_validate" />
104         <fieldset class="rows">
105             <ol>
106                 [% IF itemtype %]
107                     <li>
108                         <input type="hidden" name="is_a_modif" value="1" />
109                         <span class="label">Item type: </span> <input type="hidden" name="itemtype" value="[% itemtype.itemtype %]" />
110                         [% itemtype.itemtype %]
111                     </li>
112                 [% ELSE %]
113                     <li>
114                         <label for="itemtype" class="required">Item type: </label>
115                         <input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" required="required" /> <span class="required">Required</span>
116                     </li>
117                 [% END %]
118                 <li>
119                     <label for="description" class="required">Description: </label>
120                     <input type="text" id="description" name="description" size="48" value="[% itemtype.description |html %]" required="required" /> <span class="required">Required</span>
121                     [% IF can_be_translated %]
122                         <a href="/cgi-bin/koha/admin/localization.pl?entity=itemtypes&code=[% itemtype.itemtype %]" title="Translate item type [% itemtype.itemtype %]" rel="gb_page_center[600,500]"><i class="fa fa-pencil"></i> Translate into other languages</a>
123                     [% END %]
124                 </li>
125                 <li>
126                     <span class="label">Search category</span>
127                     <select id="searchcategory" name="searchcategory">
128                     <option value="">None</option>
129                         [% FOREACH cat IN searchcategory %]
130                             [% IF cat.authorised_value == itemtype.searchcategory %]
131                                 <option value="[% cat.authorised_value %]" selected="selected">
132                                     [% cat.lib %]
133                                 </option>
134                             [% ELSE %]
135                                 <option value="[% cat.authorised_value %]" >
136                                     [% cat.lib %]
137                                 </option>
138                             [% END %]
139                         [% END %]
140                     </select>
141                     (Options are defined as the authorized values for the ITEMTYPECAT category)
142                 </li>
143                 [% IF Koha.Preference('noItemTypeImages') %]
144                     <li>
145                         <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 system preference</a>
146                     </li>
147                 [% END %]
148             </ol>
149             [% UNLESS Koha.Preference('noItemTypeImages') %]
150                 <div id="icons" class="toptabs" style="clear:both">
151                     <h5 style="margin-left:10px;">Choose an icon:</h5>
152                     <ul>
153                         <li><a href="#none">None</a></li>
154                         [% FOREACH imageset IN imagesets %]
155                             [% IF ( imageset.imagesetactive ) %]
156                                 <li class="ui-tabs-active">
157                             [% ELSE %]
158                                 <li>
159                             [% END %]
160                             <a href="#[% imageset.imagesetname %]">[% imageset.imagesetname %]</a>
161                             </li>
162                         [% END %]
163                         [% IF itemtype.image_location('intranet').match('^http') %]<li class="ui-tabs-active">[% ELSE %]<li>[% END %]<a href="#remote">Remote image</a></li>
164                     </ul>
165                     <div id="none">
166                         <ul>
167                             <li><label for="noimage">No image: </label><input type="radio" name="image" id="noimage" value="removeImage" /></li>
168                         </ul>
169                         <br class="clear" />
170                     </div>
171
172                     [% FOREACH imageset IN imagesets %]
173                         <div id="[% imageset.imagesetname %]">
174                             <ul>
175                                 [% FOREACH image IN imageset.images %]
176                                     <li style="float: none; display: inline-block; clear : none; width: auto;">
177                                         <label>
178                                             [% IF image.StaffImageUrl %]
179                                                 <img src="[% image.StaffImageUrl %]" alt="[% image.StaffImageUrl %]" title="[% image.StaffImageUrl %]" />
180                                             [% END %]
181                                             [% IF image.checked %]
182                                                 <input type="radio" name="image" value="[% image.KohaImage %]" checked="checked" />
183                                             [% ELSIF image.KohaImage %] <!-- to delete the radio button if there is no image after -->
184                                                 <input type="radio" name="image" value="[% image.KohaImage %]" />
185                                             [% END %]
186                                         </label>
187                                     </li>
188                                 [% END %]
189                             </ul>
190                             <br class="clear" />
191                         </div>
192                     [% END %]
193
194                     <div id="remote">
195                         <ul>
196                             <li>
197                                 <label for="remote_image_check"> Remote image:</label>
198                                 [% IF remote_image %]
199                                     <input type="radio" id="remote_image_check" name="image" value="remoteImage" checked="checked" />
200                                 [% ELSE %]
201                                     <input type="radio" id="remote_image_check" name="image" value="remoteImage" />
202                                 [% END %]
203                                 <input type="text" name="remoteImage" size="48" maxlength="200" value="[% remote_image %]" onmousedown="document.getElementById('remote_image_check').checked = true;" />
204                                 [% IF ( remote_image ) %]
205                                     <img src="[% remote_image %]" alt="" />
206                                 [% END %]
207                             </li>
208                         </ul>
209                         <br class="clear" />
210                     </div>
211                 </div>
212             [% END %]
213             <ol class="oladditemtype">
214                 <li>
215                     <label for="hideinopac">Hide in OPAC: </label>
216                     [% IF ( itemtype.hideinopac ) %]
217                         <input type="checkbox" id="hideinopac" name="hideinopac" checked="checked" value="1" />
218                     [% ELSE %]
219                         <input type="checkbox" id="hideinopac" name="hideinopac" value="1" />
220                     [% END %]
221                     (if checked, items of this type will be hidden as filters in OPAC's advanced search)
222                 </li>
223                 <li>
224                     <label for="notforloan">Not for loan: </label>
225                         [% IF itemtype.notforloan %]
226                             <input type="checkbox" id="notforloan" name="notforloan" checked="checked" value="1" />
227                         [% ELSE %]
228                             <input type="checkbox" id="notforloan" name="notforloan" value="1" />
229                         [% END %]
230                       (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)
231                 </li>
232                 <li>
233                     <label for="rentalcharge">Rental charge: </label>
234                     <input type="text" id="rentalcharge" name="rentalcharge" size="10" value="[% itemtype.rentalcharge %]" />
235                 </li>
236                 <li>
237                     <label for="defaultreplacecost">Default replacement cost: </label>
238                     <input type="text" id="defaultreplacecost" name="defaultreplacecost" size="10" value="[% defaultreplacecost %]" />
239                 </li>
240                 <li>
241                     <label for="processfee">Processing fee (when lost): </label>
242                     <input type="text" id="processfee" name="processfee" size="10" value="[% processfee %]" />
243                 </li>
244                 <li>
245                     <label for="checkinmsg">Checkin message: </label>
246                     <textarea id="checkinmsg" name="checkinmsg" cols="55" rows="5">[% itemtype.checkinmsg %]</textarea>
247                 </li>
248                 <li>
249                     <label for="checkinmsgtype">Checkin message type: </label>
250                     <select type="text" id="checkinmsgtype" name="checkinmsgtype">
251                         [% IF itemtype.checkinmsgtype == 'message' %]
252                             <option value="message" selected="selected">Message</option>
253                         [% ELSE %]
254                             <option value="message">Message</option>
255                         [% END %]
256                         [% IF itemtype.checkinmsgtype == 'alert' %]
257                             <option value="alert" selected="selected">Alert</option>
258                         [% ELSE %]
259                             <option value="alert">Alert</option>
260                         [% END %]
261                     </select>
262                 </li>
263                 <li>
264                     <label for="sip_media_type">SIP media type: </label>
265                     <select id="sip_media_type" name="sip_media_type">
266                         <option value=""></option>
267                         [% FOREACH a IN AuthorisedValues.Get('SIP_MEDIA_TYPE') %]
268                             [% IF a.authorised_value == itemtype.sip_media_type %]
269                                 <option value="[% a.authorised_value %]" selected="selected">[% a.lib %]</option>
270                             [% ELSE %]
271                                 <option value="[% a.authorised_value %]">[% a.lib %]</option>
272                             [% END %]
273                         [% END %]
274                     </select>
275                 </li>
276                 <li>
277                     <label for="summary">Summary: </label>
278                    <textarea id="summary" name="summary" cols="55" rows="5">[% itemtype.summary %]</textarea>
279                     <p>Enter a summary that will overwrite the default one in search results lists. Example, for a website itemtype : </p>
280                     <p><b>&lt;a href="[856u]"&gt;open site&lt;/a&gt;</b> will show the link just below the title</p>
281                 </li>
282             </ol>
283         </fieldset>
284
285         <fieldset class="action">
286             <input type="submit" value="Save changes" />
287             <a href="/cgi-bin/koha/admin/itemtypes.pl" class="cancel">Cancel</a>
288         </fieldset>
289     </form>
290 [% END %]
291
292 [% IF op == 'delete_confirm' %]
293     <div class="dialog alert">
294         <h3>Delete item type '[% itemtype.itemtype %]'?</h3>
295         <table>
296             <tr>
297                 <th scope="row">Item type</th>
298                 <td>[% itemtype.itemtype %]</td>
299             </tr>
300             <tr><th scope="row">Description</th><td>[% itemtype.translated_description %]</td></tr>
301             [% UNLESS Koha.Preference('noItemTypeImages') %]
302                 <tr>
303                     <th scope="row">Image</th>
304                     <td>
305                         [% SET image_location = itemtype.image_location('intranet') %]
306                         [% IF image_location %]<img src="[% image_location %]" alt="" />[% END %]
307                     </td>
308                 </tr>
309             [% END %]
310             <tr><th scope="row">Rental charge</th><td>[% itemtype.rentalcharge | $Price %]</td></tr>
311         </table>
312         <form action="/cgi-bin/koha/admin/itemtypes.pl" method="post">
313             <input type="hidden" name="op" value="delete_confirmed" /><input type="hidden" name="itemtype" value="[% itemtype.itemtype %]" />
314             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this item type</button>
315         </form>
316         <form action="/cgi-bin/koha/admin/itemtypes.pl" method="post">
317             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
318         </form>
319     </div>
320 [% END %]
321
322 [% IF op == 'list' %]
323     <h2>Item types administration</h2>
324     [% IF itemtypes %]
325         <table id="table_item_type">
326           <thead>
327             [% UNLESS Koha.Preference('noItemTypeImages') %]<th>Image</th>[% END %]
328             <th>Code</th>
329             <th>Description</th>
330             <th>Search category</th>
331             <th>Not for loan</th>
332             <th>Hide in OPAC</th>
333             <th>Charge</th>
334             <th>Default replacement cost</th>
335             <th>Processing fee (when lost)</th>
336             <th>Checkin message</th>
337             <th>Actions</th>
338           </thead>
339           [% FOREACH itemtype IN itemtypes %]
340             <tr>
341                 [% UNLESS Koha.Preference('noItemTypeImages') %]
342                     <td>
343                         [% SET image_location = itemtype.image_location('intranet') %]
344                         [% IF image_location %]<img src="[% image_location %]" alt="" />[% ELSE %]&nbsp;[% END %]
345                     </td>
346                 [% END %]
347             <td>
348               <a href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form&amp;itemtype=[% itemtype.itemtype |html %]">
349                 [% itemtype.itemtype %]
350               </a>
351             </td>
352             <td>
353                 [% IF itemtype.translated_descriptions.size %]
354                     [% itemtype.description %] (default)<br/>
355                     [% FOR description IN itemtype.translated_descriptions %]
356                         [% IF description.translation == itemtype.translated_description %]
357                             <b>[% description.translation %]</b>
358                         [% ELSE %]
359                             [% description.translation %] ([% description.lang %])
360                         [% END %]
361                         <br/>
362                     [% END %]
363                 [% ELSE %]
364                     [% itemtype.description |html %]
365                 [% END %]
366             </td>
367             <td>[% itemtype.searchcategory %]</td>
368             <td>[% IF ( itemtype.notforloan ) %]Yes[% ELSE %]&nbsp;[% END %]</td>
369             <td>[% IF ( itemtype.hideinopac ) %]Yes[% ELSE %]&nbsp;[% END %]</td>
370             <td>
371             [% UNLESS ( itemtype.notforloan ) %]
372               [% itemtype.rentalcharge | $Price %]
373             [% END %]
374             </td>
375             <td>[% itemtype.defaultreplacecost | $Price %]</td>
376             <td>[% itemtype.processfee | $Price %]</td>
377             <td>[% itemtype.checkinmsg | html | html_line_break %]</td>
378             <td class="actions">
379               <a href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form&amp;itemtype=[% itemtype.itemtype |html %]" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
380               <a href="/cgi-bin/koha/admin/itemtypes.pl?op=delete_confirm&amp;itemtype=[% itemtype.itemtype |html %]" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a>
381             </td>
382           </tr>
383           [% END %]
384         </table>
385     [% ELSE %]
386         <div class="dialog message">There are no itemtypes defined</div>
387     [% END %]
388 [% END %]
389
390 </div>
391 </div>
392 <div class="yui-b">
393 [% INCLUDE 'admin-menu.inc' %]
394 </div>
395 </div>
396
397 [% MACRO jsinclude BLOCK %]
398     <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
399     [% INCLUDE 'greybox.inc' %]
400     [% INCLUDE 'datatables.inc' %]
401     <script type="text/javascript">
402          $(document).ready(function() {
403             $('#icons').tabs();
404             $("#table_item_type").dataTable($.extend(true, {}, dataTablesDefaults, {
405                 "aoColumnDefs": [
406                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
407                 ],
408                 "aaSorting": [[ 2, "asc" ]],
409                 "iDisplayLength": 10,
410                 "sPaginationType": "four_button"
411             }));
412             $( "#itemtypeentry" ).validate({
413                 rules: {
414                     itemtype: { required: true },
415                     description: { required: true },
416                     rentalcharge: { number: true }
417                 }
418             });
419             $("#itemtype").on("blur",function(){
420                 toUC(this);
421             });
422          });
423     </script>
424 [% END %]
425
426 [% INCLUDE 'intranet-bottom.inc' %]