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' %]
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> ›
18 Edit <a href="/cgi-bin/koha/patroncards/edit-batch.pl?op=edit&element_id=[% batch_id | uri %]">[% description | html %]</a>
20 Edit <a href="/cgi-bin/koha/patroncards/edit-batch.pl?op=edit&element_id=[% batch_id | uri %]">([% batch_id | html %])</a>
26 <div class="main container-fluid">
28 <div class="col-sm-10 col-sm-push-2">
31 [% INCLUDE 'patroncards-toolbar.inc' %]
33 [% IF ( duplicate_message ) %]
34 <div class="dialog message">
35 <strong>Duplicate patrons removed from batch number [% batch_id | html %]: [% duplicate_count | html %]</strong>
39 [% INCLUDE 'patroncards-errors.inc' %]
40 <div id="manage-patroncard-batches">
41 <div class="hint">Current library: [% LoginBranchname | html %]</div>
42 <form name="add_by_bor_num" action="/cgi-bin/koha/patroncards/edit-batch.pl" method="post">
44 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
45 <ol><li id="description">
46 <input type="hidden" name="op" value="add" />
47 <input type="hidden" name="batch_id" value="[% batch_id | html %]" />
48 <label for="description">Batch description: </label>
49 <input type="text" name="description" value="[% description | html %]"> <span id="change-status"></span>
51 <label for="bor_num_list">Add by borrowernumber(s):
52 <br /> <span class="hint">One borrowernumber per line.</span>
54 <textarea rows="5" id="bor_num_list" name="bor_num_list" tabindex="1" class="focus"></textarea>
59 <div id="batch-manage" class="action">
60 <a class="btn btn-default" id="additems" href="#"><i class="fa fa-plus"></i> Add patron(s)</a>[% IF ( table_loop ) %]
61 <a class="btn btn-default" id="savedesc" href="#" data-batch_id="[% batch_id | html %]"><i class="fa fa-save"></i> Save description</a>
62 <a class="btn btn-default" id="removeitems" href="#"><i class="fa fa-trash"></i> Remove selected patrons</a>
63 <a class="btn btn-default" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
64 <a class="btn btn-default" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
65 <a class="btn btn-default" id="exportitems" href="#"><i class="fa fa-share-square-o"></i> Export selected card(s)</a>
66 <a class="btn btn-default" id="exportbatch" href="#"><i class="fa fa-share-square-o"></i> Export card batch</a>[% END %]
68 [% IF ( table_loop ) %]
69 <form name="items" class="checkboxed">
70 <h2>Patrons in batch number [% batch_id | html %]</h2>
72 [% FOREACH table_loo IN table_loop %]
73 [% IF ( table_loo.header_fields ) %]
76 [% FOREACH header_field IN table_loo.header_fields %]
77 [% SWITCH header_field.field_label -%]
79 <th>Borrower name</th>
80 [% CASE "Borrower Number" %]
81 <th>Borrower number</th>
87 <th>[% header_field.field_label | html %]</th>
95 [% FOREACH text_field IN table_loo.text_fields %]
96 [% IF ( text_field.select_field ) %]
98 <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>
99 <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>
101 <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>
103 <td>[% text_field.field_value | html %]</td>
113 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
115 <div class="dialog message">
116 <h4>There are no patrons in this batch yet</h4>
117 <p>Add patrons by borrowernumber using the text area above or leave empty to add via patron search.</p>
125 </div> <!-- /.col-sm-10.col-sm-push-2 -->
127 <div class="col-sm-2 col-sm-pull-10">
129 [% INCLUDE 'tools-menu.inc' %]
131 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
132 </div> <!-- /.row -->
133 [% MACRO jsinclude BLOCK %]
134 [% INCLUDE 'greybox.inc' %]
135 [% INCLUDE 'datatables.inc' %]
137 function DeleteConfirm() {
138 var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id | html %]");
139 var answer = confirm(msg);
141 window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=batch&element_id=[% batch_id | html %]";
143 return; // abort delete
149 if(document.items.action.length > 0) {
150 for (var i=0; i < document.items.action.length; i++) {
151 if (document.items.action[i].checked) {
152 items.push("label_id=" + document.items.action[i].value);
155 getstr = items.join("&");
156 var msg = _("Are you sure you want to remove the selected patron(s) from this batch?");
157 } else if (document.items.action.checked) {
158 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"));
159 return; // no deletion for single item batch
161 alert(_("Please select at least one patron to delete."));
162 return; // no item selected
164 var answer = confirm(msg);
166 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&" + getstr;
168 return; // abort delete
172 var bor_nums = document.getElementById("bor_num_list");
173 if (bor_nums.value == '') {
174 window.open("/cgi-bin/koha/patroncards/add_user_search.pl",
176 'width=840,height=500,location=yes,toolbar=no,'
177 + 'scrollbars=yes,resize=yes');
179 document.forms["add_by_bor_num"].submit();
183 function add_user(borrowernumber) {
184 $("#bor_num_list").val($("#bor_num_list").val()+borrowernumber+"\r\n");
187 function DeDuplicate() {
188 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=de_duplicate&batch_id=[% batch_id | html %]";
190 function Xport(mode) {
191 if (mode == 'label') {
192 patroncards= new Array;
193 if(document.items.action.length > 0) {
194 for (var i=0; i < document.items.action.length; i++) {
195 if (document.items.action[i].checked) {
196 patroncards.push("label_id=" + document.items.action[i].value);
199 if (patroncards.length < 1) {
200 alert(_("Please select at least one card to export."));
201 return; // no batch selected
203 getstr = patroncards.join("&");
204 } else if (document.items.action.checked) {
205 getstr = document.items.action.value;
207 alert(_("Please select at least one card to export."));
208 return; // no batch selected
210 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]&" + getstr, 400, 800);
211 } else if (mode == 'batch') {
212 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]", 400, 800);
214 // some pass-thru error trapping just in case...
217 function selected_layout() {
218 if (document.items.action.length) {
219 for (i=0;i<document.items.action.length;i++){
220 if (document.items.action[i].checked==true){
221 return(document.items.action[i].value);
225 if (document.items.action.checked){
226 return(document.items.action.value);
229 alert(_("Please select at least one item."));
233 $(document).ready(function() {
235 $("#description").show();
237 $("#description").hide();
239 $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
241 { "aTargets": [ -2, -1 ], "bSortable": false, "bSearchable": false }
243 "aaSorting": [[ 0, "asc" ]],
244 "sPaginationType": "full",
247 $("#additems").click(function(){
251 $("#removeitems").click(function(){
255 $("#deletebatch").click(function(){
259 $("#deduplicate").click(function(){
263 $("#exportitems").click(function(){
267 $("#exportbatch").click(function(){
271 $(".delete").on("click", function(){
272 return confirmDelete( _("Are you sure you want to delete this patron from the card batch?") );
274 $(".export").on("click", function(e){
276 var label_id = $(this).data("label-id");
277 var batch_id = $(this).data("batch-id");
278 GB_showCenter( _("Export single card"),'/cgi-bin/koha/patroncards/print.pl?batch_id=' + batch_id + '&label_id=' + label_id, 400, 800);
280 $("#savedesc").click(function(event){
281 var newdescription = $(this).siblings('input[name="description"]').val();
282 var batch_id = $(this).data('batch_id');
284 'newdescription': newdescription,
285 'batch_id': batch_id,
286 'card_element': "batch",
287 'creator': "patroncard",
291 url: '/cgi-bin/koha/svc/creator_batches',
297 .done(function(data){
298 if (data.status == 'success') {
299 $("input[name='description']").text(data.newdesc);
300 $("#change-status").text(_("Saved"));
302 $("#change-status").text(_("Unable to save description"));
306 $("#savedesc").click(function(event){
307 var newdescription = $('input[name="description"]').val();
308 var batch_id = $(this).data('batch_id');
310 'newdescription': newdescription,
311 'batch_id': batch_id,
312 'card_element': "batch",
313 'creator': "patroncard",
317 url: '/cgi-bin/koha/svc/creator_batches',
323 .done(function(data){
324 if (data.status == 'success') {
325 $("input[name='description']").text(data.newdesc);
326 $("#change-status").text(_("Saved"));
328 $("#change-status").text(_("Unable to save description"));
336 [% INCLUDE 'intranet-bottom.inc' %]