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>Yes</option>
137 <option value="0">No</option>
139 <option value="1">Yes</option>
140 <option value="0" 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 [% rota.title | html %] 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 <form id="stage_form" method="post" enctype="multipart/form-data" class="validated">
184 <fieldset class="rows">
185 <legend>Add stage</legend>
188 <label class="required" for="branch">Library:</label>
189 <select name="branchcode" id="branch">
190 [% FOREACH branch IN branches %]
191 [% IF branch.branchcode == stage.branchcode_id %]
192 <option value="[% branch.branchcode | html %]" selected>[% Branches.GetName(branch.branchcode) | html %]</option>
194 <option value="[% branch.branchcode | html %]">[% Branches.GetName(branch.branchcode) | html %]</option>
198 <span class="required">Required</span>
201 <label class="required" for="duration">Duration:</label>
202 <input type="text" id="duration" name="duration" value="[% stage.duration | html %]" required="required" placeholder="Duration (days)">
203 <span class="required">Required</span>
207 <fieldset class="action">
208 <input type="submit" value="Submit">
210 <input type="hidden" name="stage_id" value="[% stage.id | html %]">
211 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
212 <input type="hidden" name="op" value="process_stage">
215 [% IF existing_stages.size > 0 %]
216 <div id="manage_stages">
217 <div id="manage_stages_help">
218 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
220 <div id="stage_list_headings">
221 <span class="stagename">Library</span>
222 <span class="stageduration">Duration (days)</span>
224 <ul id="sortable_stages" data-rota-id="[% rota.rota_id | html %]">
225 [% FOREACH stage IN existing_stages %]
226 <li id="stage_[% stage.stage_id | html %]">
227 <span data-toggle="tooltip" title="Drag and drop to move this stage to another position" data-placement="right" class="stagename">
228 [% IF existing_stages.size > 1 %]
229 <i class="drag_handle fa fa-lg fa-bars"></i>
231 [% Branches.GetName(stage.branchcode_id) | html %]
233 <span class="stageduration">[% stage.duration | html %]</span>
234 <span class="stageactions">
235 <a class="btn btn-default btn-xs" href="?op=create_edit_stage&stage_id=[% stage.stage_id | uri %]">
236 <i class="fa fa-pencil"></i> Edit
238 <a class="btn btn-default btn-xs" href="?op=confirm_delete_stage&stage_id=[% stage.stage_id | uri %]">
239 <i class="fa fa-trash"></i> Delete
248 <p><a href="stockrotation.pl">Return to rotas</a></p>
250 [% ELSIF (op == 'create_edit_stage') %]
253 <h2>Edit "[% Branches.GetName(stage.branchcode_id) | html %]"</h2>
255 <h2>Create new stage</h2>
258 [% IF error == 'invalid_form' %]
259 <div class="dialog alert">
260 <h3>There was a problem with your form submission</h3>
264 <form id="stage_form" method="post" enctype="multipart/form-data" class="validated">
265 <fieldset class="rows">
268 <label class="required" for="branch">Library:</label>
269 <select name="branchcode" id="branch">
270 [% FOREACH branch IN branches %]
271 [% IF branch.branchcode == stage.branchcode_id %]
272 <option value="[% branch.branchcode | html %]" selected>[% Branches.GetName(branch.branchcode) | html %]</option>
274 <option value="[% branch.branchcode | html %]">[% Branches.GetName(branch.branchcode) | html %]</option>
278 <span class="required">Required</span>
281 <label class="required" for="duration">Duration:</label>
282 <input type="text" id="duration" name="duration" value="[% stage.duration | html %]" required="required" placeholder="Duration (days)">
283 <span class="required">Required</span>
287 <fieldset class="action">
288 <input type="submit" value="Save">
289 <a href="/cgi-bin/koha/tools/stockrotation.pl?op=manage_stages&rota_id=[% rota_id | uri %]" class="cancel">Cancel</a>
291 <input type="hidden" name="stage_id" value="[% stage.id | html %]">
292 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
293 <input type="hidden" name="op" value="process_stage">
295 [% ELSIF (op == 'confirm_remove_from_rota') %]
297 <div class="dialog alert">
298 <h3>Are you sure you wish to remove this item from it's rota</h3>
300 <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>
301 <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>
304 [% ELSIF (op == 'confirm_delete_stage') %]
306 <div class="dialog alert">
307 <h3>Are you sure you want to delete this stage?</h3>
308 [% IF stage.stockrotationitems.count > 0 %]
309 <p>This stage contains the following item(s):</p>
311 [% FOREACH item IN stage.stockrotationitems %]
312 <li>[% item.itemnumber.biblio.title | html %] (Barcode: [% item.itemnumber.barcode | html %])</li>
317 <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>
318 <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>
321 [% ELSIF (op == 'manage_items') %]
323 [% INCLUDE 'stockrotation-toolbar.inc' %]
326 <div class="dialog alert">
327 [% IF error == "item_not_found" %]
328 <h3>The item was not found</h3>
329 [% ELSIF error == "already_on_rota" %]
330 <h3>This item is already on this rota</h3>
335 <h2>Manage [% rota.title | html %] items</h2>
338 <form id="add_rota_item_form" method="post" enctype="multipart/form-data" class="validated">
339 <fieldset class="rows">
340 <legend>Add item to "[% rota.title | html %]"</legend>
343 <label for="barcode">Barcode:</label>
344 <input type="text" id="barcode" name="barcode" placeholder="Item barcode" autofocus>
348 <fieldset class="rows">
349 <legend>Use a barcode file</legend>
352 <label for="barcodefile">Barcode file:</label>
353 <input type="file" id="barcodefile" name="barcodefile">
357 <fieldset class="action">
358 <input type="submit" value="Save">
360 <input type="hidden" name="rota_id" value="[% rota.id | html %]">
361 <input type="hidden" name="op" value="add_items_to_rota">
365 [% IF items.count > 0 %]
366 <h3>Manage items assigned to "[% rota.title | html %]"</h3>
367 <table id="stock_rotation_manage_items" class="items_table" role="grid">
374 <th class="NoSearch">In transit</th>
375 <th class="NoSort noExport">Stages & duration in days<br>(current stage highlighted)</th>
376 <th class="NoSort noExport"> </th>
380 [% FOREACH item IN items %]
382 <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>
383 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.itemnumber.biblio.id | uri %]">[% item.itemnumber.biblio.title | html %]</a></td>
384 <td>[% item.itemnumber.biblio.author | html %]</td>
385 <td>[% item.itemnumber.itemcallnumber | html %]</td>
386 <td>[% item.itemnumber.get_transfer ? 'Yes' : 'No' | html %]</td>
388 [% FOREACH this_stage IN stages %]
389 [% IF this_stage.stage_id == item.stage.stage_id %]
390 <span class="stage highlight_stage">
394 [% Branches.GetName(this_stage.branchcode_id) | html %] ([% this_stage.duration | html %])
398 [% IF stages.size > 0 %]
399 <span class="stage">[% rota.cyclical ? 'START' : 'END' | html %]</span>
403 [% in_transit = item.itemnumber.get_transfer %]
404 [% IF !in_transit && stages.size > 1 %]
405 <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 %]">
407 <a class="btn btn-default btn-xs" disabled>
409 <i class="fa fa-arrow-right"></i>
413 <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 %]">
415 <a class="btn btn-default btn-xs" disabled>
417 <i class="fa fa-fire"></i>
418 [% IF item.indemand %]
419 <span>Remove "In demand"</span>
421 <span>Add "In demand"</span>
425 <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 %]">
427 <a class="btn btn-default btn-xs" disabled>
429 <i class="fa fa-trash"></i>
439 <p><a href="stockrotation.pl">Return to rotas</a></p>
441 [% ELSIF op == 'add_items_to_rota' %]
443 <div class="dialog message">
444 <h3>Add items to rota report</h3>
448 [% IF barcode_status.ok.size > 0 %]
449 <h4>Items added to rota:</h4>
451 [% FOREACH item_ok IN barcode_status.ok %]
452 <li>[% item_ok.biblio.title | html %]</li>
456 [% IF barcode_status.on_this.size > 0 %]
457 <h4>Items already on this rota:</h4>
459 [% FOREACH item_on_this IN barcode_status.on_this %]
460 <li>[% item_on_this.biblio.title | html %]</li>
464 [% IF barcode_status.not_found.size > 0 %]
465 <h4>Barcodes not found:</h4>
467 [% FOREACH barcode_not_found IN barcode_status.not_found %]
468 <li>[% barcode_not_found | html %]</li>
472 [% IF barcode_status.on_other.size > 0 %]
473 <h4>Items found on other rotas:</h4>
475 [% FOREACH item_on_other IN barcode_status.on_other %]
476 <li>[% item_on_other.biblio.title | html %]</li>
481 [% IF barcode_status.on_other.size > 0 %]
482 <form id="add_rota_item_form" method="post" enctype="multipart/form-data">
484 <legend>Select items to move to this rota:</legend>
485 [% FOREACH item_on_other IN barcode_status.on_other %]
486 <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>
490 <fieldset class="action">
491 <input type="submit" value="Save">
493 <input type="hidden" name="rota_id" value="[% rota_id | html %]">
494 <input type="hidden" name="op" value="move_items_to_rota">
497 <p><a href="?op=manage_items&rota_id=[% rota_id | uri %]">Return to rota</a></p>
503 </div> <!-- /.col-sm-10.col-sm-push-2 -->
505 <div class="col-sm-2 col-sm-pull-10">
507 [% INCLUDE 'tools-menu.inc' %]
509 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
510 </div> <!-- /.row -->
512 [% MACRO jsinclude BLOCK %]
513 [% Asset.js("js/tools-menu.js") | $raw %]
514 [% INCLUDE 'datatables.inc' %]
515 [% INCLUDE 'columns_settings.inc' %]
516 [% Asset.js("js/pages/stockrotation.js") | $raw %]
518 var stock_rotation_items_columns_settings = [% ColumnsSettings.GetColumns( 'tools', 'stockrotation', 'stock_rotation_manage_items', 'json' ) | $raw %];
519 var stock_rotation_columns_settings = [% ColumnsSettings.GetColumns( 'tools', 'stockrotation', 'stock_rotation', 'json' ) | $raw %];
523 [% INCLUDE 'intranet-bottom.inc' %]