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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-1 / +1 lines)
Lines 1137-1143 Link Here
1137
    </script>
1137
    </script>
1138
    [% INCLUDE 'str/members-menu.inc' %]
1138
    [% INCLUDE 'str/members-menu.inc' %]
1139
    [% Asset.js("js/members-menu.js") | $raw %]
1139
    [% Asset.js("js/members-menu.js") | $raw %]
1140
    [% Asset.js("js/bookings-table.js") | $raw %]
1140
    [% Asset.js("js/tables/bookings.js") | $raw %]
1141
    [% Asset.js("js/recalls.js") | $raw %]
1141
    [% Asset.js("js/recalls.js") | $raw %]
1142
[% END %]
1142
[% END %]
1143
1143
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +26 lines)
Lines 804-811 Link Here
804
               }
804
               }
805
            }
805
            }
806
        }
806
        }
807
808
        $(document).ready(function () {
809
            $("#info_digests").tooltip();
810
811
            $("#finesholdsissues a[data-toggle='tab']").on(
812
                "shown.bs.tab",
813
                function (e) {
814
                    var oTable = $(
815
                        "div.dataTables_wrapper > table",
816
                        $(e.target.hash)
817
                    ).dataTable();
818
                    if (oTable.length > 0) {
819
                        oTable.fnAdjustColumnSizing();
820
                    }
821
                }
822
            );
823
824
            $("#view_restrictions").on("click", function () {
825
                $("#reldebarments-tab").click();
826
            });
827
828
            $("#view_guarantees_finesandcharges").on("click", function () {
829
                $("#guarantees_finesandcharges-tab").click();
830
            });
831
        });
807
    </script>
832
    </script>
808
    [% Asset.js("js/bookings-table.js") | $raw %]
833
    [% Asset.js("js/tables/bookings.js") | $raw %]
809
[% END %]
834
[% END %]
810
835
811
[% INCLUDE 'intranet-bottom.inc' %]
836
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/bookings-table.js (-124 lines)
Lines 1-123 Link Here
1
$(document).ready(function () {
2
    var bookings_table;
3
    $(document).ready(function () {
4
        $("#info_digests").tooltip();
5
6
        $("#finesholdsissues a[data-toggle='tab']").on(
7
            "shown.bs.tab",
8
            function (e) {
9
                var oTable = $(
10
                    "div.dataTables_wrapper > table",
11
                    $(e.target.hash)
12
                ).dataTable();
13
                if (oTable.length > 0) {
14
                    oTable.fnAdjustColumnSizing();
15
                }
16
            }
17
        );
18
19
        $("#view_restrictions").on("click", function () {
20
            $("#reldebarments-tab").click();
21
        });
22
23
        $("#view_guarantees_finesandcharges").on("click", function () {
24
            $("#guarantees_finesandcharges-tab").click();
25
        });
26
27
        // Bookings
28
        // Load bookings table on tab selection
29
        $("#bookings-tab").on("click", function () {
30
            if (!bookings_table) {
31
                var today = new Date();
32
                var bookings_table_url = "/api/v1/bookings";
33
                bookings_table = $("#bookings_table").kohaTable(
34
                    {
35
                        ajax: {
36
                            url: bookings_table_url,
37
                        },
38
                        embed: ["biblio", "item", "patron"],
39
                        columns: [
40
                            {
41
                                data: "booking_id",
42
                                title: _("Booking ID"),
43
                            },
44
                            {
45
                                data: "biblio.title",
46
                                title: _("Title"),
47
                                searchable: true,
48
                                orderable: true,
49
                                render: function (data, type, row, meta) {
50
                                    return $biblio_to_html(row.biblio, {
51
                                        link: "bookings",
52
                                    });
53
                                },
54
                            },
55
                            {
56
                                data: "item.external_id",
57
                                title: _("Item"),
58
                                searchable: true,
59
                                orderable: true,
60
                                defaultContent: _("Any item"),
61
                                render: function (data, type, row, meta) {
62
                                    if (row.item) {
63
                                        return (
64
                                            row.item.external_id +
65
                                            " (" +
66
                                            row.booking_id +
67
                                            ")"
68
                                        );
69
                                    } else {
70
                                        return null;
71
                                    }
72
                                },
73
                            },
74
                            {
75
                                data: "start_date",
76
                                title: _("Start date"),
77
                                searchable: true,
78
                                orderable: true,
79
                                render: function (data, type, row, meta) {
80
                                    return $date(row.start_date);
81
                                },
82
                            },
83
                            {
84
                                data: "end_date",
85
                                title: _("End date"),
86
                                searchable: true,
87
                                orderable: true,
88
                                render: function (data, type, row, meta) {
89
                                    return $date(row.end_date);
90
                                },
91
                            },
92
                            {
93
                                data: "",
94
                                title: _("Actions"),
95
                                class: "actions",
96
                                searchable: false,
97
                                orderable: false,
98
                                render: function (data, type, row, meta) {
99
                                    let result = "";
100
                                    if (CAN_user_circulate_manage_bookings) {
101
                                        result +=
102
                                            '<button type="button" class="btn btn-default btn-xs cancel-action" data-toggle="modal" data-target="#cancelBookingModal" data-booking="' +
103
                                            row.booking_id +
104
                                            '"><i class="fa fa-trash" aria-hidden="true"></i> ' +
105
                                            _("Cancel") +
106
                                            "</button>";
107
                                    }
108
                                    return result;
109
                                },
110
                            },
111
                        ],
112
                    },
113
                    table_settings_bookings_table,
114
                    0,
115
                    {
116
                        patron_id: patron_borrowernumber,
117
                        end_date: { ">=": today.toISOString() },
118
                    }
119
                );
120
            }
121
        });
122
    });
123
});
124
- 

Return to bug 37047