Koha/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt
Jonathan Druart 1473575317 Bug 30603: Fix other occurrences
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-05-10 23:09:09 -10:00

269 lines
12 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE KohaDates %]
[% USE Branches %]
[% USE TablesSettings %]
[% USE AuthorisedValues %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Holds awaiting pickup &rsaquo; Circulation &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="circ_waitingreserves" class="circ">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'circ-search.inc' %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
</li>
<li>
<a href="#" aria-current="page">Holds awaiting pickup</a>
</li>
</ol>
</nav>
<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 %]
<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 ( 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">
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
</form>
</div>
[% END %]
[% 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">
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
</form>
</div>
[% END %]
[% END %]
[% 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 %]
<div id="resultlist" class="toptabs">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#holdswaiting" aria-controls="holdswaiting" role="tab" data-toggle="tab">Holds waiting: [% reservecount | html %]</a></li>
<li role="presentation">
<a href="#holdsover" aria-controls="holdsover" role="tab" data-toggle="tab">
Holds waiting over [% Koha.Preference('ReservesMaxPickUpDelay') | html %] days: [% overcount | html %]
</a>
</li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="holdswaiting">
[% IF ( reserveloop ) %]
<div id="toolbar" class="btn-toolbar">
<button class="cancel_selected_holds" data-bulk="true"></button>
</div>
[% INCLUDE waiting_holds.inc select_column='1' table_name='holdst' reserveloop=reserveloop tab='holdwaiting' %]
[% ELSE %]
<div class="dialog message">No holds found.</div>
[% END %]
</div>
<div role="tabpanel" class="tab-pane" id="holdsover">
[% IF ( ReservesMaxPickUpDelay ) %]<p>Holds listed here have been awaiting pickup for more than [% ReservesMaxPickUpDelay | html %] days.</p>[% END %]
[% IF ( overloop ) %]
<span id="holdsover-cancel-all">
<button class="cancel_selected_holds" data-bulk="true"></button>
<form name="cancelAllReserve" action="waitingreserves.pl" method="post">
<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" value="Cancel and Transfer all" />
[% ELSE %]
<input type="submit" value="Cancel all" />
[% END %]
</form>
[% UNLESS TransferWhenCancelAllWaitingHolds %]
Only items that need not be transferred will be cancelled (TransferWhenCancelAllWaitingHolds syspref)
[% END %]
</span>
[% INCLUDE waiting_holds.inc select_column='1' table_name='holdso' reserveloop=overloop tab='holdsover' %]
[% ELSE %]
<div class="dialog message">No holds found.</div>
[% END %]
</div>
</div>
[% END %]
[% IF Koha.Preference('CircSidebar') %]
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'circ-nav.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% END %]
</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>
</div>
<div class="modal-footer">
<button id="cancelModalConfirmBtn" type="button" class="btn btn-danger">Confirm cancellation</button>
<a href="#" data-dismiss="modal">Cancel</a>
</div>
</div>
</div>
</div>
[% 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 %];
$(document).ready(function() {
KohaTable("holdst", {
"sPaginationType": "full",
"order": [[1, 'asc']]
}, holdst_table_settings);
KohaTable("holdso", {
"sPaginationType": "full",
"order": [[1, 'asc']]
}, holdso_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&amp;ids=${ids.join(',')}`;
let reason = $("#modal-cancellation-reason").val();
if ( reason ) {
link += "&amp;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;
});
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]