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