Lines 6-15
Link Here
|
6 |
[% INCLUDE 'doc-head-open.inc' %] |
6 |
[% INCLUDE 'doc-head-open.inc' %] |
7 |
<title>Koha › Circulation › Article requests</title> |
7 |
<title>Koha › Circulation › Article requests</title> |
8 |
[% INCLUDE 'doc-head-close.inc' %] |
8 |
[% INCLUDE 'doc-head-close.inc' %] |
9 |
<style type="text/css"> p { margin-top: 0; }</style> |
9 |
<style type="text/css"> p { margin-top: 0; } [id^="article-menu-"] { display: none; } [id^="article-menu-"]:before { content: "|"; }</style> |
10 |
</head> |
10 |
</head> |
11 |
|
11 |
|
12 |
[% BLOCK actions %] |
12 |
[% BLOCK actions %] |
|
|
13 |
<div id="[% menuid %]" class="dropdown"> |
13 |
<a class="btn btn-default btn-xs dropdown-toggle ar-actions" role="button" data-toggle="dropdown" href="#"> |
14 |
<a class="btn btn-default btn-xs dropdown-toggle ar-actions" role="button" data-toggle="dropdown" href="#"> |
14 |
Actions <b class="caret"></b> |
15 |
Actions <b class="caret"></b> |
15 |
</a> |
16 |
</a> |
Lines 39-44
Link Here
|
39 |
[% END %] |
40 |
[% END %] |
40 |
</li> |
41 |
</li> |
41 |
</ul> |
42 |
</ul> |
|
|
43 |
</div> |
42 |
[% END %] |
44 |
[% END %] |
43 |
|
45 |
|
44 |
<body id="circ_article-requests" class="circ"> |
46 |
<body id="circ_article-requests" class="circ"> |
Lines 91-101
Link Here
|
91 |
</ul> |
93 |
</ul> |
92 |
|
94 |
|
93 |
<div id="article-requests-pending"> |
95 |
<div id="article-requests-pending"> |
94 |
<div class="table_controls row" id="table_controls"> |
96 |
<div class="article-requests-pending_table_controls"> |
95 |
<a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> <a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a> |
97 |
<a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a> |
96 |
[% PROCESS actions id_arg=0 pull_right='' aria_menu='table_controls' %] |
98 |
[% PROCESS actions menuid='article-menu-pending' id_arg=0 pull_right='' aria_menu='table_controls' %] |
97 |
</div> |
99 |
</div> |
98 |
<br/> |
100 |
|
99 |
<table id="article-requests-pending-table"> |
101 |
<table id="article-requests-pending-table"> |
100 |
<thead> |
102 |
<thead> |
101 |
<tr> |
103 |
<tr> |
Lines 190-196
Link Here
|
190 |
<td class="ar-date"><span title="[% ar.created_on %]">[% ar.created_on | $KohaDates %]</span></td> |
192 |
<td class="ar-date"><span title="[% ar.created_on %]">[% ar.created_on | $KohaDates %]</span></td> |
191 |
<td class="ar-actions"> |
193 |
<td class="ar-actions"> |
192 |
<div class="dropdown"> |
194 |
<div class="dropdown"> |
193 |
[% PROCESS actions id_arg=ar.id pull_right='pull-right' aria_menu='ar-actions' %] |
195 |
[% PROCESS actions menuid = "row" _ ar.id id_arg=ar.id pull_right='pull-right' aria_menu='ar-actions' %] |
194 |
</div> |
196 |
</div> |
195 |
</td> |
197 |
</td> |
196 |
</tr> |
198 |
</tr> |
Lines 200-205
Link Here
|
200 |
</div> |
202 |
</div> |
201 |
|
203 |
|
202 |
<div id="article-requests-processing"> |
204 |
<div id="article-requests-processing"> |
|
|
205 |
<div class="article-requests-processing_table_controls"> |
206 |
<a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a> |
207 |
[% PROCESS actions menuid='article-menu-processing' id_arg=0 pull_right='' aria_menu='table_controls' %] |
208 |
</div> |
203 |
<table id="article-requests-processing-table"> |
209 |
<table id="article-requests-processing-table"> |
204 |
<thead> |
210 |
<thead> |
205 |
<tr> |
211 |
<tr> |
Lines 294-300
Link Here
|
294 |
<td class="ar-date"><span title="[% ar.created_on %]">[% ar.created_on | $KohaDates %]</span></td> |
300 |
<td class="ar-date"><span title="[% ar.created_on %]">[% ar.created_on | $KohaDates %]</span></td> |
295 |
<td class="ar-actions"> |
301 |
<td class="ar-actions"> |
296 |
<div class="dropdown"> |
302 |
<div class="dropdown"> |
297 |
[% PROCESS actions id_arg=ar.id pull_right='pull-right' aria_menu='ar-actions' %] |
303 |
[% PROCESS actions menuid="table_" _ ar.id id_arg=ar.id pull_right='pull-right' aria_menu='ar-actions' %] |
298 |
</div> |
304 |
</div> |
299 |
</td> |
305 |
</td> |
300 |
</tr> |
306 |
</tr> |
Lines 309-317
Link Here
|
309 |
</div> |
315 |
</div> |
310 |
|
316 |
|
311 |
[% MACRO jsinclude BLOCK %] |
317 |
[% MACRO jsinclude BLOCK %] |
312 |
<script type="text/javascript"> |
318 |
<script> |
|
|
319 |
var active_table = "#article-requests-pending"; |
313 |
$(document).ready(function() { |
320 |
$(document).ready(function() { |
314 |
$('#article-request-tabs').tabs(); |
321 |
$('#article-request-tabs').tabs({ |
|
|
322 |
activate: function( activate_event, activate_ui ) { |
323 |
active_table = activate_ui.newPanel.selector; |
324 |
}, |
325 |
create: function( create_event, create_ui ){ |
326 |
active_table = create_ui.panel.selector; |
327 |
}, |
328 |
}); |
329 |
|
330 |
activateBatchActions( active_table ); |
315 |
|
331 |
|
316 |
[% IF article_requests_pending.count %] |
332 |
[% IF article_requests_pending.count %] |
317 |
$(".ar-pending-none").hide(); |
333 |
$(".ar-pending-none").hide(); |
Lines 321-354
Link Here
|
321 |
$(".ar-processing-none").hide(); |
337 |
$(".ar-processing-none").hide(); |
322 |
[% END %] |
338 |
[% END %] |
323 |
|
339 |
|
|
|
340 |
$( "input:checkbox", active_table ).on("change", function(){ |
341 |
activateBatchActions( active_table ); |
342 |
}); |
343 |
|
324 |
$(".SelectAll").on("click", function(e) { |
344 |
$(".SelectAll").on("click", function(e) { |
325 |
e.preventDefault(); |
345 |
e.preventDefault(); |
326 |
if( $('table#article-requests-pending-table').is(":visible") ) |
346 |
$( active_table + " input[type='checkbox']").prop('checked', true); |
327 |
var table='article-requests-pending-table'; |
347 |
activateBatchActions( active_table ); |
328 |
else table='article-requests-processing-table'; |
|
|
329 |
$("table#"+table+" input[type='checkbox']").prop('checked', true); |
330 |
}); |
348 |
}); |
331 |
$(".ClearAll").on("click", function(e) { |
349 |
$(".ClearAll").on("click", function(e) { |
332 |
e.preventDefault(); |
350 |
e.preventDefault(); |
333 |
if( $('table#article-requests-pending-table').is(":visible") ) |
351 |
$( active_table + " input[type='checkbox']").prop('checked', false); |
334 |
var table='article-requests-pending-table'; |
352 |
activateBatchActions( active_table ); |
335 |
else table='article-requests-processing-table'; |
|
|
336 |
$("table#"+table+" input[type='checkbox']").prop('checked', false); |
337 |
}); |
353 |
}); |
338 |
$("a.ar-actions").on('click', function(e) { |
354 |
$("a.ar-actions").on('click', function(e) { |
339 |
// Hide menu option ? |
355 |
// Hide menu option ? |
340 |
if( $('table#article-requests-processing-table').is(":visible") ) |
356 |
if( $('#article-requests-processing-table').is(":visible") ) |
341 |
$('a.ar-process-request').hide(); |
357 |
$('a.ar-process-request').hide(); |
342 |
else $('a.ar-process-request').show(); |
358 |
else $('a.ar-process-request').show(); |
343 |
}); |
359 |
}); |
344 |
}); |
360 |
}); |
345 |
|
361 |
|
|
|
362 |
function activateBatchActions( active_table ){ |
363 |
// Check to see whether batch menu should be shown based on state of checkboxes |
364 |
if ( $( "input:checkbox", active_table ).length > 0 ) { |
365 |
// There are rows with checkboxes |
366 |
$( "[class$='_table_controls']", active_table ).show(); |
367 |
if ( $( "input:checkbox:checked", active_table ).length > 0 ) { |
368 |
$( "[id^='article-menu-']", active_table ).css("display","inline-block"); |
369 |
} else { |
370 |
$( "[id^='article-menu-']", active_table ).hide(); |
371 |
} |
372 |
} else { |
373 |
// All rows have been removed |
374 |
$("[class$='_table_controls']", active_table ).hide(); |
375 |
} |
376 |
} |
377 |
|
346 |
function HandleMulti( fnHandler, id, a ) { |
378 |
function HandleMulti( fnHandler, id, a ) { |
347 |
if( id !== 0 ) { fnHandler( id, a ); return; } |
379 |
if( id !== 0 ) { fnHandler( id, a ); return; } |
348 |
if( $('table#article-requests-pending-table').is(":visible") ) |
380 |
$( active_table + " input[type='checkbox']:checked").each(function() { |
349 |
var table='article-requests-pending-table'; |
|
|
350 |
else table='article-requests-processing-table'; |
351 |
$("table#"+table+" input[type='checkbox']:checked").each(function() { |
352 |
fnHandler( $(this).attr('reqid'), $(this).closest('tr').find('td.ar-actions div a') ); |
381 |
fnHandler( $(this).attr('reqid'), $(this).closest('tr').find('td.ar-actions div a') ); |
353 |
}); |
382 |
}); |
354 |
} |
383 |
} |
Lines 364-370
Link Here
|
364 |
return; |
393 |
return; |
365 |
} |
394 |
} |
366 |
|
395 |
|
367 |
a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/loading-small.gif"/>').find('div.dropdown').hide(); |
396 |
a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/spinner-small.gif"/>').find('div.dropdown').hide(); |
368 |
$.ajax({ |
397 |
$.ajax({ |
369 |
type: "POST", |
398 |
type: "POST", |
370 |
url: '/cgi-bin/koha/svc/article_request', |
399 |
url: '/cgi-bin/koha/svc/article_request', |
Lines 375-381
Link Here
|
375 |
}, |
404 |
}, |
376 |
success: function( data ) { |
405 |
success: function( data ) { |
377 |
a.closest('tr').remove(); |
406 |
a.closest('tr').remove(); |
378 |
UpdateTabCounts() |
407 |
UpdateTabCounts(); |
|
|
408 |
activateBatchActions( active_table ); |
379 |
}, |
409 |
}, |
380 |
dataType: 'json' |
410 |
dataType: 'json' |
381 |
}); |
411 |
}); |
Lines 386-392
Link Here
|
386 |
table_row.find('.ar-process-request').remove(); |
416 |
table_row.find('.ar-process-request').remove(); |
387 |
table_row.find('input[type="checkbox"]').prop('checked', false); |
417 |
table_row.find('input[type="checkbox"]').prop('checked', false); |
388 |
|
418 |
|
389 |
a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/loading-small.gif"/>').find('div.dropdown').hide(); |
419 |
a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/spinner-small.gif"/>').find('div.dropdown').hide(); |
390 |
$.ajax({ |
420 |
$.ajax({ |
391 |
type: "POST", |
421 |
type: "POST", |
392 |
url: '/cgi-bin/koha/svc/article_request', |
422 |
url: '/cgi-bin/koha/svc/article_request', |
Lines 398-411
Link Here
|
398 |
a.closest('tr').remove(); |
428 |
a.closest('tr').remove(); |
399 |
$("#article-requests-processing-table").append( table_row ); |
429 |
$("#article-requests-processing-table").append( table_row ); |
400 |
$("#article-requests-processing-table .ar-processing-none").hide(); |
430 |
$("#article-requests-processing-table .ar-processing-none").hide(); |
401 |
UpdateTabCounts() |
431 |
UpdateTabCounts(); |
|
|
432 |
activateBatchActions( active_table ); |
402 |
}, |
433 |
}, |
403 |
dataType: 'json' |
434 |
dataType: 'json' |
404 |
}); |
435 |
}); |
405 |
} |
436 |
} |
406 |
|
437 |
|
407 |
function Complete( id, a ) { |
438 |
function Complete( id, a ) { |
408 |
a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/loading-small.gif"/>').find('div.dropdown').hide(); |
439 |
a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/spinner-small.gif"/>').find('div.dropdown').hide(); |
409 |
$.ajax({ |
440 |
$.ajax({ |
410 |
type: "POST", |
441 |
type: "POST", |
411 |
url: '/cgi-bin/koha/svc/article_request', |
442 |
url: '/cgi-bin/koha/svc/article_request', |
Lines 415-421
Link Here
|
415 |
}, |
446 |
}, |
416 |
success: function( data ) { |
447 |
success: function( data ) { |
417 |
a.closest('tr').remove(); |
448 |
a.closest('tr').remove(); |
418 |
UpdateTabCounts() |
449 |
UpdateTabCounts(); |
|
|
450 |
activateBatchActions( active_table ); |
419 |
}, |
451 |
}, |
420 |
dataType: 'json' |
452 |
dataType: 'json' |
421 |
}); |
453 |
}); |
422 |
- |
|
|