View | Details | Raw Unified | Return to bug 20468
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt (-29 / +61 lines)
Lines 6-15 Link Here
6
[% INCLUDE 'doc-head-open.inc' %]
6
[% INCLUDE 'doc-head-open.inc' %]
7
<title>Koha &rsaquo; Circulation &rsaquo; Article requests</title>
7
<title>Koha &rsaquo; Circulation &rsaquo; 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-96 Link Here
91
                    </ul>
93
                    </ul>
92
94
93
                    <div id="article-requests-pending">
95
                    <div id="article-requests-pending">
96
                        <div class="article-requests-pending_table_controls">
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>
98
                            [% PROCESS actions menuid='article-menu-pending' id_arg=0 pull_right='' aria_menu='table_controls' %]
99
                        </div>
100
94
                        <table id="article-requests-pending-table">
101
                        <table id="article-requests-pending-table">
95
                            <thead>
102
                            <thead>
96
                                <tr>
103
                                <tr>
Lines 185-191 Link Here
185
                                        <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>
186
                                        <td class="ar-actions">
193
                                        <td class="ar-actions">
187
                                        <div class="dropdown">
194
                                        <div class="dropdown">
188
                                            [% 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' %]
189
                                        </div>
196
                                        </div>
190
                                        </td>
197
                                        </td>
191
                                    </tr>
198
                                    </tr>
Lines 195-200 Link Here
195
                    </div>
202
                    </div>
196
203
197
                    <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>
198
                        <table id="article-requests-processing-table">
209
                        <table id="article-requests-processing-table">
199
                            <thead>
210
                            <thead>
200
                                <tr>
211
                                <tr>
Lines 289-295 Link Here
289
                                        <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>
290
                                        <td class="ar-actions">
301
                                        <td class="ar-actions">
291
                                        <div class="dropdown">
302
                                        <div class="dropdown">
292
                                            [% 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' %]
293
                                        </div>
304
                                        </div>
294
                                        </td>
305
                                        </td>
295
                                    </tr>
306
                                    </tr>
Lines 298-316 Link Here
298
                        </table>
309
                        </table>
299
                    </div>
310
                    </div>
300
                    <br/>
311
                    <br/>
301
                    <div class="table_controls row" id="table_controls">
302
                        <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>
303
                        [% PROCESS actions id_arg=0 pull_right='' aria_menu='table_controls' %]
304
                    </div>
305
                </div>
312
                </div>
306
            </div>
313
            </div>
307
        </div>
314
        </div>
308
    </div>
315
    </div>
309
316
310
[% MACRO jsinclude BLOCK %]
317
[% MACRO jsinclude BLOCK %]
311
    <script type="text/javascript">
318
    <script>
319
        var active_table = "#article-requests-pending";
312
        $(document).ready(function() {
320
        $(document).ready(function() {
313
            $('#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 );
314
331
315
            [% IF article_requests_pending.count %]
332
            [% IF article_requests_pending.count %]
316
                $(".ar-pending-none").hide();
333
                $(".ar-pending-none").hide();
Lines 320-353 Link Here
320
                $(".ar-processing-none").hide();
337
                $(".ar-processing-none").hide();
321
            [% END %]
338
            [% END %]
322
339
340
            $( "input:checkbox", active_table ).on("change", function(){
341
                activateBatchActions( active_table );
342
            });
343
323
            $(".SelectAll").on("click", function(e) {
344
            $(".SelectAll").on("click", function(e) {
324
                e.preventDefault();
345
                e.preventDefault();
325
                if( $('table#article-requests-pending-table').is(":visible") )
346
                $( active_table + " input[type='checkbox']").prop('checked', true);
326
                    var table='article-requests-pending-table';
347
                activateBatchActions( active_table );
327
                else table='article-requests-processing-table';
328
                $("table#"+table+" input[type='checkbox']").prop('checked', true);
329
            });
348
            });
330
            $(".ClearAll").on("click", function(e) {
349
            $(".ClearAll").on("click", function(e) {
331
                e.preventDefault();
350
                e.preventDefault();
332
                if( $('table#article-requests-pending-table').is(":visible") )
351
                $( active_table + " input[type='checkbox']").prop('checked', false);
333
                    var table='article-requests-pending-table';
352
                activateBatchActions( active_table );
334
                else table='article-requests-processing-table';
335
                $("table#"+table+" input[type='checkbox']").prop('checked', false);
336
            });
353
            });
337
            $("a.ar-actions").on('click', function(e) {
354
            $("a.ar-actions").on('click', function(e) {
338
                // Hide menu option ?
355
                // Hide menu option ?
339
                if( $('table#article-requests-processing-table').is(":visible") )
356
                if( $('#article-requests-processing-table').is(":visible") )
340
                    $('a.ar-process-request').hide();
357
                    $('a.ar-process-request').hide();
341
                else $('a.ar-process-request').show();
358
                else $('a.ar-process-request').show();
342
            });
359
            });
343
        });
360
        });
344
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
345
        function HandleMulti( fnHandler, id, a ) {
378
        function HandleMulti( fnHandler, id, a ) {
346
            if( id !== 0 ) { fnHandler( id, a ); return; }
379
            if( id !== 0 ) { fnHandler( id, a ); return; }
347
            if( $('table#article-requests-pending-table').is(":visible") )
380
            $( active_table + " input[type='checkbox']:checked").each(function() {
348
                var table='article-requests-pending-table';
349
            else table='article-requests-processing-table';
350
            $("table#"+table+" input[type='checkbox']:checked").each(function() {
351
                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') );
352
            });
382
            });
353
        }
383
        }
Lines 363-369 Link Here
363
                return;
393
                return;
364
            }
394
            }
365
395
366
            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();
367
            $.ajax({
397
            $.ajax({
368
                type: "POST",
398
                type: "POST",
369
                url: '/cgi-bin/koha/svc/article_request',
399
                url: '/cgi-bin/koha/svc/article_request',
Lines 374-380 Link Here
374
                },
404
                },
375
                success: function( data ) {
405
                success: function( data ) {
376
                    a.closest('tr').remove();
406
                    a.closest('tr').remove();
377
                    UpdateTabCounts()
407
                    UpdateTabCounts();
408
                    activateBatchActions( active_table );
378
                },
409
                },
379
                dataType: 'json'
410
                dataType: 'json'
380
            });
411
            });
Lines 385-391 Link Here
385
            table_row.find('.ar-process-request').remove();
416
            table_row.find('.ar-process-request').remove();
386
            table_row.find('input[type="checkbox"]').prop('checked', false);
417
            table_row.find('input[type="checkbox"]').prop('checked', false);
387
418
388
            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();
389
            $.ajax({
420
            $.ajax({
390
                type: "POST",
421
                type: "POST",
391
                url: '/cgi-bin/koha/svc/article_request',
422
                url: '/cgi-bin/koha/svc/article_request',
Lines 397-410 Link Here
397
                    a.closest('tr').remove();
428
                    a.closest('tr').remove();
398
                    $("#article-requests-processing-table").append( table_row );
429
                    $("#article-requests-processing-table").append( table_row );
399
                    $("#article-requests-processing-table .ar-processing-none").hide();
430
                    $("#article-requests-processing-table .ar-processing-none").hide();
400
                    UpdateTabCounts()
431
                    UpdateTabCounts();
432
                    activateBatchActions( active_table );
401
                },
433
                },
402
                dataType: 'json'
434
                dataType: 'json'
403
            });
435
            });
404
        }
436
        }
405
437
406
        function Complete( id, a ) {
438
        function Complete( id, a ) {
407
            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();
408
            $.ajax({
440
            $.ajax({
409
                type: "POST",
441
                type: "POST",
410
                url: '/cgi-bin/koha/svc/article_request',
442
                url: '/cgi-bin/koha/svc/article_request',
Lines 414-420 Link Here
414
                },
446
                },
415
                success: function( data ) {
447
                success: function( data ) {
416
                    a.closest('tr').remove();
448
                    a.closest('tr').remove();
417
                    UpdateTabCounts()
449
                    UpdateTabCounts();
450
                    activateBatchActions( active_table );
418
                },
451
                },
419
                dataType: 'json'
452
                dataType: 'json'
420
            });
453
            });
421
- 

Return to bug 20468