7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha › Stock rotation</title>
9 [% INCLUDE 'doc-head-close.inc' %]
12 <body id="tools_stockrotation" class="tools">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'cat-search.inc' %]
16 <div id="breadcrumbs">
17 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
18 › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
21 › Stock rotation
23 › <a href="/cgi-bin/koha/tools/stockrotation.pl">Stock rotation</a>
26 [% IF (op == 'create_edit_rota' && rota.rota_id) %]
28 [% ELSIF (op == 'create_edit_rota' && !rota.rota_id) %]
30 [% ELSIF (op == 'manage_stages') %]
31 › Manage stages
32 [% ELSIF (op == 'create_edit_stage' && stage.id) %]
33 <a href="?op=manage_stages&rota_id=[% rota_id | uri %]">› Manage stages</a>
35 [% ELSIF (op == 'create_edit_stage' && !stage.id) %]
36 <a href="?op=manage_stages&rota_id=[% rota_id | uri %]">› Manage stages</a>
38 [% ELSIF (op == 'manage_items') %]
44 <div class="main container-fluid">
46 <div class="col-sm-10 col-sm-push-2">
49 <div id="stockrotation">
53 [% INCLUDE 'stockrotation-toolbar.inc' %]
55 <h2>Stock rotation</h2>
57 [% IF existing_rotas.size > 0 %]
58 <table class="rotas_table" role="grid">
65 <th>Number of items</th>
70 [% FOREACH rota IN existing_rotas %]
72 <td>[% rota.title | html %]</td>
73 <td>[% rota.cyclical ? 'Yes' : 'No' | html %]</td>
74 <td>[% rota.active ? 'Yes' : 'No' | html %]</td>
75 <td>[% rota.description | html %]</td>
76 <td>[% rota.stockrotationitems.count | html %]</td>
78 <a class="btn btn-default btn-xs" href="?op=create_edit_rota&rota_id=[% rota.rota_id | uri %]">
79 <i class="fa fa-pencil"></i>
82 <div class="btn-group" role="group">
83 <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
85 <i class="fa fa-caret-down"></i>
87 <ul class="dropdown-menu">
88 <li><a href="?op=manage_stages&rota_id=[% rota.rota_id | uri %]">Stages</a></li>
89 [% IF CAN_user_stockrotation_manage_rota_items && rota.stockrotationstages.count > 0 %]
90 <li><a href="?op=manage_items&rota_id=[% rota.rota_id | uri %]">Items</a></li>
94 <a class="btn btn-default btn-xs" href="?op=toggle_rota&rota_id=[% rota.rota_id | uri %]">
95 <i class="fa fa-power-off"></i>
109 [% ELSIF (op == 'create_edit_rota') %]
111 [% IF rota.rota_id %]
112 <h2>Edit "[% rota.title | html %]"</h2>
114 <h2>Create new rota</h2>
117 [% IF error == 'invalid_form' %]
118 <div class="dialog alert">
119 <h3>There was a problem with your form submission</h3>
123 <form id="rota_form" method="post" enctype="multipart/form-data" class="validated">
124 <fieldset class="rows">
127 <label class="required" for="title">Name:</label>
128 <input type="text" id="title" name="title" value="[% rota.title | html %]" required="required" placeholder="Rota name">
129 <span class="required">Required</span>
132 <label for="cyclical">Cyclical:</label>
133 <select name="cyclical" id="cyclical">
134 [% IF rota.cyclical %]
135 <option value="1" selected>Yes</option>
136 <option value="0">No</option>
138 <option value="1">Yes</option>
139 <option value="0" selected>No</option>
144 <label for="description">Description:</label>
145 <textarea id="description" name="description" placeholder="Rota description">[% rota.description | html %]</textarea>
149 <fieldset class="action">
150 <input type="submit" value="Save">
151 <a href="/cgi-bin/koha/tools/stockrotation.pl" class="cancel">Cancel</a>
153 [% IF rota.rota_id %]
154 <input type="hidden" name="id" value="[% rota.rota_id | html %]">
156 <input type="hidden" name="op" value="process_rota">
159 [% ELSIF (op == 'manage_stages') %]
161 [% INCLUDE 'stockrotation-toolbar.inc' %]
163 [% IF error == 'invalid_form' %]
164 <div class="dialog alert">
165 <h3>There was a problem with your form submission</h3>
169 <h2>Manage [% rota.title | html %] stages</h2>
170 <div id="ajax_status"
171 data-saving-msg="Saving changes..."
173 data-failed-msg="Error: ">
174 <span id="ajax_saving_msg"></span>
175 <i id="ajax_saving_icon" class="fa fa-spinner fa-spin"></i>
176 <i id="ajax_success_icon" class="fa fa-check"></i>
177 <i id="ajax_failed_icon" class="fa fa-times"></i>
178 <span id="ajax_success_msg"></span>
179 <span id="ajax_failed_msg"></span>
182 <form id="stage_form" method="post" enctype="multipart/form-data" class="validated">
183 <fieldset class="rows">
184 <legend>Add stage</legend>
187 <label class="required" for="branch">Library:</label>
188 <select name="branchcode" id="branch">
189 [% FOREACH branch IN branches %]
190 [% IF branch.branchcode == stage.branchcode_id %]
191 <option value="[% branch.branchcode | html %]" selected>[% Branches.GetName(branch.branchcode) | html %]</option>
193 <option value="[% branch.branchcode | html %]">[% Branches.GetName(branch.branchcode) | html %]</option>
197 <span class="required">Required</span>
200 <label class="required" for="duration">Duration:</label>
201 <input type="text" id="duration" name="duration" value="[% stage.duration | html %]" required="required" placeholder="Duration (days)">
202 <span class="required">Required</span>
206 <fieldset class="action">
207 <input type="submit" value="Submit">
209 <input type="hidden" name="stage_id" value="[% stage.id | html %]">
210 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
211 <input type="hidden" name="op" value="process_stage">
214 [% IF existing_stages.size > 0 %]
215 <div id="manage_stages">
216 <div id="manage_stages_help">
217 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
219 <div id="stage_list_headings">
220 <span class="stagename">Library</span>
221 <span class="stageduration">Duration (days)</span>
223 <ul id="sortable_stages" data-rota-id="[% rota.rota_id | html %]">
224 [% FOREACH stage IN existing_stages %]
225 <li id="stage_[% stage.stage_id | html %]">
226 <span data-toggle="tooltip" title="Drag and drop to move this stage to another position" data-placement="right" class="stagename">
227 [% IF existing_stages.size > 1 %]
228 <i class="drag_handle fa fa-lg fa-bars"></i>
230 [% Branches.GetName(stage.branchcode_id) | html %]
232 <span class="stageduration">[% stage.duration | html %]</span>
233 <span class="stageactions">
234 <a class="btn btn-default btn-xs" href="?op=create_edit_stage&stage_id=[% stage.stage_id | uri %]">
235 <i class="fa fa-pencil"></i> Edit
237 <a class="btn btn-default btn-xs" href="?op=confirm_delete_stage&stage_id=[% stage.stage_id | uri %]">
238 <i class="fa fa-trash"></i> Delete
247 <p><a href="stockrotation.pl">Return to rotas</a></p>
249 [% ELSIF (op == 'create_edit_stage') %]
252 <h2>Edit "[% Branches.GetName(stage.branchcode_id) | html %]"</h2>
254 <h2>Create new stage</h2>
257 [% IF error == 'invalid_form' %]
258 <div class="dialog alert">
259 <h3>There was a problem with your form submission</h3>
263 <form id="stage_form" method="post" enctype="multipart/form-data" class="validated">
264 <fieldset class="rows">
267 <label class="required" for="branch">Library:</label>
268 <select name="branchcode" id="branch">
269 [% FOREACH branch IN branches %]
270 [% IF branch.branchcode == stage.branchcode_id %]
271 <option value="[% branch.branchcode | html %]" selected>[% Branches.GetName(branch.branchcode) | html %]</option>
273 <option value="[% branch.branchcode | html %]">[% Branches.GetName(branch.branchcode) | html %]</option>
277 <span class="required">Required</span>
280 <label class="required" for="duration">Duration:</label>
281 <input type="text" id="duration" name="duration" value="[% stage.duration | html %]" required="required" placeholder="Duration (days)">
282 <span class="required">Required</span>
286 <fieldset class="action">
287 <input type="submit" value="Save">
288 <a href="/cgi-bin/koha/tools/stockrotation.pl?op=manage_stages&rota_id=[% rota_id | uri %]" class="cancel">Cancel</a>
290 <input type="hidden" name="stage_id" value="[% stage.id | html %]">
291 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
292 <input type="hidden" name="op" value="process_stage">
294 [% ELSIF (op == 'confirm_remove_from_rota') %]
296 <div class="dialog alert">
297 <h3>Are you sure you wish to remove this item from it's rota</h3>
299 <a class="btn btn-default btn-xs approve" href="?op=remove_item_from_stage&item_id=[% item_id | uri %]&stage_id=[% stage_id | uri %]&rota_id=[% rota_id | uri %]"><i class="fa fa-fw fa-check"></i>Yes</a>
300 <a class="btn btn-default btn-xs deny" href="?op=manage_items&rota_id=[% rota_id | uri %]"><i class="fa fa-fw fa-remove"></i>No</a>
303 [% ELSIF (op == 'confirm_delete_stage') %]
305 <div class="dialog alert">
306 <h3>Are you sure you want to delete this stage?</h3>
307 [% IF stage.stockrotationitems.count > 0 %]
308 <p>This stage contains the following item(s):</p>
310 [% FOREACH item IN stage.stockrotationitems %]
311 <li>[% item.itemnumber.biblio.title | html %] (Barcode: [% item.itemnumber.barcode | html %])</li>
316 <a class="btn btn-default btn-xs approve" href="?op=delete_stage&stage_id=[% stage.stage_id | uri %]"><i class="fa fa-fw fa-check"></i>Yes</a>
317 <a class="btn btn-default btn-xs deny" href="?op=manage_stages&rota_id=[% stage.rota.rota_id | uri %]"><i class="fa fa-fw fa-remove"></i>No</a>
320 [% ELSIF (op == 'manage_items') %]
322 [% INCLUDE 'stockrotation-toolbar.inc' %]
325 <div class="dialog alert">
326 [% IF error == "item_not_found" %]
327 <h3>The item was not found</h3>
328 [% ELSIF error == "already_on_rota" %]
329 <h3>This item is already on this rota</h3>
334 <h2>Manage [% rota.title | html %] items</h2>
337 <form id="add_rota_item_form" method="post" enctype="multipart/form-data" class="validated">
338 <fieldset class="rows">
339 <legend>Add item to "[% rota.title | html %]"</legend>
342 <label for="barcode">Barcode:</label>
343 <input type="text" id="barcode" name="barcode" placeholder="Item barcode" autofocus>
347 <fieldset class="rows">
348 <legend>Use a barcode file</legend>
351 <label for="barcodefile">Barcode file:</label>
352 <input type="file" id="barcodefile" name="barcodefile">
356 <fieldset class="action">
357 <input type="submit" value="Save">
359 <input type="hidden" name="rota_id" value="[% rota.id | html %]">
360 <input type="hidden" name="op" value="add_items_to_rota">
364 [% IF items.count > 0 %]
365 <h3>Manage items assigned to "[% rota.title | html %]"</h3>
366 <table id="sr_manage_items" class="items_table" role="grid">
373 <th class="NoSearch">In transit</th>
374 <th class="NoSort">Stages & duration in days<br>(current stage highlighted)</th>
375 <th class="NoSort"> </th>
379 [% FOREACH item IN items %]
381 <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% item.id | uri %]&biblionumber=[% item.itemnumber.biblio.id | uri %]#item[% item.id | uri %]">[% item.itemnumber.barcode | html %]</a></td>
382 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.itemnumber.biblio.id | uri %]">[% item.itemnumber.biblio.title | html %]</a></td>
383 <td>[% item.itemnumber.biblio.author | html %]</td>
384 <td>[% item.itemnumber.itemcallnumber | html %]</td>
385 <td>[% item.itemnumber.get_transfer ? 'Yes' : 'No' | html %]</td>
387 [% FOREACH this_stage IN stages %]
388 [% IF this_stage.stage_id == item.stage.stage_id %]
389 <span class="stage highlight_stage">
393 [% Branches.GetName(this_stage.branchcode_id) | html %] ([% this_stage.duration | html %])
397 [% IF stages.size > 0 %]
398 <span class="stage">[% rota.cyclical ? 'START' : 'END' | html %]</span>
402 [% in_transit = item.itemnumber.get_transfer %]
403 [% IF !in_transit && stages.size > 1 %]
404 <a class="btn btn-default btn-xs" href="?op=move_to_next_stage&rota_id=[% rota.id | uri %]&item_id=[% item.id | uri %]&stage_id=[% item.stage.stage_id | uri %]">
406 <a class="btn btn-default btn-xs" disabled>
408 <i class="fa fa-arrow-right"></i>
412 <a class="btn btn-default btn-xs" href="?op=toggle_in_demand&stage_id=[% item.stage.stage_id | uri %]&item_id=[% item.id | uri %]&rota_id=[% rota.id | uri %]">
414 <a class="btn btn-default btn-xs" disabled>
416 <i class="fa fa-fire"></i>
417 [% IF item.indemand %]
418 <span>Remove "In demand"</span>
420 <span>Add "In demand"</span>
424 <a class="btn btn-default btn-xs" href="?op=confirm_remove_from_rota&stage_id=[% item.stage.stage_id | uri %]&item_id=[% item.id | uri %]&rota_id=[% rota.id | uri %]">
426 <a class="btn btn-default btn-xs" disabled>
428 <i class="fa fa-trash"></i>
438 <p><a href="stockrotation.pl">Return to rotas</a></p>
440 [% ELSIF op == 'add_items_to_rota' %]
442 <div class="dialog message">
443 <h3>Add items to rota report</h3>
447 [% IF barcode_status.ok.size > 0 %]
448 <h4>Items added to rota:</h4>
450 [% FOREACH item_ok IN barcode_status.ok %]
451 <li>[% item_ok.biblio.title | html %]</li>
455 [% IF barcode_status.on_this.size > 0 %]
456 <h4>Items already on this rota:</h4>
458 [% FOREACH item_on_this IN barcode_status.on_this %]
459 <li>[% item_on_this.biblio.title | html %]</li>
463 [% IF barcode_status.not_found.size > 0 %]
464 <h4>Barcodes not found:</h4>
466 [% FOREACH barcode_not_found IN barcode_status.not_found %]
467 <li>[% barcode_not_found | html %]</li>
471 [% IF barcode_status.on_other.size > 0 %]
472 <h4>Items found on other rotas:</h4>
474 [% FOREACH item_on_other IN barcode_status.on_other %]
475 <li>[% item_on_other.biblio.title | html %]</li>
480 [% IF barcode_status.on_other.size > 0 %]
481 <form id="add_rota_item_form" method="post" enctype="multipart/form-data">
483 <legend>Select items to move to this rota:</legend>
484 [% FOREACH item_on_other IN barcode_status.on_other %]
485 <li><input type="checkbox" name="move_item" value="[% item_on_other.itemnumber | html %]"> [% item_on_other.biblio.title | html %] (Currently on "[% item_on_other.stockrotationitem.stage.rota.title | html %]")</li>
489 <fieldset class="action">
490 <input type="submit" value="Save">
492 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
493 <input type="hidden" name="op" value="move_items_to_rota">
496 <p><a href="?op=manage_items&rota_id=[% rota_id | uri %]">Return to rota</a></p>
501 </div> <!-- /.col-sm-10.col-sm-push-2 -->
503 <div class="col-sm-2 col-sm-pull-10">
505 [% INCLUDE 'tools-menu.inc' %]
507 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
508 </div> <!-- /.row -->
511 [% MACRO jsinclude BLOCK %]
512 [% Asset.js("js/tools-menu.js") | $raw %]
513 [% INCLUDE 'datatables.inc' %]
514 [% Asset.js("js/pages/stockrotation.js") | $raw %]
516 $(document).ready(function() {
517 $('#sr_manage_items').dataTable($.extend(true, {}, dataTablesDefaults, {
520 { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
521 { "bSortable": true, "bSearchable": false, 'aTargets': [ 'NoSearch' ] }
523 "sPaginationType": "four_button"
529 [% INCLUDE 'intranet-bottom.inc' %]