|
Lines 175-187
Link Here
|
| 175 |
[% MACRO jsinclude BLOCK %] |
175 |
[% MACRO jsinclude BLOCK %] |
| 176 |
[% INCLUDE 'datatables.inc' %] |
176 |
[% INCLUDE 'datatables.inc' %] |
| 177 |
[% Asset.js("js/tools-menu.js") | $raw %] |
177 |
[% Asset.js("js/tools-menu.js") | $raw %] |
|
|
178 |
<script> |
| 179 |
const batch_id = "[% batch_id | html %]"; |
| 180 |
addPrefs({ |
| 181 |
PatronsPerPage: "[% Koha.Preference('PatronsPerPage') | html %]", |
| 182 |
}); |
| 183 |
const has_entries = [% table_loop ? 1 : 0 | html %]; |
| 184 |
</script> |
| 185 |
|
| 178 |
<script> |
186 |
<script> |
| 179 |
function DeleteConfirm() { |
187 |
function DeleteConfirm() { |
| 180 |
var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id | html %]"); |
188 |
var msg = _("Are you sure you want to delete batch %s?").format(batch_id); |
| 181 |
var answer = confirm(msg); |
189 |
var answer = confirm(msg); |
| 182 |
if (answer) { |
190 |
if (answer) { |
| 183 |
$('#batch_form input[name="op"]').val('cud-delete'); |
191 |
$('#batch_form input[name="op"]').val('cud-delete'); |
| 184 |
$('#batch_form').append( '<input type="hidden" name="element_id" value="[% batch_id | html %]" />' ); |
192 |
$('#batch_form').append( `<input type="hidden" name="element_id" value="${batch_id}" />` ); |
| 185 |
$('#batch_form').append( '<input type="hidden" name="card_element" value="batch" />' ); |
193 |
$('#batch_form').append( '<input type="hidden" name="card_element" value="batch" />' ); |
| 186 |
$('#batch_form').submit(); |
194 |
$('#batch_form').submit(); |
| 187 |
} else { |
195 |
} else { |
|
Lines 209-215
Link Here
|
| 209 |
var answer = confirm(msg); |
217 |
var answer = confirm(msg); |
| 210 |
if (answer) { |
218 |
if (answer) { |
| 211 |
$('#patron_form input[name="op"]').val('cud-remove'); |
219 |
$('#patron_form input[name="op"]').val('cud-remove'); |
| 212 |
$('#patron_form input[name="batch_id"]').val( [% batch_id | html %] ); |
220 |
$('#patron_form input[name="batch_id"]').val(batch_id); |
| 213 |
$('#patron_form input[name="label_id"]').remove(); |
221 |
$('#patron_form input[name="label_id"]').remove(); |
| 214 |
items.forEach( (item_id) => { |
222 |
items.forEach( (item_id) => { |
| 215 |
$('#patron_form').append( '<input type="hidden" name="label_id" value="' + item_id + '" />' ); |
223 |
$('#patron_form').append( '<input type="hidden" name="label_id" value="' + item_id + '" />' ); |
|
Lines 240-246
Link Here
|
| 240 |
|
248 |
|
| 241 |
function DeDuplicate() { |
249 |
function DeDuplicate() { |
| 242 |
$('#patron_form input[name="op"]').val('cud-dedup'); |
250 |
$('#patron_form input[name="op"]').val('cud-dedup'); |
| 243 |
$('#patron_form input[name="batch_id"]').val('[% batch_id | html %]'); |
251 |
$('#patron_form input[name="batch_id"]').val(batch_id); |
| 244 |
$('#patron_form').submit(); |
252 |
$('#patron_form').submit(); |
| 245 |
} |
253 |
} |
| 246 |
|
254 |
|
|
Lines 264-272
Link Here
|
| 264 |
alert(_("Please select at least one card to export.")); |
272 |
alert(_("Please select at least one card to export.")); |
| 265 |
return; // no batch selected |
273 |
return; // no batch selected |
| 266 |
} |
274 |
} |
| 267 |
location.href = "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]&" + getstr; |
275 |
location.href = `/cgi-bin/koha/patroncards/print.pl?batch_id=${batch_id}&${getstr}`; |
| 268 |
} else if (mode == 'batch') { |
276 |
} else if (mode == 'batch') { |
| 269 |
location.href = "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]"; |
277 |
location.href = `/cgi-bin/koha/patroncards/print.pl?batch_id=${batch_id`; |
| 270 |
} else { |
278 |
} else { |
| 271 |
// some pass-through error trapping just in case... |
279 |
// some pass-through error trapping just in case... |
| 272 |
} |
280 |
} |
|
Lines 291-313
Link Here
|
| 291 |
// Prepare DataTables settings |
299 |
// Prepare DataTables settings |
| 292 |
var aLengthMenu = [10, 20, 50, 100, -1]; |
300 |
var aLengthMenu = [10, 20, 50, 100, -1]; |
| 293 |
var aLengthMenuLabel = [10, 20, 50, 100, _("All")]; |
301 |
var aLengthMenuLabel = [10, 20, 50, 100, _("All")]; |
| 294 |
var patronsPerPage = [% Koha.Preference('PatronsPerPage') | html %]; |
|
|
| 295 |
for ( var i = 0; i < aLengthMenu.length; i++ ) { |
302 |
for ( var i = 0; i < aLengthMenu.length; i++ ) { |
| 296 |
if ( aLengthMenu[i] == patronsPerPage ) { |
303 |
if ( aLengthMenu[i] == prefs.PatronsPerPage ) { |
| 297 |
break; |
304 |
break; |
| 298 |
} |
305 |
} |
| 299 |
if ( aLengthMenu[i] > patronsPerPage || aLengthMenu[i] == -1 ) { |
306 |
if ( aLengthMenu[i] > prefs.PatronsPerPage || aLengthMenu[i] == -1 ) { |
| 300 |
aLengthMenu.splice(i, 0, patronsPerPage); |
307 |
aLengthMenu.splice(i, 0, prefs.PatronsPerPage); |
| 301 |
aLengthMenuLabel.splice(i, 0, patronsPerPage); |
308 |
aLengthMenuLabel.splice(i, 0, prefs.PatronsPerPage); |
| 302 |
break; |
309 |
break; |
| 303 |
} |
310 |
} |
| 304 |
} |
311 |
} |
| 305 |
|
312 |
|
| 306 |
[% IF table_loop %] |
313 |
if (has_entries){ |
| 307 |
$("#description").show(); |
314 |
$("#description").show(); |
| 308 |
[% ELSE %] |
315 |
} else { |
| 309 |
$("#description").hide(); |
316 |
$("#description").hide(); |
| 310 |
[% END %] |
317 |
} |
| 311 |
$("#batcht").kohaTable({ |
318 |
$("#batcht").kohaTable({ |
| 312 |
dom: '<"dt-info"i><"top pager"<"table_entries"lp><"table_controls"f>>tr<"bottom pager"ip>', |
319 |
dom: '<"dt-info"i><"top pager"<"table_entries"lp><"table_controls"f>>tr<"bottom pager"ip>', |
| 313 |
order: [[0, "asc"]], |
320 |
order: [[0, "asc"]], |
| 314 |
- |
|
|