4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>[% IF batch_id %]Edit ([% batch_id | html %])[% ELSE %]New[% END %] › Batches › Patron card creator › Tools › Koha</title>
6 [% INCLUDE 'doc-head-close.inc' %]
9 <body id="pcard_edit-batch" class="tools pcard">
10 [% INCLUDE 'header.inc' %]
11 [% INCLUDE 'cat-search.inc' %]
13 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
16 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
19 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
22 <a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a>
25 <a href="/cgi-bin/koha/patroncards/manage.pl?card_element=batch">Batches</a>
28 <a href="#" aria-current="page">
30 Edit [% description | html %]
32 Edit ([% batch_id | html %])
41 <div class="main container-fluid">
43 <div class="col-sm-10 col-sm-push-2">
46 [% INCLUDE 'patroncards-toolbar.inc' %]
48 [% IF ( duplicate_message ) %]
49 <div class="dialog message">
50 <strong>Duplicate patrons removed from batch number [% batch_id | html %]: [% duplicate_count | html %]</strong>
54 [% INCLUDE 'patroncards-errors.inc' %]
55 <div id="manage-patroncard-batches">
56 <form name="add_by_bor_num" action="/cgi-bin/koha/patroncards/edit-batch.pl" method="post">
58 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
59 <ol><li id="description">
60 <input type="hidden" name="op" value="add" />
61 <input type="hidden" name="batch_id" value="[% batch_id | html %]" />
62 <label for="description">Batch description: </label>
63 <input type="text" name="description" value="[% description | html %]"> <span id="change-status"></span>
65 <label for="bor_num_list">Add by borrowernumber(s):
66 <br /> <span class="hint">One borrowernumber per line.</span>
68 <textarea rows="5" id="bor_num_list" name="bor_num_list" tabindex="1" class="focus"></textarea>
73 <div id="batch-manage" class="action">
74 <a class="btn btn-default" id="additems" href="#"><i class="fa fa-plus"></i> Add patron(s)</a>[% IF ( table_loop ) %]
75 <a class="btn btn-default" id="savedesc" href="#" data-batch_id="[% batch_id | html %]"><i class="fa fa-save"></i> Save description</a>
76 <a class="btn btn-default" id="removeitems" href="#"><i class="fa fa-trash"></i> Remove selected patrons</a>
77 <a class="btn btn-default" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
78 <a class="btn btn-default" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
79 <a class="btn btn-default" id="exportitems" href="#"><i class="fa fa-share-square-o"></i> Export selected card(s)</a>
80 <a class="btn btn-default" id="exportbatch" href="#"><i class="fa fa-share-square-o"></i> Export card batch</a>[% END %]
82 [% IF ( table_loop ) %]
84 <h2>Patrons in batch number [% batch_id | html %]</h2>
86 [% FOREACH table_loo IN table_loop %]
87 [% IF ( table_loo.header_fields ) %]
90 [% FOREACH header_field IN table_loo.header_fields %]
91 [% SWITCH header_field.field_label -%]
93 <th>Borrower name</th>
94 [% CASE "Borrower Number" %]
95 <th>Borrower number</th>
97 <th class="noExport">Actions</th>
101 <th>[% header_field.field_label | html %]</th>
109 [% FOREACH text_field IN table_loo.text_fields %]
110 [% IF ( text_field.select_field ) %]
112 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&label_id=[% text_field.field_value | html %]"><i class="fa fa-trash"></i> Delete</a>
113 <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>
115 <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>
117 <td>[% text_field.field_value | html %]</td>
127 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
129 <div class="dialog message">
130 <h4>There are no patrons in this batch yet</h4>
131 <p>Add patrons by borrowernumber using the text area above or leave empty to add via patron search.</p>
139 </div> <!-- /.col-sm-10.col-sm-push-2 -->
141 <div class="col-sm-2 col-sm-pull-10">
143 [% INCLUDE 'tools-menu.inc' %]
145 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
146 </div> <!-- /.row -->
147 [% MACRO jsinclude BLOCK %]
148 [% INCLUDE 'greybox.inc' %]
149 [% INCLUDE 'datatables.inc' %]
151 function DeleteConfirm() {
152 var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id | html %]");
153 var answer = confirm(msg);
155 window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=batch&element_id=[% batch_id | html %]";
157 return; // abort delete
163 if(document.items.action.length > 0) {
164 for (var i=0; i < document.items.action.length; i++) {
165 if (document.items.action[i].checked) {
166 items.push("label_id=" + document.items.action[i].value);
169 getstr = items.join("&");
170 var msg = _("Are you sure you want to remove the selected patron(s) from this batch?");
171 } else if (document.items.action.checked) {
172 alert(_("Deletion of patron from a batch with only one patron will delete the batch.") + "\n\n" + _("If this is what you want, select the 'Delete batch' option from the toolbar"));
173 return; // no deletion for single item batch
175 alert(_("Please select at least one patron to delete."));
176 return; // no item selected
178 var answer = confirm(msg);
180 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&" + getstr;
182 return; // abort delete
186 var bor_nums = document.getElementById("bor_num_list");
187 if (bor_nums.value == '') {
188 window.open("/cgi-bin/koha/members/search.pl?columns=cardnumber,name,category,branch,dateexpiry,borrowernotes,action&selection_type=add",
190 'width=1024,height=768,location=yes,toolbar=no,'
191 + 'scrollbars=yes,resize=yes');
193 document.forms["add_by_bor_num"].submit();
197 function add_user(borrowernumber) {
198 $("#bor_num_list").val($("#bor_num_list").val()+borrowernumber+"\r\n");
201 function DeDuplicate() {
202 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=de_duplicate&batch_id=[% batch_id | html %]";
204 function Xport(mode) {
205 if (mode == 'label') {
206 patroncards= new Array;
207 if(document.items.action.length > 0) {
208 for (var i=0; i < document.items.action.length; i++) {
209 if (document.items.action[i].checked) {
210 patroncards.push("label_id=" + document.items.action[i].value);
213 if (patroncards.length < 1) {
214 alert(_("Please select at least one card to export."));
215 return; // no batch selected
217 getstr = patroncards.join("&");
218 } else if (document.items.action.checked) {
219 getstr = document.items.action.value;
221 alert(_("Please select at least one card to export."));
222 return; // no batch selected
224 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]&" + getstr, 400, 800);
225 } else if (mode == 'batch') {
226 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]", 400, 800);
228 // some pass-thru error trapping just in case...
231 function selected_layout() {
232 if (document.items.action.length) {
233 for (i=0;i<document.items.action.length;i++){
234 if (document.items.action[i].checked==true){
235 return(document.items.action[i].value);
239 if (document.items.action.checked){
240 return(document.items.action.value);
243 alert(_("Please select at least one item."));
247 $(document).ready(function() {
249 $("#description").show();
251 $("#description").hide();
253 $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
255 { "aTargets": [ -2, -1 ], "bSortable": false, "bSearchable": false }
257 "aaSorting": [[ 0, "asc" ]],
258 "sPaginationType": "full",
261 $("#additems").click(function(){
265 $("#removeitems").click(function(){
269 $("#deletebatch").click(function(){
273 $("#deduplicate").click(function(){
277 $("#exportitems").click(function(){
281 $("#exportbatch").click(function(){
285 $(".delete").on("click", function(){
286 return confirmDelete( _("Are you sure you want to delete this patron from the card batch?") );
288 $(".export").on("click", function(e){
290 var label_id = $(this).data("label-id");
291 var batch_id = $(this).data("batch-id");
292 GB_showCenter( _("Export single card"),'/cgi-bin/koha/patroncards/print.pl?batch_id=' + batch_id + '&label_id=' + label_id, 400, 800);
294 $("#savedesc").click(function(event){
295 var newdescription = $(this).siblings('input[name="description"]').val();
296 var batch_id = $(this).data('batch_id');
298 'newdescription': newdescription,
299 'batch_id': batch_id,
300 'card_element': "batch",
301 'creator': "patroncard",
305 url: '/cgi-bin/koha/svc/creator_batches',
311 .done(function(data){
312 if (data.status == 'success') {
313 $("input[name='description']").text(data.newdesc);
314 $("#change-status").text(_("Saved"));
316 $("#change-status").text(_("Unable to save description"));
320 $("#savedesc").click(function(event){
321 var newdescription = $('input[name="description"]').val();
322 var batch_id = $(this).data('batch_id');
324 'newdescription': newdescription,
325 'batch_id': batch_id,
326 'card_element': "batch",
327 'creator': "patroncard",
331 url: '/cgi-bin/koha/svc/creator_batches',
337 .done(function(data){
338 if (data.status == 'success') {
339 $("input[name='description']").text(data.newdesc);
340 $("#change-status").text(_("Saved"));
342 $("#change-status").text(_("Unable to save description"));
350 [% INCLUDE 'intranet-bottom.inc' %]