1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha › Tools › Patron card creator › Batches › [% IF batch_id %]Edit ([% batch_id %])[% ELSE %]New[% END %]</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 [% INCLUDE 'greybox.inc' %]
5 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
6 [% INCLUDE 'datatables.inc' %]
7 <script type="text/javascript">
9 function DeleteConfirm() {
10 var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id %]");
11 var answer = confirm(msg);
13 window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=batch&element_id=[% batch_id %]";
16 return; // abort delete
22 if(document.items.action.length > 0) {
23 for (var i=0; i < document.items.action.length; i++) {
24 if (document.items.action[i].checked) {
25 items.push("label_id=" + document.items.action[i].value);
28 getstr = items.join("&");
29 var msg = _("Are you sure you want to remove the selected patron(s) from this batch?");
30 } else if (document.items.action.checked) {
31 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"));
32 return; // no deletion for single item batch
35 alert(_("Please select at least one patron to delete."));
36 return; // no item selected
38 var answer = confirm(msg);
40 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id %]&" + getstr;
43 return; // abort delete
47 var bor_nums = document.getElementById("bor_num_list");
48 if (bor_nums.value == '') {
49 window.open("/cgi-bin/koha/patroncards/add_user_search.pl",
51 'width=840,height=500,location=yes,toolbar=no,'
52 + 'scrollbars=yes,resize=yes');
55 document.forms["add_by_bor_num"].submit();
59 function add_user(borrowernumber) {
60 $("#bor_num_list").val($("#bor_num_list").val()+borrowernumber+"\r\n");
63 function DeDuplicate() {
64 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=de_duplicate&batch_id=[% batch_id %]";
66 function Xport(mode) {
67 if (mode == 'label') {
68 patroncards= new Array;
69 if(document.items.action.length > 0) {
70 for (var i=0; i < document.items.action.length; i++) {
71 if (document.items.action[i].checked) {
72 patroncards.push("label_id=" + document.items.action[i].value);
75 if (patroncards.length < 1) {
76 alert(_("Please select at least one card to export."));
77 return; // no batch selected
79 getstr = patroncards.join("&");
81 else if (document.items.action.checked) {
82 getstr = document.items.action.value;
85 alert(_("Please select at least one card to export."));
86 return; // no batch selected
88 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id %]&" + getstr, 400, 800);
90 else if (mode == 'batch') {
91 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id %]", 400, 800);
94 // some pass-thru error trapping just in case...
97 function selected_layout() {
98 if (document.items.action.length) {
99 for (i=0;i<document.items.action.length;i++){
100 if (document.items.action[i].checked==true){
101 return(document.items.action[i].value);
106 if (document.items.action.checked){
107 return(document.items.action.value);
110 alert(_("Please select at least one item."));
114 $(document).ready(function() {
115 $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
117 { "aTargets": [ -2, -1 ], "bSortable": false, "bSearchable": false }
119 "aaSorting": [[ 0, "asc" ]],
120 "sPaginationType": "four_button",
123 $("#additems").click(function(){
127 $("#removeitems").click(function(){
131 $("#deletebatch").click(function(){
135 $("#deduplicate").click(function(){
139 $("#exportitems").click(function(){
143 $("#exportbatch").click(function(){
147 $(".delete").on("click", function(){
148 return confirmDelete( _("Are you sure you want to delete this patron from the card batch?") );
150 $(".export").on("click", function(e){
152 var label_id = $(this).data("label-id");
153 var batch_id = $(this).data("batch-id");
154 GB_showCenter( _("Export single card"),'/cgi-bin/koha/patroncards/print.pl?batch_id='+batch_id+'&label_id='+label_id, 400, 800);
160 <body id="pcard_edit-batch" class="tools pcard">
161 [% INCLUDE 'header.inc' %]
162 [% INCLUDE 'cat-search.inc' %]
163 <div id="breadcrumbs">
164 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
165 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
166 <a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a> ›
167 <a href="/cgi-bin/koha/patroncards/manage.pl?card_element=batch">Batches</a> ›
169 Edit ([% batch_id %])
174 <div id="doc3" class="yui-t2">
179 [% INCLUDE 'patroncards-toolbar.inc' %]
180 <div class="yui-u first">
185 [% IF ( duplicate_message ) %]
186 <div class="dialog message">
187 <strong>Duplicate patrons removed from batch number [% batch_id %]: [% duplicate_count %]</strong>
191 [% INCLUDE 'patroncards-errors.inc' %]
192 <div id="manage-patroncard-batches">
193 <div class="hint">Current library: [% LoginBranchname %]</div>
194 <form name="add_by_bor_num" action="/cgi-bin/koha/patroncards/edit-batch.pl" method="post">
196 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
198 <input type="hidden" name="op" value="add" />
199 <input type="hidden" name="batch_id" value="[% batch_id %]" />
200 <label for="bor_num_list">Add by borrowernumber(s):
201 <br /> <span class="hint">One borrowernumber per line.</span>
203 <textarea rows="5" id="bor_num_list" name="bor_num_list" tabindex="1" class="focus"></textarea>
208 <div id="batch-manage" class="action">
209 <a class="btn btn-default btn-sm" id="additems" href="#"><i class="fa fa-plus"></i> Add patron(s)</a>[% IF ( table_loop ) %]
210 <a class="btn btn-default btn-sm" id="removeitems" href="#"><i class="fa fa-trash"></i> Remove selected patrons</a>
211 <a class="btn btn-default btn-sm" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
212 <a class="btn btn-default btn-sm" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
213 <a class="btn btn-default btn-sm" id="exportitems" href="#"><i class="fa fa-share-square-o"></i> Export selected card(s)</a>
214 <a class="btn btn-default btn-sm" id="exportbatch" href="#"><i class="fa fa-share-square-o"></i> Export card batch</a>[% END %]
216 [% IF ( table_loop ) %]
217 <form name="items" class="checkboxed">
218 <h2>Patrons in batch number [% batch_id %]</h2>
220 [% FOREACH table_loo IN table_loop %]
221 [% IF ( table_loo.header_fields ) %]
224 [% FOREACH header_field IN table_loo.header_fields %]
225 [% SWITCH header_field.field_label -%]
226 [% CASE "Summary" -%]
227 <th>Borrower name</th>
228 [% CASE "Borrower Number" %]
229 <th>Borrower number</th>
230 [% CASE "Actions " %]
235 <th>[% header_field.field_label %]</th>
243 [% FOREACH text_field IN table_loo.text_fields %]
244 [% IF ( text_field.select_field ) %]
246 <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>
247 <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>
249 <td><input type="checkbox" name="action" value="[% text_field.field_value %]" /></td>
251 <td>[% text_field.field_value %]</td>
261 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
263 <div class="dialog message">
264 <h4>There are no patrons in this batch yet</h4>
265 <p>Add patrons by borrowernumber using the text area above or leave empty to add via patron search.</p>
274 [% INCLUDE 'tools-menu.inc' %]
277 [% INCLUDE 'intranet-bottom.inc' %]