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 <form name="add_by_bor_num" action="/cgi-bin/koha/patroncards/edit-batch.pl" method="post">
43 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
44 <ol><li id="description">
45 <input type="hidden" name="op" value="add" />
46 <input type="hidden" name="batch_id" value="[% batch_id | html %]" />
47 <label for="description">Batch description: </label>
48 <input type="text" name="description" value="[% description | html %]"> <span id="change-status"></span>
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" id="additems" href="#"><i class="fa fa-plus"></i> Add patron(s)</a>[% IF ( table_loop ) %]
60 <a class="btn btn-default" id="savedesc" href="#" data-batch_id="[% batch_id | html %]"><i class="fa fa-save"></i> Save description</a>
61 <a class="btn btn-default" id="removeitems" href="#"><i class="fa fa-trash"></i> Remove selected patrons</a>
62 <a class="btn btn-default" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
63 <a class="btn btn-default" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
64 <a class="btn btn-default" id="exportitems" href="#"><i class="fa fa-share-square-o"></i> Export selected card(s)</a>
65 <a class="btn btn-default" id="exportbatch" href="#"><i class="fa fa-share-square-o"></i> Export card batch</a>[% END %]
67 [% IF ( table_loop ) %]
69 <h2>Patrons in batch number [% batch_id | html %]</h2>
71 [% FOREACH table_loo IN table_loop %]
72 [% IF ( table_loo.header_fields ) %]
75 [% FOREACH header_field IN table_loo.header_fields %]
76 [% SWITCH header_field.field_label -%]
78 <th>Borrower name</th>
79 [% CASE "Borrower Number" %]
80 <th>Borrower number</th>
82 <th class="noExport">Actions</th>
86 <th>[% header_field.field_label | html %]</th>
94 [% FOREACH text_field IN table_loo.text_fields %]
95 [% IF ( text_field.select_field ) %]
97 <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>
98 <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>
100 <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>
102 <td>[% text_field.field_value | html %]</td>
112 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
114 <div class="dialog message">
115 <h4>There are no patrons in this batch yet</h4>
116 <p>Add patrons by borrowernumber using the text area above or leave empty to add via patron search.</p>
124 </div> <!-- /.col-sm-10.col-sm-push-2 -->
126 <div class="col-sm-2 col-sm-pull-10">
128 [% INCLUDE 'tools-menu.inc' %]
130 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
131 </div> <!-- /.row -->
132 [% MACRO jsinclude BLOCK %]
133 [% INCLUDE 'greybox.inc' %]
134 [% INCLUDE 'datatables.inc' %]
136 function DeleteConfirm() {
137 var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id | html %]");
138 var answer = confirm(msg);
140 window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=batch&element_id=[% batch_id | html %]";
142 return; // abort delete
148 if(document.items.action.length > 0) {
149 for (var i=0; i < document.items.action.length; i++) {
150 if (document.items.action[i].checked) {
151 items.push("label_id=" + document.items.action[i].value);
154 getstr = items.join("&");
155 var msg = _("Are you sure you want to remove the selected patron(s) from this batch?");
156 } else if (document.items.action.checked) {
157 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"));
158 return; // no deletion for single item batch
160 alert(_("Please select at least one patron to delete."));
161 return; // no item selected
163 var answer = confirm(msg);
165 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&" + getstr;
167 return; // abort delete
171 var bor_nums = document.getElementById("bor_num_list");
172 if (bor_nums.value == '') {
173 window.open("/cgi-bin/koha/patroncards/add_user_search.pl",
175 'width=840,height=500,location=yes,toolbar=no,'
176 + 'scrollbars=yes,resize=yes');
178 document.forms["add_by_bor_num"].submit();
182 function add_user(borrowernumber) {
183 $("#bor_num_list").val($("#bor_num_list").val()+borrowernumber+"\r\n");
186 function DeDuplicate() {
187 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=de_duplicate&batch_id=[% batch_id | html %]";
189 function Xport(mode) {
190 if (mode == 'label') {
191 patroncards= new Array;
192 if(document.items.action.length > 0) {
193 for (var i=0; i < document.items.action.length; i++) {
194 if (document.items.action[i].checked) {
195 patroncards.push("label_id=" + document.items.action[i].value);
198 if (patroncards.length < 1) {
199 alert(_("Please select at least one card to export."));
200 return; // no batch selected
202 getstr = patroncards.join("&");
203 } else if (document.items.action.checked) {
204 getstr = document.items.action.value;
206 alert(_("Please select at least one card to export."));
207 return; // no batch selected
209 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]&" + getstr, 400, 800);
210 } else if (mode == 'batch') {
211 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]", 400, 800);
213 // some pass-thru error trapping just in case...
216 function selected_layout() {
217 if (document.items.action.length) {
218 for (i=0;i<document.items.action.length;i++){
219 if (document.items.action[i].checked==true){
220 return(document.items.action[i].value);
224 if (document.items.action.checked){
225 return(document.items.action.value);
228 alert(_("Please select at least one item."));
232 $(document).ready(function() {
234 $("#description").show();
236 $("#description").hide();
238 $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
240 { "aTargets": [ -2, -1 ], "bSortable": false, "bSearchable": false }
242 "aaSorting": [[ 0, "asc" ]],
243 "sPaginationType": "full",
246 $("#additems").click(function(){
250 $("#removeitems").click(function(){
254 $("#deletebatch").click(function(){
258 $("#deduplicate").click(function(){
262 $("#exportitems").click(function(){
266 $("#exportbatch").click(function(){
270 $(".delete").on("click", function(){
271 return confirmDelete( _("Are you sure you want to delete this patron from the card batch?") );
273 $(".export").on("click", function(e){
275 var label_id = $(this).data("label-id");
276 var batch_id = $(this).data("batch-id");
277 GB_showCenter( _("Export single card"),'/cgi-bin/koha/patroncards/print.pl?batch_id=' + batch_id + '&label_id=' + label_id, 400, 800);
279 $("#savedesc").click(function(event){
280 var newdescription = $(this).siblings('input[name="description"]').val();
281 var batch_id = $(this).data('batch_id');
283 'newdescription': newdescription,
284 'batch_id': batch_id,
285 'card_element': "batch",
286 'creator': "patroncard",
290 url: '/cgi-bin/koha/svc/creator_batches',
296 .done(function(data){
297 if (data.status == 'success') {
298 $("input[name='description']").text(data.newdesc);
299 $("#change-status").text(_("Saved"));
301 $("#change-status").text(_("Unable to save description"));
305 $("#savedesc").click(function(event){
306 var newdescription = $('input[name="description"]').val();
307 var batch_id = $(this).data('batch_id');
309 'newdescription': newdescription,
310 'batch_id': batch_id,
311 'card_element': "batch",
312 'creator': "patroncard",
316 url: '/cgi-bin/koha/svc/creator_batches',
322 .done(function(data){
323 if (data.status == 'success') {
324 $("input[name='description']").text(data.newdesc);
325 $("#change-status").text(_("Saved"));
327 $("#change-status").text(_("Unable to save description"));
335 [% INCLUDE 'intranet-bottom.inc' %]