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

(-)a/admin/columns_settings.yml (+3 lines)
Lines 1195-1200 modules: Link Here
1195
            -
1195
            -
1196
              columnname: booking_id
1196
              columnname: booking_id
1197
              is_hidden: 1
1197
              is_hidden: 1
1198
            -
1199
              columnname: status
1200
              is_hidden: 1
1198
            -
1201
            -
1199
              columnname: title
1202
              columnname: title
1200
            -
1203
            -
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt (-1 / +23 lines)
Lines 229-234 Link Here
229
                "title": _("Booking ID"),
229
                "title": _("Booking ID"),
230
                "visible": false
230
                "visible": false
231
            },
231
            },
232
            {
233
                data: "",
234
                title: __("Status"),
235
                name: "status",
236
                searchable: true,
237
                orderable: true,
238
                visible: false,
239
                render: function (data, type, row, meta) {
240
                    let is_expired = dayjs(row.end_date).isBefore(new Date());
241
                    if (is_expired) {
242
                        return '<span class="badge rounded-pill bg-secondary">' + __("Expired") + '</span>';
243
                    }
244
245
                    return '<span class="badge rounded-pill bg-success">' + __("Active") + '</span>';
246
                }
247
            },
232
            {
248
            {
233
                "data": "item.external_id",
249
                "data": "item.external_id",
234
                "title": _("Item"),
250
                "title": _("Item"),
Lines 309-315 Link Here
309
                filter_expired = true;
325
                filter_expired = true;
310
                $(this).html('<i class="fa fa-bars"></i> '+txtActivefilter);
326
                $(this).html('<i class="fa fa-bars"></i> '+txtActivefilter);
311
            }
327
            }
312
            bookings_table.DataTable().draw();
328
329
            bookings_table.DataTable().ajax.reload(() => {
330
                bookings_table
331
                    .DataTable()
332
                    .column("status:name")
333
                    .visible(!filter_expired, false);
334
            });
313
            $(this).toggleClass('filtered');
335
            $(this).toggleClass('filtered');
314
        });
336
        });
315
337
(-)a/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js (-2 / +32 lines)
Lines 32-37 $(document).ready(function () { Link Here
32
                            data: "booking_id",
32
                            data: "booking_id",
33
                            title: __("Booking ID"),
33
                            title: __("Booking ID"),
34
                        },
34
                        },
35
                        {
36
                            data: "",
37
                            title: __("Status"),
38
                            name: "status",
39
                            searchable: true,
40
                            orderable: true,
41
                            render: function (data, type, row, meta) {
42
                                let is_expired = dayjs(row.end_date).isBefore(
43
                                    new Date()
44
                                );
45
                                if (is_expired) {
46
                                    return (
47
                                        '<span class="badge rounded-pill bg-secondary">' +
48
                                        __("Expired") +
49
                                        "</span>"
50
                                    );
51
                                }
52
53
                                return (
54
                                    '<span class="badge rounded-pill bg-success">' +
55
                                    __("Active") +
56
                                    "</span>"
57
                                );
58
                            },
59
                        },
35
                        {
60
                        {
36
                            data: "biblio.title",
61
                            data: "biblio.title",
37
                            title: __("Title"),
62
                            title: __("Title"),
Lines 118-124 $(document).ready(function () { Link Here
118
            filter_expired = true;
143
            filter_expired = true;
119
            $(this).html('<i class="fa fa-bars"></i> ' + txtActivefilter);
144
            $(this).html('<i class="fa fa-bars"></i> ' + txtActivefilter);
120
        }
145
        }
121
        bookings_table.DataTable().draw();
146
147
        bookings_table.DataTable().ajax.reload(() => {
148
            bookings_table
149
                .DataTable()
150
                .column("status:name")
151
                .visible(!filter_expired, false);
152
        });
122
        $(this).toggleClass("filtered");
153
        $(this).toggleClass("filtered");
123
    });
154
    });
124
});
155
});
125
- 

Return to bug 37574