6 [% USE TablesSettings %]
7 [% USE AuthorisedValues %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>Holds awaiting pickup › Circulation › Koha</title>
11 [% INCLUDE 'doc-head-close.inc' %]
14 <body id="circ_waitingreserves" class="circ">
15 [% WRAPPER 'header.inc' %]
16 [% INCLUDE 'circ-search.inc' %]
19 [% WRAPPER 'sub-header.inc' %]
20 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
23 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
26 <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
29 <a href="#" aria-current="page">Holds awaiting pickup</a>
35 <div class="main container-fluid">
37 <div class="col-sm-12">
41 [% IF Koha.Preference('CircSidebar') %]
42 <div class="col-sm-10 col-sm-push-2">
44 <div class="col-sm-12">
47 <h1>Holds awaiting pickup for your library on: [% show_date | $KohaDates %]</h1>
49 [% IF ( all_branches_link ) %]
50 <span><a href="[% all_branches_link | url %]">
51 View all libraries</a></span>
54 [% IF reject_result_error %]
55 <div class="error message">
56 [% IF reject_result_error.invalid_status %]
57 <p>There was a problem rejecting the cancellation request. Cannot reject an already completed cancellation request.</p>
59 <p>Some error occurred while rejecting the cancellation request. Please check the logs</p>
63 [% IF ( cancel_result ) %]
64 [% FOREACH cancel_result %]
65 [% IF ( messagetransfert ) %]
66 <div class="dialog message">
67 <h2>This item is on hold for pick-up at [% Branches.GetName( branchname ) | html %]</h2>
68 <p><strong>[% nextreservtitle | html %]</strong> is on hold for <strong> [% nextreservsurname | html %], [% nextreservfirstname | html %]</strong>.
69 Please retain this item and check it in to process the hold.
71 <form name="cancelReservewithtransfert" action="waitingreserves.pl#[% tab | html %]" method="post">
72 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
77 <div class="dialog message">
78 <h2>This item is on hold for pick-up at your library</h2>
79 <p><strong>[% nextreservtitle | html %]</strong> is on hold for <strong>[% nextreservsurname | html %], [% nextreservfirstname | html %]</strong>.
80 Please retain this item and check it in to process the hold.
82 <form name="cancelReservewithwaiting" action="waitingreserves.pl#[% tab | html %]" method="post">
83 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
90 <div class="dialog message">
91 <p>The job has been enqueued! It will be processed as soon as possible.</p>
92 <p><a href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=[% job_id | uri %]" title="View detail of the enqueued job">View detail of the enqueued job</a></p>
95 <div id="resultlist" class="toptabs">
96 <ul class="nav nav-tabs" role="tablist">
97 <li role="presentation" class="active"><a href="#holdswaiting" aria-controls="holdswaiting" role="tab" data-toggle="tab">Holds waiting: [% reservecount | html %]</a></li>
98 <li role="presentation">
99 <a href="#holdsover" aria-controls="holdsover" role="tab" data-toggle="tab">
100 Holds waiting over [% Koha.Preference('ReservesMaxPickUpDelay') | html %] days: [% overcount | html %]
103 <li role="presentation">
104 <a href="#holdscancelled" aria-controls="holdscancelled" role="tab" data-toggle="tab">
105 Holds with cancellation requests: [% cancel_reqs_count | html %]
109 <div class="tab-content">
110 <div role="tabpanel" class="tab-pane active" id="holdswaiting">
111 [% IF ( reserveloop ) %]
112 <div id="toolbar" class="btn-toolbar">
113 <button class="btn btn-default cancel_selected_holds" data-bulk="true"></button>
115 [% INCLUDE waiting_holds.inc table_name='holdst' reserveloop=reserveloop tab='holdwaiting' %]
117 <div class="dialog message">No holds found.</div>
120 <div role="tabpanel" class="tab-pane" id="holdsover">
121 [% IF ( ReservesMaxPickUpDelay ) %]
122 <p>Holds listed here have been awaiting pickup for more than [% ReservesMaxPickUpDelay | html %] days.</p>
124 [% IF ( overloop ) %]
125 <span id="holdsover-cancel-all">
126 <button class="cancel_selected_holds" data-bulk="true"></button>
127 <form name="cancelAllReserve" action="waitingreserves.pl" method="post">
128 <input type="hidden" name="cancelall" value="1" />
129 <input type="hidden" name="allbranches" value="[% allbranches | html %]" />
130 <input type="hidden" name="tab" value="holdsover">
131 [% IF TransferWhenCancelAllWaitingHolds %]
132 <input type="submit" class="btn btn-primary" value="Cancel and transfer all" />
134 <input type="submit" class="btn btn-primary" value="Cancel all" />
137 [% UNLESS TransferWhenCancelAllWaitingHolds %]
138 Only items that need not be transferred will be cancelled (TransferWhenCancelAllWaitingHolds syspref)
141 [% INCLUDE waiting_holds.inc table_name='holdso' reserveloop=overloop tab='holdsover' %]
143 <div class="dialog message">No holds found.</div>
146 <div role="tabpanel" class="tab-pane" id="holdscancelled">
147 [% IF cancel_reqs_count %]
148 [% INCLUDE waiting_holds.inc select_column='1' table_name='holdscr' reserveloop=cancel_reqs tab='holdscr' %]
150 <div class="dialog message">No holds found.</div>
156 </div> <!-- /.col-sm-10.col-sm-push-2 -->
158 [% IF Koha.Preference('CircSidebar') %]
159 <div class="col-sm-2 col-sm-pull-10">
161 [% INCLUDE 'circ-nav.inc' %]
163 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
165 </div> <!-- /.row -->
168 </div> <!-- /.col-sm-12 -->
169 </div> <!-- /.row -->
171 <div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
172 <div class="modal-dialog" role="document">
173 <div class="modal-content">
174 <div class="modal-header">
175 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
176 <h3>Confirm deletion</h3>
179 <div class="modal-body">
180 <p>Are you sure you want to cancel this hold?</p>
182 <fieldset class="action">
183 [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
184 [% IF hold_cancellation.count %]
185 <label for="cancellation-reason">Cancellation reason: </label>
186 <select class="cancellation-reason" name="modal-cancellation-reason" id="modal-cancellation-reason">
187 <option value="">No reason given</option>
188 [% FOREACH reason IN hold_cancellation %]
189 <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
196 <div class="modal-footer">
197 <button id="cancelModalConfirmBtn" type="button" class="btn btn-danger">Confirm cancellation</button>
198 <a href="#" data-dismiss="modal">Cancel</a>
204 [% MACRO jsinclude BLOCK %]
205 [% INCLUDE 'datatables.inc' %]
206 [% INCLUDE 'columns_settings.inc' %]
208 var MSG_CANCEL_SELECTED = _("Cancel selected (%s)");
209 var holdst_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdst', 'json' ) | $raw %];
210 var holdso_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdso', 'json' ) | $raw %];
211 var holdscr_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdscr', 'json' ) | $raw %];
213 $(document).ready(function() {
215 KohaTable("holdst", {
216 "sPaginationType": "full",
217 "order": [[1, 'asc']]
218 }, holdst_table_settings);
220 KohaTable("holdso", {
221 "sPaginationType": "full",
222 "order": [[1, 'asc']]
223 }, holdso_table_settings);
225 KohaTable("holdscr", {
226 "sPaginationType": "full",
227 "order": [[1, 'asc']]
228 }, holdscr_table_settings);
232 $("#cancelModalConfirmBtn").on("click",function(e) {
233 var ids = cancel_link.data('ids');
234 localStorage.selectedWaitingHolds = JSON.stringify(JSON.parse(localStorage.selectedWaitingHolds).filter(id => !ids.includes(id)));
235 let link = `waitingreserves.pl?cancelBulk=1&ids=${ids.join(',')}`;
236 let reason = $("#modal-cancellation-reason").val();
238 link += "&cancellation-reason=" + reason
240 window.location.href = link;
244 if(!localStorage.selectedWaitingHolds || document.referrer.replace(/\?.*/, '') !== document.location.origin+document.location.pathname) {
245 localStorage.selectedWaitingHolds = '[]';
249 JSON.parse(localStorage.selectedWaitingHolds);
251 localStorage.selectedWaitingHolds = '[]';
254 $('.holds_table .select_hold').each(function() {
255 if(JSON.parse(localStorage.selectedWaitingHolds).includes($(this).data('id'))) {
256 $(this).prop('checked', true);
260 $('.holds_table').each(function() {
262 var parent = table.parents('.tab-pane');
264 $('.holds_table .select_hold_all', parent).each(function() {
265 var count = $('.select_hold:not(:checked)', table).length;
266 $('.select_hold_all', table).prop('checked', !count);
269 $('.cancel_selected_holds', parent).html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked', parent).length));
271 $('.holds_table .select_hold_all', parent).click(function() {
272 var count = $('.select_hold:checked', table).length;
273 $('.select_hold', table).prop('checked', !count);
274 $(this).prop('checked', !count);
275 $('.cancel_selected_holds', parent).data('ids', $('.holds_table .select_hold:checked', parent).toArray().map(el => $(el).data('id'))).html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked', parent).length));
276 localStorage.selectedWaitingHolds = JSON.stringify($('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')));
279 $('.holds_table .select_hold', parent).click(function() {
280 var count = $('.select_hold:not(:checked)', table).length;
281 $('.select_hold_all', table).prop('checked', !count);
282 $('.cancel_selected_holds', parent).data('ids', $('.holds_table .select_hold:checked', parent).toArray().map(el => $(el).data('id'))).html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked', parent).length));
283 localStorage.selectedWaitingHolds = JSON.stringify($('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')));
286 $('.cancel_selected_holds', parent).click(function(e) {
288 if($('.select_hold:checked', table).length) {
289 cancel_link = $(this);
290 $('#cancelModal').modal();
296 var activeTab = localStorage.getItem("waitingreserves_activetab");
298 $("div#resultlist li:eq(" + activeTab + ") a").tab("show");
300 $("div#resultlist a[data-toggle='tab']").on("shown.bs.tab", function (e) {
301 var thisTab = $(e.target).parent();
302 var activeTab = thisTab.index();
303 localStorage.setItem("waitingreserves_activetab", activeTab );
310 [% INCLUDE 'intranet-bottom.inc' %]