Owen Leonard
1c38ddf410
This patch modifies the event handler on the individual "Mark seen" / "Mark unseen" buttons in the table of checkout notes. For an event to be successfully attached to a hidden element it must be given a context. To test you should have multiple checkout notes to work with, both seen and unseen. Apply the patch and go to "Checkout notes pending" from the staff client home page. - Navigate to the second "page" of data in the DataTable. - Test the functionality of the "Mark seen" and "Mark unseen" buttons. They should work correctly. Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
212 lines
10 KiB
Text
212 lines
10 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% USE Koha %]
|
|
[% USE KohaDates %]
|
|
[% USE Branches %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Circulation › Checkout notes</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
|
|
<body id="circ_checkout-notes" class="circ">
|
|
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'circ-search.inc' %]
|
|
<div id="breadcrumbs">
|
|
<a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
|
|
<a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> ›
|
|
Checkout notes
|
|
</div>
|
|
|
|
<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-md-12 col-lg-10 col-lg-offset-1">
|
|
[% END %]
|
|
|
|
<h1>Checkout notes</h1>
|
|
|
|
<div class="dialog alert" id="error" style="display:none;"></div>
|
|
|
|
[% IF ( selected_count ) %]
|
|
<div class="dialog message">
|
|
[% IF ( action == 'seen' ) %]
|
|
<span>[% selected_count | html %] note(s) marked as seen.</span>
|
|
[% ELSIF ( action == 'notseen' ) %]
|
|
<span>[% selected_count | html %] note(s) marked as not seen.</span>
|
|
[% ELSE %]
|
|
<span>Failed to change the status of [% selected_count | html %] item(s).</span>
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF ( notes.count ) %]
|
|
<form id="mark_selected" method="post" action="/cgi-bin/koha/circ/checkout-notes.pl">
|
|
<div id="toolbar" class="btn-toolbar">
|
|
<button type="submit" class="btn btn-default markseen" name="mark_selected-seen" value="seen" disabled="disabled"><i class="fa fa-eye"></i> Mark seen</button>
|
|
<button type="submit" class="btn btn-default markseen" name="mark_selected-notseen" value="notseen" disabled="disabled"><i class="fa fa-eye-slash"></i> Mark not seen</button>
|
|
</div>
|
|
|
|
<fieldset class="action" style="cursor:pointer;">
|
|
<a class="SelectAll"><i class="fa fa-check"></i> Select all</a>
|
|
| <a class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
|
|
| <a class="HideSeen"><i class="fa fa-minus-square"></i> Hide seen</a>
|
|
| <a class="ShowAll"><i class="fa fa-bars"></i> Show all</a>
|
|
</fieldset>
|
|
|
|
<table id="notestable">
|
|
<thead>
|
|
<tr>
|
|
<th class="NoSort"> </th>
|
|
<th class="anti-the">Title</th>
|
|
<th>Note</th>
|
|
<th class="title-string">Date</th>
|
|
<th>Set by</th>
|
|
<th>Status</th>
|
|
<th class="NoSort">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH note IN notes %]
|
|
<tr>
|
|
<td><input type="checkbox" name="issue_ids" value="[% note.issue_id | html %]"></td>
|
|
<td>[% note.item.biblio.title | html %] - [% note.item.biblio.author | html %] (<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% note.item.biblionumber | uri %]">[% note.item.barcode | html %]</a>)</td>
|
|
<td>[% note.note | html %]</td>
|
|
<td><span title="[% note.notedate | html %]">[% note.notedate | $KohaDates %]</span></td>
|
|
<td>[% INCLUDE 'patron-title.inc' patron => note.patron hide_patron_infos_if_needed=1 %]</td>
|
|
<td class="seen[% note.noteseen | html %]">
|
|
[% IF ( note.noteseen == 0 ) %]
|
|
<span id="status_[% note.issue_id | html %]">Not seen</span>
|
|
[% ELSIF ( note.noteseen == 1 ) %]
|
|
<span id="status_[% note.issue_id | html %]">Seen</span>
|
|
[% END %]
|
|
</td>
|
|
<td class="actions">
|
|
[% IF ( note.noteseen == 1 ) %]
|
|
<button name="seen" data-issue_id="[% note.issue_id | html %]" 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 | html %]" 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 | html %]" 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 | html %]" 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>
|
|
|
|
</form>
|
|
|
|
[% ELSE %]
|
|
<div class="dialog message">There are currently no checkout notes.</div>
|
|
[% END %] <!-- notes -->
|
|
|
|
[% 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 -->
|
|
[% ELSE %]
|
|
</div> <!-- .col-md-12.col-lg-10.col-lg-offset-1 -->
|
|
[% END %]
|
|
|
|
</div> <!-- /.row -->
|
|
</main>
|
|
</div> <!-- /.col-sm-12 -->
|
|
</div> <!-- /.row -->
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
|
|
[% INCLUDE 'calendar.inc' %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
<script>
|
|
$(document).ready(function(){
|
|
$("#notestable").dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
"order": [[ 1, "asc" ]],
|
|
"aoColumnDefs": [
|
|
{ "orderable": false, "searchable": false, 'targets': [ 'NoSort' ] },
|
|
{ "type": "title-string", "targets" : [ "title-string" ] },
|
|
{ "type": "anti-the", "targets": [ "anti-the" ] }
|
|
],
|
|
"pagingType": "full"
|
|
}));
|
|
|
|
$(".SelectAll").on("click", function(){
|
|
$("input[name='issue_ids'][type='checkbox']").prop("checked", true);
|
|
$(".markseen").prop("disabled", false);
|
|
});
|
|
|
|
$(".ClearAll").on("click", function(){
|
|
$("input[name='issue_ids'][type='checkbox']").prop("checked", false);
|
|
$(".markseen").prop("disabled", true);
|
|
});
|
|
|
|
$(".HideSeen").on("click", function(){
|
|
$(".seen1").parent().hide();
|
|
});
|
|
|
|
$(".ShowAll").on("click", function(){
|
|
$("tr").show();
|
|
});
|
|
|
|
$("#error").hide();
|
|
|
|
$("#notestable").on("change", "input[type='checkbox']", function(){
|
|
if ( $("input[type='checkbox']").is(":checked") ) {
|
|
$(".markseen").prop("disabled", false);
|
|
} else {
|
|
$(".markseen").prop("disabled", true);
|
|
}
|
|
});
|
|
|
|
$("#notestable").on("click", "button.seen, button.notseen", 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).parent().siblings(".seen1").removeClass("seen1").addClass("seen0");
|
|
$(event.target).siblings(".seen").prop("disabled", false);
|
|
$(event.target).prop("disabled", true);
|
|
} else {
|
|
$("#status_" + $issue_id).text(_("Seen"));
|
|
$(event.target).parent().siblings(".seen0").removeClass("seen0").addClass("seen1");
|
|
$(event.target).siblings(".notseen").prop("disabled", false);
|
|
$(event.target).prop("disabled", true);
|
|
}
|
|
} else {
|
|
$("#error").text(_("Unable to change status of note."));
|
|
$("#error").show();
|
|
}
|
|
})
|
|
.error(function(data){
|
|
$("#error").text(_("Unable to change status of note."));
|
|
$("#error").show();
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|