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 692-698 Link Here
692
                    </div> <!-- /div.row -->
692
                    </div> <!-- /div.row -->
693
693
694
                    [% INCLUDE 'patron-detail-tabs.inc' patronpage = "borrower" %]
694
                    [% INCLUDE 'patron-detail-tabs.inc' patronpage = "borrower" %]
695
696
                </main>
695
                </main>
697
            </div> <!-- /.col-sm-10.col-sm-push-2 -->
696
            </div> <!-- /.col-sm-10.col-sm-push-2 -->
698
697
Lines 707-712 Link Here
707
            [% INCLUDE 'modals/resolve_return_claim.inc' %]
706
            [% INCLUDE 'modals/resolve_return_claim.inc' %]
708
        [% END %]
707
        [% END %]
709
708
709
        [% INCLUDE modals/cancel_booking.inc %]
710
710
[% MACRO jsinclude BLOCK %]
711
[% MACRO jsinclude BLOCK %]
711
    [% INCLUDE 'datatables.inc' %]
712
    [% INCLUDE 'datatables.inc' %]
712
    [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
713
    [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
Lines 742-747 Link Here
742
    [% END %]
743
    [% END %]
743
    [% Asset.js("js/holds.js") | $raw %]
744
    [% Asset.js("js/holds.js") | $raw %]
744
    [% INCLUDE 'calendar.inc' %]
745
    [% INCLUDE 'calendar.inc' %]
746
    [% Asset.js("js/bookings.js") | $raw %]
747
    [% Asset.js("js/cancel_booking_modal.js") | $raw %]
745
    [% INCLUDE 'str/members-menu.inc' %]
748
    [% INCLUDE 'str/members-menu.inc' %]
746
    [% Asset.js("js/members-menu.js") | $raw %]
749
    [% Asset.js("js/members-menu.js") | $raw %]
747
    [% Asset.js("js/recalls.js") | $raw %]
750
    [% Asset.js("js/recalls.js") | $raw %]
Lines 770-776 Link Here
770
                $('#guarantees_finesandcharges-tab').click();
773
                $('#guarantees_finesandcharges-tab').click();
771
            });
774
            });
772
775
776
            // Bookings
777
            var bookings_table;
778
            // Load bookings table on tab selection
779
            $("#bookings-tab").on( "click", function(){
780
                if ( !bookings_table ) {
781
                    var today = new Date();
782
                    var bookings_table_url = "/api/v1/bookings";
783
                    bookings_table = $('#bookings-table').kohaTable({
784
                        "ajax": {
785
                            "url": bookings_table_url
786
                        },
787
                        "embed": [
788
                            "biblio",
789
                            "item",
790
                            "patron"
791
                        ],
792
                        "columns": [{
793
                            "data": "booking_id",
794
                            "title": "Booking ID",
795
                            "visible": false,
796
                            "searchable": false,
797
                            "orderable": false
798
                        },
799
                        {
800
                            "data": "biblio.title",
801
                            "title": "Title",
802
                            "searchable": true,
803
                            "orderable": true,
804
                            "render": function(data,type,row,meta) {
805
                                return row.biblio.title;
806
                            }
807
                        },
808
                        {
809
                            "data": "item.external_id",
810
                            "title": "Item",
811
                            "searchable": true,
812
                            "orderable": true,
813
                            "defaultContent": "Any item",
814
                            "render": function(data,type,row,meta) {
815
                                if ( row.item ) {
816
                                    return row.item.external_id;
817
                                } else {
818
                                    return null;
819
                                }
820
                            }
821
                        },
822
                        {
823
                            "data": "start_date",
824
                            "title": "Start date",
825
                            "searchable": true,
826
                            "orderable": true,
827
                            "render": function(data, type, row, meta) {
828
                                return $datetime(row.start_date);
829
                            }
830
                        },
831
                        {
832
                            "data": "end_date",
833
                            "title": "End date",
834
                            "searchable": true,
835
                            "orderable": true,
836
                            "render": function(data, type, row, meta) {
837
                                return $datetime(row.end_date);
838
                            }
839
                        },
840
                        {
841
                            "data": "",
842
                            "title": "Actions",
843
                            "searchable": false,
844
                            "orderable": false,
845
                            "render": function(data, type, row, meta) {
846
                                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>';
847
                                return result;
848
                            }
849
                        }]
850
                    }, [], 1, { patron_id: "[% patron.borrowernumber | html %]", end_date: { ">=": today.toISOString() } });
851
                };
852
            });
853
            // Bookings
854
773
         });
855
         });
856
774
        function uncheck_sibling(me){
857
        function uncheck_sibling(me){
775
            nodename=me.getAttribute("name");
858
            nodename=me.getAttribute("name");
776
            if (nodename =="barcodes[]"){
859
            if (nodename =="barcodes[]"){
777
- 

Return to bug 33737