4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Stock rotation</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% Asset.css("css/datatables.css") %]
8 [% INCLUDE 'datatables.inc' %]
9 [% Asset.js("js/pages/stockrotation.js") %]
10 <script type="text/javascript">
12 $(document).ready(function() {
13 $('#sr_manage_items').dataTable($.extend(true, {}, dataTablesDefaults, {
16 { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
17 { "bSortable": true, "bSearchable": false, 'aTargets': [ 'NoSearch' ] }
19 "sPaginationType": "four_button"
27 [% INCLUDE 'header.inc' %]
28 [% INCLUDE 'patron-search.inc' %]
30 <div id="breadcrumbs">
31 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
32 › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
35 › Stock rotation
37 › <a href="/cgi-bin/koha/tools/stockrotation.pl">Stock rotation</a>
40 [% IF (op == 'create_edit_rota' && rota.rota_id) %]
42 [% ELSIF (op == 'create_edit_rota' && !rota.rota_id) %]
44 [% ELSIF (op == 'manage_stages') %]
45 › Manage stages
46 [% ELSIF (op == 'create_edit_stage' && stage.id) %]
47 <a href="?op=manage_stages&rota_id=[% rota_id %]">› Manage stages</a>
49 [% ELSIF (op == 'create_edit_stage' && !stage.id) %]
50 <a href="?op=manage_stages&rota_id=[% rota_id %]">› Manage stages</a>
52 [% ELSIF (op == 'manage_items') %]
58 <div id="doc3" class="yui-t2">
61 <div id="stockrotation" class="yui-b">
65 [% INCLUDE 'stockrotation-toolbar.inc' %]
67 <h2>Stock rotation</h2>
69 [% IF existing_rotas.size > 0 %]
70 <table class="rotas_table" role="grid">
76 <th>Number of items</th>
80 [% FOREACH rota IN existing_rotas %]
82 <td>[% rota.title %]</td>
83 <td>[% rota.cyclical ? 'Yes' : 'No'%]</td>
84 <td>[% rota.active ? 'Yes' : 'No'%]</td>
85 <td>[% rota.description %]</td>
86 <td>[% rota.stockrotationitems.count %]</td>
88 <a class="btn btn-default btn-xs" href="?op=create_edit_rota&rota_id=[% rota.rota_id %]">
89 <i class="fa fa-pencil"></i>
92 <div class="btn-group" role="group">
93 <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
95 <i class="fa fa-caret-down"></i>
97 <ul class="dropdown-menu">
98 <li><a href="?op=manage_stages&rota_id=[% rota.rota_id %]">Stages</a></li>
99 [% IF CAN_user_stockrotation_manage_rota_items && rota.stockrotationstages.count > 0 %]
100 <li><a href="?op=manage_items&rota_id=[% rota.rota_id %]">Items</a></li>
104 <a class="btn btn-default btn-xs" href="?op=toggle_rota&rota_id=[% rota.rota_id %]">
105 <i class="fa fa-power-off"></i>
106 [% IF !rota.active %]
119 [% ELSIF (op == 'create_edit_rota') %]
121 [% IF rota.rota_id %]
122 <h2>Edit "[% rota.title %]"</h2>
124 <h2>Create new rota</h2>
127 [% IF error == 'invalid_form' %]
128 <div class="dialog alert">
129 <h3>There was a problem with your form submission</h3>
133 <form id="rota_form" method="post" enctype="multipart/form-data" class="validated">
134 <fieldset class="rows">
137 <label class="required" for="title">Name:</label>
138 <input type="text" id="title" name="title" value="[% rota.title %]" required="required" placeholder="Rota name">
139 <span class="required">Required</span>
142 <label for="cyclical">Cyclical:</label>
143 <select name="cyclical" id="cyclical">
144 [% IF rota.cyclical %]
145 <option value="1" selected>Yes</option>
146 <option value="0">No</option>
148 <option value="1">Yes</option>
149 <option value="0" selected>No</option>
154 <label for="description">Description:</label>
155 <textarea id="description" name="description" placeholder="Rota description">[% rota.description %]</textarea>
159 <fieldset class="action">
160 <input type="submit" value="Save">
161 <a href="/cgi-bin/koha/tools/stockrotation.pl" class="cancel">Cancel</a>
163 [% IF rota.rota_id %]
164 <input type="hidden" name="id" value="[% rota.rota_id %]">
166 <input type="hidden" name="op" value="process_rota">
169 [% ELSIF (op == 'manage_stages') %]
171 [% INCLUDE 'stockrotation-toolbar.inc' %]
173 [% IF error == 'invalid_form' %]
174 <div class="dialog alert">
175 <h3>There was a problem with your form submission</h3>
179 <h2>Manage [% rota.title %] stages</h2>
180 <div id="ajax_status"
181 data-saving-msg="Saving changes..."
183 data-failed-msg="Error: ">
184 <span id="ajax_saving_msg"></span>
185 <i id="ajax_saving_icon" class="fa fa-spinner fa-spin"></i>
186 <i id="ajax_success_icon" class="fa fa-check"></i>
187 <i id="ajax_failed_icon" class="fa fa-times"></i>
188 <span id="ajax_success_msg"></span>
189 <span id="ajax_failed_msg"></span>
192 <form id="stage_form" method="post" enctype="multipart/form-data" class="validated">
193 <fieldset class="rows">
194 <legend>Add stage</legend>
197 <label class="required" for="branch">Library:</label>
198 <select name="branchcode" id="branch">
199 [% FOREACH branch IN branches %]
200 [% IF branch.branchcode == stage.branchcode_id %]
201 <option value="[% branch.branchcode %]" selected>[% Branches.GetName(branch.branchcode) %]</option>
203 <option value="[% branch.branchcode %]">[% Branches.GetName(branch.branchcode) %]</option>
207 <span class="required">Required</span>
210 <label class="required" for="duration">Duration:</label>
211 <input type="text" id="duration" name="duration" value="[% stage.duration %]" required="required" placeholder="Duration (days)">
212 <span class="required">Required</span>
216 <fieldset class="action">
217 <input type="submit" value="Submit">
219 <input type="hidden" name="stage_id" value="[% stage.id %]">
220 <input type="hidden" name="rota_id" value="[% rota_id %]">
221 <input type="hidden" name="op" value="process_stage">
224 [% IF existing_stages.size > 0 %]
225 <div id="manage_stages">
226 <div id="manage_stages_help">
227 Stages can be re-ordered by using the <i class="drag_handle fa fa-lg fa-bars"></i>handle to drag and drop them to their new position
229 <div id="stage_list_headings">
230 <span class="stagename">Library</span>
231 <span class="stageduration">Duration (days)</span>
233 <ul id="sortable_stages" data-rota-id="[% rota.rota_id %]">
234 [% FOREACH stage IN existing_stages %]
235 <li id="stage_[% stage.stage_id %]">
236 <span data-toggle="tooltip" title="Drag and drop to move this stage to another position" data-placement="right" class="stagename">
237 [% IF existing_stages.size > 1 %]
238 <i class="drag_handle fa fa-lg fa-bars"></i>
240 [% Branches.GetName(stage.branchcode_id) %]
242 <span class="stageduration">[% stage.duration %]</span>
243 <span class="stageactions">
244 <a class="btn btn-default btn-xs" href="?op=create_edit_stage&stage_id=[% stage.stage_id %]">
245 <i class="fa fa-pencil"></i> Edit
247 <a class="btn btn-default btn-xs" href="?op=confirm_delete_stage&stage_id=[% stage.stage_id %]">
248 <i class="fa fa-trash"></i> Delete
257 <p><a href="stockrotation.pl">Return to rotas</a></p>
259 [% ELSIF (op == 'create_edit_stage') %]
262 <h2>Edit "[% Branches.GetName(stage.branchcode_id) %]"</h2>
264 <h2>Create new stage</h2>
267 [% IF error == 'invalid_form' %]
268 <div class="dialog alert">
269 <h3>There was a problem with your form submission</h3>
273 <form id="stage_form" method="post" enctype="multipart/form-data" class="validated">
274 <fieldset class="rows">
277 <label class="required" for="branch">Library:</label>
278 <select name="branchcode" id="branch">
279 [% FOREACH branch IN branches %]
280 [% IF branch.branchcode == stage.branchcode_id %]
281 <option value="[% branch.branchcode %]" selected>[% Branches.GetName(branch.branchcode) %]</option>
283 <option value="[% branch.branchcode %]">[% Branches.GetName(branch.branchcode) %]</option>
287 <span class="required">Required</span>
290 <label class="required" for="duration">Duration:</label>
291 <input type="text" id="duration" name="duration" value="[% stage.duration %]" required="required" placeholder="Duration (days)">
292 <span class="required">Required</span>
296 <fieldset class="action">
297 <input type="submit" value="Save">
298 <a href="/cgi-bin/koha/tools/stockrotation.pl?op=manage_stages&rota_id=[% rota_id %]" class="cancel">Cancel</a>
300 <input type="hidden" name="stage_id" value="[% stage.id %]">
301 <input type="hidden" name="rota_id" value="[% rota_id %]">
302 <input type="hidden" name="op" value="process_stage">
304 [% ELSIF (op == 'confirm_remove_from_rota') %]
306 <div class="dialog alert">
307 <h3>Are you sure you wish to remove this item from it's rota</h3>
309 <a class="btn btn-default btn-xs approve" href="?op=remove_item_from_stage&item_id=[% item_id %]&stage_id=[% stage_id %]&rota_id=[% rota_id %]"><i class="fa fa-fw fa-check"></i>Yes</a>
310 <a class="btn btn-default btn-xs deny" href="?op=manage_items&rota_id=[% rota_id %]"><i class="fa fa-fw fa-remove"></i>No</a>
313 [% ELSIF (op == 'confirm_delete_stage') %]
315 <div class="dialog alert">
316 <h3>Are you sure you want to delete this stage?</h3>
317 [% IF stage.stockrotationitems.count > 0 %]
318 <p>This stage contains the following item(s):</p>
320 [% FOREACH item IN stage.stockrotationitems %]
321 <li>[% item.itemnumber.biblio.title %] (Barcode: [% item.itemnumber.barcode %])</li>
326 <a class="btn btn-default btn-xs approve" href="?op=delete_stage&stage_id=[% stage.stage_id %]"><i class="fa fa-fw fa-check"></i>Yes</a>
327 <a class="btn btn-default btn-xs deny" href="?op=manage_stages&rota_id=[% stage.rota.rota_id %]"><i class="fa fa-fw fa-remove"></i>No</a>
330 [% ELSIF (op == 'manage_items') %]
332 [% INCLUDE 'stockrotation-toolbar.inc' %]
335 <div class="dialog alert">
336 [% IF error == "item_not_found" %]
337 <h3>The item was not found</h3>
338 [% ELSIF error == "already_on_rota" %]
339 <h3>This item is already on this rota</h3>
344 <h2>Manage [% rota.title %] items</h2>
347 <form id="add_rota_item_form" method="post" enctype="multipart/form-data" class="validated">
348 <fieldset class="rows">
349 <legend>Add item to "[% rota.title %]"</legend>
352 <label for="barcode">Barcode:</label>
353 <input type="text" id="barcode" name="barcode" placeholder="Item barcode" autofocus>
357 <fieldset class="rows">
358 <legend>Use a barcode file</legend>
361 <label for="barcodefile">Barcode file:</label>
362 <input type="file" id="barcodefile" name="barcodefile">
366 <fieldset class="action">
367 <input type="submit" value="Save">
369 <input type="hidden" name="rota_id" value="[% rota.id %]">
370 <input type="hidden" name="op" value="add_items_to_rota">
374 [% IF items.count > 0 %]
375 <h3>Manage items assigned to "[% rota.title %]"</h3>
376 <table id="sr_manage_items" class="items_table" role="grid">
382 <th class="NoSearch">In transit</th>
383 <th class="NoSort">Stages & duration in days<br>(current stage highlighted)</th>
384 <th class="NoSort"> </th>
387 [% FOREACH item IN items %]
389 <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% item.id %]&biblionumber=[% item.itemnumber.biblio.id %]#item[% item.id %]">[% item.itemnumber.barcode %]</a></td>
390 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.itemnumber.biblio.id %]">[% item.itemnumber.biblio.title %]</a></td>
391 <td>[% item.itemnumber.biblio.author %]</td>
392 <td>[% item.itemnumber.itemcallnumber %]</td>
393 <td>[% item.itemnumber.get_transfer ? 'Yes' : 'No' %]</td>
395 [% FOREACH this_stage IN stages %]
396 [% IF this_stage.stage_id == item.stage.stage_id %]
397 <span class="stage highlight_stage">
401 [% Branches.GetName(this_stage.branchcode_id) %] ([% this_stage.duration %])
405 [% IF stages.size > 0 %]
406 <span class="stage">[% rota.cyclical ? 'START' : 'END' %]</span>
410 [% in_transit = item.itemnumber.get_transfer %]
411 [% IF !in_transit && stages.size > 1 %]
412 <a class="btn btn-default btn-xs" href="?op=move_to_next_stage&rota_id=[% rota.id %]&item_id=[% item.id %]&stage_id=[% item.stage.stage_id %]">
414 <a class="btn btn-default btn-xs" disabled>
416 <i class="fa fa-arrow-right"></i>
420 <a class="btn btn-default btn-xs" href="?op=toggle_in_demand&stage_id=[% item.stage.stage_id %]&item_id=[% item.id %]&rota_id=[% rota.id %]">
422 <a class="btn btn-default btn-xs" disabled>
424 <i class="fa fa-fire"></i>
425 [% item.indemand ? 'Remove "In demand"' : 'Add "In demand"' %]
428 <a class="btn btn-default btn-xs" href="?op=confirm_remove_from_rota&stage_id=[% item.stage.stage_id %]&item_id=[% item.id %]&rota_id=[% rota.id %]">
430 <a class="btn btn-default btn-xs" disabled>
432 <i class="fa fa-trash"></i>
442 <p><a href="stockrotation.pl">Return to rotas</a></p>
444 [% ELSIF op == 'add_items_to_rota' %]
446 <div class="dialog message">
447 <h3>Add items to rota report</h3>
451 [% IF barcode_status.ok.size > 0 %]
452 <h4>Items added to rota:</h4>
454 [% FOREACH item_ok IN barcode_status.ok %]
455 <li>[% item_ok.biblio.title %]</li>
459 [% IF barcode_status.on_this.size > 0 %]
460 <h4>Items already on this rota:</h4>
462 [% FOREACH item_on_this IN barcode_status.on_this %]
463 <li>[% item_on_this.biblio.title %]</li>
467 [% IF barcode_status.not_found.size > 0 %]
468 <h4>Barcodes not found:</h4>
470 [% FOREACH barcode_not_found IN barcode_status.not_found %]
471 <li>[% barcode_not_found %]</li>
475 [% IF barcode_status.on_other.size > 0 %]
476 <h4>Items found on other rotas:</h4>
478 [% FOREACH item_on_other IN barcode_status.on_other %]
479 <li>[% item_on_other.biblio.title %]</li>
484 [% IF barcode_status.on_other.size > 0 %]
485 <form id="add_rota_item_form" method="post" enctype="multipart/form-data">
487 <legend>Select items to move to this rota:</legend>
488 [% FOREACH item_on_other IN barcode_status.on_other %]
489 <li><input type="checkbox" name="move_item" value="[% item_on_other.itemnumber %]"> [% item_on_other.biblio.title %] (Currently on "[% item_on_other.stockrotationitem.stage.rota.title %]")</li>
493 <fieldset class="action">
494 <input type="submit" value="Save">
496 <input type="hidden" name="rota_id" value="[% rota_id %]">
497 <input type="hidden" name="op" value="move_items_to_rota">
500 <p><a href="?op=manage_items&rota_id=[% rota_id %]">Return to rota</a></p>
506 [% INCLUDE 'tools-menu.inc' %]
510 [% INCLUDE 'intranet-bottom.inc' %]