|
Lines 14-20
Link Here
|
| 14 |
[% INCLUDE 'doc-head-open.inc' %] |
14 |
[% INCLUDE 'doc-head-open.inc' %] |
| 15 |
<title>Your library home › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title> |
15 |
<title>Your library home › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title> |
| 16 |
[% INCLUDE 'doc-head-close.inc' %] |
16 |
[% INCLUDE 'doc-head-close.inc' %] |
| 17 |
[% BLOCK cssinclude %][% END %] |
17 |
[% BLOCK cssinclude %] |
|
|
18 |
[% FILTER collapse %] |
| 19 |
<style> |
| 20 |
#addNote { |
| 21 |
width: 100%; |
| 22 |
} |
| 23 |
.checkout_note { |
| 24 |
border-radius: 5px; |
| 25 |
border: 1px dashed #999; |
| 26 |
padding: .5em; |
| 27 |
} |
| 28 |
</style> |
| 29 |
[% END %] |
| 30 |
[% END %] |
| 18 |
</head> |
31 |
</head> |
| 19 |
[% INCLUDE 'bodytag.inc' bodyid='opac-user' bodyclass='scrollto' %] |
32 |
[% INCLUDE 'bodytag.inc' bodyid='opac-user' bodyclass='scrollto' %] |
| 20 |
[% INCLUDE 'masthead.inc' %] |
33 |
[% INCLUDE 'masthead.inc' %] |
|
Lines 440-449
Link Here
|
| 440 |
[% END %] |
453 |
[% END %] |
| 441 |
[% IF ( Koha.Preference('AllowCheckoutNotes') ) %] |
454 |
[% IF ( Koha.Preference('AllowCheckoutNotes') ) %] |
| 442 |
<td class="note"> |
455 |
<td class="note"> |
| 443 |
<input type="text" name="note" data-issue_id="[% ISSUE.issue_id | html %]" data-origvalue="[% ISSUE.note | html %]" value="[% ISSUE.note | html %]" maxlength="255" readonly> |
456 |
[% IF ( ISSUE.note ) -%] |
| 444 |
<div class="hint">255 characters maximum</div> |
457 |
[% SET note_action = "Edit note" %] |
| 445 |
<button type="button" class="btn btn-primary btn-sm js_submitnote" id="save_[% ISSUE.issue_id | html %]" style="display:none;">Submit note</button> |
458 |
[% ELSE -%] |
| 446 |
<button type="button" class="btn btn-primary btn-sm nonjs_submitnote" href="/cgi-bin/koha/opac-issue-note.pl?issue_id=[% ISSUE.issue_id | url %]">Edit / Create note</button> |
459 |
[% SET note_action = "Add note" %] |
|
|
460 |
[% END %] |
| 461 |
<a id="save_[% ISSUE.issue_id | html %]" href="/cgi-bin/koha/opac-issue-note.pl?issue_id=[% ISSUE.issue_id | html %]" class="btn btn-primary btn-sm btn-add-note" data-title="[% ISSUE.title | html %] [% FOREACH subtitle IN ISSUE.subtitle.split(' \| ') %][% IF Koha.Preference('marcflavour')=='UNIMARC' %],[% END %][% subtitle | html %][% END %]" data-issueid="[% ISSUE.issue_id | html %]" id="save_[% ISSUE.issue_id | html %]" data-note="[% ISSUE.note | html %]" data-origvalue="[% ISSUE.note | html %]"> |
| 462 |
[% note_action | html %] |
| 463 |
</button> |
| 464 |
<input type="hidden" name="note" value="[% ISSUE.note | html %]" data-origvalue="[% ISSUE.note | html %]" /> |
| 447 |
</td> |
465 |
</td> |
| 448 |
[% END %] |
466 |
[% END %] |
| 449 |
</tr> |
467 |
</tr> |
|
Lines 475-480
Link Here
|
| 475 |
<tr><td>You have nothing checked out</td></tr> |
493 |
<tr><td>You have nothing checked out</td></tr> |
| 476 |
</table> |
494 |
</table> |
| 477 |
[% END # IF issues_count %] |
495 |
[% END # IF issues_count %] |
|
|
496 |
|
| 497 |
<!-- Add note modal --> |
| 498 |
<div class="modal" id="addNoteModal" tabindex="-1" aria-labelledby="addNoteLabel" aria-hidden="true"> |
| 499 |
<div class="modal-dialog"> |
| 500 |
<form action="#" id="addNoteForm"> |
| 501 |
<div class="modal-content"> |
| 502 |
<div class="modal-header"> |
| 503 |
<h5 class="modal-title" id="addNoteLabel">Report a problem</h5> |
| 504 |
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"> |
| 505 |
<span aria-hidden="true">×</span> |
| 506 |
</button> |
| 507 |
</div> |
| 508 |
<div class="modal-body" id="addNoteBody"> |
| 509 |
<h6 id="addNoteTitle"></h6> |
| 510 |
<input type="hidden" id="addNoteIssueId" name="issue_id" value="" /> |
| 511 |
<textarea name="note" id="addNote" rows="4"></textarea> |
| 512 |
<div class="hint">Your note will be shown to the librarian when the item is checked in.</div> |
| 513 |
</div> |
| 514 |
<div class="modal-footer"> |
| 515 |
<button type="submit" class="btn btn-primary">Submit note</button> |
| 516 |
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> |
| 517 |
</div> |
| 518 |
</div> |
| 519 |
</form> |
| 520 |
</div> |
| 521 |
</div> |
| 522 |
|
| 478 |
</div> <!-- / .opac-user-checkouts --> |
523 |
</div> <!-- / .opac-user-checkouts --> |
| 479 |
|
524 |
|
| 480 |
[% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %] |
525 |
[% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %] |
|
Lines 981-1038
Link Here
|
| 981 |
} |
1026 |
} |
| 982 |
}); |
1027 |
}); |
| 983 |
|
1028 |
|
| 984 |
$(".js_submitnote").click(function(e){ |
|
|
| 985 |
var $self = $(this); |
| 986 |
var title = $(this).parent().parent().find('a.title')[0].outerHTML; |
| 987 |
var $noteinput = $(this).siblings('input[name="note"]').first(); |
| 988 |
|
| 989 |
var ajaxData = { |
| 990 |
'action': 'issuenote', |
| 991 |
'issue_id': $noteinput.data('issue_id'), |
| 992 |
'note': $noteinput.val(), |
| 993 |
}; |
| 994 |
|
| 995 |
$.ajax({ |
| 996 |
url: '/cgi-bin/koha/svc/checkout_notes/', |
| 997 |
type: 'POST', |
| 998 |
dataType: 'json', |
| 999 |
data: ajaxData, |
| 1000 |
}) |
| 1001 |
.done(function(data) { |
| 1002 |
var message = ""; |
| 1003 |
if(data.status == 'saved') { |
| 1004 |
$("#notesaved").removeClass("alert-error"); |
| 1005 |
$("#notesaved").addClass("alert-info"); |
| 1006 |
$noteinput.data('origvalue', data.note); |
| 1007 |
$noteinput.val(data.note); |
| 1008 |
message = "<p>" + _("Your note about %s has been saved and sent to the library.").format(title) + "</p>"; |
| 1009 |
message += "<p style=\"font-style:italic;\">" + data.note + "</p>"; |
| 1010 |
$self.hide(); |
| 1011 |
} else if(data.status == 'removed') { |
| 1012 |
$("#notesaved").removeClass("alert-error"); |
| 1013 |
$("#notesaved").addClass("alert-info"); |
| 1014 |
$noteinput.data('origvalue', ""); |
| 1015 |
$noteinput.val(""); |
| 1016 |
message = "<p>" + _("Your note about %s was removed.").format(title) + "</p>"; |
| 1017 |
$self.hide(); |
| 1018 |
} else { |
| 1019 |
$("#notesaved").removeClass("alert-info"); |
| 1020 |
$("#notesaved").addClass("alert-error"); |
| 1021 |
message = "<p>" + _("Your note about %s could not be saved.").format(title) + "</p>"; |
| 1022 |
message += "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>"; |
| 1023 |
} |
| 1024 |
$("#notesaved").html(message); |
| 1025 |
}) |
| 1026 |
.fail(function(data) { |
| 1027 |
$("#notesaved").removeClass("alert-info"); |
| 1028 |
$("#notesaved").addClass("alert-error"); |
| 1029 |
var message = "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>"; |
| 1030 |
$("#notesaved").html(message); |
| 1031 |
}) |
| 1032 |
.always(function() { |
| 1033 |
$("#notesaved").show(); |
| 1034 |
}); |
| 1035 |
}); |
| 1036 |
[% END %] |
1029 |
[% END %] |
| 1037 |
|
1030 |
|
| 1038 |
$(".suspend-until").datepicker({ |
1031 |
$(".suspend-until").datepicker({ |
|
Lines 1057-1064
Link Here
|
| 1057 |
$('#opac-user-clubs').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrowernumber | html %]'); |
1050 |
$('#opac-user-clubs').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrowernumber | html %]'); |
| 1058 |
}); |
1051 |
}); |
| 1059 |
} |
1052 |
} |
|
|
1053 |
|
| 1054 |
$("body").on("click", ".btn-add-note", function(e){ |
| 1055 |
e.preventDefault(); |
| 1056 |
var title = $(this).data("title"); |
| 1057 |
var issue_id = $(this).data("issueid"); |
| 1058 |
var note = $(this).data("note"); |
| 1059 |
var origvalue = $(this).data("origvalue"); |
| 1060 |
$("#addNote").val( note ); |
| 1061 |
$("#addNoteIssueId").val( issue_id ); |
| 1062 |
$("#addNoteTitle").text( title ); |
| 1063 |
$("#addNoteModal").modal("show"); |
| 1064 |
}); |
| 1065 |
|
| 1066 |
$("#addNoteForm").on("submit", function(e){ |
| 1067 |
e.preventDefault(); |
| 1068 |
var title = $("#addNoteTitle").text(); |
| 1069 |
var issue_id = $("#addNoteIssueId").val(); |
| 1070 |
var note = $("#addNote").val(); |
| 1071 |
submitNote( title, issue_id, note ); |
| 1072 |
}); |
| 1073 |
|
| 1074 |
$("#addNoteModal").on("hidden.bs.modal", function(){ |
| 1075 |
$("#addNoteTitle").text(""); |
| 1076 |
$("#addNote").val(""); |
| 1077 |
}); |
| 1060 |
}); |
1078 |
}); |
| 1061 |
|
1079 |
|
|
|
1080 |
function submitNote( title, issue_id, note ){ |
| 1081 |
var self = $("#addNoteModal"); |
| 1082 |
var noteinput = $("#save_" + issue_id ); |
| 1083 |
|
| 1084 |
var ajaxData = { |
| 1085 |
'action': 'issuenote', |
| 1086 |
'issue_id': issue_id, |
| 1087 |
'note': note |
| 1088 |
}; |
| 1089 |
|
| 1090 |
$.ajax({ |
| 1091 |
url: '/cgi-bin/koha/svc/checkout_notes/', |
| 1092 |
type: 'POST', |
| 1093 |
dataType: 'json', |
| 1094 |
data: ajaxData, |
| 1095 |
}) |
| 1096 |
.done(function(data) { |
| 1097 |
var message = ""; |
| 1098 |
if(data.status == 'saved') { |
| 1099 |
$("#notesaved").removeClass("alert-error"); |
| 1100 |
$("#notesaved").addClass("alert-info"); |
| 1101 |
noteinput.data('origvalue', data.note) |
| 1102 |
.data('note', data.note) |
| 1103 |
.text( _("Edit note" ) ); |
| 1104 |
message = "<p>" + _("Your note about %s has been saved and sent to the library.").format( em(title) ) + "</p>"; |
| 1105 |
message += "<p class=\"checkout_note\">" + data.note; |
| 1106 |
message += "<a href=\"/cgi-bin/koha/opac-issue-note.pl?issue_id=" + issue_id + "\" class=\"btn btn-link btn-sm btn-add-note\" data-title=\"" + title + "\" data-issueid=\"" + issue_id + "\" data-note=\"" + data.note + "\" data-origvalue=\"" + data.note + "\"><i class=\"fa fa-pencil\" aria-hidden=\"true\"></i> " + _("Edit note") + "</a>"; |
| 1107 |
message += "</p>"; |
| 1108 |
} else if(data.status == 'removed') { |
| 1109 |
$("#notesaved").removeClass("alert-error"); |
| 1110 |
$("#notesaved").addClass("alert-info"); |
| 1111 |
noteinput.data('origvalue', "") |
| 1112 |
.data("note", "") |
| 1113 |
.text( _("Add note") ); |
| 1114 |
message = "<p>" + _("Your note about %s was removed.").format( em(title) ) + "</p>"; |
| 1115 |
} else { |
| 1116 |
$("#notesaved").removeClass("alert-info"); |
| 1117 |
$("#notesaved").addClass("alert-error"); |
| 1118 |
message = "<p>" + _("Your note about %s could not be saved.").format( em(title) ) + "</p>"; |
| 1119 |
noteinput.text( _("Add note") ); |
| 1120 |
message += "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>"; |
| 1121 |
} |
| 1122 |
self.modal("hide"); |
| 1123 |
$("#notesaved").html(message); |
| 1124 |
}) |
| 1125 |
.fail(function(data) { |
| 1126 |
$("#notesaved").removeClass("alert-info"); |
| 1127 |
$("#notesaved").addClass("alert-error"); |
| 1128 |
var message = "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>"; |
| 1129 |
$("#notesaved").html(message); |
| 1130 |
}) |
| 1131 |
.always(function() { |
| 1132 |
$("#notesaved").show(); |
| 1133 |
}); |
| 1134 |
} |
| 1135 |
|
| 1136 |
function em( title ){ |
| 1137 |
return "<em>" + title + "</em>"; |
| 1138 |
} |
| 1139 |
|
| 1062 |
var borrowernumber = "[% borrowernumber | html %]"; |
1140 |
var borrowernumber = "[% borrowernumber | html %]"; |
| 1063 |
var MSG_YOUR_RATING = _("Your rating: %s, "); |
1141 |
var MSG_YOUR_RATING = _("Your rating: %s, "); |
| 1064 |
var MSG_AVERAGE_RATING = _("Average rating: %s (%s votes)"); |
1142 |
var MSG_AVERAGE_RATING = _("Average rating: %s (%s votes)"); |
| 1065 |
- |
|
|