3 [% PROCESS 'i18n.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% FILTER collapse %]
8 [% t("Edit patron card batch") | html %] ([% batch_id | html %])
10 [% t("New patron card batch") | html %]
12 [% t("Batches") | html %] ›
13 [% t("Patron card creator") | html %] ›
14 [% t("Tools") | html %] ›
15 [% t("Koha") | html %]
17 [% INCLUDE 'doc-head-close.inc' %]
20 <body id="pcard_edit-batch" class="tools pcard">
21 [% WRAPPER 'header.inc' %]
22 [% INCLUDE 'cat-search.inc' %]
25 [% WRAPPER 'sub-header.inc' %]
26 [% WRAPPER breadcrumbs %]
27 [% WRAPPER breadcrumb_item %]
28 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
30 [% WRAPPER breadcrumb_item %]
31 <a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a>
33 [% WRAPPER breadcrumb_item %]
34 <a href="/cgi-bin/koha/patroncards/manage.pl?card_element=batch">Batches</a>
36 [% WRAPPER breadcrumb_item bc_active= 1 %]
38 <span>Edit [% description | html %]</span>
40 <span>Edit ([% batch_id | html %])</span>
42 <span>New patron card batch</span>
45 [% END #/ WRAPPER breadcrumbs %]
46 [% END #/ WRAPPER sub-header.inc %]
48 <div class="main container-fluid">
50 <div class="col-sm-10 col-sm-push-2">
53 [% INCLUDE 'patroncards-toolbar.inc' %]
55 <h1>[% IF description %]<span>Edit</span> [% description | html %]
56 [% ELSIF batch_id %]<span>Edit patron card batch</span> [% batch_id | html %]
57 [% ELSE %]<span>New patron card batch</span>[% END %]
60 [% IF ( duplicate_message ) %]
61 <div class="dialog message">
62 <strong>Duplicate patrons removed from batch number [% batch_id | html %]: [% duplicate_count | html %]</strong>
66 [% INCLUDE 'patroncards-errors.inc' %]
67 <div id="manage-patroncard-batches">
68 <form name="add_by_bor_num" action="/cgi-bin/koha/patroncards/edit-batch.pl" method="post">
70 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
71 <ol><li id="description">
72 <input type="hidden" name="op" value="add" />
73 <input type="hidden" name="batch_id" value="[% batch_id | html %]" />
74 <label for="description">Batch description: </label>
75 <input type="text" name="description" value="[% description | html %]"> <span id="change-status"></span>
77 <label for="bor_num_list">Add by borrowernumber(s):
78 <br /> <span class="hint">One borrowernumber per line.</span>
80 <textarea rows="5" id="bor_num_list" name="bor_num_list" tabindex="1" class="focus"></textarea>
85 <div id="batch-manage" class="action">
86 <a class="btn btn-default" id="additems" href="#"><i class="fa fa-plus"></i> Add patron(s)</a>[% IF ( table_loop ) %]
87 <a class="btn btn-default" id="savedesc" href="#" data-batch_id="[% batch_id | html %]"><i class="fa fa-save"></i> Save description</a>
88 <a class="btn btn-default" id="removeitems" href="#"><i class="fa fa-trash-can"></i> Remove selected patrons</a>
89 <a class="btn btn-default" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
90 <a class="btn btn-default" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
91 <a class="btn btn-default" id="exportitems" href="#"><i class="fa-solid fa-share-from-square"></i> Export selected card(s)</a>
92 <a class="btn btn-default" id="exportbatch" href="#"><i class="fa-solid fa-share-from-square"></i> Export card batch</a>[% END %]
94 [% IF ( table_loop ) %]
96 <h2>Patrons in batch number [% batch_id | html %]</h2>
97 <div class="page-section">
99 [% FOREACH table_loo IN table_loop %]
100 [% IF ( table_loo.header_fields ) %]
103 [% FOREACH header_field IN table_loo.header_fields %]
104 [% SWITCH header_field.field_label -%]
105 [% CASE "Summary" -%]
107 [% CASE "Borrower Number" %]
108 <th>Borrower number</th>
109 [% CASE "Actions " %]
110 <th class="noExport">Actions</th>
114 <th>[% header_field.field_label | html %]</th>
122 [% FOREACH text_field IN table_loo.text_fields %]
123 [% IF ( text_field.select_field ) %]
125 <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-can"></i> Delete</a>
126 <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-solid fa-share-from-square"></i> Export</a>
128 <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>
130 <td>[% text_field.field_value | html %]</td>
141 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
143 <div class="dialog message">
144 <h4>There are no patrons in this batch yet</h4>
145 <p>Add patrons by borrowernumber using the text area above or leave empty to add via patron search.</p>
153 </div> <!-- /.col-sm-10.col-sm-push-2 -->
155 <div class="col-sm-2 col-sm-pull-10">
157 [% INCLUDE 'tools-menu.inc' %]
159 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
160 </div> <!-- /.row -->
161 [% MACRO jsinclude BLOCK %]
162 [% INCLUDE 'greybox.inc' %]
163 [% INCLUDE 'datatables.inc' %]
165 function DeleteConfirm() {
166 var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id | html %]");
167 var answer = confirm(msg);
169 window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=batch&element_id=[% batch_id | html %]";
171 return; // abort delete
177 if(document.items.action.length > 0) {
178 for (var i=0; i < document.items.action.length; i++) {
179 if (document.items.action[i].checked) {
180 items.push("label_id=" + document.items.action[i].value);
183 getstr = items.join("&");
184 var msg = _("Are you sure you want to remove the selected patron(s) from this batch?");
185 } else if (document.items.action.checked) {
186 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"));
187 return; // no deletion for single item batch
189 alert(_("Please select at least one patron to delete."));
190 return; // no item selected
192 var answer = confirm(msg);
194 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&" + getstr;
196 return; // abort delete
200 var bor_nums = document.getElementById("bor_num_list");
201 if (bor_nums.value == '') {
202 window.open("/cgi-bin/koha/members/search.pl?columns=checkbox,cardnumber,name,category,branch,dateexpiry,borrowernotes,action&selection_type=add",
204 'width=1024,height=768,location=yes,toolbar=no,'
205 + 'scrollbars=yes,resize=yes');
207 document.forms["add_by_bor_num"].submit();
211 function add_user(borrowernumber) {
212 $("#bor_num_list").val($("#bor_num_list").val()+borrowernumber+"\r\n");
215 function DeDuplicate() {
216 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=de_duplicate&batch_id=[% batch_id | html %]";
218 function Xport(mode) {
219 if (mode == 'label') {
220 patroncards= new Array;
221 if(document.items.action.length > 0) {
222 for (var i=0; i < document.items.action.length; i++) {
223 if (document.items.action[i].checked) {
224 patroncards.push("label_id=" + document.items.action[i].value);
227 if (patroncards.length < 1) {
228 alert(_("Please select at least one card to export."));
229 return; // no batch selected
231 getstr = patroncards.join("&");
232 } else if (document.items.action.checked) {
233 getstr = document.items.action.value;
235 alert(_("Please select at least one card to export."));
236 return; // no batch selected
238 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]&" + getstr, 400, 800);
239 } else if (mode == 'batch') {
240 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]", 400, 800);
242 // some pass-thru error trapping just in case...
245 function selected_layout() {
246 if (document.items.action.length) {
247 for (i=0;i<document.items.action.length;i++){
248 if (document.items.action[i].checked==true){
249 return(document.items.action[i].value);
253 if (document.items.action.checked){
254 return(document.items.action.value);
257 alert(_("Please select at least one item."));
261 $(document).ready(function() {
262 // Prepare DataTables settings
263 var aLengthMenu = [10, 20, 50, 100, -1];
264 var aLengthMenuLabel = [10, 20, 50, 100, _("All")];
265 var patronsPerPage = [% Koha.Preference('PatronsPerPage') | html %];
266 for ( var i = 0; i < aLengthMenu.length; i++ ) {
267 if ( aLengthMenu[i] == patronsPerPage ) {
270 if ( aLengthMenu[i] > patronsPerPage || aLengthMenu[i] == -1 ) {
271 aLengthMenu.splice(i, 0, patronsPerPage);
272 aLengthMenuLabel.splice(i, 0, patronsPerPage);
278 $("#description").show();
280 $("#description").hide();
282 $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
284 { "aTargets": [ -2, -1 ], "bSortable": false, "bSearchable": false }
286 "aaSorting": [[ 0, "asc" ]],
287 "sPaginationType": "full",
288 "aLengthMenu": [aLengthMenu, aLengthMenuLabel],
289 "pageLength": patronsPerPage,
292 $("#additems").click(function(){
296 $("#removeitems").click(function(){
300 $("#deletebatch").click(function(){
304 $("#deduplicate").click(function(){
308 $("#exportitems").click(function(){
312 $("#exportbatch").click(function(){
316 $(".delete").on("click", function(){
317 return confirmDelete( _("Are you sure you want to delete this patron from the card batch?") );
319 $(".export").on("click", function(e){
321 var label_id = $(this).data("label-id");
322 var batch_id = $(this).data("batch-id");
323 GB_showCenter( _("Export single card"),'/cgi-bin/koha/patroncards/print.pl?batch_id=' + batch_id + '&label_id=' + label_id, 400, 800);
325 $("#savedesc").click(function(event){
326 var newdescription = $(this).siblings('input[name="description"]').val();
327 var batch_id = $(this).data('batch_id');
329 'newdescription': newdescription,
330 'batch_id': batch_id,
331 'card_element': "batch",
332 'creator': "patroncard",
336 url: '/cgi-bin/koha/svc/creator_batches',
342 .done(function(data){
343 if (data.status == 'success') {
344 $("input[name='description']").text(data.newdesc);
345 $("#change-status").text(_("Saved"));
347 $("#change-status").text(_("Unable to save description"));
351 $("#savedesc").click(function(event){
352 var newdescription = $('input[name="description"]').val();
353 var batch_id = $(this).data('batch_id');
355 'newdescription': newdescription,
356 'batch_id': batch_id,
357 'card_element': "batch",
358 'creator': "patroncard",
362 url: '/cgi-bin/koha/svc/creator_batches',
368 .done(function(data){
369 if (data.status == 'success') {
370 $("input[name='description']").text(data.newdesc);
371 $("#change-status").text(_("Saved"));
373 $("#change-status").text(_("Unable to save description"));
381 [% INCLUDE 'intranet-bottom.inc' %]