Koha/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt
Aleisha Amohia 4e722eda45 Bug 17698: (follow-up) Changing to Koha Objects style, adding circ sidebar
Marcel, can you please have a look at this patch. I tried to implement
the change
my @notes = $schema->resultset('Issue')->search({ 'me.note' => { '!=', undef } }, { prefetch => [ 'borrower', { item => 'biblionumber' } ] });
to
my @notes = Koha::Checkouts->search({ 'me.note' => { '!=', undef } }, { prefetch => [ 'borrower', { item => 'biblionumber' } ] });
but am having problems on the template side. I can access the item and
biblio information about the issue, but not the borrower information,
even though the query is definitely pulling it correctly. Any
suggestions or ideas as to why this breaks?

This patch also adds the implementation of the circSidebar.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-07-23 15:23:41 +00:00

178 lines
8.3 KiB
Text

[% USE Koha %]
[% USE KohaDates %]
[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Home &rsaquo; Circulation &rsaquo; Checkout Notes</title>
[% INCLUDE 'doc-head-close.inc' %]
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$("#notestable").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "aTargets": [ 0, -1 ], "bSearchable": false, "bSortable": false },
],
"sPaginationType": "four_button"
}));
$(".SelectAll").on("click", function(){
$("input[name='issue_ids'][type='checkbox']").prop("checked", true);
$(".btn-sm").prop("disabled", false);
});
$(".ClearAll").on("click", function(){
$("input[name='issue_ids'][type='checkbox']").prop("checked", false);
$(".btn-sm").prop("disabled", true);
});
$("#error").hide();
$("input[type='checkbox']").click(function(event){
if ( $("input[type='checkbox']").is(":checked") ) {
$(".btn-sm").prop("disabled", false);
} else {
$(".btn-sm").prop("disabled", true);
}
});
$(".btn-xs").click(function(event){
event.preventDefault(); // prevent form submission
var $action = $(this).attr("name");
var $issue_id = $(this).data('issue_id');
var ajaxData = {
'action': $action,
'issue_id': $issue_id,
};
$.ajax({
url: '/cgi-bin/koha/svc/checkout_notes/',
type: 'POST',
dataType: 'json',
data: ajaxData,
})
.done(function(data){
if (data.status == 'success'){
if ( $action == 'notseen' ){
$("#status_" + $issue_id).text("Not seen");
$(event.target).siblings(".seen").prop("disabled", false);
$(event.target).prop("disabled", true);
} else {
$("#status_" + $issue_id).text("Seen");
$(event.target).siblings(".notseen").prop("disabled", false);
$(event.target).prop("disabled", true);
}
} else {
$("#error").text(_("Unable to change status of note."));
$("#error").show();
}
});
});
});
//]]>
</script>
[% INCLUDE 'calendar.inc' %]
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
</head>
[% INCLUDE 'header.inc' %]
[% INCLUDE 'circ-search.inc' %]
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
<a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo;
Checkout notes
</div>
[% IF Koha.Preference('CircSidebar') %]<div id="doc3" class="yui-t2">[% ELSE %]<div id="doc" class="yui-t7">[% END %]
<div id="bd">
<div id="yui-main">
[% IF Koha.Preference('CircSidebar') %]<div class="yui-b">[% END %]
<h1>Checkout notes</h1>
<div class="dialog alert" id="error"></div>
[% IF ( selected_count ) %]
<div class="dialog message">
[% IF ( action == 'seen' ) %]
[% selected_count %] note(s) marked as seen.
[% ELSIF ( action == 'notseen' ) %]
[% selected_count %] note(s) marked as not seen.
[% ELSE %]
Failed to change the status of [% selected_count %] item(s).
[% END %]
</div>
<a href="/cgi-bin/koha/circ/checkout-notes.pl" class="btn btn-default btn-sm"><i class="fa fa-left"></i> Return to checkout notes</a>
[% ELSE %]
[% IF ( notes ) %]
<fieldset class="action">
<a class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
</fieldset>
<form id="mark_selected" method="post" action="/cgi-bin/koha/circ/checkout-notes.pl">
<table id="notestable">
<thead>
<tr>
<th>&nbsp;</th>
<th>Title</th>
<th>Note</th>
<th>Date</th>
<th>Set by</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
[% FOREACH note IN notes %]
<tr>
<td><input type="checkbox" name="issue_ids" value="[% note.issue_id %]"></td>
<td>[% note.item.biblio.title %] - [% note.item.biblio.author %] (<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% note.item.biblionumber %]">[% note.item.barcode %]</a>)</td>
<td>[% note.note %]</td>
<td>[% note.notedate | $KohaDates %]</td>
<td>[% IF note.borrower.title %][% note.borrower.title [% END %][% note.borrower.firstname %] [% note.borrower.surname %] (<a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% note.borrower.borrowernumber %]">[% note.borrower.cardnumber %]</a>)</td>
<td>
[% IF ( note.noteseen == 0 ) %]
<span id="status_[% note.issue_id %]">Not seen</span>
[% ELSIF ( note.noteseen == 1 ) %]
<span id="status_[% note.issue_id %]">Seen</span>
[% END %]
</td>
<td class="actions">
[% IF ( note.noteseen == 1 ) %]
<button name="seen" data-issue_id="[% note.issue_id %]" class="seen btn btn-default btn-xs" disabled="disabled"><i class="fa fa-eye"></i> Mark seen</button> <button name="notseen" data-issue_id="[% note.issue_id %]" class="notseen btn btn-default btn-xs"><i class="fa fa-eye-slash"></i> Mark not seen</button>
[% ELSIF ( note.noteseen == 0 ) %]
<button name="seen" data-issue_id="[% note.issue_id %]" class="seen btn btn-default btn-xs"><i class="fa fa-eye"></i> Mark seen</button> <button name="notseen" data-issue_id="[% note.issue_id %]" class="notseen btn btn-default btn-xs" disabled="disabled"><i class="fa fa-eye-slash"></i> Mark not seen</button>
[% END %]
</td>
</tr>
[% END %]
</tbody>
</table>
<fieldset class="action">
<button type="submit" class="btn btn-default btn-sm" name="mark_selected-seen" value="seen" disabled="disabled"><i class="fa fa-eye"></i> Mark seen</button>
<button type="submit" class="btn btn-default btn-sm" name="mark_selected-notseen" value="notseen" disabled="disabled"><i class="fa fa-eye-slash"></i> Mark not seen</button>
</fieldset>
</form>
[% END %] <!-- notes -->
[% END %] <!-- selected_count -->
</div> <!-- yui-imain -->
[% IF Koha.Preference('CircSidebar') %]
</div>
<div class="yui-b noprint">
[% INCLUDE 'circ-nav.inc' %]
</div>
[% END %]
</div> <!-- bd -->
</div> <!-- doc3 -->
[% INCLUDE 'intranet-bottom.inc' %]