6 [% USE TablesSettings %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Stock rotation › Koha</title>
10 [% INCLUDE 'doc-head-close.inc' %]
13 <body id="tools_stockrotation" class="tools">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'cat-search.inc' %]
17 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
20 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
23 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
28 <a href="#" aria-current="page">
34 <a href="/cgi-bin/koha/tools/stockrotation.pl">Stock rotation</a>
38 [% IF (op == 'create_edit_rota' && rota.rota_id) %]
40 <a href="#" aria-current="page">
44 [% ELSIF (op == 'create_edit_rota' && !rota.rota_id) %]
46 <a href="#" aria-current="page">
50 [% ELSIF (op == 'manage_stages') %]
52 <a href="#" aria-current="page">
56 [% ELSIF (op == 'create_edit_stage' && stage.id) %]
58 <a href="?op=manage_stages&rota_id=[% rota_id | uri %]">Manage stages</a>
61 <a href="#" aria-current="page">
65 [% ELSIF (op == 'create_edit_stage' && !stage.id) %]
67 <a href="?op=manage_stages&rota_id=[% rota_id | uri %]">
73 <a href="#" aria-current="page">
77 [% ELSIF (op == 'manage_items') %]
79 <a href="#" aria-current="page">
87 <div class="main container-fluid">
89 <div class="col-sm-10 col-sm-push-2">
92 <div id="stockrotation">
96 [% INCLUDE 'stockrotation-toolbar.inc' %]
98 <h1>Stock rotation</h1>
100 [% IF existing_rotas.size > 0 %]
101 <table id="stock_rotation" class="rotas_table" role="grid">
104 <th class="anti-the">Name</th>
108 <th>Number of items</th>
109 <th class="NoSort noExport"> </th>
113 [% FOREACH rota IN existing_rotas %]
115 <td>[% rota.title | html %]</td>
116 <td>[% rota.cyclical ? 'Yes' : 'No' | html %]</td>
117 <td>[% rota.active ? 'Yes' : 'No' | html %]</td>
118 <td>[% rota.description | html %]</td>
119 <td>[% rota.stockrotationitems.count | html %]</td>
121 <a class="btn btn-default btn-xs" href="?op=create_edit_rota&rota_id=[% rota.rota_id | uri %]">
122 <i class="fa fa-pencil"></i>
125 <div class="btn-group dropup" role="group">
126 <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
128 <i class="fa fa-caret-down"></i>
130 <ul class="dropdown-menu pull-right">
131 <li><a href="?op=manage_stages&rota_id=[% rota.rota_id | uri %]">Stages</a></li>
132 [% IF CAN_user_stockrotation_manage_rota_items && rota.stockrotationstages.count > 0 %]
133 <li><a href="?op=manage_items&rota_id=[% rota.rota_id | uri %]">Items</a></li>
137 <a class="btn btn-default btn-xs" href="?op=toggle_rota&rota_id=[% rota.rota_id | uri %]">
138 <i class="fa fa-power-off"></i>
139 [% IF !rota.active %]
152 [% ELSIF (op == 'create_edit_rota') %]
154 [% IF rota.rota_id %]
155 <h1>Edit "[% rota.title | html %]"</h1>
157 <h1>Create new rota</h1>
160 [% IF error == 'invalid_form' %]
161 <div class="dialog alert">
162 <h3>There was a problem with your form submission</h3>
166 <form id="rota_form" method="post" enctype="multipart/form-data" class="validated">
167 <fieldset class="rows">
170 <label class="required" for="title">Name:</label>
171 <input type="text" id="title" name="title" value="[% rota.title | html %]" required="required" placeholder="Rota name">
172 <span class="required">Required</span>
175 <label for="cyclical">Cyclical:</label>
176 <select name="cyclical" id="cyclical">
177 [% IF rota.cyclical %]
178 <option value="1" selected="selected">Yes</option>
179 <option value="0">No</option>
181 <option value="1">Yes</option>
182 <option value="0" selected="selected">No</option>
187 <label for="description">Description:</label>
188 <textarea id="description" name="description" placeholder="Rota description">[% rota.description | html %]</textarea>
192 <fieldset class="action">
193 <input type="submit" value="Save">
194 <a href="/cgi-bin/koha/tools/stockrotation.pl" class="cancel">Cancel</a>
196 [% IF rota.rota_id %]
197 <input type="hidden" name="id" value="[% rota.rota_id | html %]">
199 <input type="hidden" name="op" value="process_rota">
202 [% ELSIF (op == 'manage_stages') %]
204 [% INCLUDE 'stockrotation-toolbar.inc' %]
206 [% IF error == 'invalid_form' %]
207 <div class="dialog alert">
208 <h3>There was a problem with your form submission</h3>
212 <h1>Manage <em>[% rota.title | html %]</em> stages</h1>
213 <div id="ajax_status"
214 data-saving-msg="Saving changes..."
216 data-failed-msg="Error: ">
217 <span id="ajax_saving_msg"></span>
218 <i id="ajax_saving_icon" class="fa fa-spinner fa-spin"></i>
219 <i id="ajax_success_icon" class="fa fa-check"></i>
220 <i id="ajax_failed_icon" class="fa fa-times"></i>
221 <span id="ajax_success_msg"></span>
222 <span id="ajax_failed_msg"></span>
225 <!-- Add stage modal -->
226 <div class="modal" id="addStageModal" tabindex="-1" role="dialog" aria-labelledby="addStageLabel">
227 <form id="stage_form" method="post" enctype="multipart/form-data" class="validated">
228 <div class="modal-dialog" role="document">
229 <div class="modal-content">
230 <div class="modal-header">
231 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
232 <h4 class="modal-title" id="addStageLabel">Add stage to <em>[% rota.title | html %]</em></h4>
234 <div class="modal-body">
235 <fieldset class="rows">
238 <label class="required" for="branch">Library:</label>
239 <select name="branchcode" id="branch">
240 [% FOREACH branch IN branches %]
241 [% IF branch.branchcode == stage.branchcode_id %]
242 <option value="[% branch.branchcode | html %]" selected="selected">[% Branches.GetName(branch.branchcode) | html %]</option>
244 <option value="[% branch.branchcode | html %]">[% Branches.GetName(branch.branchcode) | html %]</option>
248 <span class="required">Required</span>
251 <label class="required" for="duration">Duration:</label>
252 <input type="text" id="duration" name="duration" value="[% stage.duration | html %]" required="required" placeholder="Duration (days)">
253 <span class="required">Required</span>
256 </fieldset> <!-- /.rows -->
257 </div> <!-- /.modal-body -->
258 <div class="modal-footer">
259 <input type="hidden" name="stage_id" value="[% stage.id | html %]">
260 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
261 <input type="hidden" name="op" value="process_stage">
262 <button type="submit" class="btn btn-default">Save</button>
263 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
264 </div> <!-- /.modal-footer -->
265 </div> <!-- /.modal-content -->
266 </div> <!-- /.modal-dialog -->
267 </form> <!-- /#stage_form -->
268 </div> <!-- /#addStageModal -->
270 [% IF existing_stages.size > 0 %]
271 <div id="manage_stages">
272 <div id="manage_stages_help">
273 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
275 <div id="stage_list_headings">
276 <span class="stagename">Library</span>
277 <span class="stageduration">Duration (days)</span>
279 <ul id="sortable_stages" data-rota-id="[% rota.rota_id | html %]">
280 [% FOREACH stage IN existing_stages %]
281 <li id="stage_[% stage.stage_id | html %]">
282 <span data-toggle="tooltip" title="Drag and drop to move this stage to another position" data-placement="right" class="stagename">
283 [% IF existing_stages.size > 1 %]
284 <i class="drag_handle fa fa-lg fa-bars"></i>
286 [% Branches.GetName(stage.branchcode_id) | html %]
288 <span class="stageduration">[% stage.duration | html %]</span>
289 <span class="stageactions">
290 <a class="btn btn-default btn-xs" href="?op=create_edit_stage&stage_id=[% stage.stage_id | uri %]">
291 <i class="fa fa-pencil"></i> Edit
293 <a class="btn btn-default btn-xs" href="?op=confirm_delete_stage&stage_id=[% stage.stage_id | uri %]">
294 <i class="fa fa-trash"></i> Delete
303 <div class="dialog message">
304 <h4>This rota has no stages.</h4>
305 <p><button type="button" data-toggle="modal" data-target="#addStageModal"><i class="fa fa-plus"></i> Add a stage</button></p>
310 <p><a href="stockrotation.pl">Return to rotas</a></p>
312 [% ELSIF (op == 'create_edit_stage') %]
315 <h1>Edit "[% Branches.GetName(stage.branchcode_id) | html %]"</h1>
317 <h1>Create new stage</h1>
320 [% IF error == 'invalid_form' %]
321 <div class="dialog alert">
322 <h3>There was a problem with your form submission</h3>
326 <form id="stage_form" method="post" enctype="multipart/form-data" class="validated">
327 <fieldset class="rows">
330 <label class="required" for="branch">Library:</label>
331 <select name="branchcode" id="branch">
332 [% FOREACH branch IN branches %]
333 [% IF branch.branchcode == stage.branchcode_id %]
334 <option value="[% branch.branchcode | html %]" selected="selected">[% Branches.GetName(branch.branchcode) | html %]</option>
336 <option value="[% branch.branchcode | html %]">[% Branches.GetName(branch.branchcode) | html %]</option>
340 <span class="required">Required</span>
343 <label class="required" for="duration">Duration:</label>
344 <input type="text" id="duration" name="duration" value="[% stage.duration | html %]" required="required" placeholder="Duration (days)">
345 <span class="required">Required</span>
349 <fieldset class="action">
350 <input type="submit" value="Save">
351 <a href="/cgi-bin/koha/tools/stockrotation.pl?op=manage_stages&rota_id=[% rota_id | uri %]" class="cancel">Cancel</a>
353 <input type="hidden" name="stage_id" value="[% stage.id | html %]">
354 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
355 <input type="hidden" name="op" value="process_stage">
357 [% ELSIF (op == 'confirm_remove_from_rota') %]
359 <div class="dialog alert">
360 <h1>Are you sure you wish to remove this item from it's rota</h1>
362 <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>
363 <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>
366 [% ELSIF (op == 'confirm_delete_stage') %]
368 <div class="dialog alert">
369 <h1>Are you sure you want to delete this stage?</h1>
370 [% IF stage.stockrotationitems.count > 0 %]
371 <p>This stage contains the following item(s):</p>
373 [% FOREACH sritem IN stage.stockrotationitems %]
374 <li>[% sritem.item.biblio.title | html %] (Barcode: [% sritem.item.barcode | html %])</li>
379 <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>
380 <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>
383 [% ELSIF (op == 'manage_items') %]
385 [% INCLUDE 'stockrotation-toolbar.inc' %]
388 <div class="dialog alert">
389 [% IF error == "item_not_found" %]
390 <h3>The item was not found</h3>
391 [% ELSIF error == "already_on_rota" %]
392 <h3>This item is already on this rota</h3>
397 <h1>Manage items assigned to <em>[% rota.title | html %]</em></h1>
399 <!-- Add items modal -->
400 <div class="modal" id="addItemsModal" tabindex="-1" role="dialog" aria-labelledby="addItemsLabel">
401 <form id="add_rota_item_form" method="post" enctype="multipart/form-data" class="validated">
402 <div class="modal-dialog" role="document">
403 <div class="modal-content">
404 <div class="modal-header">
405 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
406 <h4 class="modal-title" id="addItemsLabel">Add item to <em>[% rota.title | html %]</em></h4>
408 <div class="modal-body">
409 <fieldset class="rows">
410 <legend>Add an item by barcode</legend>
413 <label for="barcode">Barcode:</label>
414 <input type="text" id="barcode" name="barcode" placeholder="Item barcode" autofocus>
418 <fieldset class="rows">
419 <legend>Use a barcode file</legend>
422 <label for="barcodefile">Barcode file:</label>
423 <input type="file" id="barcodefile" name="barcodefile">
426 </fieldset> <!-- /.rows -->
427 </div> <!-- /.modal-body -->
428 <div class="modal-footer">
429 <input type="hidden" name="rota_id" value="[% rota.id | html %]">
430 <input type="hidden" name="op" value="add_items_to_rota">
431 <button type="submit" class="btn btn-default">Save</button>
432 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
433 </div> <!-- /.modal-footer -->
434 </div> <!-- /.modal-content -->
435 </div> <!-- /.modal-dialog -->
436 </form> <!-- /#dd_rota_item_form -->
437 </div> <!-- /#addItemsModal -->
439 [% IF sritems.count > 0 %]
440 <table id="stock_rotation_manage_items" class="items_table" role="grid">
447 <th class="NoSearch">In transit</th>
448 <th class="NoSort noExport">Stages & duration in days<br>(current stage highlighted)</th>
449 <th class="NoSort noExport"> </th>
453 [% FOREACH sritem IN sritems %]
455 <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>
456 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% sritem.item.biblio.id | uri %]">[% sritem.item.biblio.title | html %]</a></td>
457 <td>[% sritem.item.biblio.author | html %]</td>
458 <td>[% sritem.item.itemcallnumber | html %]</td>
459 <td>[% sritem.item.get_transfer ? 'Yes' : 'No' | html %]</td>
461 [% FOREACH this_stage IN stages %]
462 [% IF this_stage.stage_id == sritem.stage.stage_id %]
463 <span class="stage highlight_stage">
467 [% Branches.GetName(this_stage.branchcode_id) | html %] ([% this_stage.duration | html %])
471 [% IF stages.size > 0 %]
472 <span class="stage">[% rota.cyclical ? 'START' : 'END' | html %]</span>
476 [% in_transit = sritem.item.get_transfer %]
477 [% IF !in_transit && stages.size > 1 %]
478 <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 %]">
480 <a class="btn btn-default btn-xs" disabled>
482 <i class="fa fa-arrow-right"></i>
486 <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 %]">
488 <a class="btn btn-default btn-xs" disabled>
490 <i class="fa fa-fire"></i>
491 [% IF sritem.indemand %]
492 <span>Remove "In demand"</span>
494 <span>Add "In demand"</span>
498 <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 %]">
500 <a class="btn btn-default btn-xs" disabled>
502 <i class="fa fa-trash"></i>
512 <div class="dialog message">
513 <h4>There are no items assigned to this rota.</h4>
514 <p><button type="button" data-toggle="modal" data-target="#addItemsModal"><i class="fa fa-plus"></i> Add items</button></p>
519 <p><a href="stockrotation.pl">Return to rotas</a></p>
521 [% ELSIF op == 'add_items_to_rota' %]
523 <div class="dialog message">
524 <h1>Add items to rota report</h1>
528 [% IF barcode_status.ok.size > 0 %]
529 <h4>Items added to rota:</h4>
531 [% FOREACH item_ok IN barcode_status.ok %]
532 <li>[% item_ok.biblio.title | html %]</li>
536 [% IF barcode_status.on_this.size > 0 %]
537 <h4>Items already on this rota:</h4>
539 [% FOREACH item_on_this IN barcode_status.on_this %]
540 <li>[% item_on_this.biblio.title | html %]</li>
544 [% IF barcode_status.not_found.size > 0 %]
545 <h4>Barcodes not found:</h4>
547 [% FOREACH barcode_not_found IN barcode_status.not_found %]
548 <li>[% barcode_not_found | html %]</li>
552 [% IF barcode_status.on_other.size > 0 %]
553 <h4>Items found on other rotas:</h4>
555 [% FOREACH item_on_other IN barcode_status.on_other %]
556 <li>[% item_on_other.biblio.title | html %]</li>
561 [% IF barcode_status.on_other.size > 0 %]
562 <form id="add_rota_item_form" method="post" enctype="multipart/form-data">
564 <legend>Select items to move to this rota:</legend>
565 [% FOREACH item_on_other IN barcode_status.on_other %]
566 <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>
570 <fieldset class="action">
571 <input type="submit" value="Save">
573 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
574 <input type="hidden" name="op" value="move_items_to_rota">
577 <p><a href="?op=manage_items&rota_id=[% rota_id | uri %]">Return to rota</a></p>
583 </div> <!-- /.col-sm-10.col-sm-push-2 -->
585 <div class="col-sm-2 col-sm-pull-10">
587 [% IF ( op == 'manage_stages' || op == 'manage_items' ) %]
590 [% IF op == 'manage_stages' %]
595 <a href="/cgi-bin/koha/tools/stockrotation.pl?op=manage_stages&rota_id=[% rota_id | uri %]">Manage stages</a>
597 [% IF op == 'manage_items' %]
602 <a href="/cgi-bin/koha/tools/stockrotation.pl?op=manage_items&rota_id=[% rota_id | uri %]">Manage items</a>
607 [% INCLUDE 'tools-menu.inc' %]
609 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
610 </div> <!-- /.row -->
612 [% MACRO jsinclude BLOCK %]
613 [% Asset.js("js/tools-menu.js") | $raw %]
614 [% INCLUDE 'datatables.inc' %]
615 [% INCLUDE 'columns_settings.inc' %]
616 [% Asset.js("js/pages/stockrotation.js") | $raw %]
618 var stock_rotation_items_columns_settings = [% TablesSettings.GetColumns( 'tools', 'stockrotation', 'stock_rotation_manage_items', 'json' ) | $raw %];
619 var stock_rotation_columns_settings = [% TablesSettings.GetColumns( 'tools', 'stockrotation', 'stock_rotation', 'json' ) | $raw %];
620 $("#addStageModal, #addItemsModal").on("shown.bs.modal", function(){
621 $("#branch, #barcode").focus();
626 [% INCLUDE 'intranet-bottom.inc' %]