Lines 779-884
Link Here
|
779 |
table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %] |
779 |
table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %] |
780 |
table_settings_holds_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'holds-table', 'json' ) | $raw %] |
780 |
table_settings_holds_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'holds-table', 'json' ) | $raw %] |
781 |
table_settings_bookings_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'bookings-table', 'json' ) | $raw %] |
781 |
table_settings_bookings_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'bookings-table', 'json' ) | $raw %] |
782 |
|
782 |
CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %] |
783 |
var bookings_table; |
783 |
patron_borrowernumber = [% patron.borrowernumber | $raw %] |
784 |
$(document).ready(function() { |
|
|
785 |
$("#info_digests").tooltip(); |
786 |
|
787 |
$("#finesholdsissues a[data-toggle='tab']").on("shown.bs.tab", function(e){ |
788 |
var oTable = $('div.dataTables_wrapper > table', $(e.target.hash) ).dataTable(); |
789 |
if ( oTable.length > 0 ) { |
790 |
oTable.fnAdjustColumnSizing(); |
791 |
} |
792 |
}); |
793 |
|
794 |
$("#view_restrictions").on("click",function(){ |
795 |
$('#reldebarments-tab').click(); |
796 |
}); |
797 |
|
798 |
$("#view_guarantees_finesandcharges").on("click",function(){ |
799 |
$('#guarantees_finesandcharges-tab').click(); |
800 |
}); |
801 |
|
802 |
// Bookings |
803 |
// Load bookings table on tab selection |
804 |
$("#bookings-tab").on( "click", function(){ |
805 |
if ( !bookings_table ) { |
806 |
var today = new Date(); |
807 |
var bookings_table_url = "/api/v1/bookings"; |
808 |
bookings_table = $('#bookings_table').kohaTable({ |
809 |
"ajax": { |
810 |
"url": bookings_table_url |
811 |
}, |
812 |
"embed": [ |
813 |
"biblio", |
814 |
"item", |
815 |
"patron" |
816 |
], |
817 |
"columns": [{ |
818 |
"data": "booking_id", |
819 |
"title": _("Booking ID"), |
820 |
}, |
821 |
{ |
822 |
"data": "biblio.title", |
823 |
"title": _("Title"), |
824 |
"searchable": true, |
825 |
"orderable": true, |
826 |
"render": function(data,type,row,meta) { |
827 |
return $biblio_to_html(row.biblio, { |
828 |
link: 'bookings' |
829 |
}); |
830 |
} |
831 |
}, |
832 |
{ |
833 |
"data": "item.external_id", |
834 |
"title": _("Item"), |
835 |
"searchable": true, |
836 |
"orderable": true, |
837 |
"defaultContent": _("Any item"), |
838 |
"render": function(data,type,row,meta) { |
839 |
if ( row.item ) { |
840 |
return row.item.external_id + " (" + row.booking_id + ")"; |
841 |
} else { |
842 |
return null; |
843 |
} |
844 |
} |
845 |
}, |
846 |
{ |
847 |
"data": "start_date", |
848 |
"title": _("Start date"), |
849 |
"searchable": true, |
850 |
"orderable": true, |
851 |
"render": function(data, type, row, meta) { |
852 |
return $date(row.start_date); |
853 |
} |
854 |
}, |
855 |
{ |
856 |
"data": "end_date", |
857 |
"title": _("End date"), |
858 |
"searchable": true, |
859 |
"orderable": true, |
860 |
"render": function(data, type, row, meta) { |
861 |
return $date(row.end_date); |
862 |
} |
863 |
}, |
864 |
{ |
865 |
"data": "", |
866 |
"title": _("Actions"), |
867 |
"class": "actions", |
868 |
"searchable": false, |
869 |
"orderable": false, |
870 |
"render": function(data, type, row, meta) { |
871 |
let result = ""; |
872 |
[% IF CAN_user_circulate_manage_bookings %] |
873 |
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>'; |
874 |
[% END %] |
875 |
return result; |
876 |
} |
877 |
}] |
878 |
}, table_settings_bookings_table, 0, { patron_id: "[% patron.borrowernumber | html %]", end_date: { ">=": today.toISOString() } }); |
879 |
}; |
880 |
}); |
881 |
}); |
882 |
|
784 |
|
883 |
function uncheck_sibling(me){ |
785 |
function uncheck_sibling(me){ |
884 |
nodename=me.getAttribute("name"); |
786 |
nodename=me.getAttribute("name"); |
Lines 903-908
Link Here
|
903 |
} |
805 |
} |
904 |
} |
806 |
} |
905 |
</script> |
807 |
</script> |
|
|
808 |
[% Asset.js("js/bookings-table.js") | $raw %] |
906 |
[% END %] |
809 |
[% END %] |
907 |
|
810 |
|
908 |
[% INCLUDE 'intranet-bottom.inc' %] |
811 |
[% INCLUDE 'intranet-bottom.inc' %] |
909 |
- |
|
|