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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt (-2 / +32 lines)
Lines 43-48 Link Here
43
                    <h1>Bookings for [% INCLUDE 'biblio-title-head.inc' %]</h1>
43
                    <h1>Bookings for [% INCLUDE 'biblio-title-head.inc' %]</h1>
44
                    <div class="page-section" id="bookings-timeline"></div>
44
                    <div class="page-section" id="bookings-timeline"></div>
45
                    <div class="page-section">
45
                    <div class="page-section">
46
                        <fieldset class="action filters" style="cursor:pointer;">
47
                            <a id="completed_filter" class="filtered"><i class="fa fa-bars"></i> Include completed</a>
48
                        </fieldset>
49
46
                        <table id="bookings_table"></table>
50
                        <table id="bookings_table"></table>
47
                    </div>
51
                    </div>
48
                </div>
52
                </div>
Lines 198-203 Link Here
198
            }
202
            }
199
        );
203
        );
200
204
205
        let filter_completed = true;
206
        let additional_filters = {
207
            end_date: function(){
208
                if ( filter_completed ) {
209
                    let today = new Date();
210
                    return { ">=": today.toISOString() }
211
                } else {
212
                    return;
213
                }
214
            }
215
        };
216
201
        var bookings_table_url = "/api/v1/biblios/[% biblionumber | uri %]/bookings";
217
        var bookings_table_url = "/api/v1/biblios/[% biblionumber | uri %]/bookings";
202
        bookings_table = $('#bookings_table').kohaTable({
218
        bookings_table = $('#bookings_table').kohaTable({
203
            "ajax": {
219
            "ajax": {
Lines 281-287 Link Here
281
                    return result;
297
                    return result;
282
                }
298
                }
283
            }]
299
            }]
284
        }, [], 0);
300
        }, [], 0, additional_filters);
301
302
        var txtActivefilter = _("Include completed");
303
        var txtInactivefilter = _("Filter completed");
304
        $('#completed_filter').on("click", function() {
305
            if ($(this).hasClass('filtered')){
306
                filter_completed = false;
307
                $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
308
            } else {
309
                filter_completed = true;
310
                $(this).html('<i class="fa fa-bars"></i> '+txtInactivefilter);
311
            }
312
            bookings_table.DataTable().draw();
313
            $(this).toggleClass('filtered');
314
        });
315
285
    });
316
    });
286
</script>
317
</script>
287
    [% END %]
318
    [% END %]
288
- 

Return to bug 37065