4 [% PROCESS 'i18n.inc' %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>[% FILTER collapse %]
9 [% tx("Edit label batch {batch_id}", { batch_id = batch_id }) | html %]
11 [% t("New label batch") | html %]
13 [% t("Batches") | html %] ›
14 [% t("Label creator") | html %] ›
15 [% t("Cataloging") | html %] ›
16 [% t("Koha") | html %]
18 [% INCLUDE 'doc-head-close.inc' %]
21 <body id="labels_label-edit-batch" class="tools labels" onload="dofocus();">
22 [% WRAPPER 'header.inc' %]
23 [% INCLUDE 'cat-search.inc' %]
26 [% WRAPPER 'sub-header.inc' %]
27 [% WRAPPER breadcrumbs %]
28 [% WRAPPER breadcrumb_item %]
29 <a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
31 [% WRAPPER breadcrumb_item %]
32 <a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a>
34 [% WRAPPER breadcrumb_item %]
35 <a href="/cgi-bin/koha/labels/label-manage.pl?label_element=batch">Batches</a>
37 [% WRAPPER breadcrumb_item bc_active= 1 %]
39 <span>Edit [% description | html %]</span>
41 <span>Edit label batch [% batch_id | html %]</span>
43 <span>New label batch</span>
46 [% END #/ WRAPPER breadcrumbs %]
47 [% END #/ WRAPPER sub-header.inc %]
49 <div class="main container-fluid">
51 <div class="col-sm-10 col-sm-push-2">
54 [% INCLUDE 'labels-toolbar.inc' %]
57 <h1>Edit [% description | html %]</h1>
59 <h1>Edit label batch [% batch_id | html %]</h1>
61 <h1>New label batch</h1>
65 [% BLOCK xlate_errtype %]
67 [% CASE 'ITEM_NOT_REMOVED' %]
68 <span>Item(s) not removed from batch [% batch_id | html %].</span>
69 [% CASE 'BATCH_NOT_DELETED' %]
70 <span>Batch [% batch_id | html %] was not deleted.</span>
71 [% CASE 'ITEM_NOT_ADDED' %]
72 <span>Item(s) not added to batch [% batch_id | html %].</span>
73 [% CASE 'BRANCH_NOT_SET' %]
74 <span>Library is not set, please set your library before adding items to a batch.</span>
75 [% CASE 'BATCH_NOT_DEDUP' %]
76 <span>Batch [% batch_id | html %] not fully de-duplicated.</span>
78 <span>Unknown error type [% errtype | html %].</span>
81 <div class="dialog alert">
82 <strong>WARNING:</strong> An error was encountered: [% PROCESS xlate_errtype %] Please have your system administrator check the error log for details.
84 [% ELSIF ( duplicate_message ) %]
85 <div class="dialog message">
86 <strong>Duplicate item(s) removed from batch number [% batch_id | html %]: [% duplicate_count | html %]</strong>
90 <div id="manage-label-batches">
91 <form name="add_by_number" action="/cgi-bin/koha/labels/label-edit-batch.pl" method="post">
93 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
94 <ol><li id="description">
95 <input type="hidden" name="op" value="add" />
96 <input type="hidden" name="batch_id" value="[% batch_id | html %]" />
97 <label for="description">Batch description: </label>
98 <input type="text" name="description" value="[% description | html %]"> <span id="change-status"></span>
101 <input type="radio" name="number_type" id="barcode_enter" value="barcode" checked />
102 <label for="barcode_enter">Enter by barcode:</label>
105 <input type="radio" name="number_type" id="itemnum_enter" value="itemnumber" />
106 <label for="itemnum_enter">Enter by itemnumber:</label>
109 <label for="number_list">
110 Add by barcode(s) or itemnumbers(s):
112 <textarea rows="5" id="number_list" name="number_list" tabindex="1" class="focus"></textarea>
115 <br /> Leave empty to add via item search (itemnumber)
121 <div id="batch-manage" class="btn-toolbar">
122 <a class="btn btn-default" id="additems" href="#"><i class="fa fa-plus"></i> Add item(s)</a>[% IF ( table_loop ) %]
123 <a class="btn btn-default" id="savedesc" href="#" data-batch_id="[% batch_id | html %]"><i class="fa fa-save"></i> Save description</a>
124 <a class="btn btn-default" id="removeitems" href="#"><i class="fa fa-trash-can"></i> Remove selected items</a>
125 <a class="btn btn-default" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
126 <a class="btn btn-default" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
127 <a class="btn btn-default" id="exportitems" href="#"><i class="fa-solid fa-share-from-square"></i> Export selected items</a>
128 <a class="btn btn-default" id="exportbatch" href="#"><i class="fa-solid fa-share-from-square"></i> Export full batch</a>[% END %]
130 [% IF ( table_loop ) %]
132 <h2>Items in batch number [% batch_id | html %]</h2>
134 <div class="page-section">
136 [% FOREACH table_loo IN table_loop %]
137 [% IF ( table_loo.header_fields ) %]
140 [% FOREACH header_field IN table_loo.header_fields %]
141 [% SWITCH header_field.field_label -%]
142 [% CASE "Label number" -%]
143 <th>Label number</th>
144 [% CASE "Summary" -%]
145 <th class="anti-the">Summary</th>
146 [% CASE "Item type" %]
148 [% CASE "Call number" %]
155 <th>[% header_field.field_label | html %]</th>
163 [% FOREACH text_field IN table_loo.text_fields %]
164 [% IF ( text_field.select_field ) %]
166 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&batch_id=[% batch_id |url %]&label_id=[% text_field.field_value |url %]"><i class="fa fa-trash-can"></i> Delete</a>
167 <a class="btn btn-default btn-xs export" href="#" data-batch-id="[% batch_id | html %]" data-label-id="[% text_field.field_value | html %]"><i class="fa-solid fa-share-from-square"></i> Export</a>
169 <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]"></td>
172 [% IF ( text_field.field_name == '_item_type_tbl' ) %]
173 [% ItemTypes.GetDescription( text_field.field_value ) | html %]
175 [% text_field.field_value | $raw %]
185 </div> <!-- /.page-section -->
188 <div class="dialog message">
189 <h4>There are no items in this batch yet</h4>
190 <p>Add items by using the text area above or leave empty to add via item search.</p>
195 </div> <!-- /.col-sm-10.col-sm-push-2 -->
197 <div class="col-sm-2 col-sm-pull-10">
199 [% INCLUDE 'cat-menu.inc' %]
201 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
202 </div> <!-- /.row -->
204 [% MACRO jsinclude BLOCK %]
205 [% INCLUDE 'greybox.inc' %]
206 [% INCLUDE 'datatables.inc' %]
208 function DeleteConfirm() {
209 var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id | html %]");
210 var answer = confirm(msg);
212 window.location = "/cgi-bin/koha/labels/label-manage.pl?op=delete&label_element=batch&element_id=[% batch_id | html %]";
215 return; // abort delete
218 function dofocus() { // named function req'd for body onload event by some FF and IE7 security models
219 $(".focus:last").select();
221 function verifyBarcodes(barcodes) {
222 if (barcodes.value == '') {
223 alert(_("Please add barcodes using either the direct entry text area or the item search."));
224 return false; // not ok
232 item_num = new Array;
233 if(document.items.action.length > 0) {
234 for (var i=0; i < document.items.action.length; i++) {
235 if (document.items.action[i].checked) {
236 items.push("label_id=" + document.items.action[i].value);
240 getstr = items.join("&");
241 item_msg = item_num.join(", ");
242 var msg = _("Are you sure you want to remove label number(s): %s from this batch?").format(item_msg);
243 } else if (document.items.action.checked) {
244 alert(_("Deletion of label from a batch with only one label will delete the batch.") + "\n\n" + _("If this is what you want, select the 'Delete batch' option from the toolbar"));
245 return; // no deletion for single item batch
247 alert(_("Please select at least one label to delete."));
248 return; // no item selected
250 var answer = confirm(msg);
252 window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&" + getstr;
254 return; // abort delete
258 var number_list = document.getElementById("number_list");
259 if (number_list.value == '') {
260 window.open("/cgi-bin/koha/labels/label-item-search.pl?batch_id=[% batch_id | html %]&type=labels",'FindABibIndex','width=875,height=400,toolbar=no,scrollbars=yes');
262 document.forms["add_by_number"].submit();
266 function add_item(item_number) {
267 $("#itemnum_enter").prop("checked",true);
268 $("#number_list").val($("#number_list").val()+item_number+"\r\n");
271 function DeDuplicate() {
272 window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=de_duplicate&batch_id=[% batch_id | html %]";
275 function Xport(mode) {
276 if (mode == 'label') {
278 if(document.items.action.length > 0) {
279 for (var i=0; i < document.items.action.length; i++) {
280 if (document.items.action[i].checked) {
281 labels.push("label_id=" + document.items.action[i].value);
284 if (labels.length < 1) {
285 alert(_("Please select at least one label to export."));
286 return; // no batch selected
288 getstr = labels.join("&");
290 else if (document.items.action.checked) {
291 getstr = document.items.action.value;
293 alert(_("Please select at least one label to export."));
294 return; // no batch selected
296 return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id | html %]&" + getstr, 400, 800);
297 } else if (mode == 'batch') {
298 return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id | html %]", 400, 800);
300 // some pass-thru error trapping just in case...
304 function selected_layout() {
305 if (document.items.action.length) {
306 for (i=0;i<document.items.action.length;i++){
307 if (document.items.action[i].checked==true){
308 return(document.items.action[i].value);
312 if (document.items.action.checked){
313 return(document.items.action.value);
316 alert(_("Please select at least one item."));
320 $(document).ready(function() {
321 $('#navmenulist a[href$="/cgi-bin/koha/labels/label-home.pl"]').addClass("current");
323 $("#description").show();
325 $("#description").hide();
327 $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
330 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
331 { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
333 "aaSorting": [[ 0, "asc" ]],
334 "sPaginationType": "full"
336 $("#additems").click(function(){
340 $("#removeitems").click(function(){
344 $("#deletebatch").click(function(){
348 $("#deduplicate").click(function(){
352 $("#exportitems").click(function(){
356 $("#exportbatch").click(function(){
360 $(".delete").on("click", function(){
361 return confirmDelete( _("Are you sure you want to delete this?") );
363 $(".export").on("click", function(e){
365 var label_id = $(this).data("label-id");
366 var batch_id = $(this).data("batch-id");
367 GB_showCenter(_("Export labels"),"/cgi-bin/koha/labels/label-print.pl?batch_id=" + batch_id + "&label_id=" + label_id, 400, 800);
369 $("#savedesc").click(function(event){
370 event.preventDefault(); // prevent form submission
371 var newdescription = $('input[name="description"]').val();
372 var batch_id = $(this).data('batch_id');
374 'newdescription': newdescription,
375 'batch_id': batch_id,
376 'card_element': "batch",
381 url: '/cgi-bin/koha/svc/creator_batches',
387 .done(function(data){
388 if (data.status == 'success') {
389 $("input[name='description']").text(data.newdesc);
390 $("#change-status").text(_("Saved"));
392 $("#change-status").text(_("Unable to save description"));
400 [% INCLUDE 'intranet-bottom.inc' %]