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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt (-64 / +87 lines)
Lines 9-14 Link Here
9
<style type="text/css"> p { margin-top: 0; }</style>
9
<style type="text/css"> p { margin-top: 0; }</style>
10
</head>
10
</head>
11
11
12
[% BLOCK actions %]
13
        <a class="btn btn-default btn-xs dropdown-toggle ar-actions" role="button" data-toggle="dropdown" href="#">
14
            Actions <b class="caret"></b>
15
        </a>
16
17
        <ul class="dropdown-menu [% pull_right %]" role="menu" aria-labelledby="[% aria_menu %]">
18
            <li>
19
                <a class="ar-process-request" href="#" onclick="HandleMulti( Process, [% id_arg %], $(this) ); return false;">
20
                    <i class="fa fa-cog"></i>
21
                    Process request
22
                </a>
23
24
                <a class="ar-complete-request" href="#" onclick="HandleMulti( Complete, [% id_arg %], $(this) ); return false;">
25
                    <i class="fa fa-check-circle"></i>
26
                    Complete request
27
                </a>
28
29
                <a class="ar-cancel-request" href="#" onclick="HandleMulti( Cancel, [% id_arg %], $(this) ); return false;">
30
                    <i class="fa fa-minus-circle"></i>
31
                    Cancel request
32
                </a>
33
34
                [% IF id_arg %][%# TODO: Does not work with multi-select %]
35
                <a class="ar-print-request" href="#" onclick="HandleMulti( PrintSlip, [% id_arg %], $(this) ); return false;">
36
                    <i class="fa fa-print"></i>
37
                    Print slip
38
                </a>
39
                [% END %]
40
            </li>
41
        </ul>
42
[% END %]
43
12
<body id="circ_article-requests" class="circ">
44
<body id="circ_article-requests" class="circ">
13
    [% INCLUDE 'header.inc' %]
45
    [% INCLUDE 'header.inc' %]
14
    [% INCLUDE 'cat-search.inc' %]
46
    [% INCLUDE 'cat-search.inc' %]
Lines 62-67 Link Here
62
                        <table id="article-requests-pending-table">
94
                        <table id="article-requests-pending-table">
63
                            <thead>
95
                            <thead>
64
                                <tr>
96
                                <tr>
97
                                    <th/>
65
                                    <th class="ar-title">Title</th>
98
                                    <th class="ar-title">Title</th>
66
                                    <th class="ar-request">Requested article</th>
99
                                    <th class="ar-request">Requested article</th>
67
                                    <th class="ar-collection">Collection</th>
100
                                    <th class="ar-collection">Collection</th>
Lines 78-90 Link Here
78
111
79
                             <tbody>
112
                             <tbody>
80
                                <tr class="ar-pending-none">
113
                                <tr class="ar-pending-none">
81
                                    <td colspan="11">
114
                                    <td colspan="12">
82
                                        There are no pending article requests at this time.
115
                                        There are no pending article requests at this time.
83
                                    </td>
116
                                    </td>
84
                                </tr>
117
                                </tr>
85
118
86
                                [% FOREACH ar IN article_requests_pending %]
119
                                [% FOREACH ar IN article_requests_pending %]
87
                                    <tr class="ar-row ar-pending">
120
                                    <tr class="ar-row ar-pending">
121
                                        <td><input type="checkbox" reqid="[% ar.id %]"/></td>
88
                                        <td class="ar-title">
122
                                        <td class="ar-title">
89
                                            <p>
123
                                            <p>
90
                                                <a href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% ar.biblionumber %]">
124
                                                <a href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% ar.biblionumber %]">
Lines 150-184 Link Here
150
                                        </td>
184
                                        </td>
151
                                        <td class="ar-date"><span title="[% ar.created_on %]">[% ar.created_on | $KohaDates %]</span></td>
185
                                        <td class="ar-date"><span title="[% ar.created_on %]">[% ar.created_on | $KohaDates %]</span></td>
152
                                        <td class="ar-actions">
186
                                        <td class="ar-actions">
153
                                            <div class="dropdown">
187
                                        <div class="dropdown">
154
                                                <a class="btn btn-default btn-xs dropdown-toggle" id="ar-actions" role="button" data-toggle="dropdown" href="#">
188
                                            [% PROCESS actions id_arg=ar.id pull_right='pull-right' aria_menu='ar-actions' %]
155
                                                    Actions <b class="caret"></b>
189
                                        </div>
156
                                                </a>
157
158
                                                <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="ar-actions">
159
                                                    <li>
160
                                                        <a class="ar-process-request" href="#" onclick="Process( [% ar.id %], $(this) ); return false;">
161
                                                            <i class="fa fa-cog"></i>
162
                                                            Process request
163
                                                        </a>
164
165
                                                        <a class="ar-complete-request" href="#" onclick="Complete( [% ar.id %], $(this) ); return false;">
166
                                                            <i class="fa fa-check-circle"></i>
167
                                                            Complete request
168
                                                        </a>
169
170
                                                        <a class="ar-cancel-request" href="#" onclick="Cancel( [% ar.id %], $(this) ); return false;">
171
                                                            <i class="fa fa-minus-circle"></i>
172
                                                            Cancel request
173
                                                        </a>
174
175
                                                        <a class="ar-print-request" href="#" onclick="PrintSlip('article-request-slip.pl?id=[% ar.id %]'); return false;">
176
                                                            <i class="fa fa-print"></i>
177
                                                            Print slip
178
                                                        </a>
179
                                                    </li>
180
                                                </ul>
181
                                            </div>
182
                                        </td>
190
                                        </td>
183
                                    </tr>
191
                                    </tr>
184
                                [% END %]
192
                                [% END %]
Lines 190-195 Link Here
190
                        <table id="article-requests-processing-table">
198
                        <table id="article-requests-processing-table">
191
                            <thead>
199
                            <thead>
192
                                <tr>
200
                                <tr>
201
                                    <th/>
193
                                    <th class="ar-title">Title</th>
202
                                    <th class="ar-title">Title</th>
194
                                    <th class="ar-request">Requested article</th>
203
                                    <th class="ar-request">Requested article</th>
195
                                    <th class="ar-collection">Collection</th>
204
                                    <th class="ar-collection">Collection</th>
Lines 206-218 Link Here
206
215
207
                             <tbody>
216
                             <tbody>
208
                                <tr class="ar-processing-none">
217
                                <tr class="ar-processing-none">
209
                                    <td colspan="11">
218
                                    <td colspan="12">
210
                                        There are no article requests in processing at this time.
219
                                        There are no article requests in processing at this time.
211
                                    </td>
220
                                    </td>
212
                                </tr>
221
                                </tr>
213
222
214
                                [% FOREACH ar IN article_requests_processing %]
223
                                [% FOREACH ar IN article_requests_processing %]
215
                                    <tr class="ar-row ar-processing">
224
                                    <tr class="ar-row ar-processing">
225
                                        <td><input type="checkbox" reqid="[% ar.id %]"/></td>
216
                                        <td class="ar-title">
226
                                        <td class="ar-title">
217
                                            <p>
227
                                            <p>
218
                                                <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% ar.biblionumber %]">
228
                                                <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% ar.biblionumber %]">
Lines 278-313 Link Here
278
                                        </td>
288
                                        </td>
279
                                        <td class="ar-date"><span title="[% ar.created_on %]">[% ar.created_on | $KohaDates %]</span></td>
289
                                        <td class="ar-date"><span title="[% ar.created_on %]">[% ar.created_on | $KohaDates %]</span></td>
280
                                        <td class="ar-actions">
290
                                        <td class="ar-actions">
281
                                            <div class="dropdown">
291
                                        <div class="dropdown">
282
                                                <a class="btn btn-default btn-xs dropdown-toggle" id="ar-actions" role="button" data-toggle="dropdown" href="#">
292
                                            [% PROCESS actions id_arg=ar.id pull_right='pull-right' aria_menu='ar-actions' %]
283
                                                    Actions <b class="caret"></b>
293
                                        </div>
284
                                                </a>
285
286
                                                <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="ar-actions">
287
                                                    <li>
288
                                                        <a href="#" onclick="Complete( [% ar.id %], $(this) ); return false;">
289
                                                            <i class="icon-ok-circle"></i>
290
                                                            Complete request
291
                                                        </a>
292
293
                                                        <a href="#" onclick="Cancel( [% ar.id %], $(this) ); return false;">
294
                                                            <i class="icon-remove-circle"></i>
295
                                                            Cancel request
296
                                                        </a>
297
298
                                                        <a href="#" onclick="PrintSlip('article-request-slip.pl?id=[% ar.id %]'); return false;">
299
                                                            <i class="icon-print"></i>
300
                                                            Print slip
301
                                                        </a>
302
                                                    </li>
303
                                                </ul>
304
                                            </div>
305
                                        </td>
294
                                        </td>
306
                                    </tr>
295
                                    </tr>
307
                                [% END %]
296
                                [% END %]
308
                            </tbody>
297
                            </tbody>
309
                        </table>
298
                        </table>
310
299
                    </div>
300
                    <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>
311
                </div>
305
                </div>
312
            </div>
306
            </div>
313
        </div>
307
        </div>
Lines 325-333 Link Here
325
            [% IF article_requests_processing.count %]
319
            [% IF article_requests_processing.count %]
326
                $(".ar-processing-none").hide();
320
                $(".ar-processing-none").hide();
327
            [% END %]
321
            [% END %]
322
323
            $(".SelectAll").on("click", function(e) {
324
                e.preventDefault();
325
                if( $('table#article-requests-pending-table').is(":visible") )
326
                    var table='article-requests-pending-table';
327
                else table='article-requests-processing-table';
328
                $("table#"+table+" input[type='checkbox']").prop('checked', true);
329
            });
330
            $(".ClearAll").on("click", function(e) {
331
                e.preventDefault();
332
                if( $('table#article-requests-pending-table').is(":visible") )
333
                    var table='article-requests-pending-table';
334
                else table='article-requests-processing-table';
335
                $("table#"+table+" input[type='checkbox']").prop('checked', false);
336
            });
337
            $("a.ar-actions").on('click', function(e) {
338
                // Hide menu option ?
339
                if( $('table#article-requests-processing-table').is(":visible") )
340
                    $('a.ar-process-request').hide();
341
                else $('a.ar-process-request').show();
342
            });
328
        });
343
        });
329
344
330
        function PrintSlip(link) {
345
        function HandleMulti( fnHandler, id, a ) {
346
            if( id !== 0 ) { fnHandler( id, a ); return; }
347
            if( $('table#article-requests-pending-table').is(":visible") )
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') );
352
            });
353
        }
354
355
        function PrintSlip(id, a) {
356
            var link = 'article-request-slip.pl?id='+id;
331
            window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
357
            window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
332
        }
358
        }
333
359
Lines 337-344 Link Here
337
                return;
363
                return;
338
            }
364
            }
339
365
340
            a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/spinner-small.gif"/>');
366
            a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/loading-small.gif"/>').find('div.dropdown').hide();
341
            a.closest('div').hide();
342
            $.ajax({
367
            $.ajax({
343
                type: "POST",
368
                type: "POST",
344
                url: '/cgi-bin/koha/svc/article_request',
369
                url: '/cgi-bin/koha/svc/article_request',
Lines 358-366 Link Here
358
        function Process( id, a ) {
383
        function Process( id, a ) {
359
            var table_row = a.closest('tr').clone();
384
            var table_row = a.closest('tr').clone();
360
            table_row.find('.ar-process-request').remove();
385
            table_row.find('.ar-process-request').remove();
386
            table_row.find('input[type="checkbox"]').prop('checked', false);
361
387
362
            a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/spinner-small.gif"/>');
388
            a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/loading-small.gif"/>').find('div.dropdown').hide();
363
            a.closest('div').hide();
364
            $.ajax({
389
            $.ajax({
365
                type: "POST",
390
                type: "POST",
366
                url: '/cgi-bin/koha/svc/article_request',
391
                url: '/cgi-bin/koha/svc/article_request',
Lines 379-386 Link Here
379
        }
404
        }
380
405
381
        function Complete( id, a ) {
406
        function Complete( id, a ) {
382
            a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/spinner-small.gif"/>');
407
            a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/loading-small.gif"/>').find('div.dropdown').hide();
383
            a.closest('div').hide();
384
            $.ajax({
408
            $.ajax({
385
                type: "POST",
409
                type: "POST",
386
                url: '/cgi-bin/koha/svc/article_request',
410
                url: '/cgi-bin/koha/svc/article_request',
387
- 

Return to bug 20468