6 [% USE TablesSettings %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Stock rotation › Cataloging › Koha</title>
10 [% INCLUDE 'doc-head-close.inc' %]
13 <body id="tools_stockrotation" class="tools">
14 [% WRAPPER 'header.inc' %]
15 [% INCLUDE 'cat-search.inc' %]
18 [% WRAPPER 'sub-header.inc' %]
19 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
22 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
25 <a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
30 <a href="#" aria-current="page">
36 <a href="/cgi-bin/koha/tools/stockrotation.pl">Stock rotation</a>
40 [% IF (op == 'create_edit_rota' && rota.rota_id) %]
42 <a href="#" aria-current="page">
46 [% ELSIF (op == 'create_edit_rota' && !rota.rota_id) %]
48 <a href="#" aria-current="page">
52 [% ELSIF (op == 'manage_stages') %]
54 <a href="#" aria-current="page">
58 [% ELSIF (op == 'create_edit_stage' && stage.id) %]
60 <a href="?op=manage_stages&rota_id=[% rota_id | uri %]">Manage stages</a>
63 <a href="#" aria-current="page">
67 [% ELSIF (op == 'create_edit_stage' && !stage.id) %]
69 <a href="?op=manage_stages&rota_id=[% rota_id | uri %]">
75 <a href="#" aria-current="page">
79 [% ELSIF (op == 'manage_items') %]
81 <a href="#" aria-current="page">
90 <div class="main container-fluid">
92 <div class="col-sm-10 col-sm-push-2">
95 <div id="stockrotation">
99 [% INCLUDE 'stockrotation-toolbar.inc' %]
101 <h1>Stock rotation</h1>
103 [% IF existing_rotas.size > 0 %]
104 <div class="page-section">
105 <table id="stock_rotation" class="rotas_table" role="grid">
108 <th class="anti-the">Name</th>
112 <th>Number of items</th>
113 <th class="NoSort noExport"> </th>
117 [% FOREACH rota IN existing_rotas %]
119 <td>[% rota.title | html %]</td>
120 <td>[% rota.cyclical ? 'Yes' : 'No' | html %]</td>
121 <td>[% rota.active ? 'Yes' : 'No' | html %]</td>
122 <td>[% rota.description | html %]</td>
123 <td>[% rota.stockrotationitems.count | html %]</td>
125 <a class="btn btn-default btn-xs" href="?op=create_edit_rota&rota_id=[% rota.rota_id | uri %]">
126 <i class="fa fa-pencil"></i>
129 <div class="btn-group dropup" role="group">
130 <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
132 <i class="fa fa-caret-down"></i>
134 <ul class="dropdown-menu pull-right">
135 <li><a href="?op=manage_stages&rota_id=[% rota.rota_id | uri %]">Stages</a></li>
136 [% IF CAN_user_stockrotation_manage_rota_items && rota.stockrotationstages.count > 0 %]
137 <li><a href="?op=manage_items&rota_id=[% rota.rota_id | uri %]">Items</a></li>
141 <a class="btn btn-default btn-xs" href="?op=toggle_rota&rota_id=[% rota.rota_id | uri %]">
142 <i class="fa fa-power-off"></i>
143 [% IF !rota.active %]
154 </div><!-- /.page-section -->
157 [% ELSIF (op == 'create_edit_rota') %]
159 [% IF rota.rota_id %]
160 <h1>Edit "[% rota.title | html %]"</h1>
162 <h1>Create new rota</h1>
165 [% IF error == 'invalid_form' %]
166 <div class="dialog alert">
167 <h3>There was a problem with your form submission</h3>
171 <form id="rota_form" method="post" enctype="multipart/form-data" class="validated">
172 <fieldset class="rows">
175 <label class="required" for="title">Name:</label>
176 <input type="text" id="title" name="title" value="[% rota.title | html %]" required="required" placeholder="Rota name">
177 <span class="required">Required</span>
180 <label for="cyclical">Cyclical:</label>
181 <select name="cyclical" id="cyclical">
182 [% IF rota.cyclical %]
183 <option value="1" selected="selected">Yes</option>
184 <option value="0">No</option>
186 <option value="1">Yes</option>
187 <option value="0" selected="selected">No</option>
192 <label for="description">Description:</label>
193 <textarea id="description" name="description" placeholder="Rota description">[% rota.description | html %]</textarea>
197 <fieldset class="action">
198 <input type="submit" class="btn btn-primary" value="Save" />
199 <a href="/cgi-bin/koha/tools/stockrotation.pl" class="cancel">Cancel</a>
201 [% IF rota.rota_id %]
202 <input type="hidden" name="id" value="[% rota.rota_id | html %]">
204 <input type="hidden" name="op" value="process_rota">
207 [% ELSIF (op == 'manage_stages') %]
209 [% INCLUDE 'stockrotation-toolbar.inc' %]
211 [% IF error == 'invalid_form' %]
212 <div class="dialog alert">
213 <h3>There was a problem with your form submission</h3>
217 <h1>Manage <em>[% rota.title | html %]</em> stages</h1>
218 <div id="ajax_status"
219 data-saving-msg="Saving changes..."
221 data-failed-msg="Error: ">
222 <span id="ajax_saving_msg"></span>
223 <i id="ajax_saving_icon" class="fa fa-spinner fa-spin"></i>
224 <i id="ajax_success_icon" class="fa fa-check"></i>
225 <i id="ajax_failed_icon" class="fa fa-times"></i>
226 <span id="ajax_success_msg"></span>
227 <span id="ajax_failed_msg"></span>
230 <!-- Add stage modal -->
231 <div class="modal" id="addStageModal" tabindex="-1" role="dialog" aria-labelledby="addStageLabel">
232 <form id="stage_form" method="post" enctype="multipart/form-data" class="validated">
233 <div class="modal-dialog" role="document">
234 <div class="modal-content">
235 <div class="modal-header">
236 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
237 <h4 class="modal-title" id="addStageLabel">Add stage to <em>[% rota.title | html %]</em></h4>
239 <div class="modal-body">
240 <fieldset class="rows">
243 <label class="required" for="branch">Library:</label>
244 <select name="branchcode" id="branch">
245 [% FOREACH branch IN branches %]
246 [% IF branch.branchcode == stage.branchcode_id %]
247 <option value="[% branch.branchcode | html %]" selected="selected">[% Branches.GetName(branch.branchcode) | html %]</option>
249 <option value="[% branch.branchcode | html %]">[% Branches.GetName(branch.branchcode) | html %]</option>
253 <span class="required">Required</span>
256 <label class="required" for="duration">Duration:</label>
257 <input type="text" id="duration" name="duration" value="[% stage.duration | html %]" required="required" placeholder="Duration (days)">
258 <span class="required">Required</span>
261 </fieldset> <!-- /.rows -->
262 </div> <!-- /.modal-body -->
263 <div class="modal-footer">
264 <input type="hidden" name="stage_id" value="[% stage.id | html %]">
265 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
266 <input type="hidden" name="op" value="process_stage">
267 <button type="submit" class="btn btn-default">Save</button>
268 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
269 </div> <!-- /.modal-footer -->
270 </div> <!-- /.modal-content -->
271 </div> <!-- /.modal-dialog -->
272 </form> <!-- /#stage_form -->
273 </div> <!-- /#addStageModal -->
275 [% IF existing_stages.size > 0 %]
276 <div id="manage_stages" class="page-section">
277 <div id="manage_stages_help">
278 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
280 <div id="stage_list_headings">
281 <span class="stagename">Library</span>
282 <span class="stageduration">Duration (days)</span>
284 <ul id="sortable_stages" data-rota-id="[% rota.rota_id | html %]">
285 [% FOREACH stage IN existing_stages %]
286 <li id="stage_[% stage.stage_id | html %]">
287 <span data-toggle="tooltip" title="Drag and drop to move this stage to another position" data-placement="right" class="stagename">
288 [% IF existing_stages.size > 1 %]
289 <i class="drag_handle fa fa-lg fa-bars"></i>
291 [% Branches.GetName(stage.branchcode_id) | html %]
293 <span class="stageduration">[% stage.duration | html %]</span>
294 <span class="stageactions">
295 <a class="btn btn-default btn-xs" href="?op=create_edit_stage&stage_id=[% stage.stage_id | uri %]">
296 <i class="fa fa-pencil"></i> Edit
298 <a class="btn btn-default btn-xs" href="?op=confirm_delete_stage&stage_id=[% stage.stage_id | uri %]">
299 <i class="fa fa-trash"></i> Delete
308 <div class="dialog message">
309 <h4>This rota has no stages.</h4>
310 <p><button type="button" data-toggle="modal" data-target="#addStageModal"><i class="fa fa-plus"></i> Add a stage</button></p>
315 <p><a href="stockrotation.pl">Return to rotas</a></p>
317 [% ELSIF (op == 'create_edit_stage') %]
320 <h1>Edit "[% Branches.GetName(stage.branchcode_id) | html %]"</h1>
322 <h1>Create new stage</h1>
325 [% IF error == 'invalid_form' %]
326 <div class="dialog alert">
327 <h3>There was a problem with your form submission</h3>
331 <form id="stage_form" method="post" enctype="multipart/form-data" class="validated">
332 <fieldset class="rows">
335 <label class="required" for="branch">Library:</label>
336 <select name="branchcode" id="branch">
337 [% FOREACH branch IN branches %]
338 [% IF branch.branchcode == stage.branchcode_id %]
339 <option value="[% branch.branchcode | html %]" selected="selected">[% Branches.GetName(branch.branchcode) | html %]</option>
341 <option value="[% branch.branchcode | html %]">[% Branches.GetName(branch.branchcode) | html %]</option>
345 <span class="required">Required</span>
348 <label class="required" for="duration">Duration:</label>
349 <input type="text" id="duration" name="duration" value="[% stage.duration | html %]" required="required" placeholder="Duration (days)">
350 <span class="required">Required</span>
354 <fieldset class="action">
355 <input type="submit" class="btn btn-primary" value="Save" />
356 <a href="/cgi-bin/koha/tools/stockrotation.pl?op=manage_stages&rota_id=[% rota_id | uri %]" class="cancel">Cancel</a>
358 <input type="hidden" name="stage_id" value="[% stage.id | html %]">
359 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
360 <input type="hidden" name="op" value="process_stage">
362 [% ELSIF (op == 'confirm_remove_from_rota') %]
364 <div class="dialog alert">
365 <h1>Are you sure you wish to remove this item from it's rota</h1>
367 <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>
368 <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>
371 [% ELSIF (op == 'confirm_delete_stage') %]
373 <div class="dialog alert">
374 <h1>Are you sure you want to delete this stage?</h1>
375 [% IF stage.stockrotationitems.count > 0 %]
376 <p>This stage contains the following item(s):</p>
378 [% FOREACH sritem IN stage.stockrotationitems %]
379 <li>[% sritem.item.biblio.title | html %] (Barcode: [% sritem.item.barcode | html %])</li>
384 <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>
385 <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>
388 [% ELSIF (op == 'manage_items') %]
390 [% INCLUDE 'stockrotation-toolbar.inc' %]
393 <div class="dialog alert">
394 [% IF error == "item_not_found" %]
395 <h3>The item was not found</h3>
396 [% ELSIF error == "already_on_rota" %]
397 <h3>This item is already on this rota</h3>
402 <h1>Manage items assigned to <em>[% rota.title | html %]</em></h1>
404 <!-- Add items modal -->
405 <div class="modal" id="addItemsModal" tabindex="-1" role="dialog" aria-labelledby="addItemsLabel">
406 <form id="add_rota_item_form" method="post" enctype="multipart/form-data" class="validated">
407 <div class="modal-dialog" role="document">
408 <div class="modal-content">
409 <div class="modal-header">
410 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
411 <h4 class="modal-title" id="addItemsLabel">Add item to <em>[% rota.title | html %]</em></h4>
413 <div class="modal-body">
414 <fieldset class="rows">
415 <legend>Add an item by barcode</legend>
418 <label for="barcode">Barcode:</label>
419 <input type="text" id="barcode" name="barcode" placeholder="Item barcode" autofocus>
423 <fieldset class="rows">
424 <legend>Use a barcode file</legend>
427 <label for="barcodefile">Barcode file:</label>
428 <input type="file" id="barcodefile" name="barcodefile">
431 </fieldset> <!-- /.rows -->
432 </div> <!-- /.modal-body -->
433 <div class="modal-footer">
434 <input type="hidden" name="rota_id" value="[% rota.id | html %]">
435 <input type="hidden" name="op" value="add_items_to_rota">
436 <button type="submit" class="btn btn-default">Save</button>
437 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
438 </div> <!-- /.modal-footer -->
439 </div> <!-- /.modal-content -->
440 </div> <!-- /.modal-dialog -->
441 </form> <!-- /#dd_rota_item_form -->
442 </div> <!-- /#addItemsModal -->
444 [% IF sritems.count > 0 %]
445 <div class="page-section">
446 <table id="stock_rotation_manage_items" class="items_table" role="grid">
453 <th class="NoSearch">In transit</th>
454 <th class="NoSort noExport">Stages & duration in days<br>(current stage highlighted)</th>
455 <th class="NoSort noExport"> </th>
459 [% FOREACH sritem IN sritems %]
461 <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% sritem.id | uri %]&biblionumber=[% sritem.item.biblio.id | uri %]#item[% sritem.id | uri %]">[% sritem.item.barcode | html %]</a></td>
462 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% sritem.item.biblio.id | uri %]">[% sritem.item.biblio.title | html %]</a></td>
463 <td>[% sritem.item.biblio.author | html %]</td>
464 <td>[% sritem.item.itemcallnumber | html %]</td>
465 <td>[% sritem.item.get_transfer ? 'Yes' : 'No' | html %]</td>
467 [% FOREACH this_stage IN stages %]
468 [% IF this_stage.stage_id == sritem.stage.stage_id %]
469 <span class="stage highlight_stage">
473 [% Branches.GetName(this_stage.branchcode_id) | html %] ([% this_stage.duration | html %])
477 [% IF stages.size > 0 %]
478 <span class="stage">[% rota.cyclical ? 'START' : 'END' | html %]</span>
482 [% in_transit = sritem.item.get_transfer %]
483 [% IF !in_transit && stages.size > 1 %]
484 <a class="btn btn-default btn-xs" href="?op=move_to_next_stage&rota_id=[% rota.id | uri %]&item_id=[% sritem.id | uri %]&stage_id=[% sritem.stage.stage_id | uri %]">
486 <a class="btn btn-default btn-xs" disabled>
488 <i class="fa fa-arrow-right"></i>
492 <a class="btn btn-default btn-xs" href="?op=toggle_in_demand&stage_id=[% sritem.stage.stage_id | uri %]&item_id=[% sritem.id | uri %]&rota_id=[% rota.id | uri %]">
494 <a class="btn btn-default btn-xs" disabled>
496 <i class="fa fa-fire"></i>
497 [% IF sritem.indemand %]
498 <span>Remove "In demand"</span>
500 <span>Add "In demand"</span>
504 <a class="btn btn-default btn-xs" href="?op=confirm_remove_from_rota&stage_id=[% sritem.stage.stage_id | uri %]&item_id=[% sritem.id | uri %]&rota_id=[% rota.id | uri %]">
506 <a class="btn btn-default btn-xs" disabled>
508 <i class="fa fa-trash"></i>
516 </div> <!-- /.page-section -->
519 <div class="dialog message">
520 <h4>There are no items assigned to this rota.</h4>
521 <p><button type="button" data-toggle="modal" data-target="#addItemsModal"><i class="fa fa-plus"></i> Add items</button></p>
526 <p><a href="stockrotation.pl">Return to rotas</a></p>
528 [% ELSIF op == 'add_items_to_rota' %]
530 <h1>Add items to rota report</h1>
532 <div class="page-section">
533 [% IF barcode_status.ok.size > 0 %]
534 <h4>Items added to rota:</h4>
536 [% FOREACH item_ok IN barcode_status.ok %]
537 <li>[% item_ok.biblio.title | html %]</li>
541 [% IF barcode_status.on_this.size > 0 %]
542 <h4>Items already on this rota:</h4>
544 [% FOREACH item_on_this IN barcode_status.on_this %]
545 <li>[% item_on_this.biblio.title | html %]</li>
549 [% IF barcode_status.not_found.size > 0 %]
550 <h4>Barcodes not found:</h4>
552 [% FOREACH barcode_not_found IN barcode_status.not_found %]
553 <li>[% barcode_not_found | html %]</li>
557 [% IF barcode_status.on_other.size > 0 %]
558 <h4>Items found on other rotas:</h4>
560 [% FOREACH item_on_other IN barcode_status.on_other %]
561 <li>[% item_on_other.biblio.title | html %]</li>
567 [% IF barcode_status.on_other.size > 0 %]
568 <form id="add_rota_item_form" method="post" enctype="multipart/form-data">
570 <legend>Select items to move to this rota:</legend>
571 [% FOREACH item_on_other IN barcode_status.on_other %]
572 <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>
576 <fieldset class="action">
577 <input type="submit" class="btn btn-primary" value="Save" />
579 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
580 <input type="hidden" name="op" value="move_items_to_rota">
583 <p><a href="?op=manage_items&rota_id=[% rota_id | uri %]">Return to rota</a></p>
589 </div> <!-- /.col-sm-10.col-sm-push-2 -->
591 <div class="col-sm-2 col-sm-pull-10">
593 [% IF ( op == 'manage_stages' || op == 'manage_items' ) %]
596 [% IF op == 'manage_stages' %]
601 <a href="/cgi-bin/koha/tools/stockrotation.pl?op=manage_stages&rota_id=[% rota_id | uri %]">Manage stages</a>
603 [% IF op == 'manage_items' %]
608 <a href="/cgi-bin/koha/tools/stockrotation.pl?op=manage_items&rota_id=[% rota_id | uri %]">Manage items</a>
613 [% INCLUDE 'cat-menu.inc' %]
615 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
616 </div> <!-- /.row -->
618 [% MACRO jsinclude BLOCK %]
619 [% INCLUDE 'datatables.inc' %]
620 [% INCLUDE 'columns_settings.inc' %]
621 [% Asset.js("js/pages/stockrotation.js") | $raw %]
623 var stock_rotation_items_table_settings = [% TablesSettings.GetTableSettings( 'tools', 'stockrotation', 'stock_rotation_manage_items', 'json' ) | $raw %];
624 var stock_rotation_table_settings = [% TablesSettings.GetTableSettings( 'tools', 'stockrotation', 'stock_rotation', 'json' ) | $raw %];
625 $("#addStageModal, #addItemsModal").on("shown.bs.modal", function(){
626 $("#branch, #barcode").focus();
631 [% INCLUDE 'intranet-bottom.inc' %]