Lines 2-12
Link Here
|
2 |
[% USE ItemTypes %] |
2 |
[% USE ItemTypes %] |
3 |
[% USE Branches %] |
3 |
[% USE Branches %] |
4 |
[% USE AuthorisedValues %] |
4 |
[% USE AuthorisedValues %] |
|
|
5 |
[% USE Asset %] |
6 |
[% USE raw %] |
5 |
[% SET footerjs = 1 %] |
7 |
[% SET footerjs = 1 %] |
6 |
[% INCLUDE 'doc-head-open.inc' %] |
8 |
[% INCLUDE 'doc-head-open.inc' %] |
7 |
<title>Koha › Circulation › Article requests</title> |
9 |
<title>Koha › Circulation › Article requests</title> |
8 |
[% INCLUDE 'doc-head-close.inc' %] |
10 |
[% INCLUDE 'doc-head-close.inc' %] |
9 |
<style> p { margin-top: 0; } [id^="article-menu-"] { display: none; } [id^="article-menu-"]:before { content: "|"; }</style> |
11 |
<style>p { margin-top: 0; } [id^="article-menu-"] { display: none; } [id^="article-menu-"]:before { content: "|"; } .starthidden { display:none; }</style> |
10 |
</head> |
12 |
</head> |
11 |
|
13 |
|
12 |
[% BLOCK actions %] |
14 |
[% BLOCK actions %] |
Lines 62-68
Link Here
|
62 |
<a href="/cgi-bin/koha/circ/article-requests.pl">Article requests</a> |
64 |
<a href="/cgi-bin/koha/circ/article-requests.pl">Article requests</a> |
63 |
</div> |
65 |
</div> |
64 |
|
66 |
|
65 |
<div class="main container-fluid"> |
67 |
<div class="main container-fluid starthidden"> |
66 |
<div class="row"> |
68 |
<div class="row"> |
67 |
<div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2"> |
69 |
<div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2"> |
68 |
|
70 |
|
Lines 125-136
Link Here
|
125 |
</thead> |
127 |
</thead> |
126 |
|
128 |
|
127 |
<tbody> |
129 |
<tbody> |
128 |
<tr class="ar-pending-none"> |
|
|
129 |
<td colspan="12"> |
130 |
There are no pending article requests at this time. |
131 |
</td> |
132 |
</tr> |
133 |
|
134 |
[% FOREACH ar IN article_requests_pending %] |
130 |
[% FOREACH ar IN article_requests_pending %] |
135 |
<tr class="ar-row ar-pending"> |
131 |
<tr class="ar-row ar-pending"> |
136 |
<td><input type="checkbox" reqid="[% ar.id | html %]"/></td> |
132 |
<td><input type="checkbox" reqid="[% ar.id | html %]"/></td> |
Lines 232-243
Link Here
|
232 |
</thead> |
228 |
</thead> |
233 |
|
229 |
|
234 |
<tbody> |
230 |
<tbody> |
235 |
<tr class="ar-processing-none"> |
|
|
236 |
<td colspan="12"> |
237 |
There are no article requests in processing at this time. |
238 |
</td> |
239 |
</tr> |
240 |
|
241 |
[% FOREACH ar IN article_requests_processing %] |
231 |
[% FOREACH ar IN article_requests_processing %] |
242 |
<tr class="ar-row ar-processing"> |
232 |
<tr class="ar-row ar-processing"> |
243 |
<td><input type="checkbox" reqid="[% ar.id | html %]"/></td> |
233 |
<td><input type="checkbox" reqid="[% ar.id | html %]"/></td> |
Lines 320-362
Link Here
|
320 |
</div> |
310 |
</div> |
321 |
|
311 |
|
322 |
[% MACRO jsinclude BLOCK %] |
312 |
[% MACRO jsinclude BLOCK %] |
|
|
313 |
[% INCLUDE 'datatables.inc' %] |
323 |
<script> |
314 |
<script> |
324 |
var active_table = "#article-requests-pending"; |
315 |
var active_tab = "#article-requests-pending"; |
325 |
var last_cancel_reason; |
316 |
var last_cancel_reason, pending_datatable, processing_datatable, active_datatable; |
326 |
$(document).ready(function() { |
317 |
$(document).ready(function() { |
327 |
$('#article-request-tabs').tabs({ |
318 |
$('#article-request-tabs').tabs({ |
328 |
activate: function( activate_event, activate_ui ) { |
319 |
activate: function( activate_event, activate_ui ) { |
329 |
active_table = activate_ui.newPanel.selector; |
320 |
active_tab = activate_ui.newPanel.selector; |
330 |
activateBatchActions( active_table ); |
321 |
if( active_tab == '#article-requests-pending' ) |
331 |
}, |
322 |
active_datatable = pending_datatable; |
332 |
create: function( create_event, create_ui ){ |
323 |
else active_datatable = processing_datatable; |
333 |
active_table = create_ui.panel.selector; |
324 |
activateBatchActions( active_tab ); |
334 |
}, |
325 |
}, |
335 |
}); |
326 |
}); |
336 |
|
327 |
|
337 |
activateBatchActions( active_table ); |
|
|
338 |
|
328 |
|
339 |
[% IF article_requests_pending.count %] |
329 |
$( "input:checkbox, #article-request-tabs" ).on("change", function(){ |
340 |
$(".ar-pending-none").hide(); |
330 |
activateBatchActions( active_tab ); |
341 |
[% END %] |
|
|
342 |
|
343 |
[% IF article_requests_processing.count %] |
344 |
$(".ar-processing-none").hide(); |
345 |
[% END %] |
346 |
|
347 |
$( "input:checkbox", active_table ).on("change", function(){ |
348 |
activateBatchActions( active_table ); |
349 |
}); |
331 |
}); |
350 |
|
332 |
|
351 |
$(".SelectAll").on("click", function(e) { |
333 |
$(".SelectAll").on("click", function(e) { |
352 |
e.preventDefault(); |
334 |
e.preventDefault(); |
353 |
$( active_table + " input[type='checkbox']").prop('checked', true); |
335 |
$( active_tab + " input[type='checkbox']").prop('checked', true); |
354 |
activateBatchActions( active_table ); |
336 |
activateBatchActions( active_tab ); |
355 |
}); |
337 |
}); |
356 |
$(".ClearAll").on("click", function(e) { |
338 |
$(".ClearAll").on("click", function(e) { |
357 |
e.preventDefault(); |
339 |
e.preventDefault(); |
358 |
$( active_table + " input[type='checkbox']").prop('checked', false); |
340 |
$( active_tab + " input[type='checkbox']").prop('checked', false); |
359 |
activateBatchActions( active_table ); |
341 |
activateBatchActions( active_tab ); |
360 |
}); |
342 |
}); |
361 |
$("a.ar-actions").on('click', function(e) { |
343 |
$("a.ar-actions").on('click', function(e) { |
362 |
// Hide menu option ? |
344 |
// Hide menu option ? |
Lines 364-391
Link Here
|
364 |
$('a.ar-process-request').hide(); |
346 |
$('a.ar-process-request').hide(); |
365 |
else $('a.ar-process-request').show(); |
347 |
else $('a.ar-process-request').show(); |
366 |
}); |
348 |
}); |
|
|
349 |
|
350 |
pending_datatable = $("#article-requests-pending-table").DataTable($.extend(true, {}, dataTablesDefaults, { |
351 |
"aoColumnDefs": [ |
352 |
{ "aTargets": [0, -1], "bSortable": false, "bSearchable": false }, |
353 |
], |
354 |
})); |
355 |
active_datatable = pending_datatable; |
356 |
processing_datatable = $("#article-requests-processing-table").DataTable($.extend(true, {}, dataTablesDefaults, { |
357 |
"aoColumnDefs": [ |
358 |
{ "aTargets": [0, -1], "bSortable": false, "bSearchable": false }, |
359 |
], |
360 |
})); |
361 |
activateBatchActions( active_tab ); |
362 |
$(".starthidden").show(); |
367 |
}); |
363 |
}); |
368 |
|
364 |
|
369 |
function activateBatchActions( active_table ){ |
365 |
function activateBatchActions( active_tab ){ |
370 |
// Check to see whether batch menu should be shown based on state of checkboxes |
366 |
// Check to see whether batch menu should be shown based on state of checkboxes |
371 |
if ( $( "input:checkbox", active_table ).length > 0 ) { |
367 |
if ( $( "input:checkbox", active_tab ).length > 0 ) { |
372 |
// There are rows with checkboxes |
368 |
// There are rows with checkboxes |
373 |
$( "[class$='_table_controls']", active_table ).show(); |
369 |
$( "[class$='_table_controls']", active_tab ).show(); |
374 |
if ( $( "input:checkbox:checked", active_table ).length > 0 ) { |
370 |
if ( $( "input:checkbox:checked", active_tab ).length > 0 ) { |
375 |
$( "[id^='article-menu-']", active_table ).css("display","inline-block"); |
371 |
$( "[id^='article-menu-']", active_tab ).css("display","inline-block"); |
376 |
} else { |
372 |
} else { |
377 |
$( "[id^='article-menu-']", active_table ).hide(); |
373 |
$( "[id^='article-menu-']", active_tab ).hide(); |
378 |
} |
374 |
} |
379 |
} else { |
375 |
} else { |
380 |
// All rows have been removed |
376 |
// All rows have been removed |
381 |
$("[class$='_table_controls']", active_table ).hide(); |
377 |
$("[class$='_table_controls']", active_tab ).hide(); |
382 |
} |
378 |
} |
383 |
} |
379 |
} |
384 |
|
380 |
|
385 |
function HandleMulti( fnHandler, id, a ) { |
381 |
function HandleMulti( fnHandler, id, a ) { |
386 |
last_cancel_reason = undefined; |
382 |
last_cancel_reason = undefined; |
387 |
if( id !== 0 ) { fnHandler( id, a ); return; } |
383 |
if( id !== 0 ) { fnHandler( id, a ); return; } |
388 |
$( active_table + " input[type='checkbox']:checked").each(function() { |
384 |
$( active_tab + " input[type='checkbox']:checked").each(function() { |
389 |
fnHandler( $(this).attr('reqid'), $(this).closest('tr').find('td.ar-actions div a') ); |
385 |
fnHandler( $(this).attr('reqid'), $(this).closest('tr').find('td.ar-actions div a') ); |
390 |
}); |
386 |
}); |
391 |
} |
387 |
} |
Lines 413-432
Link Here
|
413 |
notes: last_cancel_reason |
409 |
notes: last_cancel_reason |
414 |
}, |
410 |
}, |
415 |
success: function( data ) { |
411 |
success: function( data ) { |
416 |
a.closest('tr').remove(); |
412 |
active_datatable.row( a.closest('tr') ).remove().draw(); |
417 |
UpdateTabCounts(); |
413 |
UpdateTabCounts(); |
418 |
activateBatchActions( active_table ); |
414 |
activateBatchActions( active_tab ); |
419 |
}, |
415 |
}, |
420 |
dataType: 'json' |
416 |
dataType: 'json' |
421 |
}); |
417 |
}); |
422 |
} |
418 |
} |
423 |
|
419 |
|
424 |
function Process( id, a ) { |
420 |
function Process( id, a ) { |
425 |
var table_row = a.closest('tr').clone(); |
421 |
var table_row = a.closest('tr'); |
426 |
table_row.find('.ar-process-request').remove(); |
422 |
table_row.find('.ar-process-request').remove(); |
427 |
table_row.find('input[type="checkbox"]').prop('checked', false); |
423 |
table_row.find('input[type="checkbox"]').prop('checked', false); |
428 |
|
424 |
|
429 |
a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif"/>').find('div.dropdown').hide(); |
425 |
a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" class="spinner"/>').find('div.dropdown').hide(); |
430 |
$.ajax({ |
426 |
$.ajax({ |
431 |
type: "POST", |
427 |
type: "POST", |
432 |
url: '/cgi-bin/koha/svc/article_request', |
428 |
url: '/cgi-bin/koha/svc/article_request', |
Lines 435-445
Link Here
|
435 |
id: id, |
431 |
id: id, |
436 |
}, |
432 |
}, |
437 |
success: function( data ) { |
433 |
success: function( data ) { |
438 |
a.closest('tr').remove(); |
434 |
$("img.spinner").remove(); |
439 |
$("#article-requests-processing-table").append( table_row ); |
435 |
pending_datatable.row( table_row ).remove().draw(); |
440 |
$("#article-requests-processing-table .ar-processing-none").hide(); |
436 |
processing_datatable.row.add( table_row ).draw(); |
441 |
UpdateTabCounts(); |
437 |
UpdateTabCounts(); |
442 |
activateBatchActions( active_table ); |
438 |
activateBatchActions( active_tab ); |
443 |
}, |
439 |
}, |
444 |
dataType: 'json' |
440 |
dataType: 'json' |
445 |
}); |
441 |
}); |
Lines 455-476
Link Here
|
455 |
id: id, |
451 |
id: id, |
456 |
}, |
452 |
}, |
457 |
success: function( data ) { |
453 |
success: function( data ) { |
458 |
a.closest('tr').remove(); |
454 |
active_table.row( a.closest('tr') ).remove().draw(); |
459 |
UpdateTabCounts(); |
455 |
UpdateTabCounts(); |
460 |
activateBatchActions( active_table ); |
456 |
activateBatchActions( active_tab ); |
461 |
}, |
457 |
}, |
462 |
dataType: 'json' |
458 |
dataType: 'json' |
463 |
}); |
459 |
}); |
464 |
} |
460 |
} |
465 |
|
461 |
|
466 |
function UpdateTabCounts() { |
462 |
function UpdateTabCounts() { |
467 |
var pending_count = $('#article-requests-pending-table tbody tr.ar-row').length; |
463 |
$("#ar_pending_count").html( pending_datatable.rows().count() ); |
468 |
$("#ar_pending_count").html( pending_count ); |
464 |
$("#ar_processing_count").html( processing_datatable.rows().count() ); |
469 |
if ( pending_count == 0 ) $(".ar-pending-none").show(); |
|
|
470 |
|
471 |
var processing_count = $('#article-requests-processing-table tbody tr.ar-row').length; |
472 |
$("#ar_processing_count").html( processing_count ); |
473 |
if ( processing_count == 0 ) $(".ar-processing-none").show(); |
474 |
} |
465 |
} |
475 |
</script> |
466 |
</script> |
476 |
[% END %] |
467 |
[% END %] |
477 |
- |
|
|