4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Tools › Patron card creator › Batches › [% IF batch_id %]Edit ([% batch_id | html %])[% ELSE %]New[% END %]</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% Asset.css("css/datatables.css") | $raw %]
10 <body id="pcard_edit-batch" class="tools pcard">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'cat-search.inc' %]
13 <div id="breadcrumbs">
14 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
15 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
16 <a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a> ›
17 <a href="/cgi-bin/koha/patroncards/manage.pl?card_element=batch">Batches</a> ›
19 Edit ([% batch_id | html %])
24 <div id="doc3" class="yui-t2">
29 [% INCLUDE 'patroncards-toolbar.inc' %]
30 <div class="yui-u first">
35 [% IF ( duplicate_message ) %]
36 <div class="dialog message">
37 <strong>Duplicate patrons removed from batch number [% batch_id | html %]: [% duplicate_count | html %]</strong>
41 [% INCLUDE 'patroncards-errors.inc' %]
42 <div id="manage-patroncard-batches">
43 <div class="hint">Current library: [% LoginBranchname | html %]</div>
44 <form name="add_by_bor_num" action="/cgi-bin/koha/patroncards/edit-batch.pl" method="post">
46 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
48 <input type="hidden" name="op" value="add" />
49 <input type="hidden" name="batch_id" value="[% batch_id | html %]" />
50 <label for="bor_num_list">Add by borrowernumber(s):
51 <br /> <span class="hint">One borrowernumber per line.</span>
53 <textarea rows="5" id="bor_num_list" name="bor_num_list" tabindex="1" class="focus"></textarea>
58 <div id="batch-manage" class="action">
59 <a class="btn btn-default btn-sm" id="additems" href="#"><i class="fa fa-plus"></i> Add patron(s)</a>[% IF ( table_loop ) %]
60 <a class="btn btn-default btn-sm" id="removeitems" href="#"><i class="fa fa-trash"></i> Remove selected patrons</a>
61 <a class="btn btn-default btn-sm" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
62 <a class="btn btn-default btn-sm" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
63 <a class="btn btn-default btn-sm" id="exportitems" href="#"><i class="fa fa-share-square-o"></i> Export selected card(s)</a>
64 <a class="btn btn-default btn-sm" id="exportbatch" href="#"><i class="fa fa-share-square-o"></i> Export card batch</a>[% END %]
66 [% IF ( table_loop ) %]
67 <form name="items" class="checkboxed">
68 <h2>Patrons in batch number [% batch_id | html %]</h2>
70 [% FOREACH table_loo IN table_loop %]
71 [% IF ( table_loo.header_fields ) %]
74 [% FOREACH header_field IN table_loo.header_fields %]
75 [% SWITCH header_field.field_label -%]
77 <th>Borrower name</th>
78 [% CASE "Borrower Number" %]
79 <th>Borrower number</th>
85 <th>[% header_field.field_label | html %]</th>
93 [% FOREACH text_field IN table_loo.text_fields %]
94 [% IF ( text_field.select_field ) %]
96 <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>
97 <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>
99 <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>
101 <td>[% text_field.field_value | html %]</td>
111 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
113 <div class="dialog message">
114 <h4>There are no patrons in this batch yet</h4>
115 <p>Add patrons by borrowernumber using the text area above or leave empty to add via patron search.</p>
124 [% INCLUDE 'tools-menu.inc' %]
128 [% MACRO jsinclude BLOCK %]
129 [% INCLUDE 'greybox.inc' %]
130 [% INCLUDE 'datatables.inc' %]
132 function DeleteConfirm() {
133 var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id | html %]");
134 var answer = confirm(msg);
136 window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=batch&element_id=[% batch_id | html %]";
138 return; // abort delete
144 if(document.items.action.length > 0) {
145 for (var i=0; i < document.items.action.length; i++) {
146 if (document.items.action[i].checked) {
147 items.push("label_id=" + document.items.action[i].value);
150 getstr = items.join("&");
151 var msg = _("Are you sure you want to remove the selected patron(s) from this batch?");
152 } else if (document.items.action.checked) {
153 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"));
154 return; // no deletion for single item batch
156 alert(_("Please select at least one patron to delete."));
157 return; // no item selected
159 var answer = confirm(msg);
161 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&" + getstr;
163 return; // abort delete
167 var bor_nums = document.getElementById("bor_num_list");
168 if (bor_nums.value == '') {
169 window.open("/cgi-bin/koha/patroncards/add_user_search.pl",
171 'width=840,height=500,location=yes,toolbar=no,'
172 + 'scrollbars=yes,resize=yes');
174 document.forms["add_by_bor_num"].submit();
178 function add_user(borrowernumber) {
179 $("#bor_num_list").val($("#bor_num_list").val()+borrowernumber+"\r\n");
182 function DeDuplicate() {
183 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=de_duplicate&batch_id=[% batch_id | html %]";
185 function Xport(mode) {
186 if (mode == 'label') {
187 patroncards= new Array;
188 if(document.items.action.length > 0) {
189 for (var i=0; i < document.items.action.length; i++) {
190 if (document.items.action[i].checked) {
191 patroncards.push("label_id=" + document.items.action[i].value);
194 if (patroncards.length < 1) {
195 alert(_("Please select at least one card to export."));
196 return; // no batch selected
198 getstr = patroncards.join("&");
199 } else if (document.items.action.checked) {
200 getstr = document.items.action.value;
202 alert(_("Please select at least one card to export."));
203 return; // no batch selected
205 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]&" + getstr, 400, 800);
206 } else if (mode == 'batch') {
207 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]", 400, 800);
209 // some pass-thru error trapping just in case...
212 function selected_layout() {
213 if (document.items.action.length) {
214 for (i=0;i<document.items.action.length;i++){
215 if (document.items.action[i].checked==true){
216 return(document.items.action[i].value);
220 if (document.items.action.checked){
221 return(document.items.action.value);
224 alert(_("Please select at least one item."));
228 $(document).ready(function() {
229 $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
231 { "aTargets": [ -2, -1 ], "bSortable": false, "bSearchable": false }
233 "aaSorting": [[ 0, "asc" ]],
234 "sPaginationType": "four_button",
237 $("#additems").click(function(){
241 $("#removeitems").click(function(){
245 $("#deletebatch").click(function(){
249 $("#deduplicate").click(function(){
253 $("#exportitems").click(function(){
257 $("#exportbatch").click(function(){
261 $(".delete").on("click", function(){
262 return confirmDelete( _("Are you sure you want to delete this patron from the card batch?") );
264 $(".export").on("click", function(e){
266 var label_id = $(this).data("label-id");
267 var batch_id = $(this).data("batch-id");
268 GB_showCenter( _("Export single card"),'/cgi-bin/koha/patroncards/print.pl?batch_id='+batch_id+'&label_id='+label_id, 400, 800);
274 [% INCLUDE 'intranet-bottom.inc' %]