3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha › Tools › Patron card creator › Batches › [% IF batch_id %]Edit ([% batch_id %])[% ELSE %]New[% END %]</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 [% Asset.css("css/datatables.css") %]
9 <body id="pcard_edit-batch" class="tools pcard">
10 [% INCLUDE 'header.inc' %]
11 [% INCLUDE 'cat-search.inc' %]
12 <div id="breadcrumbs">
13 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
14 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
15 <a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a> ›
16 <a href="/cgi-bin/koha/patroncards/manage.pl?card_element=batch">Batches</a> ›
23 <div id="doc3" class="yui-t2">
28 [% INCLUDE 'patroncards-toolbar.inc' %]
29 <div class="yui-u first">
34 [% IF ( duplicate_message ) %]
35 <div class="dialog message">
36 <strong>Duplicate patrons removed from batch number [% batch_id %]: [% duplicate_count %]</strong>
40 [% INCLUDE 'patroncards-errors.inc' %]
41 <div id="manage-patroncard-batches">
42 <div class="hint">Current library: [% LoginBranchname %]</div>
43 <form name="add_by_bor_num" action="/cgi-bin/koha/patroncards/edit-batch.pl" method="post">
45 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
47 <input type="hidden" name="op" value="add" />
48 <input type="hidden" name="batch_id" value="[% batch_id %]" />
49 <label for="bor_num_list">Add by borrowernumber(s):
50 <br /> <span class="hint">One borrowernumber per line.</span>
52 <textarea rows="5" id="bor_num_list" name="bor_num_list" tabindex="1" class="focus"></textarea>
57 <div id="batch-manage" class="action">
58 <a class="btn btn-default btn-sm" id="additems" href="#"><i class="fa fa-plus"></i> Add patron(s)</a>[% IF ( table_loop ) %]
59 <a class="btn btn-default btn-sm" id="removeitems" href="#"><i class="fa fa-trash"></i> Remove selected patrons</a>
60 <a class="btn btn-default btn-sm" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
61 <a class="btn btn-default btn-sm" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
62 <a class="btn btn-default btn-sm" id="exportitems" href="#"><i class="fa fa-share-square-o"></i> Export selected card(s)</a>
63 <a class="btn btn-default btn-sm" id="exportbatch" href="#"><i class="fa fa-share-square-o"></i> Export card batch</a>[% END %]
65 [% IF ( table_loop ) %]
66 <form name="items" class="checkboxed">
67 <h2>Patrons in batch number [% batch_id %]</h2>
69 [% FOREACH table_loo IN table_loop %]
70 [% IF ( table_loo.header_fields ) %]
73 [% FOREACH header_field IN table_loo.header_fields %]
74 [% SWITCH header_field.field_label -%]
76 <th>Borrower name</th>
77 [% CASE "Borrower Number" %]
78 <th>Borrower number</th>
84 <th>[% header_field.field_label %]</th>
92 [% FOREACH text_field IN table_loo.text_fields %]
93 [% IF ( text_field.select_field ) %]
95 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id %]&label_id=[% text_field.field_value %]"><i class="fa fa-trash"></i> Delete</a>
96 <a class="btn btn-default btn-xs export" href="#" data-batch-id="[% batch_id %]" data-label-id="[% text_field.field_value %]"><i class="fa fa-share-square-o"></i> Export</a>
98 <td><input type="checkbox" name="action" value="[% text_field.field_value %]" /></td>
100 <td>[% text_field.field_value %]</td>
110 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
112 <div class="dialog message">
113 <h4>There are no patrons in this batch yet</h4>
114 <p>Add patrons by borrowernumber using the text area above or leave empty to add via patron search.</p>
123 [% INCLUDE 'tools-menu.inc' %]
127 [% MACRO jsinclude BLOCK %]
128 [% INCLUDE 'greybox.inc' %]
129 [% INCLUDE 'datatables.inc' %]
131 function DeleteConfirm() {
132 var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id %]");
133 var answer = confirm(msg);
135 window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=batch&element_id=[% batch_id %]";
137 return; // abort delete
143 if(document.items.action.length > 0) {
144 for (var i=0; i < document.items.action.length; i++) {
145 if (document.items.action[i].checked) {
146 items.push("label_id=" + document.items.action[i].value);
149 getstr = items.join("&");
150 var msg = _("Are you sure you want to remove the selected patron(s) from this batch?");
151 } else if (document.items.action.checked) {
152 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"));
153 return; // no deletion for single item batch
155 alert(_("Please select at least one patron to delete."));
156 return; // no item selected
158 var answer = confirm(msg);
160 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id %]&" + getstr;
162 return; // abort delete
166 var bor_nums = document.getElementById("bor_num_list");
167 if (bor_nums.value == '') {
168 window.open("/cgi-bin/koha/patroncards/add_user_search.pl",
170 'width=840,height=500,location=yes,toolbar=no,'
171 + 'scrollbars=yes,resize=yes');
173 document.forms["add_by_bor_num"].submit();
177 function add_user(borrowernumber) {
178 $("#bor_num_list").val($("#bor_num_list").val()+borrowernumber+"\r\n");
181 function DeDuplicate() {
182 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=de_duplicate&batch_id=[% batch_id %]";
184 function Xport(mode) {
185 if (mode == 'label') {
186 patroncards= new Array;
187 if(document.items.action.length > 0) {
188 for (var i=0; i < document.items.action.length; i++) {
189 if (document.items.action[i].checked) {
190 patroncards.push("label_id=" + document.items.action[i].value);
193 if (patroncards.length < 1) {
194 alert(_("Please select at least one card to export."));
195 return; // no batch selected
197 getstr = patroncards.join("&");
198 } else if (document.items.action.checked) {
199 getstr = document.items.action.value;
201 alert(_("Please select at least one card to export."));
202 return; // no batch selected
204 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id %]&" + getstr, 400, 800);
205 } else if (mode == 'batch') {
206 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id %]", 400, 800);
208 // some pass-thru error trapping just in case...
211 function selected_layout() {
212 if (document.items.action.length) {
213 for (i=0;i<document.items.action.length;i++){
214 if (document.items.action[i].checked==true){
215 return(document.items.action[i].value);
219 if (document.items.action.checked){
220 return(document.items.action.value);
223 alert(_("Please select at least one item."));
227 $(document).ready(function() {
228 $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
230 { "aTargets": [ -2, -1 ], "bSortable": false, "bSearchable": false }
232 "aaSorting": [[ 0, "asc" ]],
233 "sPaginationType": "four_button",
236 $("#additems").click(function(){
240 $("#removeitems").click(function(){
244 $("#deletebatch").click(function(){
248 $("#deduplicate").click(function(){
252 $("#exportitems").click(function(){
256 $("#exportbatch").click(function(){
260 $(".delete").on("click", function(){
261 return confirmDelete( _("Are you sure you want to delete this patron from the card batch?") );
263 $(".export").on("click", function(e){
265 var label_id = $(this).data("label-id");
266 var batch_id = $(this).data("batch-id");
267 GB_showCenter( _("Export single card"),'/cgi-bin/koha/patroncards/print.pl?batch_id='+batch_id+'&label_id='+label_id, 400, 800);
273 [% INCLUDE 'intranet-bottom.inc' %]