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

(-)a/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js (-9 / +8 lines)
Lines 3-9 Link Here
3
var bookings_table;
3
var bookings_table;
4
$(document).ready(function () {
4
$(document).ready(function () {
5
    // Determine whether we have a filtered list
5
    // Determine whether we have a filtered list
6
    let filter_expired = $("#expired_filter").hasClass('filtered');
6
    let filter_expired = $("#expired_filter").hasClass("filtered");
7
7
8
    // Load bookings table on tab selection
8
    // Load bookings table on tab selection
9
    $("#bookings-tab").on("click", function () {
9
    $("#bookings-tab").on("click", function () {
Lines 12-26 $(document).ready(function () { Link Here
12
            end_date: function () {
12
            end_date: function () {
13
                if (filter_expired) {
13
                if (filter_expired) {
14
                    let today = new Date();
14
                    let today = new Date();
15
                    return { ">=": today.toISOString() }
15
                    return { ">=": today.toISOString() };
16
                } else {
16
                } else {
17
                    return;
17
                    return;
18
                }
18
                }
19
            }
19
            },
20
        };
20
        };
21
21
22
        if (!bookings_table) {
22
        if (!bookings_table) {
23
24
            var bookings_table_url = "/api/v1/bookings";
23
            var bookings_table_url = "/api/v1/bookings";
25
            bookings_table = $("#bookings_table").kohaTable(
24
            bookings_table = $("#bookings_table").kohaTable(
26
                {
25
                {
Lines 102-108 $(document).ready(function () { Link Here
102
                        },
101
                        },
103
                    ],
102
                    ],
104
                },
103
                },
105
                table_settings_bookings_table, 0, additional_filters
104
                table_settings_bookings_table,
105
                0,
106
                additional_filters
106
            );
107
            );
107
        }
108
        }
108
    });
109
    });
Lines 110-116 $(document).ready(function () { Link Here
110
    var txtActivefilter = _("Show expired");
111
    var txtActivefilter = _("Show expired");
111
    var txtInactivefilter = _("Hide expired");
112
    var txtInactivefilter = _("Hide expired");
112
    $("#expired_filter").on("click", function () {
113
    $("#expired_filter").on("click", function () {
113
        if ($(this).hasClass('filtered')) {
114
        if ($(this).hasClass("filtered")) {
114
            filter_expired = false;
115
            filter_expired = false;
115
            $(this).html('<i class="fa fa-filter"></i> ' + txtInactivefilter);
116
            $(this).html('<i class="fa fa-filter"></i> ' + txtInactivefilter);
116
        } else {
117
        } else {
Lines 118-124 $(document).ready(function () { Link Here
118
            $(this).html('<i class="fa fa-bars"></i> ' + txtActivefilter);
119
            $(this).html('<i class="fa fa-bars"></i> ' + txtActivefilter);
119
        }
120
        }
120
        bookings_table.DataTable().draw();
121
        bookings_table.DataTable().draw();
121
        $(this).toggleClass('filtered');
122
        $(this).toggleClass("filtered");
122
    });
123
    });
123
124
});
124
});
125
- 

Return to bug 37141