7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha › Stock rotation</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% Asset.css("css/datatables.css") | $raw %]
13 <body id="tools_stockrotation" class="tools">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'patron-search.inc' %]
17 <div id="breadcrumbs">
18 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
19 › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
22 › Stock rotation
24 › <a href="/cgi-bin/koha/tools/stockrotation.pl">Stock rotation</a>
27 [% IF (op == 'create_edit_rota' && rota.rota_id) %]
29 [% ELSIF (op == 'create_edit_rota' && !rota.rota_id) %]
31 [% ELSIF (op == 'manage_stages') %]
32 › Manage stages
33 [% ELSIF (op == 'create_edit_stage' && stage.id) %]
34 <a href="?op=manage_stages&rota_id=[% rota_id | uri %]">› Manage stages</a>
36 [% ELSIF (op == 'create_edit_stage' && !stage.id) %]
37 <a href="?op=manage_stages&rota_id=[% rota_id | uri %]">› Manage stages</a>
39 [% ELSIF (op == 'manage_items') %]
45 <div id="doc3" class="yui-t2">
48 <div id="stockrotation" class="yui-b">
52 [% INCLUDE 'stockrotation-toolbar.inc' %]
54 <h2>Stock rotation</h2>
56 [% IF existing_rotas.size > 0 %]
57 <table class="rotas_table" role="grid">
63 <th>Number of items</th>
67 [% FOREACH rota IN existing_rotas %]
69 <td>[% rota.title | html %]</td>
70 <td>[% rota.cyclical ? 'Yes' : 'No' | html %]</td>
71 <td>[% rota.active ? 'Yes' : 'No' | html %]</td>
72 <td>[% rota.description | html %]</td>
73 <td>[% rota.stockrotationitems.count | html %]</td>
75 <a class="btn btn-default btn-xs" href="?op=create_edit_rota&rota_id=[% rota.rota_id | uri %]">
76 <i class="fa fa-pencil"></i>
79 <div class="btn-group" role="group">
80 <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
82 <i class="fa fa-caret-down"></i>
84 <ul class="dropdown-menu">
85 <li><a href="?op=manage_stages&rota_id=[% rota.rota_id | uri %]">Stages</a></li>
86 [% IF CAN_user_stockrotation_manage_rota_items && rota.stockrotationstages.count > 0 %]
87 <li><a href="?op=manage_items&rota_id=[% rota.rota_id | uri %]">Items</a></li>
91 <a class="btn btn-default btn-xs" href="?op=toggle_rota&rota_id=[% rota.rota_id | uri %]">
92 <i class="fa fa-power-off"></i>
106 [% ELSIF (op == 'create_edit_rota') %]
108 [% IF rota.rota_id %]
109 <h2>Edit "[% rota.title | html %]"</h2>
111 <h2>Create new rota</h2>
114 [% IF error == 'invalid_form' %]
115 <div class="dialog alert">
116 <h3>There was a problem with your form submission</h3>
120 <form id="rota_form" method="post" enctype="multipart/form-data" class="validated">
121 <fieldset class="rows">
124 <label class="required" for="title">Name:</label>
125 <input type="text" id="title" name="title" value="[% rota.title | html %]" required="required" placeholder="Rota name">
126 <span class="required">Required</span>
129 <label for="cyclical">Cyclical:</label>
130 <select name="cyclical" id="cyclical">
131 [% IF rota.cyclical %]
132 <option value="1" selected>Yes</option>
133 <option value="0">No</option>
135 <option value="1">Yes</option>
136 <option value="0" selected>No</option>
141 <label for="description">Description:</label>
142 <textarea id="description" name="description" placeholder="Rota description">[% rota.description | html %]</textarea>
146 <fieldset class="action">
147 <input type="submit" value="Save">
148 <a href="/cgi-bin/koha/tools/stockrotation.pl" class="cancel">Cancel</a>
150 [% IF rota.rota_id %]
151 <input type="hidden" name="id" value="[% rota.rota_id | html %]">
153 <input type="hidden" name="op" value="process_rota">
156 [% ELSIF (op == 'manage_stages') %]
158 [% INCLUDE 'stockrotation-toolbar.inc' %]
160 [% IF error == 'invalid_form' %]
161 <div class="dialog alert">
162 <h3>There was a problem with your form submission</h3>
166 <h2>Manage [% rota.title | html %] stages</h2>
167 <div id="ajax_status"
168 data-saving-msg="Saving changes..."
170 data-failed-msg="Error: ">
171 <span id="ajax_saving_msg"></span>
172 <i id="ajax_saving_icon" class="fa fa-spinner fa-spin"></i>
173 <i id="ajax_success_icon" class="fa fa-check"></i>
174 <i id="ajax_failed_icon" class="fa fa-times"></i>
175 <span id="ajax_success_msg"></span>
176 <span id="ajax_failed_msg"></span>
179 <form id="stage_form" method="post" enctype="multipart/form-data" class="validated">
180 <fieldset class="rows">
181 <legend>Add stage</legend>
184 <label class="required" for="branch">Library:</label>
185 <select name="branchcode" id="branch">
186 [% FOREACH branch IN branches %]
187 [% IF branch.branchcode == stage.branchcode_id %]
188 <option value="[% branch.branchcode | html %]" selected>[% Branches.GetName(branch.branchcode) | html %]</option>
190 <option value="[% branch.branchcode | html %]">[% Branches.GetName(branch.branchcode) | html %]</option>
194 <span class="required">Required</span>
197 <label class="required" for="duration">Duration:</label>
198 <input type="text" id="duration" name="duration" value="[% stage.duration | html %]" required="required" placeholder="Duration (days)">
199 <span class="required">Required</span>
203 <fieldset class="action">
204 <input type="submit" value="Submit">
206 <input type="hidden" name="stage_id" value="[% stage.id | html %]">
207 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
208 <input type="hidden" name="op" value="process_stage">
211 [% IF existing_stages.size > 0 %]
212 <div id="manage_stages">
213 <div id="manage_stages_help">
214 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
216 <div id="stage_list_headings">
217 <span class="stagename">Library</span>
218 <span class="stageduration">Duration (days)</span>
220 <ul id="sortable_stages" data-rota-id="[% rota.rota_id | html %]">
221 [% FOREACH stage IN existing_stages %]
222 <li id="stage_[% stage.stage_id | html %]">
223 <span data-toggle="tooltip" title="Drag and drop to move this stage to another position" data-placement="right" class="stagename">
224 [% IF existing_stages.size > 1 %]
225 <i class="drag_handle fa fa-lg fa-bars"></i>
227 [% Branches.GetName(stage.branchcode_id) | html %]
229 <span class="stageduration">[% stage.duration | html %]</span>
230 <span class="stageactions">
231 <a class="btn btn-default btn-xs" href="?op=create_edit_stage&stage_id=[% stage.stage_id | uri %]">
232 <i class="fa fa-pencil"></i> Edit
234 <a class="btn btn-default btn-xs" href="?op=confirm_delete_stage&stage_id=[% stage.stage_id | uri %]">
235 <i class="fa fa-trash"></i> Delete
244 <p><a href="stockrotation.pl">Return to rotas</a></p>
246 [% ELSIF (op == 'create_edit_stage') %]
249 <h2>Edit "[% Branches.GetName(stage.branchcode_id) | html %]"</h2>
251 <h2>Create new stage</h2>
254 [% IF error == 'invalid_form' %]
255 <div class="dialog alert">
256 <h3>There was a problem with your form submission</h3>
260 <form id="stage_form" method="post" enctype="multipart/form-data" class="validated">
261 <fieldset class="rows">
264 <label class="required" for="branch">Library:</label>
265 <select name="branchcode" id="branch">
266 [% FOREACH branch IN branches %]
267 [% IF branch.branchcode == stage.branchcode_id %]
268 <option value="[% branch.branchcode | html %]" selected>[% Branches.GetName(branch.branchcode) | html %]</option>
270 <option value="[% branch.branchcode | html %]">[% Branches.GetName(branch.branchcode) | html %]</option>
274 <span class="required">Required</span>
277 <label class="required" for="duration">Duration:</label>
278 <input type="text" id="duration" name="duration" value="[% stage.duration | html %]" required="required" placeholder="Duration (days)">
279 <span class="required">Required</span>
283 <fieldset class="action">
284 <input type="submit" value="Save">
285 <a href="/cgi-bin/koha/tools/stockrotation.pl?op=manage_stages&rota_id=[% rota_id | uri %]" class="cancel">Cancel</a>
287 <input type="hidden" name="stage_id" value="[% stage.id | html %]">
288 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
289 <input type="hidden" name="op" value="process_stage">
291 [% ELSIF (op == 'confirm_remove_from_rota') %]
293 <div class="dialog alert">
294 <h3>Are you sure you wish to remove this item from it's rota</h3>
296 <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>
297 <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>
300 [% ELSIF (op == 'confirm_delete_stage') %]
302 <div class="dialog alert">
303 <h3>Are you sure you want to delete this stage?</h3>
304 [% IF stage.stockrotationitems.count > 0 %]
305 <p>This stage contains the following item(s):</p>
307 [% FOREACH item IN stage.stockrotationitems %]
308 <li>[% item.itemnumber.biblio.title | html %] (Barcode: [% item.itemnumber.barcode | html %])</li>
313 <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>
314 <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>
317 [% ELSIF (op == 'manage_items') %]
319 [% INCLUDE 'stockrotation-toolbar.inc' %]
322 <div class="dialog alert">
323 [% IF error == "item_not_found" %]
324 <h3>The item was not found</h3>
325 [% ELSIF error == "already_on_rota" %]
326 <h3>This item is already on this rota</h3>
331 <h2>Manage [% rota.title | html %] items</h2>
334 <form id="add_rota_item_form" method="post" enctype="multipart/form-data" class="validated">
335 <fieldset class="rows">
336 <legend>Add item to "[% rota.title | html %]"</legend>
339 <label for="barcode">Barcode:</label>
340 <input type="text" id="barcode" name="barcode" placeholder="Item barcode" autofocus>
344 <fieldset class="rows">
345 <legend>Use a barcode file</legend>
348 <label for="barcodefile">Barcode file:</label>
349 <input type="file" id="barcodefile" name="barcodefile">
353 <fieldset class="action">
354 <input type="submit" value="Save">
356 <input type="hidden" name="rota_id" value="[% rota.id | html %]">
357 <input type="hidden" name="op" value="add_items_to_rota">
361 [% IF items.count > 0 %]
362 <h3>Manage items assigned to "[% rota.title | html %]"</h3>
363 <table id="sr_manage_items" class="items_table" role="grid">
369 <th class="NoSearch">In transit</th>
370 <th class="NoSort">Stages & duration in days<br>(current stage highlighted)</th>
371 <th class="NoSort"> </th>
374 [% FOREACH item IN items %]
376 <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>
377 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.itemnumber.biblio.id | uri %]">[% item.itemnumber.biblio.title | html %]</a></td>
378 <td>[% item.itemnumber.biblio.author | html %]</td>
379 <td>[% item.itemnumber.itemcallnumber | html %]</td>
380 <td>[% item.itemnumber.get_transfer ? 'Yes' : 'No' | html %]</td>
382 [% FOREACH this_stage IN stages %]
383 [% IF this_stage.stage_id == item.stage.stage_id %]
384 <span class="stage highlight_stage">
388 [% Branches.GetName(this_stage.branchcode_id) | html %] ([% this_stage.duration | html %])
392 [% IF stages.size > 0 %]
393 <span class="stage">[% rota.cyclical ? 'START' : 'END' | html %]</span>
397 [% in_transit = item.itemnumber.get_transfer %]
398 [% IF !in_transit && stages.size > 1 %]
399 <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 %]">
401 <a class="btn btn-default btn-xs" disabled>
403 <i class="fa fa-arrow-right"></i>
407 <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 %]">
409 <a class="btn btn-default btn-xs" disabled>
411 <i class="fa fa-fire"></i>
412 [% item.indemand ? 'Remove "In demand"' : 'Add "In demand"' | html %]
415 <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 %]">
417 <a class="btn btn-default btn-xs" disabled>
419 <i class="fa fa-trash"></i>
429 <p><a href="stockrotation.pl">Return to rotas</a></p>
431 [% ELSIF op == 'add_items_to_rota' %]
433 <div class="dialog message">
434 <h3>Add items to rota report</h3>
438 [% IF barcode_status.ok.size > 0 %]
439 <h4>Items added to rota:</h4>
441 [% FOREACH item_ok IN barcode_status.ok %]
442 <li>[% item_ok.biblio.title | html %]</li>
446 [% IF barcode_status.on_this.size > 0 %]
447 <h4>Items already on this rota:</h4>
449 [% FOREACH item_on_this IN barcode_status.on_this %]
450 <li>[% item_on_this.biblio.title | html %]</li>
454 [% IF barcode_status.not_found.size > 0 %]
455 <h4>Barcodes not found:</h4>
457 [% FOREACH barcode_not_found IN barcode_status.not_found %]
458 <li>[% barcode_not_found | html %]</li>
462 [% IF barcode_status.on_other.size > 0 %]
463 <h4>Items found on other rotas:</h4>
465 [% FOREACH item_on_other IN barcode_status.on_other %]
466 <li>[% item_on_other.biblio.title | html %]</li>
471 [% IF barcode_status.on_other.size > 0 %]
472 <form id="add_rota_item_form" method="post" enctype="multipart/form-data">
474 <legend>Select items to move to this rota:</legend>
475 [% FOREACH item_on_other IN barcode_status.on_other %]
476 <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>
480 <fieldset class="action">
481 <input type="submit" value="Save">
483 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
484 <input type="hidden" name="op" value="move_items_to_rota">
487 <p><a href="?op=manage_items&rota_id=[% rota_id | uri %]">Return to rota</a></p>
493 [% INCLUDE 'tools-menu.inc' %]
498 [% MACRO jsinclude BLOCK %]
499 [% Asset.js("js/tools-menu.js") | $raw %]
500 [% INCLUDE 'datatables.inc' %]
501 [% Asset.js("js/pages/stockrotation.js") | $raw %]
502 <script type="text/javascript">
503 $(document).ready(function() {
504 $('#sr_manage_items').dataTable($.extend(true, {}, dataTablesDefaults, {
507 { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
508 { "bSortable": true, "bSearchable": false, 'aTargets': [ 'NoSearch' ] }
510 "sPaginationType": "four_button"
516 [% INCLUDE 'intranet-bottom.inc' %]