Jonathan Druart
a3c0c92508
This is the result of % perl csrf_add_missing_csrf.pl Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
319 lines
17 KiB
Text
319 lines
17 KiB
Text
[% USE raw %]
|
||
[% USE Asset %]
|
||
[% USE Koha %]
|
||
[% USE KohaDates %]
|
||
[% USE Branches %]
|
||
[% USE TablesSettings %]
|
||
[% USE AuthorisedValues %]
|
||
[% PROCESS 'i18n.inc' %]
|
||
[% SET footerjs = 1 %]
|
||
[% INCLUDE 'doc-head-open.inc' %]
|
||
<title>[% FILTER collapse %]
|
||
[% t("Holds awaiting pickup") | html %] ›
|
||
[% t("Circulation") | html %] ›
|
||
[% t("Koha") | html %]
|
||
[% END %]</title>
|
||
[% INCLUDE 'doc-head-close.inc' %]
|
||
</head>
|
||
|
||
<body id="circ_waitingreserves" class="circ">
|
||
[% WRAPPER 'header.inc' %]
|
||
[% INCLUDE 'circ-search.inc' %]
|
||
[% END %]
|
||
|
||
[% WRAPPER 'sub-header.inc' %]
|
||
[% WRAPPER breadcrumbs %]
|
||
[% WRAPPER breadcrumb_item %]
|
||
<a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
|
||
[% END %]
|
||
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
||
<span>Holds awaiting pickup</span>
|
||
[% END %]
|
||
[% END #/ WRAPPER breadcrumbs %]
|
||
[% END #/ WRAPPER sub-header.inc %]
|
||
|
||
<div class="main container-fluid">
|
||
<div class="row">
|
||
<div class="col-sm-12">
|
||
<main>
|
||
<div class="row">
|
||
|
||
[% IF Koha.Preference('CircSidebar') %]
|
||
<div class="col-sm-10 col-sm-push-2">
|
||
[% ELSE %]
|
||
<div class="col-sm-12">
|
||
[% END %]
|
||
[% INCLUDE 'messages.inc' %]
|
||
|
||
<h1>Holds awaiting pickup for your library on: [% show_date | $KohaDates %]</h1>
|
||
<h2>
|
||
[% IF ( all_branches_link ) %]
|
||
<span><a href="[% all_branches_link | url %]">
|
||
View all libraries</a></span>
|
||
[% END %]
|
||
</h2>
|
||
[% IF reject_result_error %]
|
||
<div class="error message">
|
||
[% IF reject_result_error.invalid_status %]
|
||
<p>There was a problem rejecting the cancellation request. Cannot reject an already completed cancellation request.</p>
|
||
[% ELSE %]
|
||
<p>Some error occurred while rejecting the cancellation request. Please check the logs</p>
|
||
[% END %]
|
||
</div>
|
||
[% END %]
|
||
[% IF ( cancel_result ) %]
|
||
[% FOREACH cancel_result %]
|
||
[% IF ( messagetransfert ) %]
|
||
<div class="dialog message">
|
||
<h2>This item is on hold for pick-up at [% Branches.GetName( branchname ) | html %]</h2>
|
||
<p><strong>[% nextreservtitle | html %]</strong> is on hold for <strong> [% nextreservsurname | html %], [% nextreservfirstname | html %]</strong>.
|
||
Please retain this item and check it in to process the hold.
|
||
</p>
|
||
<form name="cancelReservewithtransfert" action="waitingreserves.pl#[% tab | html %]" method="post">
|
||
[% INCLUDE 'csrf-token.inc' %]
|
||
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
|
||
</form>
|
||
</div>
|
||
[% END # /IF messagetransfert%]
|
||
[% IF ( waiting ) %]
|
||
<div class="dialog message">
|
||
<h2>This item is on hold for pick-up at your library</h2>
|
||
<p><strong>[% nextreservtitle | html %]</strong> is on hold for <strong>[% nextreservsurname | html %], [% nextreservfirstname | html %]</strong>.
|
||
Please retain this item and check it in to process the hold.
|
||
</p>
|
||
<form name="cancelReservewithwaiting" action="waitingreserves.pl#[% tab | html %]" method="post">
|
||
[% INCLUDE 'csrf-token.inc' %]
|
||
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
|
||
</form>
|
||
</div>
|
||
[% END # /IF waiting %]
|
||
[% END # /FOREACH cancel_result %]
|
||
[% ELSE %]
|
||
[% IF enqueued %]
|
||
<div class="dialog message">
|
||
<p>The job has been enqueued! It will be processed as soon as possible.</p>
|
||
<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>
|
||
</div>
|
||
[% END %]
|
||
|
||
[% WRAPPER tabs id= "resultlist" %]
|
||
[% WRAPPER tabs_nav %]
|
||
[% WRAPPER tab_item tabname= "holdswaiting" bt_active= 1 %]
|
||
<span>Holds waiting:</span> [% reservecount | html %]
|
||
[% END %]
|
||
[% WRAPPER tab_item tabname= "holdsover" %]
|
||
<span>Holds waiting past their expiration date:</span> [% overcount | html %]
|
||
[% END %]
|
||
[% WRAPPER tab_item tabname= "holdscancelled" %]
|
||
<span>Holds with cancellation requests:</span> [% cancel_reqs_count | html %]
|
||
[% END %]
|
||
[% END # /WRAPPER tabs_nav %]
|
||
|
||
[% WRAPPER tab_panels %]
|
||
[% WRAPPER tab_panel tabname="holdswaiting" bt_active= 1 %]
|
||
[% IF ( reserveloop ) %]
|
||
<div id="toolbar" class="btn-toolbar">
|
||
<button class="btn cancel_selected_holds" data-bulk="true"></button>
|
||
</div>
|
||
[% INCLUDE waiting_holds.inc table_name='holdst' reserveloop=reserveloop tab='holdwaiting' %]
|
||
[% ELSE %]
|
||
<div class="dialog message">No holds found.</div>
|
||
[% END %]
|
||
[% END # /tab_panel#holdswaiting %]
|
||
|
||
[% WRAPPER tab_panel tabname="holdsover" %]
|
||
[% IF ( overloop ) %]
|
||
<div id="toolbar" class="btn-toolbar">
|
||
<button class="btn cancel_selected_holds" data-bulk="true"></button>
|
||
<div class="btn-group">
|
||
<form name="cancelAllReserve" action="waitingreserves.pl" method="post">
|
||
[% INCLUDE 'csrf-token.inc' %]
|
||
<input type="hidden" name="cancelall" value="1" />
|
||
<input type="hidden" name="allbranches" value="[% allbranches | html %]" />
|
||
<input type="hidden" name="tab" value="holdsover">
|
||
[% IF TransferWhenCancelAllWaitingHolds %]
|
||
<input type="submit" class="btn btn-primary" value="Cancel and transfer all" />
|
||
[% ELSE %]
|
||
<input type="submit" class="btn btn-primary" value="Cancel all" />
|
||
[% END %]
|
||
</form>
|
||
</div>
|
||
</div>
|
||
[% UNLESS TransferWhenCancelAllWaitingHolds %]
|
||
<div class="hint">Only items that need not be transferred will be cancelled (TransferWhenCancelAllWaitingHolds syspref)</div>
|
||
[% END %]
|
||
[% INCLUDE waiting_holds.inc table_name='holdso' reserveloop=overloop tab='holdsover' %]
|
||
[% ELSE %]
|
||
<div class="dialog message">No holds found.</div>
|
||
[% END # /IF( overloop ) %]
|
||
[% END # /tab_panel#holdsover %]
|
||
|
||
[% WRAPPER tab_panel tabname="holdscancelled" %]
|
||
[% IF cancel_reqs_count %]
|
||
<div id="toolbar" class="btn-toolbar">
|
||
<button class="btn cancel_selected_holds" data-bulk="true"></button>
|
||
</div>
|
||
[% INCLUDE waiting_holds.inc select_column='1' table_name='holdscr' reserveloop=cancel_reqs tab='holdscr' %]
|
||
[% ELSE %]
|
||
<div class="dialog message">No holds found.</div>
|
||
[% END %]
|
||
[% END # /tab_panel#holdscancelled %]
|
||
[% END # /WRAPPER tab_panels %]
|
||
[% END # /WRAPPER tabs %]
|
||
|
||
[% END # /IF ( cancel_result ) %]
|
||
</div> <!-- /.col-sm-10.col-sm-push-2 -->
|
||
|
||
[% IF Koha.Preference('CircSidebar') %]
|
||
<div class="col-sm-2 col-sm-pull-10">
|
||
<aside>
|
||
[% INCLUDE 'circ-nav.inc' %]
|
||
</aside>
|
||
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
|
||
[% END %]
|
||
</div> <!-- /.row -->
|
||
|
||
</main>
|
||
</div> <!-- /.col-sm-12 -->
|
||
</div> <!-- /.row -->
|
||
|
||
<div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||
<div class="modal-dialog" role="document">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
|
||
<h3>Confirm deletion</h3>
|
||
</div>
|
||
|
||
<div class="modal-body">
|
||
<p>Are you sure you want to cancel this hold?</p>
|
||
|
||
<fieldset class="action">
|
||
[% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
|
||
[% IF hold_cancellation.count %]
|
||
<label for="cancellation-reason">Cancellation reason: </label>
|
||
<select class="cancellation-reason" name="modal-cancellation-reason" id="modal-cancellation-reason">
|
||
<option value="">No reason given</option>
|
||
[% FOREACH reason IN hold_cancellation %]
|
||
<option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
|
||
[% END %]
|
||
</select>
|
||
[% END %]
|
||
</fieldset> <!-- /.action -->
|
||
</div> <!-- /.modal-body -->
|
||
|
||
<div class="modal-footer">
|
||
<button id="cancelModalConfirmBtn" type="button" class="btn btn-danger">Confirm cancellation</button>
|
||
<a href="#" data-dismiss="modal">Cancel</a>
|
||
</div> <!-- /.modal-footer -->
|
||
</div> <!-- /.modal-content -->
|
||
</div> <!-- /.modal-dialog -->
|
||
</div> <!-- /#cancelModal -->
|
||
|
||
[% MACRO jsinclude BLOCK %]
|
||
[% INCLUDE 'datatables.inc' %]
|
||
[% INCLUDE 'columns_settings.inc' %]
|
||
<script>
|
||
var MSG_CANCEL_SELECTED = _("Cancel selected (%s)");
|
||
var holdst_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdst', 'json' ) | $raw %];
|
||
var holdso_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdso', 'json' ) | $raw %];
|
||
var holdscr_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdscr', 'json' ) | $raw %];
|
||
|
||
$(document).ready(function() {
|
||
|
||
KohaTable("holdst", {
|
||
"pagingType": "full",
|
||
"order": [[1, 'asc']]
|
||
}, holdst_table_settings);
|
||
|
||
KohaTable("holdso", {
|
||
"pagingType": "full",
|
||
"order": [[1, 'asc']]
|
||
}, holdso_table_settings);
|
||
|
||
KohaTable("holdscr", {
|
||
"pagingType": "full",
|
||
"order": [[1, 'asc']]
|
||
}, holdscr_table_settings);
|
||
|
||
let cancel_link;
|
||
|
||
$("#cancelModalConfirmBtn").on("click",function(e) {
|
||
var ids = cancel_link.data('ids');
|
||
localStorage.selectedWaitingHolds = JSON.stringify(JSON.parse(localStorage.selectedWaitingHolds).filter(id => !ids.includes(id)));
|
||
let link = `waitingreserves.pl?cancelBulk=1&ids=${ids.join(',')}`;
|
||
let reason = $("#modal-cancellation-reason").val();
|
||
if ( reason ) {
|
||
link += "&cancellation-reason=" + reason
|
||
}
|
||
window.location.href = link;
|
||
return false;
|
||
});
|
||
|
||
if(!localStorage.selectedWaitingHolds || document.referrer.replace(/\?.*/, '') !== document.location.origin+document.location.pathname) {
|
||
localStorage.selectedWaitingHolds = '[]';
|
||
}
|
||
|
||
try {
|
||
JSON.parse(localStorage.selectedWaitingHolds);
|
||
} catch(e) {
|
||
localStorage.selectedWaitingHolds = '[]';
|
||
}
|
||
|
||
$('.holds_table .select_hold').each(function() {
|
||
if(JSON.parse(localStorage.selectedWaitingHolds).includes($(this).data('id'))) {
|
||
$(this).prop('checked', true);
|
||
}
|
||
});
|
||
|
||
$('.holds_table').each(function() {
|
||
var table = $(this);
|
||
var parent = table.parents('.tab-pane');
|
||
|
||
$('.holds_table .select_hold_all', parent).each(function() {
|
||
var count = $('.select_hold:not(:checked)', table).length;
|
||
$('.select_hold_all', table).prop('checked', !count);
|
||
});
|
||
|
||
$('.cancel_selected_holds', parent).html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked', parent).length));
|
||
|
||
$('.holds_table .select_hold_all', parent).click(function() {
|
||
var count = $('.select_hold:checked', table).length;
|
||
$('.select_hold', table).prop('checked', !count);
|
||
$(this).prop('checked', !count);
|
||
$('.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));
|
||
localStorage.selectedWaitingHolds = JSON.stringify($('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')));
|
||
});
|
||
|
||
$('.holds_table .select_hold', parent).click(function() {
|
||
var count = $('.select_hold:not(:checked)', table).length;
|
||
$('.select_hold_all', table).prop('checked', !count);
|
||
$('.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));
|
||
localStorage.selectedWaitingHolds = JSON.stringify($('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')));
|
||
});
|
||
|
||
$('.cancel_selected_holds', parent).click(function(e) {
|
||
e.preventDefault();
|
||
if($('.select_hold:checked', table).length) {
|
||
cancel_link = $(this);
|
||
$('#cancelModal').modal();
|
||
}
|
||
return false;
|
||
});
|
||
});
|
||
|
||
var activeTab = localStorage.getItem("waitingreserves_activetab");
|
||
if( activeTab ){
|
||
$("div#resultlist li:eq(" + activeTab + ") a").tab("show");
|
||
}
|
||
$("div#resultlist a[data-toggle='tab']").on("shown.bs.tab", function (e) {
|
||
var thisTab = $(e.target).parent();
|
||
var activeTab = thisTab.index();
|
||
localStorage.setItem("waitingreserves_activetab", activeTab );
|
||
});
|
||
|
||
});
|
||
</script>
|
||
[% END %]
|
||
|
||
[% INCLUDE 'intranet-bottom.inc' %]
|