5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha › Tools › Label creator › Batches › [% IF batch_id %]Edit ([% batch_id | html %])[% ELSE %]New[% END %]</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% Asset.css("css/datatables.css") | $raw %]
11 <body id="labels_label-edit-batch" class="tools labels" onload="dofocus();">
12 [% INCLUDE 'header.inc' %]
13 [% INCLUDE 'cat-search.inc' %]
14 <div id="breadcrumbs">
15 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
16 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
17 <a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a> ›
18 <a href="/cgi-bin/koha/labels/label-manage.pl?label_element=batch">Batches</a> ›
20 Edit ([% batch_id | html %])
26 <div class="main container-fluid">
28 <div class="col-sm-10 col-sm-push-2">
31 [% INCLUDE 'labels-toolbar.inc' %]
33 [% BLOCK xlate_errtype %]
35 [% CASE 'ITEM_NOT_REMOVED' %]
36 <span>Item(s) not removed from batch [% batch_id | html %].</span>
37 [% CASE 'BATCH_NOT_DELETED' %]
38 <span>Batch [% batch_id | html %] was not deleted.</span>
39 [% CASE 'ITEM_NOT_ADDED' %]
40 <span>Item(s) not added to batch [% batch_id | html %].</span>
41 [% CASE 'BRANCH_NOT_SET' %]
42 <span>Library is not set, please set your library before adding items to a batch.</span>
43 [% CASE 'BATCH_NOT_DEDUP' %]
44 <span>Batch [% batch_id | html %] not fully de-duplicated.</span>
46 <span>Unknown error type [% errtype | html %].</span>
49 <div class="dialog alert">
50 <strong>WARNING:</strong> An error was encountered: [% PROCESS xlate_errtype %] Please have your system administrator check the error log for details.
52 [% ELSIF ( duplicate_message ) %]
53 <div class="dialog message">
54 <strong>Duplicate item(s) removed from batch number [% batch_id | html %]: [% duplicate_count | html %]</strong>
58 <div id="manage-label-batches">
59 <div class="hint">Current library: [% LoginBranchname | html %]</div>
60 <form name="add_by_number" action="/cgi-bin/koha/labels/label-edit-batch.pl" method="post">
62 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
63 <ol><li id="description">
64 <input type="hidden" name="op" value="add" />
65 <input type="hidden" name="batch_id" value="[% batch_id | html %]" />
66 <label for="description">Batch description: </label>
67 <input type="text" name="description" value="[% description | html %]">
68 <a href="#" id="savedesc" data-batch_id="[% batch_id | html %]" class="btn btn-default btn-xs">Save description</a> <span id="change-status"></span>
71 <input type="radio" name="number_type" id="barcode_enter" value="barcode" checked />
72 <label for="barcode_enter">Enter by barcode:</label><br/>
73 <input type="radio" name="number_type" id="itemnum_enter" value="itemnumber" />
74 <label for="itemnum_enter">Enter by itemnumber:</label>
77 <label for="number_list">Add by barcode(s) or itemnumbers(s):
78 <br /> <span class="hint">One number per line.</span>
79 <br /> <span class="hint">Leave empty to add via item search (itemnumber).</span>
81 <textarea rows="5" id="number_list" name="number_list" tabindex="1" class="focus"></textarea>
86 <div id="batch-manage" class="btn-toolbar">
87 <a class="btn btn-default btn-sm" id="additems" href="#"><i class="fa fa-plus"></i> Add item(s)</a>[% IF ( table_loop ) %]
88 <a class="btn btn-default btn-sm" id="removeitems" href="#"><i class="fa fa-trash"></i> Remove selected items</a>
89 <a class="btn btn-default btn-sm" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
90 <a class="btn btn-default btn-sm" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
91 <a class="btn btn-default btn-sm" id="exportitems" href="#"><i class="fa fa-share-square-o"></i> Export selected items</a>
92 <a class="btn btn-default btn-sm" id="exportbatch" href="#"><i class="fa fa-share-square-o"></i> Export full batch</a>[% END %]
94 [% IF ( table_loop ) %]
95 <form name="items" class="checkboxed">
96 <h2>Items in batch number [% batch_id | html %]</h2>
98 [% FOREACH table_loo IN table_loop %]
99 [% IF ( table_loo.header_fields ) %]
102 [% FOREACH header_field IN table_loo.header_fields %]
103 [% SWITCH header_field.field_label -%]
104 [% CASE "Label number" -%]
105 <th>Label number</th>
106 [% CASE "Summary" -%]
107 <th class="anti-the">Summary</th>
108 [% CASE "Item type" %]
110 [% CASE "Call number" %]
117 <th>[% header_field.field_label | html %]</th>
125 [% FOREACH text_field IN table_loo.text_fields %]
126 [% IF ( text_field.select_field ) %]
128 <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"></i> Delete</a>
129 <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 fa-share-square-o"></i> Export</a>
131 <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]"></td>
134 [% IF ( text_field.field_name == '_item_type_tbl' ) %]
135 [% ItemTypes.GetDescription( text_field.field_value ) | html %]
137 [% text_field.field_value | $raw %]
149 <div class="dialog message">
150 <h4>There are no items in this batch yet</h4>
151 <p>Add items by using the text area above or leave empty to add via item search.</p>
156 </div> <!-- /.col-sm-10.col-sm-push-2 -->
158 <div class="col-sm-2 col-sm-pull-10">
160 [% INCLUDE 'tools-menu.inc' %]
162 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
163 </div> <!-- /.row -->
165 [% MACRO jsinclude BLOCK %]
166 [% Asset.js("js/tools-menu.js") | $raw %]
167 [% INCLUDE 'greybox.inc' %]
168 [% INCLUDE 'datatables.inc' %]
170 function DeleteConfirm() {
171 var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id | html %]");
172 var answer = confirm(msg);
174 window.location = "/cgi-bin/koha/labels/label-manage.pl?op=delete&label_element=batch&element_id=[% batch_id | html %]";
177 return; // abort delete
180 function dofocus() { // named function req'd for body onload event by some FF and IE7 security models
181 $(".focus:last").select();
183 function verifyBarcodes(barcodes) {
184 if (barcodes.value == '') {
185 alert(_("Please add barcodes using either the direct entry text area or the item search."));
186 return false; // not ok
194 item_num = new Array;
195 if(document.items.action.length > 0) {
196 for (var i=0; i < document.items.action.length; i++) {
197 if (document.items.action[i].checked) {
198 items.push("label_id=" + document.items.action[i].value);
202 getstr = items.join("&");
203 item_msg = item_num.join(", ");
204 var msg = _("Are you sure you want to remove label number(s): %s from this batch?").format(item_msg);
205 } else if (document.items.action.checked) {
206 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"));
207 return; // no deletion for single item batch
209 alert(_("Please select at least one label to delete."));
210 return; // no item selected
212 var answer = confirm(msg);
214 window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&" + getstr;
216 return; // abort delete
220 var number_list = document.getElementById("number_list");
221 if (number_list.value == '') {
222 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');
224 document.forms["add_by_number"].submit();
228 function add_item(item_number) {
229 $("#itemnum_enter").prop("checked",true);
230 $("#number_list").val($("#number_list").val()+item_number+"\r\n");
233 function DeDuplicate() {
234 window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=de_duplicate&batch_id=[% batch_id | html %]";
237 function Xport(mode) {
238 if (mode == 'label') {
240 if(document.items.action.length > 0) {
241 for (var i=0; i < document.items.action.length; i++) {
242 if (document.items.action[i].checked) {
243 labels.push("label_id=" + document.items.action[i].value);
246 if (labels.length < 1) {
247 alert(_("Please select at least one label to export."));
248 return; // no batch selected
250 getstr = labels.join("&");
252 else if (document.items.action.checked) {
253 getstr = document.items.action.value;
255 alert(_("Please select at least one label to export."));
256 return; // no batch selected
258 return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id | html %]&" + getstr, 400, 800);
259 } else if (mode == 'batch') {
260 return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id | html %]", 400, 800);
262 // some pass-thru error trapping just in case...
266 function selected_layout() {
267 if (document.items.action.length) {
268 for (i=0;i<document.items.action.length;i++){
269 if (document.items.action[i].checked==true){
270 return(document.items.action[i].value);
274 if (document.items.action.checked){
275 return(document.items.action.value);
278 alert(_("Please select at least one item."));
282 $(document).ready(function() {
284 $("#description").show();
286 $("#description").hide();
288 $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
291 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
292 { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
294 "aaSorting": [[ 0, "asc" ]],
295 "sPaginationType": "four_button"
297 $("#additems").click(function(){
301 $("#removeitems").click(function(){
305 $("#deletebatch").click(function(){
309 $("#deduplicate").click(function(){
313 $("#exportitems").click(function(){
317 $("#exportbatch").click(function(){
321 $(".delete").on("click", function(){
322 return confirmDelete( _("Are you sure you want to delete this?") );
324 $(".export").on("click", function(e){
326 var label_id = $(this).data("label-id");
327 var batch_id = $(this).data("batch-id");
328 GB_showCenter(_("Export labels"),"/cgi-bin/koha/labels/label-print.pl?batch_id=" + batch_id + "&label_id=" + label_id, 400, 800);
330 $("#savedesc").click(function(event){
331 event.preventDefault(); // prevent form submission
332 var newdescription = $(this).siblings('input[name="description"]').val();
333 var batch_id = $(this).data('batch_id');
335 'newdescription': newdescription,
336 'batch_id': batch_id,
337 'card_element': "batch",
342 url: '/cgi-bin/koha/svc/creator_batches',
348 .done(function(data){
349 if (data.status == 'success') {
350 $("input[name='description']").text(data.newdesc);
351 $("#change-status").text(_("Saved"));
353 $("#change-status").text(_("Unable to save description"));
361 [% INCLUDE 'intranet-bottom.inc' %]