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"><i class="fa fa-home"></i></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="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 ) %]<p>Holds listed here have been awaiting pickup for more than [% ReservesMaxPickUpDelay | html %] days.</p>[% END %]
122 [% IF ( overloop ) %]
123 <span id="holdsover-cancel-all">
124 <button class="cancel_selected_holds" data-bulk="true"></button>
125 <form name="cancelAllReserve" action="waitingreserves.pl" method="post">
126 <input type="hidden" name="cancelall" value="1" />
127 <input type="hidden" name="allbranches" value="[% allbranches | html %]" />
128 <input type="hidden" name="tab" value="holdsover">
129 [% IF TransferWhenCancelAllWaitingHolds %]
130 <input type="submit" value="Cancel and Transfer all" />
132 <input type="submit" value="Cancel all" />
135 [% UNLESS TransferWhenCancelAllWaitingHolds %]
136 Only items that need not be transferred will be cancelled (TransferWhenCancelAllWaitingHolds syspref)
140 [% INCLUDE waiting_holds.inc table_name='holdso' reserveloop=overloop tab='holdsover' %]
142 <div class="dialog message">No holds found.</div>
145 <div role="tabpanel" class="tab-pane" id="holdscancelled">
146 [% IF cancel_reqs_count %]
147 [% INCLUDE waiting_holds.inc select_column='1' table_name='holdscr' reserveloop=cancel_reqs tab='holdscr' %]
149 <div class="dialog message">No holds found.</div>
155 [% IF Koha.Preference('CircSidebar') %]
156 </div> <!-- /.col-sm-10.col-sm-push-2 -->
157 <div class="col-sm-2 col-sm-pull-10">
159 [% INCLUDE 'circ-nav.inc' %]
161 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
162 </div> <!-- /.row -->
166 </div> <!-- /.col-sm-12 -->
167 </div> <!-- /.row -->
169 <div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
170 <div class="modal-dialog" role="document">
171 <div class="modal-content">
172 <div class="modal-header">
173 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
174 <h3>Confirm deletion</h3>
177 <div class="modal-body">
178 <p>Are you sure you want to cancel this hold?</p>
180 <fieldset class="action">
181 [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
182 [% IF hold_cancellation.count %]
183 <label for="cancellation-reason">Cancellation reason: </label>
184 <select class="cancellation-reason" name="modal-cancellation-reason" id="modal-cancellation-reason">
185 <option value="">No reason given</option>
186 [% FOREACH reason IN hold_cancellation %]
187 <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
194 <div class="modal-footer">
195 <button id="cancelModalConfirmBtn" type="button" class="btn btn-danger">Confirm cancellation</button>
196 <a href="#" data-dismiss="modal">Cancel</a>
202 [% MACRO jsinclude BLOCK %]
203 [% INCLUDE 'datatables.inc' %]
204 [% INCLUDE 'columns_settings.inc' %]
206 var MSG_CANCEL_SELECTED = _("Cancel selected (%s)");
207 var holdst_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdst', 'json' ) | $raw %];
208 var holdso_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdso', 'json' ) | $raw %];
209 var holdscr_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdscr', 'json' ) | $raw %];
211 $(document).ready(function() {
213 KohaTable("holdst", {
214 "sPaginationType": "full",
215 "order": [[1, 'asc']]
216 }, holdst_table_settings);
218 KohaTable("holdso", {
219 "sPaginationType": "full",
220 "order": [[1, 'asc']]
221 }, holdso_table_settings);
223 KohaTable("holdscr", {
224 "sPaginationType": "full",
225 "order": [[1, 'asc']]
226 }, holdscr_table_settings);
230 $("#cancelModalConfirmBtn").on("click",function(e) {
231 var ids = cancel_link.data('ids');
232 localStorage.selectedWaitingHolds = JSON.stringify(JSON.parse(localStorage.selectedWaitingHolds).filter(id => !ids.includes(id)));
233 let link = `waitingreserves.pl?cancelBulk=1&ids=${ids.join(',')}`;
234 let reason = $("#modal-cancellation-reason").val();
236 link += "&cancellation-reason=" + reason
238 window.location.href = link;
242 if(!localStorage.selectedWaitingHolds || document.referrer.replace(/\?.*/, '') !== document.location.origin+document.location.pathname) {
243 localStorage.selectedWaitingHolds = '[]';
247 JSON.parse(localStorage.selectedWaitingHolds);
249 localStorage.selectedWaitingHolds = '[]';
252 $('.holds_table .select_hold').each(function() {
253 if(JSON.parse(localStorage.selectedWaitingHolds).includes($(this).data('id'))) {
254 $(this).prop('checked', true);
258 $('.holds_table').each(function() {
260 var parent = table.parents('.tab-pane');
262 $('.holds_table .select_hold_all', parent).each(function() {
263 var count = $('.select_hold:not(:checked)', table).length;
264 $('.select_hold_all', table).prop('checked', !count);
267 $('.cancel_selected_holds', parent).html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked', parent).length));
269 $('.holds_table .select_hold_all', parent).click(function() {
270 var count = $('.select_hold:checked', table).length;
271 $('.select_hold', table).prop('checked', !count);
272 $(this).prop('checked', !count);
273 $('.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));
274 localStorage.selectedWaitingHolds = JSON.stringify($('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')));
277 $('.holds_table .select_hold', parent).click(function() {
278 var count = $('.select_hold:not(:checked)', table).length;
279 $('.select_hold_all', table).prop('checked', !count);
280 $('.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));
281 localStorage.selectedWaitingHolds = JSON.stringify($('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')));
284 $('.cancel_selected_holds', parent).click(function(e) {
286 if($('.select_hold:checked', table).length) {
287 cancel_link = $(this);
288 $('#cancelModal').modal();
294 var activeTab = localStorage.getItem("waitingreserves_activetab");
296 $("div#resultlist li:eq(" + activeTab + ") a").tab("show");
298 $("div#resultlist a[data-toggle='tab']").on("shown.bs.tab", function (e) {
299 var thisTab = $(e.target).parent();
300 var activeTab = thisTab.index();
301 localStorage.setItem("waitingreserves_activetab", activeTab );
308 [% INCLUDE 'intranet-bottom.inc' %]