6 [% USE TablesSettings %]
7 [% USE AuthorisedValues %]
8 [% PROCESS 'i18n.inc' %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 <title>[% FILTER collapse %]
12 [% t("Holds awaiting pickup") | html %] ›
13 [% t("Circulation") | html %] ›
14 [% t("Koha") | html %]
16 [% INCLUDE 'doc-head-close.inc' %]
19 <body id="circ_waitingreserves" class="circ">
20 [% WRAPPER 'header.inc' %]
21 [% INCLUDE 'circ-search.inc' %]
24 [% WRAPPER 'sub-header.inc' %]
25 [% WRAPPER breadcrumbs %]
26 [% WRAPPER breadcrumb_item %]
27 <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
29 [% WRAPPER breadcrumb_item bc_active= 1 %]
30 <span>Holds awaiting pickup</span>
32 [% END #/ WRAPPER breadcrumbs %]
33 [% END #/ WRAPPER sub-header.inc %]
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>
75 [% END # /IF messagetransfert%]
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>
86 [% END # /IF waiting %]
87 [% END # /FOREACH cancel_result %]
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>
96 [% WRAPPER tabs id= "resultlist" %]
97 [% WRAPPER tabs_nav %]
98 [% WRAPPER tab_item tabname= "holdswaiting" bt_active= 1 %]
99 <span>Holds waiting:</span> [% reservecount | html %]
101 [% WRAPPER tab_item tabname= "holdsover" %]
102 <span>Holds waiting past their expiration date:</span> [% overcount | html %]
104 [% WRAPPER tab_item tabname= "holdscancelled" %]
105 <span>Holds with cancellation requests:</span> [% cancel_reqs_count | html %]
107 [% END # /WRAPPER tabs_nav %]
109 [% WRAPPER tab_panels %]
110 [% WRAPPER tab_panel tabname="holdswaiting" bt_active= 1 %]
111 [% IF ( reserveloop ) %]
112 <div id="toolbar" class="btn-toolbar">
113 <button class="btn 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>
119 [% END # /tab_panel#holdswaiting %]
121 [% WRAPPER tab_panel tabname="holdsover" %]
122 [% IF ( overloop ) %]
123 <div id="toolbar" class="btn-toolbar">
124 <button class="btn cancel_selected_holds" data-bulk="true"></button>
125 <div class="btn-group">
126 <form name="cancelAllReserve" action="waitingreserves.pl" method="post">
127 <input type="hidden" name="cancelall" value="1" />
128 <input type="hidden" name="allbranches" value="[% allbranches | html %]" />
129 <input type="hidden" name="tab" value="holdsover">
130 [% IF TransferWhenCancelAllWaitingHolds %]
131 <input type="submit" class="btn btn-primary" value="Cancel and transfer all" />
133 <input type="submit" class="btn btn-primary" value="Cancel all" />
138 [% UNLESS TransferWhenCancelAllWaitingHolds %]
139 <div class="hint">Only items that need not be transferred will be cancelled (TransferWhenCancelAllWaitingHolds syspref)</div>
141 [% INCLUDE waiting_holds.inc table_name='holdso' reserveloop=overloop tab='holdsover' %]
143 <div class="dialog message">No holds found.</div>
144 [% END # /IF( overloop ) %]
145 [% END # /tab_panel#holdsover %]
147 [% WRAPPER tab_panel tabname="holdscancelled" %]
148 [% IF cancel_reqs_count %]
149 <div id="toolbar" class="btn-toolbar">
150 <button class="btn cancel_selected_holds" data-bulk="true"></button>
152 [% INCLUDE waiting_holds.inc select_column='1' table_name='holdscr' reserveloop=cancel_reqs tab='holdscr' %]
154 <div class="dialog message">No holds found.</div>
156 [% END # /tab_panel#holdscancelled %]
157 [% END # /WRAPPER tab_panels %]
158 [% END # /WRAPPER tabs %]
160 [% END # /IF ( cancel_result ) %]
161 </div> <!-- /.col-sm-10.col-sm-push-2 -->
163 [% IF Koha.Preference('CircSidebar') %]
164 <div class="col-sm-2 col-sm-pull-10">
166 [% INCLUDE 'circ-nav.inc' %]
168 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
170 </div> <!-- /.row -->
173 </div> <!-- /.col-sm-12 -->
174 </div> <!-- /.row -->
176 <div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
177 <div class="modal-dialog" role="document">
178 <div class="modal-content">
179 <div class="modal-header">
180 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
181 <h3>Confirm deletion</h3>
184 <div class="modal-body">
185 <p>Are you sure you want to cancel this hold?</p>
187 <fieldset class="action">
188 [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
189 [% IF hold_cancellation.count %]
190 <label for="cancellation-reason">Cancellation reason: </label>
191 <select class="cancellation-reason" name="modal-cancellation-reason" id="modal-cancellation-reason">
192 <option value="">No reason given</option>
193 [% FOREACH reason IN hold_cancellation %]
194 <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
198 </fieldset> <!-- /.action -->
199 </div> <!-- /.modal-body -->
201 <div class="modal-footer">
202 <button id="cancelModalConfirmBtn" type="button" class="btn btn-danger">Confirm cancellation</button>
203 <a href="#" data-dismiss="modal">Cancel</a>
204 </div> <!-- /.modal-footer -->
205 </div> <!-- /.modal-content -->
206 </div> <!-- /.modal-dialog -->
207 </div> <!-- /#cancelModal -->
209 [% MACRO jsinclude BLOCK %]
210 [% INCLUDE 'datatables.inc' %]
211 [% INCLUDE 'columns_settings.inc' %]
213 var MSG_CANCEL_SELECTED = _("Cancel selected (%s)");
214 var holdst_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdst', 'json' ) | $raw %];
215 var holdso_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdso', 'json' ) | $raw %];
216 var holdscr_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdscr', 'json' ) | $raw %];
218 $(document).ready(function() {
220 KohaTable("holdst", {
221 "pagingType": "full",
222 "order": [[1, 'asc']]
223 }, holdst_table_settings);
225 KohaTable("holdso", {
226 "pagingType": "full",
227 "order": [[1, 'asc']]
228 }, holdso_table_settings);
230 KohaTable("holdscr", {
231 "pagingType": "full",
232 "order": [[1, 'asc']]
233 }, holdscr_table_settings);
237 $("#cancelModalConfirmBtn").on("click",function(e) {
238 var ids = cancel_link.data('ids');
239 localStorage.selectedWaitingHolds = JSON.stringify(JSON.parse(localStorage.selectedWaitingHolds).filter(id => !ids.includes(id)));
240 let link = `waitingreserves.pl?cancelBulk=1&ids=${ids.join(',')}`;
241 let reason = $("#modal-cancellation-reason").val();
243 link += "&cancellation-reason=" + reason
245 window.location.href = link;
249 if(!localStorage.selectedWaitingHolds || document.referrer.replace(/\?.*/, '') !== document.location.origin+document.location.pathname) {
250 localStorage.selectedWaitingHolds = '[]';
254 JSON.parse(localStorage.selectedWaitingHolds);
256 localStorage.selectedWaitingHolds = '[]';
259 $('.holds_table .select_hold').each(function() {
260 if(JSON.parse(localStorage.selectedWaitingHolds).includes($(this).data('id'))) {
261 $(this).prop('checked', true);
265 $('.holds_table').each(function() {
267 var parent = table.parents('.tab-pane');
269 $('.holds_table .select_hold_all', parent).each(function() {
270 var count = $('.select_hold:not(:checked)', table).length;
271 $('.select_hold_all', table).prop('checked', !count);
274 $('.cancel_selected_holds', parent).html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked', parent).length));
276 $('.holds_table .select_hold_all', parent).click(function() {
277 var count = $('.select_hold:checked', table).length;
278 $('.select_hold', table).prop('checked', !count);
279 $(this).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 $('.holds_table .select_hold', parent).click(function() {
285 var count = $('.select_hold:not(:checked)', table).length;
286 $('.select_hold_all', table).prop('checked', !count);
287 $('.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));
288 localStorage.selectedWaitingHolds = JSON.stringify($('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')));
291 $('.cancel_selected_holds', parent).click(function(e) {
293 if($('.select_hold:checked', table).length) {
294 cancel_link = $(this);
295 $('#cancelModal').modal();
301 var activeTab = localStorage.getItem("waitingreserves_activetab");
303 $("div#resultlist li:eq(" + activeTab + ") a").tab("show");
305 $("div#resultlist a[data-toggle='tab']").on("shown.bs.tab", function (e) {
306 var thisTab = $(e.target).parent();
307 var activeTab = thisTab.index();
308 localStorage.setItem("waitingreserves_activetab", activeTab );
315 [% INCLUDE 'intranet-bottom.inc' %]