6 [% USE ColumnsSettings %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Koha › Stock rotation</title>
10 [% INCLUDE 'doc-head-close.inc' %]
13 <body id="tools_stockrotation" class="tools">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'cat-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 class="main container-fluid">
47 <div class="col-sm-10 col-sm-push-2">
50 <div id="stockrotation">
54 [% INCLUDE 'stockrotation-toolbar.inc' %]
56 <h2>Stock rotation</h2>
58 [% IF existing_rotas.size > 0 %]
59 <table id="stock_rotation" class="rotas_table" role="grid">
62 <th class="anti-the">Name</th>
66 <th>Number of items</th>
67 <th class="NoSort noExport"> </th>
71 [% FOREACH rota IN existing_rotas %]
73 <td>[% rota.title | html %]</td>
74 <td>[% rota.cyclical ? 'Yes' : 'No' | html %]</td>
75 <td>[% rota.active ? 'Yes' : 'No' | html %]</td>
76 <td>[% rota.description | html %]</td>
77 <td>[% rota.stockrotationitems.count | html %]</td>
79 <a class="btn btn-default btn-xs" href="?op=create_edit_rota&rota_id=[% rota.rota_id | uri %]">
80 <i class="fa fa-pencil"></i>
83 <div class="btn-group dropup" role="group">
84 <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
86 <i class="fa fa-caret-down"></i>
88 <ul class="dropdown-menu pull-right">
89 <li><a href="?op=manage_stages&rota_id=[% rota.rota_id | uri %]">Stages</a></li>
90 [% IF CAN_user_stockrotation_manage_rota_items && rota.stockrotationstages.count > 0 %]
91 <li><a href="?op=manage_items&rota_id=[% rota.rota_id | uri %]">Items</a></li>
95 <a class="btn btn-default btn-xs" href="?op=toggle_rota&rota_id=[% rota.rota_id | uri %]">
96 <i class="fa fa-power-off"></i>
110 [% ELSIF (op == 'create_edit_rota') %]
112 [% IF rota.rota_id %]
113 <h2>Edit "[% rota.title | html %]"</h2>
115 <h2>Create new rota</h2>
118 [% IF error == 'invalid_form' %]
119 <div class="dialog alert">
120 <h3>There was a problem with your form submission</h3>
124 <form id="rota_form" method="post" enctype="multipart/form-data" class="validated">
125 <fieldset class="rows">
128 <label class="required" for="title">Name:</label>
129 <input type="text" id="title" name="title" value="[% rota.title | html %]" required="required" placeholder="Rota name">
130 <span class="required">Required</span>
133 <label for="cyclical">Cyclical:</label>
134 <select name="cyclical" id="cyclical">
135 [% IF rota.cyclical %]
136 <option value="1" selected="selected">Yes</option>
137 <option value="0">No</option>
139 <option value="1">Yes</option>
140 <option value="0" selected="selected">No</option>
145 <label for="description">Description:</label>
146 <textarea id="description" name="description" placeholder="Rota description">[% rota.description | html %]</textarea>
150 <fieldset class="action">
151 <input type="submit" value="Save">
152 <a href="/cgi-bin/koha/tools/stockrotation.pl" class="cancel">Cancel</a>
154 [% IF rota.rota_id %]
155 <input type="hidden" name="id" value="[% rota.rota_id | html %]">
157 <input type="hidden" name="op" value="process_rota">
160 [% ELSIF (op == 'manage_stages') %]
162 [% INCLUDE 'stockrotation-toolbar.inc' %]
164 [% IF error == 'invalid_form' %]
165 <div class="dialog alert">
166 <h3>There was a problem with your form submission</h3>
170 <h2>Manage <em>[% rota.title | html %]</em> stages</h2>
171 <div id="ajax_status"
172 data-saving-msg="Saving changes..."
174 data-failed-msg="Error: ">
175 <span id="ajax_saving_msg"></span>
176 <i id="ajax_saving_icon" class="fa fa-spinner fa-spin"></i>
177 <i id="ajax_success_icon" class="fa fa-check"></i>
178 <i id="ajax_failed_icon" class="fa fa-times"></i>
179 <span id="ajax_success_msg"></span>
180 <span id="ajax_failed_msg"></span>
183 <!-- Add stage modal -->
184 <div class="modal" id="addStageModal" tabindex="-1" role="dialog" aria-labelledby="addStageLabel">
185 <form id="stage_form" method="post" enctype="multipart/form-data" class="validated">
186 <div class="modal-dialog" role="document">
187 <div class="modal-content">
188 <div class="modal-header">
189 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
190 <h4 class="modal-title" id="addStageLabel">Add stage to <em>[% rota.title | html %]</em></h4>
192 <div class="modal-body">
193 <fieldset class="rows">
196 <label class="required" for="branch">Library:</label>
197 <select name="branchcode" id="branch">
198 [% FOREACH branch IN branches %]
199 [% IF branch.branchcode == stage.branchcode_id %]
200 <option value="[% branch.branchcode | html %]" selected="selected">[% Branches.GetName(branch.branchcode) | html %]</option>
202 <option value="[% branch.branchcode | html %]">[% Branches.GetName(branch.branchcode) | html %]</option>
206 <span class="required">Required</span>
209 <label class="required" for="duration">Duration:</label>
210 <input type="text" id="duration" name="duration" value="[% stage.duration | html %]" required="required" placeholder="Duration (days)">
211 <span class="required">Required</span>
214 </fieldset> <!-- /.rows -->
215 </div> <!-- /.modal-body -->
216 <div class="modal-footer">
217 <input type="hidden" name="stage_id" value="[% stage.id | html %]">
218 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
219 <input type="hidden" name="op" value="process_stage">
220 <button type="submit" class="btn btn-default">Save</button>
221 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
222 </div> <!-- /.modal-footer -->
223 </div> <!-- /.modal-content -->
224 </div> <!-- /.modal-dialog -->
225 </form> <!-- /#stage_form -->
226 </div> <!-- /#addStageModal -->
228 [% IF existing_stages.size > 0 %]
229 <div id="manage_stages">
230 <div id="manage_stages_help">
231 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
233 <div id="stage_list_headings">
234 <span class="stagename">Library</span>
235 <span class="stageduration">Duration (days)</span>
237 <ul id="sortable_stages" data-rota-id="[% rota.rota_id | html %]">
238 [% FOREACH stage IN existing_stages %]
239 <li id="stage_[% stage.stage_id | html %]">
240 <span data-toggle="tooltip" title="Drag and drop to move this stage to another position" data-placement="right" class="stagename">
241 [% IF existing_stages.size > 1 %]
242 <i class="drag_handle fa fa-lg fa-bars"></i>
244 [% Branches.GetName(stage.branchcode_id) | html %]
246 <span class="stageduration">[% stage.duration | html %]</span>
247 <span class="stageactions">
248 <a class="btn btn-default btn-xs" href="?op=create_edit_stage&stage_id=[% stage.stage_id | uri %]">
249 <i class="fa fa-pencil"></i> Edit
251 <a class="btn btn-default btn-xs" href="?op=confirm_delete_stage&stage_id=[% stage.stage_id | uri %]">
252 <i class="fa fa-trash"></i> Delete
261 <div class="dialog message">
262 <h4>This rota has no stages.</h4>
263 <p><button type="button" data-toggle="modal" data-target="#addStageModal"><i class="fa fa-plus"></i> Add a stage</button></p>
268 <p><a href="stockrotation.pl">Return to rotas</a></p>
270 [% ELSIF (op == 'create_edit_stage') %]
273 <h2>Edit "[% Branches.GetName(stage.branchcode_id) | html %]"</h2>
275 <h2>Create new stage</h2>
278 [% IF error == 'invalid_form' %]
279 <div class="dialog alert">
280 <h3>There was a problem with your form submission</h3>
284 <form id="stage_form" method="post" enctype="multipart/form-data" class="validated">
285 <fieldset class="rows">
288 <label class="required" for="branch">Library:</label>
289 <select name="branchcode" id="branch">
290 [% FOREACH branch IN branches %]
291 [% IF branch.branchcode == stage.branchcode_id %]
292 <option value="[% branch.branchcode | html %]" selected="selected">[% Branches.GetName(branch.branchcode) | html %]</option>
294 <option value="[% branch.branchcode | html %]">[% Branches.GetName(branch.branchcode) | html %]</option>
298 <span class="required">Required</span>
301 <label class="required" for="duration">Duration:</label>
302 <input type="text" id="duration" name="duration" value="[% stage.duration | html %]" required="required" placeholder="Duration (days)">
303 <span class="required">Required</span>
307 <fieldset class="action">
308 <input type="submit" value="Save">
309 <a href="/cgi-bin/koha/tools/stockrotation.pl?op=manage_stages&rota_id=[% rota_id | uri %]" class="cancel">Cancel</a>
311 <input type="hidden" name="stage_id" value="[% stage.id | html %]">
312 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
313 <input type="hidden" name="op" value="process_stage">
315 [% ELSIF (op == 'confirm_remove_from_rota') %]
317 <div class="dialog alert">
318 <h3>Are you sure you wish to remove this item from it's rota</h3>
320 <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>
321 <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>
324 [% ELSIF (op == 'confirm_delete_stage') %]
326 <div class="dialog alert">
327 <h3>Are you sure you want to delete this stage?</h3>
328 [% IF stage.stockrotationitems.count > 0 %]
329 <p>This stage contains the following item(s):</p>
331 [% FOREACH item IN stage.stockrotationitems %]
332 <li>[% item.itemnumber.biblio.title | html %] (Barcode: [% item.itemnumber.barcode | html %])</li>
337 <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>
338 <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>
341 [% ELSIF (op == 'manage_items') %]
343 [% INCLUDE 'stockrotation-toolbar.inc' %]
346 <div class="dialog alert">
347 [% IF error == "item_not_found" %]
348 <h3>The item was not found</h3>
349 [% ELSIF error == "already_on_rota" %]
350 <h3>This item is already on this rota</h3>
355 <h2>Manage items assigned to <em>[% rota.title | html %]</em></h2>
357 <!-- Add items modal -->
358 <div class="modal" id="addItemsModal" tabindex="-1" role="dialog" aria-labelledby="addItemsLabel">
359 <form id="add_rota_item_form" method="post" enctype="multipart/form-data" class="validated">
360 <div class="modal-dialog" role="document">
361 <div class="modal-content">
362 <div class="modal-header">
363 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
364 <h4 class="modal-title" id="addItemsLabel">Add item to <em>[% rota.title | html %]</em></h4>
366 <div class="modal-body">
367 <fieldset class="rows">
368 <legend>Add an item by barcode</legend>
371 <label for="barcode">Barcode:</label>
372 <input type="text" id="barcode" name="barcode" placeholder="Item barcode" autofocus>
376 <fieldset class="rows">
377 <legend>Use a barcode file</legend>
380 <label for="barcodefile">Barcode file:</label>
381 <input type="file" id="barcodefile" name="barcodefile">
384 </fieldset> <!-- /.rows -->
385 </div> <!-- /.modal-body -->
386 <div class="modal-footer">
387 <input type="hidden" name="rota_id" value="[% rota.id | html %]">
388 <input type="hidden" name="op" value="add_items_to_rota">
389 <button type="submit" class="btn btn-default">Save</button>
390 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
391 </div> <!-- /.modal-footer -->
392 </div> <!-- /.modal-content -->
393 </div> <!-- /.modal-dialog -->
394 </form> <!-- /#dd_rota_item_form -->
395 </div> <!-- /#addItemsModal -->
397 [% IF items.count > 0 %]
398 <table id="stock_rotation_manage_items" class="items_table" role="grid">
405 <th class="NoSearch">In transit</th>
406 <th class="NoSort noExport">Stages & duration in days<br>(current stage highlighted)</th>
407 <th class="NoSort noExport"> </th>
411 [% FOREACH item IN items %]
413 <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>
414 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.itemnumber.biblio.id | uri %]">[% item.itemnumber.biblio.title | html %]</a></td>
415 <td>[% item.itemnumber.biblio.author | html %]</td>
416 <td>[% item.itemnumber.itemcallnumber | html %]</td>
417 <td>[% item.itemnumber.get_transfer ? 'Yes' : 'No' | html %]</td>
419 [% FOREACH this_stage IN stages %]
420 [% IF this_stage.stage_id == item.stage.stage_id %]
421 <span class="stage highlight_stage">
425 [% Branches.GetName(this_stage.branchcode_id) | html %] ([% this_stage.duration | html %])
429 [% IF stages.size > 0 %]
430 <span class="stage">[% rota.cyclical ? 'START' : 'END' | html %]</span>
434 [% in_transit = item.itemnumber.get_transfer %]
435 [% IF !in_transit && stages.size > 1 %]
436 <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 %]">
438 <a class="btn btn-default btn-xs" disabled>
440 <i class="fa fa-arrow-right"></i>
444 <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 %]">
446 <a class="btn btn-default btn-xs" disabled>
448 <i class="fa fa-fire"></i>
449 [% IF item.indemand %]
450 <span>Remove "In demand"</span>
452 <span>Add "In demand"</span>
456 <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 %]">
458 <a class="btn btn-default btn-xs" disabled>
460 <i class="fa fa-trash"></i>
470 <div class="dialog message">
471 <h4>There are no items assigned to this rota.</h4>
472 <p><button type="button" data-toggle="modal" data-target="#addItemsModal"><i class="fa fa-plus"></i> Add items</button></p>
477 <p><a href="stockrotation.pl">Return to rotas</a></p>
479 [% ELSIF op == 'add_items_to_rota' %]
481 <div class="dialog message">
482 <h3>Add items to rota report</h3>
486 [% IF barcode_status.ok.size > 0 %]
487 <h4>Items added to rota:</h4>
489 [% FOREACH item_ok IN barcode_status.ok %]
490 <li>[% item_ok.biblio.title | html %]</li>
494 [% IF barcode_status.on_this.size > 0 %]
495 <h4>Items already on this rota:</h4>
497 [% FOREACH item_on_this IN barcode_status.on_this %]
498 <li>[% item_on_this.biblio.title | html %]</li>
502 [% IF barcode_status.not_found.size > 0 %]
503 <h4>Barcodes not found:</h4>
505 [% FOREACH barcode_not_found IN barcode_status.not_found %]
506 <li>[% barcode_not_found | html %]</li>
510 [% IF barcode_status.on_other.size > 0 %]
511 <h4>Items found on other rotas:</h4>
513 [% FOREACH item_on_other IN barcode_status.on_other %]
514 <li>[% item_on_other.biblio.title | html %]</li>
519 [% IF barcode_status.on_other.size > 0 %]
520 <form id="add_rota_item_form" method="post" enctype="multipart/form-data">
522 <legend>Select items to move to this rota:</legend>
523 [% FOREACH item_on_other IN barcode_status.on_other %]
524 <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>
528 <fieldset class="action">
529 <input type="submit" value="Save">
531 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
532 <input type="hidden" name="op" value="move_items_to_rota">
535 <p><a href="?op=manage_items&rota_id=[% rota_id | uri %]">Return to rota</a></p>
541 </div> <!-- /.col-sm-10.col-sm-push-2 -->
543 <div class="col-sm-2 col-sm-pull-10">
545 [% IF ( op == 'manage_stages' || op == 'manage_items' ) %]
548 [% IF op == 'manage_stages' %]
553 <a href="/cgi-bin/koha/tools/stockrotation.pl?op=manage_stages&rota_id=[% rota_id | uri %]">Manage stages</a>
555 [% IF op == 'manage_items' %]
560 <a href="/cgi-bin/koha/tools/stockrotation.pl?op=manage_items&rota_id=[% rota_id | uri %]">Manage items</a>
565 [% INCLUDE 'tools-menu.inc' %]
567 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
568 </div> <!-- /.row -->
570 [% MACRO jsinclude BLOCK %]
571 [% Asset.js("js/tools-menu.js") | $raw %]
572 [% INCLUDE 'datatables.inc' %]
573 [% INCLUDE 'columns_settings.inc' %]
574 [% Asset.js("js/pages/stockrotation.js") | $raw %]
576 var stock_rotation_items_columns_settings = [% ColumnsSettings.GetColumns( 'tools', 'stockrotation', 'stock_rotation_manage_items', 'json' ) | $raw %];
577 var stock_rotation_columns_settings = [% ColumnsSettings.GetColumns( 'tools', 'stockrotation', 'stock_rotation', 'json' ) | $raw %];
578 $("#addStageModal, #addItemsModal").on("shown.bs.modal", function(){
579 $("#branch, #barcode").focus();
584 [% INCLUDE 'intranet-bottom.inc' %]