|
Lines 120-125
Using this account is not recommended because some parts of Koha will not functi
Link Here
|
| 120 |
</div> |
120 |
</div> |
| 121 |
[% END # / IF patron_flagged %] |
121 |
[% END # / IF patron_flagged %] |
| 122 |
|
122 |
|
|
|
123 |
<div class="alert alert-info" id="notesaved" style="display:none;"></div> |
| 124 |
|
| 123 |
[% SET OPACMySummaryNote = Koha.Preference('OPACMySummaryNote') %] |
125 |
[% SET OPACMySummaryNote = Koha.Preference('OPACMySummaryNote') %] |
| 124 |
[% IF OPACMySummaryNote %][% OPACMySummaryNote %][% END %] |
126 |
[% IF OPACMySummaryNote %][% OPACMySummaryNote %][% END %] |
| 125 |
|
127 |
|
|
Lines 171-176
Using this account is not recommended because some parts of Koha will not functi
Link Here
|
| 171 |
[% IF ( OPACMySummaryHTML ) %] |
173 |
[% IF ( OPACMySummaryHTML ) %] |
| 172 |
<th class="nosort">Links</th> |
174 |
<th class="nosort">Links</th> |
| 173 |
[% END %] |
175 |
[% END %] |
|
|
176 |
[% IF ( Koha.Preference('AllowIssueNotes') ) %] |
| 177 |
<th class="nosort">Note</th> |
| 178 |
[% END %] |
| 174 |
</tr> |
179 |
</tr> |
| 175 |
</thead> |
180 |
</thead> |
| 176 |
<tbody> |
181 |
<tbody> |
|
Lines 290-295
Using this account is not recommended because some parts of Koha will not functi
Link Here
|
| 290 |
[% IF ( OPACMySummaryHTML ) %] |
295 |
[% IF ( OPACMySummaryHTML ) %] |
| 291 |
<td class="links">[% ISSUE.MySummaryHTML %]</td> |
296 |
<td class="links">[% ISSUE.MySummaryHTML %]</td> |
| 292 |
[% END %] |
297 |
[% END %] |
|
|
298 |
[% IF ( Koha.Preference('AllowIssueNotes') ) %] |
| 299 |
<td class="note"> |
| 300 |
<input type="text" name="note" data-issue_id="[% ISSUE.issue_id %]" data-origvalue="[% ISSUE.note %]" value="[% ISSUE.note %]" readonly> |
| 301 |
<a class="btn" name="js_submitnote" id="save_[% ISSUE.issue_id %]" style="display:none;">Submit note</a> |
| 302 |
<a class="btn" name="nonjs_submitnote" href="/cgi-bin/koha/opac-issue-note.pl?issue_id=[% ISSUE.issue_id | url %]">Edit / Create note</a> |
| 303 |
</td> |
| 304 |
[% END %] |
| 293 |
</tr> |
305 |
</tr> |
| 294 |
[% END # /FOREACH ISSUES %] |
306 |
[% END # /FOREACH ISSUES %] |
| 295 |
</tbody> |
307 |
</tbody> |
|
Lines 894-899
Using this account is not recommended because some parts of Koha will not functi
Link Here
|
| 894 |
[% END %] |
906 |
[% END %] |
| 895 |
[% END %] |
907 |
[% END %] |
| 896 |
|
908 |
|
|
|
909 |
[% IF ( Koha.Preference('AllowIssueNotes') ) %] |
| 910 |
|
| 911 |
/* If JS enabled, show button, otherwise show link to redirect to a page where note can be submitted */ |
| 912 |
$("a[name='nonjs_submitnote']").hide(); |
| 913 |
|
| 914 |
$("input[name='note']").prop('readonly', false); |
| 915 |
$("input[name='note']").keyup(function(e){ |
| 916 |
/* prevent submitting of renewselected form */ |
| 917 |
if(e.which == 13) |
| 918 |
e.preventDefault(); |
| 919 |
|
| 920 |
var $btn_save = $('#save_'+$(this).data('issue_id')); |
| 921 |
var origvalue = $(this).data('origvalue'); |
| 922 |
var value = $(this).val(); |
| 923 |
|
| 924 |
if(origvalue != value) { |
| 925 |
if(origvalue != "") |
| 926 |
$btn_save.text('Submit changes'); |
| 927 |
else |
| 928 |
$btn_save.text('Submit note'); |
| 929 |
$btn_save.show(); |
| 930 |
} else { |
| 931 |
$btn_save.hide(); |
| 932 |
} |
| 933 |
}); |
| 934 |
|
| 935 |
$("a[name='js_submitnote']").click(function(e){ |
| 936 |
var $self = $(this); |
| 937 |
var title = $(this).parent().siblings('.title').html(); |
| 938 |
var $noteinput = $(this).siblings('input[name="note"]').first(); |
| 939 |
|
| 940 |
var ajaxData = { |
| 941 |
'action': 'issuenote', |
| 942 |
'issue_id': $noteinput.data('issue_id'), |
| 943 |
'note': $noteinput.val(), |
| 944 |
}; |
| 945 |
|
| 946 |
$.ajax({ |
| 947 |
url: '/cgi-bin/koha/svc/patron_notes/', |
| 948 |
type: 'POST', |
| 949 |
dataType: 'json', |
| 950 |
data: ajaxData, |
| 951 |
}) |
| 952 |
.done(function(data) { |
| 953 |
var message = ""; |
| 954 |
if(data.status == 'saved') { |
| 955 |
$("#notesaved").removeClass("alert-error"); |
| 956 |
$("#notesaved").addClass("alert-info"); |
| 957 |
$noteinput.data('origvalue', data.note); |
| 958 |
$noteinput.val(data.note); |
| 959 |
message = "<p>Your note about " + title + " has been saved and sent to the library.</p>"; |
| 960 |
$self.hide(); |
| 961 |
} else if(data.status == 'removed') { |
| 962 |
$("#notesaved").removeClass("alert-error"); |
| 963 |
$("#notesaved").addClass("alert-info"); |
| 964 |
$noteinput.data('origvalue', ""); |
| 965 |
$noteinput.val(""); |
| 966 |
message = "<p>Your note about " + title + " was removed.</p>"; |
| 967 |
$self.hide(); |
| 968 |
} else { |
| 969 |
$("#notesaved").removeClass("alert-info"); |
| 970 |
$("#notesaved").addClass("alert-error"); |
| 971 |
message = "<p>Your note about " + title + " could not be saved.</p>" + |
| 972 |
"<p style=\"font-weight:bold;\">" + data.error + "</p>"; |
| 973 |
} |
| 974 |
|
| 975 |
message += "<p style=\"font-style:italic;\">" + data.note + "</p>"; |
| 976 |
$("#notesaved").html(message); |
| 977 |
}) |
| 978 |
.fail(function(data) { |
| 979 |
$("#notesaved").removeClass("alert-info"); |
| 980 |
$("#notesaved").addClass("alert-error"); |
| 981 |
var message = "<p>Your note about " + title + " could not be saved.</p>" + |
| 982 |
"<p style=\"font-weight:bold;\">Ajax request has failed.</p>"; |
| 983 |
$("#notesaved").html(message); |
| 984 |
}) |
| 985 |
.always(function() { |
| 986 |
$("#notesaved").show(); |
| 987 |
}); |
| 988 |
}); |
| 989 |
[% END %] |
| 990 |
|
| 897 |
$( ".suspend-until" ).datepicker({ minDate: 1 }); // Require that "until date" be in the future |
991 |
$( ".suspend-until" ).datepicker({ minDate: 1 }); // Require that "until date" be in the future |
| 898 |
}); |
992 |
}); |
| 899 |
//]]> |
993 |
//]]> |