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