6 [% USE TablesSettings %]
7 [% USE AuthorisedValues %]
8 [% PROCESS 'i18n.inc' %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 <title>Holds awaiting pickup › Circulation › Koha</title>
12 [% INCLUDE 'doc-head-close.inc' %]
15 <body id="circ_waitingreserves" class="circ">
16 [% WRAPPER 'header.inc' %]
17 [% INCLUDE 'circ-search.inc' %]
20 [% WRAPPER 'sub-header.inc' %]
21 [% WRAPPER breadcrumbs %]
22 [% WRAPPER breadcrumb_item %]
23 <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
25 [% WRAPPER breadcrumb_item bc_active= 1 %]
26 <span>Holds awaiting pickup</span>
28 [% END #/ WRAPPER breadcrumbs %]
29 [% END #/ WRAPPER sub-header.inc %]
31 <div class="main container-fluid">
33 <div class="col-sm-12">
37 [% IF Koha.Preference('CircSidebar') %]
38 <div class="col-sm-10 col-sm-push-2">
40 <div class="col-sm-12">
43 <h1>Holds awaiting pickup for your library on: [% show_date | $KohaDates %]</h1>
45 [% IF ( all_branches_link ) %]
46 <span><a href="[% all_branches_link | url %]">
47 View all libraries</a></span>
50 [% IF reject_result_error %]
51 <div class="error message">
52 [% IF reject_result_error.invalid_status %]
53 <p>There was a problem rejecting the cancellation request. Cannot reject an already completed cancellation request.</p>
55 <p>Some error occurred while rejecting the cancellation request. Please check the logs</p>
59 [% IF ( cancel_result ) %]
60 [% FOREACH cancel_result %]
61 [% IF ( messagetransfert ) %]
62 <div class="dialog message">
63 <h2>This item is on hold for pick-up at [% Branches.GetName( branchname ) | html %]</h2>
64 <p><strong>[% nextreservtitle | html %]</strong> is on hold for <strong> [% nextreservsurname | html %], [% nextreservfirstname | html %]</strong>.
65 Please retain this item and check it in to process the hold.
67 <form name="cancelReservewithtransfert" action="waitingreserves.pl#[% tab | html %]" method="post">
68 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
71 [% END # /IF messagetransfert%]
73 <div class="dialog message">
74 <h2>This item is on hold for pick-up at your library</h2>
75 <p><strong>[% nextreservtitle | html %]</strong> is on hold for <strong>[% nextreservsurname | html %], [% nextreservfirstname | html %]</strong>.
76 Please retain this item and check it in to process the hold.
78 <form name="cancelReservewithwaiting" action="waitingreserves.pl#[% tab | html %]" method="post">
79 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
82 [% END # /IF waiting %]
83 [% END # /FOREACH cancel_result %]
86 <div class="dialog message">
87 <p>The job has been enqueued! It will be processed as soon as possible.</p>
88 <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>
92 [% WRAPPER tabs id= "resultlist" %]
93 [% WRAPPER tabs_nav %]
94 [% WRAPPER tab_item tabname= "holdswaiting" bt_active= 1 %]
95 <span>Holds waiting:</span> [% reservecount | html %]
97 [% WRAPPER tab_item tabname= "holdsover" %]
98 [% tx("Holds waiting over {count} days:", { count = Koha.Preference('ReservesMaxPickUpDelay') }) %] [% overcount | html %]
100 [% WRAPPER tab_item tabname= "holdscancelled" %]
101 <span>Holds with cancellation requests:</span> [% cancel_reqs_count | html %]
103 [% END # /WRAPPER tabs_nav %]
105 [% WRAPPER tab_panels %]
106 [% WRAPPER tab_panel tabname="holdswaiting" bt_active= 1 %]
107 [% IF ( reserveloop ) %]
108 <div id="toolbar" class="btn-toolbar">
109 <button class="btn cancel_selected_holds" data-bulk="true"></button>
111 [% INCLUDE waiting_holds.inc table_name='holdst' reserveloop=reserveloop tab='holdwaiting' %]
113 <div class="dialog message">No holds found.</div>
115 [% END # /tab_panel#holdswaiting %]
117 [% WRAPPER tab_panel tabname="holdsover" %]
118 [% IF ( ReservesMaxPickUpDelay ) %]
119 <p>Holds listed here have been awaiting pickup for more than [% ReservesMaxPickUpDelay | html %] days.</p>
121 [% IF ( overloop ) %]
122 <div id="toolbar" class="btn-toolbar">
123 <button class="btn cancel_selected_holds" data-bulk="true"></button>
124 <div class="btn-group">
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" class="btn btn-primary" value="Cancel and transfer all" />
132 <input type="submit" class="btn btn-primary" value="Cancel all" />
137 [% UNLESS TransferWhenCancelAllWaitingHolds %]
138 <div class="hint">Only items that need not be transferred will be cancelled (TransferWhenCancelAllWaitingHolds syspref)</div>
140 [% INCLUDE waiting_holds.inc table_name='holdso' reserveloop=overloop tab='holdsover' %]
142 <div class="dialog message">No holds found.</div>
143 [% END # /IF( overloop ) %]
144 [% END # /tab_panel#holdsover %]
146 [% WRAPPER tab_panel tabname="holdscancelled" %]
147 [% IF cancel_reqs_count %]
148 <div id="toolbar" class="btn-toolbar">
149 <button class="btn cancel_selected_holds" data-bulk="true"></button>
151 [% INCLUDE waiting_holds.inc select_column='1' table_name='holdscr' reserveloop=cancel_reqs tab='holdscr' %]
153 <div class="dialog message">No holds found.</div>
155 [% END # /tab_panel#holdscancelled %]
156 [% END # /WRAPPER tab_panels %]
157 [% END # /WRAPPER tabs %]
159 [% END # /IF ( cancel_result ) %]
160 </div> <!-- /.col-sm-10.col-sm-push-2 -->
162 [% IF Koha.Preference('CircSidebar') %]
163 <div class="col-sm-2 col-sm-pull-10">
165 [% INCLUDE 'circ-nav.inc' %]
167 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
169 </div> <!-- /.row -->
172 </div> <!-- /.col-sm-12 -->
173 </div> <!-- /.row -->
175 <div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
176 <div class="modal-dialog" role="document">
177 <div class="modal-content">
178 <div class="modal-header">
179 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
180 <h3>Confirm deletion</h3>
183 <div class="modal-body">
184 <p>Are you sure you want to cancel this hold?</p>
186 <fieldset class="action">
187 [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
188 [% IF hold_cancellation.count %]
189 <label for="cancellation-reason">Cancellation reason: </label>
190 <select class="cancellation-reason" name="modal-cancellation-reason" id="modal-cancellation-reason">
191 <option value="">No reason given</option>
192 [% FOREACH reason IN hold_cancellation %]
193 <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
197 </fieldset> <!-- /.action -->
198 </div> <!-- /.modal-body -->
200 <div class="modal-footer">
201 <button id="cancelModalConfirmBtn" type="button" class="btn btn-danger">Confirm cancellation</button>
202 <a href="#" data-dismiss="modal">Cancel</a>
203 </div> <!-- /.modal-footer -->
204 </div> <!-- /.modal-content -->
205 </div> <!-- /.modal-dialog -->
206 </div> <!-- /#cancelModal -->
208 [% MACRO jsinclude BLOCK %]
209 [% INCLUDE 'datatables.inc' %]
210 [% INCLUDE 'columns_settings.inc' %]
212 var MSG_CANCEL_SELECTED = _("Cancel selected (%s)");
213 var holdst_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdst', 'json' ) | $raw %];
214 var holdso_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdso', 'json' ) | $raw %];
215 var holdscr_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdscr', 'json' ) | $raw %];
217 $(document).ready(function() {
219 KohaTable("holdst", {
220 "sPaginationType": "full",
221 "order": [[1, 'asc']]
222 }, holdst_table_settings);
224 KohaTable("holdso", {
225 "sPaginationType": "full",
226 "order": [[1, 'asc']]
227 }, holdso_table_settings);
229 KohaTable("holdscr", {
230 "sPaginationType": "full",
231 "order": [[1, 'asc']]
232 }, holdscr_table_settings);
236 $("#cancelModalConfirmBtn").on("click",function(e) {
237 var ids = cancel_link.data('ids');
238 localStorage.selectedWaitingHolds = JSON.stringify(JSON.parse(localStorage.selectedWaitingHolds).filter(id => !ids.includes(id)));
239 let link = `waitingreserves.pl?cancelBulk=1&ids=${ids.join(',')}`;
240 let reason = $("#modal-cancellation-reason").val();
242 link += "&cancellation-reason=" + reason
244 window.location.href = link;
248 if(!localStorage.selectedWaitingHolds || document.referrer.replace(/\?.*/, '') !== document.location.origin+document.location.pathname) {
249 localStorage.selectedWaitingHolds = '[]';
253 JSON.parse(localStorage.selectedWaitingHolds);
255 localStorage.selectedWaitingHolds = '[]';
258 $('.holds_table .select_hold').each(function() {
259 if(JSON.parse(localStorage.selectedWaitingHolds).includes($(this).data('id'))) {
260 $(this).prop('checked', true);
264 $('.holds_table').each(function() {
266 var parent = table.parents('.tab-pane');
268 $('.holds_table .select_hold_all', parent).each(function() {
269 var count = $('.select_hold:not(:checked)', table).length;
270 $('.select_hold_all', table).prop('checked', !count);
273 $('.cancel_selected_holds', parent).html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked', parent).length));
275 $('.holds_table .select_hold_all', parent).click(function() {
276 var count = $('.select_hold:checked', table).length;
277 $('.select_hold', table).prop('checked', !count);
278 $(this).prop('checked', !count);
279 $('.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));
280 localStorage.selectedWaitingHolds = JSON.stringify($('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')));
283 $('.holds_table .select_hold', parent).click(function() {
284 var count = $('.select_hold:not(:checked)', table).length;
285 $('.select_hold_all', table).prop('checked', !count);
286 $('.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));
287 localStorage.selectedWaitingHolds = JSON.stringify($('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')));
290 $('.cancel_selected_holds', parent).click(function(e) {
292 if($('.select_hold:checked', table).length) {
293 cancel_link = $(this);
294 $('#cancelModal').modal();
300 var activeTab = localStorage.getItem("waitingreserves_activetab");
302 $("div#resultlist li:eq(" + activeTab + ") a").tab("show");
304 $("div#resultlist a[data-toggle='tab']").on("shown.bs.tab", function (e) {
305 var thisTab = $(e.target).parent();
306 var activeTab = thisTab.index();
307 localStorage.setItem("waitingreserves_activetab", activeTab );
314 [% INCLUDE 'intranet-bottom.inc' %]