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

(-)a/Koha/Bookings.pm (-4 lines)
Lines 32-39 Koha::Bookings - Koha Booking object set class Link Here
32
32
33
=head2 Class Methods
33
=head2 Class Methods
34
34
35
=cut
36
37
=head3 filter_by_future
35
=head3 filter_by_future
38
36
39
    $bookings->filter_by_future;
37
    $bookings->filter_by_future;
Lines 49-56 sub filter_by_future { Link Here
49
47
50
=head2 Internal Methods
48
=head2 Internal Methods
51
49
52
=cut
53
54
=head3 _type
50
=head3 _type
55
51
56
=cut
52
=cut
(-)a/Koha/Patron.pm (+14 lines)
Lines 1594-1599 sub curbside_pickups { Link Here
1594
    return Koha::CurbsidePickups->_new_from_dbic($curbside_pickups_rs);
1594
    return Koha::CurbsidePickups->_new_from_dbic($curbside_pickups_rs);
1595
}
1595
}
1596
1596
1597
=head3 bookings
1598
1599
  my $bookings = $item->bookings();
1600
1601
Returns the bookings for this patron.
1602
1603
=cut
1604
1605
sub bookings {
1606
    my ( $self, $params ) = @_;
1607
    my $bookings_rs = $self->_result->bookings->search($params);
1608
    return Koha::Bookings->_new_from_dbic( $bookings_rs );
1609
}
1610
1597
=head3 return_claims
1611
=head3 return_claims
1598
1612
1599
my $return_claims = $patron->return_claims
1613
my $return_claims = $patron->return_claims
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc (+12 lines)
Lines 29-34 Link Here
29
            [% WRAPPER tab_item tabname= "holds" %]
29
            [% WRAPPER tab_item tabname= "holds" %]
30
                <span>Holds ([% holds_count || 0 | html %])</span>
30
                <span>Holds ([% holds_count || 0 | html %])</span>
31
            [% END %]
31
            [% END %]
32
            [% WRAPPER tab_item tabname="bookings" %]
33
                [% SET bookings_count = patron.bookings.filter_by_future.count %]
34
                <span>Bookings ([% bookings_count || 0 | html %])</span>
35
            [% END %]
32
        [% END %]
36
        [% END %]
33
37
34
        [% IF Koha.Preference('UseRecalls') %]
38
        [% IF Koha.Preference('UseRecalls') %]
Lines 221-226 Link Here
221
                    <p>Patron has nothing on hold.</p>
225
                    <p>Patron has nothing on hold.</p>
222
                [% END %]
226
                [% END %]
223
            [% END # /tab_panel#holds %]
227
            [% END # /tab_panel#holds %]
228
229
            [% WRAPPER tab_panel tabname="bookings" %]
230
                [% IF ( bookings_count ) %]
231
                    <table id="bookings-table" style="width: 100% !Important;"></table>
232
                [% ELSE %]
233
                    <p>Patron has nothing booked.</p>
234
                [% END %]
235
            [% END %]
224
        [% END %]
236
        [% END %]
225
237
226
        [% IF Koha.Preference('UseRecalls') %]
238
        [% IF Koha.Preference('UseRecalls') %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-2 / +84 lines)
Lines 696-702 Link Here
696
                    </div> <!-- /div.row -->
696
                    </div> <!-- /div.row -->
697
697
698
                    [% INCLUDE 'patron-detail-tabs.inc' patronpage = "borrower" %]
698
                    [% INCLUDE 'patron-detail-tabs.inc' patronpage = "borrower" %]
699
700
                </main>
699
                </main>
701
            </div> <!-- /.col-sm-10.col-sm-push-2 -->
700
            </div> <!-- /.col-sm-10.col-sm-push-2 -->
702
701
Lines 711-716 Link Here
711
            [% INCLUDE 'modals/resolve_return_claim.inc' %]
710
            [% INCLUDE 'modals/resolve_return_claim.inc' %]
712
        [% END %]
711
        [% END %]
713
712
713
        [% INCLUDE modals/cancel_booking.inc %]
714
714
[% MACRO jsinclude BLOCK %]
715
[% MACRO jsinclude BLOCK %]
715
    [% INCLUDE 'datatables.inc' %]
716
    [% INCLUDE 'datatables.inc' %]
716
    [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
717
    [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
Lines 746-751 Link Here
746
    [% END %]
747
    [% END %]
747
    [% Asset.js("js/holds.js") | $raw %]
748
    [% Asset.js("js/holds.js") | $raw %]
748
    [% INCLUDE 'calendar.inc' %]
749
    [% INCLUDE 'calendar.inc' %]
750
    [% Asset.js("js/bookings.js") | $raw %]
751
    [% Asset.js("js/cancel_booking_modal.js") | $raw %]
749
    [% INCLUDE 'str/members-menu.inc' %]
752
    [% INCLUDE 'str/members-menu.inc' %]
750
    [% Asset.js("js/members-menu.js") | $raw %]
753
    [% Asset.js("js/members-menu.js") | $raw %]
751
    [% Asset.js("js/recalls.js") | $raw %]
754
    [% Asset.js("js/recalls.js") | $raw %]
Lines 774-780 Link Here
774
                $('#guarantees_finesandcharges-tab').click();
777
                $('#guarantees_finesandcharges-tab').click();
775
            });
778
            });
776
779
780
            // Bookings
781
            var bookings_table;
782
            // Load bookings table on tab selection
783
            $("#bookings-tab").on( "click", function(){
784
                if ( !bookings_table ) {
785
                    var today = new Date();
786
                    var bookings_table_url = "/api/v1/bookings";
787
                    bookings_table = $('#bookings-table').kohaTable({
788
                        "ajax": {
789
                            "url": bookings_table_url
790
                        },
791
                        "embed": [
792
                            "biblio",
793
                            "item",
794
                            "patron"
795
                        ],
796
                        "columns": [{
797
                            "data": "booking_id",
798
                            "title": "Booking ID",
799
                            "visible": false,
800
                            "searchable": false,
801
                            "orderable": false
802
                        },
803
                        {
804
                            "data": "biblio.title",
805
                            "title": "Title",
806
                            "searchable": true,
807
                            "orderable": true,
808
                            "render": function(data,type,row,meta) {
809
                                return row.biblio.title;
810
                            }
811
                        },
812
                        {
813
                            "data": "item.external_id",
814
                            "title": "Item",
815
                            "searchable": true,
816
                            "orderable": true,
817
                            "defaultContent": "Any item",
818
                            "render": function(data,type,row,meta) {
819
                                if ( row.item ) {
820
                                    return row.item.external_id;
821
                                } else {
822
                                    return null;
823
                                }
824
                            }
825
                        },
826
                        {
827
                            "data": "start_date",
828
                            "title": "Start date",
829
                            "searchable": true,
830
                            "orderable": true,
831
                            "render": function(data, type, row, meta) {
832
                                return $datetime(row.start_date);
833
                            }
834
                        },
835
                        {
836
                            "data": "end_date",
837
                            "title": "End date",
838
                            "searchable": true,
839
                            "orderable": true,
840
                            "render": function(data, type, row, meta) {
841
                                return $datetime(row.end_date);
842
                            }
843
                        },
844
                        {
845
                            "data": "",
846
                            "title": "Actions",
847
                            "searchable": false,
848
                            "orderable": false,
849
                            "render": function(data, type, row, meta) {
850
                                var result = '<button type="button" class="btn btn-default btn-xs cancel-action" data-toggle="modal" data-target="#cancelBookingModal" data-booking="'+row.booking_id+'"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Cancel")+'</button>';
851
                                return result;
852
                            }
853
                        }]
854
                    }, [], 1, { patron_id: "[% patron.borrowernumber | html %]", end_date: { ">=": today.toISOString() } });
855
                };
856
            });
857
            // Bookings
858
777
         });
859
         });
860
778
        function uncheck_sibling(me){
861
        function uncheck_sibling(me){
779
            nodename=me.getAttribute("name");
862
            nodename=me.getAttribute("name");
780
            if (nodename =="barcodes[]"){
863
            if (nodename =="barcodes[]"){
781
- 

Return to bug 33737