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 <h1>[% IF description %]Edit [% ELSIF batch_id %]Edit [% ELSE %]New [% END %]patron card batches</h1>
50 [% IF ( duplicate_message ) %]
51 <div class="dialog message">
52 <strong>Duplicate patrons removed from batch number [% batch_id | html %]: [% duplicate_count | html %]</strong>
56 [% INCLUDE 'patroncards-errors.inc' %]
57 <div id="manage-patroncard-batches">
58 <form name="add_by_bor_num" action="/cgi-bin/koha/patroncards/edit-batch.pl" method="post">
60 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
61 <ol><li id="description">
62 <input type="hidden" name="op" value="add" />
63 <input type="hidden" name="batch_id" value="[% batch_id | html %]" />
64 <label for="description">Batch description: </label>
65 <input type="text" name="description" value="[% description | html %]"> <span id="change-status"></span>
67 <label for="bor_num_list">Add by borrowernumber(s):
68 <br /> <span class="hint">One borrowernumber per line.</span>
70 <textarea rows="5" id="bor_num_list" name="bor_num_list" tabindex="1" class="focus"></textarea>
75 <div id="batch-manage" class="action">
76 <a class="btn btn-default" id="additems" href="#"><i class="fa fa-plus"></i> Add patron(s)</a>[% IF ( table_loop ) %]
77 <a class="btn btn-default" id="savedesc" href="#" data-batch_id="[% batch_id | html %]"><i class="fa fa-save"></i> Save description</a>
78 <a class="btn btn-default" id="removeitems" href="#"><i class="fa fa-trash"></i> Remove selected patrons</a>
79 <a class="btn btn-default" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
80 <a class="btn btn-default" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
81 <a class="btn btn-default" id="exportitems" href="#"><i class="fa fa-share-square-o"></i> Export selected card(s)</a>
82 <a class="btn btn-default" id="exportbatch" href="#"><i class="fa fa-share-square-o"></i> Export card batch</a>[% END %]
84 [% IF ( table_loop ) %]
86 <h2>Patrons in batch number [% batch_id | html %]</h2>
88 [% FOREACH table_loo IN table_loop %]
89 [% IF ( table_loo.header_fields ) %]
92 [% FOREACH header_field IN table_loo.header_fields %]
93 [% SWITCH header_field.field_label -%]
95 <th>Borrower name</th>
96 [% CASE "Borrower Number" %]
97 <th>Borrower number</th>
99 <th class="noExport">Actions</th>
103 <th>[% header_field.field_label | html %]</th>
111 [% FOREACH text_field IN table_loo.text_fields %]
112 [% IF ( text_field.select_field ) %]
114 <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>
115 <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>
117 <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>
119 <td>[% text_field.field_value | html %]</td>
129 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
131 <div class="dialog message">
132 <h4>There are no patrons in this batch yet</h4>
133 <p>Add patrons by borrowernumber using the text area above or leave empty to add via patron search.</p>
141 </div> <!-- /.col-sm-10.col-sm-push-2 -->
143 <div class="col-sm-2 col-sm-pull-10">
145 [% INCLUDE 'tools-menu.inc' %]
147 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
148 </div> <!-- /.row -->
149 [% MACRO jsinclude BLOCK %]
150 [% INCLUDE 'greybox.inc' %]
151 [% INCLUDE 'datatables.inc' %]
153 function DeleteConfirm() {
154 var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id | html %]");
155 var answer = confirm(msg);
157 window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=batch&element_id=[% batch_id | html %]";
159 return; // abort delete
165 if(document.items.action.length > 0) {
166 for (var i=0; i < document.items.action.length; i++) {
167 if (document.items.action[i].checked) {
168 items.push("label_id=" + document.items.action[i].value);
171 getstr = items.join("&");
172 var msg = _("Are you sure you want to remove the selected patron(s) from this batch?");
173 } else if (document.items.action.checked) {
174 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"));
175 return; // no deletion for single item batch
177 alert(_("Please select at least one patron to delete."));
178 return; // no item selected
180 var answer = confirm(msg);
182 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&" + getstr;
184 return; // abort delete
188 var bor_nums = document.getElementById("bor_num_list");
189 if (bor_nums.value == '') {
190 window.open("/cgi-bin/koha/members/search.pl?columns=cardnumber,name,category,branch,dateexpiry,borrowernotes,action&selection_type=add",
192 'width=1024,height=768,location=yes,toolbar=no,'
193 + 'scrollbars=yes,resize=yes');
195 document.forms["add_by_bor_num"].submit();
199 function add_user(borrowernumber) {
200 $("#bor_num_list").val($("#bor_num_list").val()+borrowernumber+"\r\n");
203 function DeDuplicate() {
204 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=de_duplicate&batch_id=[% batch_id | html %]";
206 function Xport(mode) {
207 if (mode == 'label') {
208 patroncards= new Array;
209 if(document.items.action.length > 0) {
210 for (var i=0; i < document.items.action.length; i++) {
211 if (document.items.action[i].checked) {
212 patroncards.push("label_id=" + document.items.action[i].value);
215 if (patroncards.length < 1) {
216 alert(_("Please select at least one card to export."));
217 return; // no batch selected
219 getstr = patroncards.join("&");
220 } else if (document.items.action.checked) {
221 getstr = document.items.action.value;
223 alert(_("Please select at least one card to export."));
224 return; // no batch selected
226 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]&" + getstr, 400, 800);
227 } else if (mode == 'batch') {
228 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]", 400, 800);
230 // some pass-thru error trapping just in case...
233 function selected_layout() {
234 if (document.items.action.length) {
235 for (i=0;i<document.items.action.length;i++){
236 if (document.items.action[i].checked==true){
237 return(document.items.action[i].value);
241 if (document.items.action.checked){
242 return(document.items.action.value);
245 alert(_("Please select at least one item."));
249 $(document).ready(function() {
251 $("#description").show();
253 $("#description").hide();
255 $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
257 { "aTargets": [ -2, -1 ], "bSortable": false, "bSearchable": false }
259 "aaSorting": [[ 0, "asc" ]],
260 "sPaginationType": "full",
263 $("#additems").click(function(){
267 $("#removeitems").click(function(){
271 $("#deletebatch").click(function(){
275 $("#deduplicate").click(function(){
279 $("#exportitems").click(function(){
283 $("#exportbatch").click(function(){
287 $(".delete").on("click", function(){
288 return confirmDelete( _("Are you sure you want to delete this patron from the card batch?") );
290 $(".export").on("click", function(e){
292 var label_id = $(this).data("label-id");
293 var batch_id = $(this).data("batch-id");
294 GB_showCenter( _("Export single card"),'/cgi-bin/koha/patroncards/print.pl?batch_id=' + batch_id + '&label_id=' + label_id, 400, 800);
296 $("#savedesc").click(function(event){
297 var newdescription = $(this).siblings('input[name="description"]').val();
298 var batch_id = $(this).data('batch_id');
300 'newdescription': newdescription,
301 'batch_id': batch_id,
302 'card_element': "batch",
303 'creator': "patroncard",
307 url: '/cgi-bin/koha/svc/creator_batches',
313 .done(function(data){
314 if (data.status == 'success') {
315 $("input[name='description']").text(data.newdesc);
316 $("#change-status").text(_("Saved"));
318 $("#change-status").text(_("Unable to save description"));
322 $("#savedesc").click(function(event){
323 var newdescription = $('input[name="description"]').val();
324 var batch_id = $(this).data('batch_id');
326 'newdescription': newdescription,
327 'batch_id': batch_id,
328 'card_element': "batch",
329 'creator': "patroncard",
333 url: '/cgi-bin/koha/svc/creator_batches',
339 .done(function(data){
340 if (data.status == 'success') {
341 $("input[name='description']").text(data.newdesc);
342 $("#change-status").text(_("Saved"));
344 $("#change-status").text(_("Unable to save description"));
352 [% INCLUDE 'intranet-bottom.inc' %]