|
Lines 1062-1239
Link Here
|
| 1062 |
const is_debarred = [% userdebarred ? 1 : 0 | html %]; |
1062 |
const is_debarred = [% userdebarred ? 1 : 0 | html %]; |
| 1063 |
const current_article_requests_size = [% current_article_requests.size || 0 | html %]; |
1063 |
const current_article_requests_size = [% current_article_requests.size || 0 | html %]; |
| 1064 |
</script> |
1064 |
</script> |
| 1065 |
|
|
|
| 1066 |
<script> |
1065 |
<script> |
| 1067 |
var AR_CAPTION_COUNT = _("(%s total)"); |
1066 |
var AR_CAPTION_COUNT = _("(%s total)"); |
| 1068 |
|
1067 |
|
| 1069 |
|
1068 |
function tableInit(tableId) { |
| 1070 |
function tableInit( tableId ){ |
1069 |
if (tableId == "checkoutst") { |
| 1071 |
if( tableId == "checkoutst" ){ |
1070 |
$(".dt-buttons").append('<button type="button" class="dt-button buttons-ical" id="buttons-ics">iCal</button> '); |
| 1072 |
$(".dt-buttons").append("<button type=\"button\" class=\"dt-button buttons-ical\" id=\"buttons-ics\">iCal</button> "); |
1071 |
if (prefs.OpacRenewalAllowed && can_renew && !is_debarred) { |
| 1073 |
if (prefs.OpacRenewalAllowed && can_renew && !is_debarred){ |
1072 |
$(".dt-buttons").append( |
| 1074 |
$(".dt-buttons").append("<button id=\"renewselected_link\" class=\"dt-button buttons-renew\"><i class=\"fa fa-check\" aria-hidden=\"true\"></i> "+_("Renew selected")+"</button> <button id=\"renewall_link\" class=\"dt-button buttons-renewall\"><span class=\"fa-stack\"><i class=\"fa fa-check fa-stack-1x\" aria-hidden=\"true\"></i><i class=\"fa fa-check fa-stack-1x\" aria-hidden=\"true\"></i></span> "+_("Renew all")+"</button>"); |
1073 |
'<button id="renewselected_link" class="dt-button buttons-renew"><i class="fa fa-check" aria-hidden="true"></i> ' + |
|
|
1074 |
_("Renew selected") + |
| 1075 |
'</button> <button id="renewall_link" class="dt-button buttons-renewall"><span class="fa-stack"><i class="fa fa-check fa-stack-1x" aria-hidden="true"></i><i class="fa fa-check fa-stack-1x" aria-hidden="true"></i></span> ' + |
| 1076 |
_("Renew all") + |
| 1077 |
"</button>" |
| 1078 |
); |
| 1075 |
} |
1079 |
} |
| 1076 |
} |
1080 |
} |
| 1077 |
} |
1081 |
} |
| 1078 |
$(document).ready(function(){ |
1082 |
$(document).ready(function () { |
| 1079 |
if (tab){ |
1083 |
if (tab) { |
| 1080 |
$(`#opac-user-views a[href='#${tab}_panel']`).tab("show"); |
1084 |
$(`#opac-user-views a[href='#${tab}_panel']`).tab("show"); |
| 1081 |
} |
1085 |
} |
| 1082 |
if( $("#opac-user-views .tab-pane.active").length < 1 ){ |
1086 |
if ($("#opac-user-views .tab-pane.active").length < 1) { |
| 1083 |
$("#opac-user-views a:first").tab("show"); |
1087 |
$("#opac-user-views a:first").tab("show"); |
| 1084 |
} |
1088 |
} |
| 1085 |
|
1089 |
|
| 1086 |
$('#article-requests-table caption .count').html(AR_CAPTION_COUNT.format(current_article_requests_size)); |
1090 |
$("#article-requests-table caption .count").html(AR_CAPTION_COUNT.format(current_article_requests_size)); |
| 1087 |
|
1091 |
|
| 1088 |
$(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs"); |
1092 |
$(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs"); |
| 1089 |
|
1093 |
|
| 1090 |
$(".btn-delete-hold").on("click", function(e){ |
1094 |
$(".btn-delete-hold").on("click", function (e) { |
| 1091 |
e.preventDefault(); |
1095 |
e.preventDefault(); |
| 1092 |
var hold_title = $(this).data("title"); |
1096 |
var hold_title = $(this).data("title"); |
| 1093 |
var reserve_id = $(this).data("reserve_id"); |
1097 |
var reserve_id = $(this).data("reserve_id"); |
| 1094 |
confirmModal( hold_title, _("Are you sure you want to cancel this hold?"), _("Yes, cancel hold"), _("No, do not cancel hold"), function( result ){ |
1098 |
confirmModal(hold_title, _("Are you sure you want to cancel this hold?"), _("Yes, cancel hold"), _("No, do not cancel hold"), function (result) { |
| 1095 |
if( result ){ |
1099 |
if (result) { |
| 1096 |
$("#delete_hold_" + reserve_id ).submit(); |
1100 |
$("#delete_hold_" + reserve_id).submit(); |
| 1097 |
} |
|
|
| 1098 |
} |
1101 |
} |
| 1099 |
); |
1102 |
}); |
| 1100 |
}); |
1103 |
}); |
| 1101 |
|
1104 |
|
| 1102 |
$(".btn-req-delete-hold").on("click", function(e){ |
1105 |
$(".btn-req-delete-hold").on("click", function (e) { |
| 1103 |
e.preventDefault(); |
1106 |
e.preventDefault(); |
| 1104 |
var hold_title = $(this).data("title"); |
1107 |
var hold_title = $(this).data("title"); |
| 1105 |
var reserve_id = $(this).data("reserve_id"); |
1108 |
var reserve_id = $(this).data("reserve_id"); |
| 1106 |
confirmModal( hold_title, _("Are you sure you want to request cancelling this hold?"), _("Yes"), _("No"), function( result ){ |
1109 |
confirmModal(hold_title, _("Are you sure you want to request cancelling this hold?"), _("Yes"), _("No"), function (result) { |
| 1107 |
if( result ){ |
1110 |
if (result) { |
| 1108 |
$("#req_cancel_hold_" + reserve_id ).submit(); |
1111 |
$("#req_cancel_hold_" + reserve_id).submit(); |
| 1109 |
} |
|
|
| 1110 |
} |
1112 |
} |
| 1111 |
); |
1113 |
}); |
| 1112 |
}); |
1114 |
}); |
| 1113 |
|
1115 |
|
| 1114 |
$("#article-requests-table").on("click", ".btn-delete-article-request", function(e){ |
1116 |
$("#article-requests-table").on("click", ".btn-delete-article-request", function (e) { |
| 1115 |
e.preventDefault(); |
1117 |
e.preventDefault(); |
| 1116 |
var article_request = $(this).data("title"); |
1118 |
var article_request = $(this).data("title"); |
| 1117 |
var article_request_id = $(this).data("article-request_id"); |
1119 |
var article_request_id = $(this).data("article-request_id"); |
| 1118 |
(function(row){ |
1120 |
(function (row) { |
| 1119 |
var doCancel = function( result ){ |
1121 |
var doCancel = function (result) { |
| 1120 |
if( result ){ |
1122 |
if (result) { |
| 1121 |
$.ajax({ |
1123 |
$.ajax({ |
| 1122 |
type: "DELETE", |
1124 |
type: "DELETE", |
| 1123 |
url: `/api/v1/public/patrons/${logged_in_user_borrowernumber}/article_requests/${article_request_id}?cancellation_reason=OPAC`, |
1125 |
url: `/api/v1/public/patrons/${logged_in_user_borrowernumber}/article_requests/${article_request_id}?cancellation_reason=OPAC`, |
| 1124 |
success: function( data ) { |
1126 |
success: function (data) { |
| 1125 |
$("#article_" + article_request_id ).hide({ |
1127 |
$("#article_" + article_request_id).hide({ |
| 1126 |
duration: 'slow', |
1128 |
duration: "slow", |
| 1127 |
complete: function() { |
1129 |
complete: function () { |
| 1128 |
$(this).siblings(".child").hide(); |
1130 |
$(this).siblings(".child").hide(); |
| 1129 |
var ar_tab = $('a[href="#opac-user-article-requests_panel"'); |
1131 |
var ar_tab = $('a[href="#opac-user-article-requests_panel"'); |
| 1130 |
var ar_table = $('#article-requests-table'); |
1132 |
var ar_table = $("#article-requests-table"); |
| 1131 |
var ar_length = $('tbody tr:visible', ar_table).length; |
1133 |
var ar_length = $("tbody tr:visible", ar_table).length; |
| 1132 |
var ar_count = $('caption .count', ar_table); |
1134 |
var ar_count = $("caption .count", ar_table); |
| 1133 |
|
1135 |
|
| 1134 |
ar_tab.html(ar_tab.html().replace(/\(\d+\)/, '('+ar_length+')')); |
1136 |
ar_tab.html(ar_tab.html().replace(/\(\d+\)/, "(" + ar_length + ")")); |
| 1135 |
ar_count.html(AR_CAPTION_COUNT.format(ar_length)); |
1137 |
ar_count.html(AR_CAPTION_COUNT.format(ar_length)); |
| 1136 |
|
1138 |
}, |
| 1137 |
} |
|
|
| 1138 |
}); |
1139 |
}); |
| 1139 |
} |
1140 |
}, |
| 1140 |
}); |
1141 |
}); |
| 1141 |
} |
1142 |
} |
| 1142 |
}; |
1143 |
}; |
| 1143 |
confirmModal( article_request, _("Are you sure you want to cancel this article request?"), _("Yes, cancel article request"), _("No, do not cancel article request"), doCancel); |
1144 |
confirmModal(article_request, _("Are you sure you want to cancel this article request?"), _("Yes, cancel article request"), _("No, do not cancel article request"), doCancel); |
| 1144 |
})($(this)) |
1145 |
})($(this)); |
| 1145 |
}); |
1146 |
}); |
| 1146 |
|
1147 |
|
| 1147 |
/* We initiate this flatpickr instance here so that we can use the variable later */ |
1148 |
/* We initiate this flatpickr instance here so that we can use the variable later */ |
| 1148 |
var suspend_until_date = $("#suspend_untilDate").flatpickr({ |
1149 |
var suspend_until_date = $("#suspend_untilDate").flatpickr({ |
| 1149 |
minDate: "today" |
1150 |
minDate: "today", |
| 1150 |
}); |
1151 |
}); |
| 1151 |
|
1152 |
|
| 1152 |
$(document).on("click", ".suspend_hold", function(e){ |
1153 |
$(document).on("click", ".suspend_hold", function (e) { |
| 1153 |
e.preventDefault(); |
1154 |
e.preventDefault(); |
| 1154 |
var title = $(this).data("title"); |
1155 |
var title = $(this).data("title"); |
| 1155 |
var reserve_id = $(this).data("reserve_id"); |
1156 |
var reserve_id = $(this).data("reserve_id"); |
| 1156 |
$("#suspendHoldReserveId").val( reserve_id ); |
1157 |
$("#suspendHoldReserveId").val(reserve_id); |
| 1157 |
$("#suspendHoldTitle").html( "<em>" + title + "</em>" ); |
1158 |
$("#suspendHoldTitle").html("<em>" + title + "</em>"); |
| 1158 |
$("#suspendHoldModal").modal("show"); |
1159 |
$("#suspendHoldModal").modal("show"); |
| 1159 |
}); |
1160 |
}); |
| 1160 |
|
1161 |
|
| 1161 |
$("#suspendHoldModal").on("hidden.bs.modal", function(){ |
1162 |
$("#suspendHoldModal").on("hidden.bs.modal", function () { |
| 1162 |
$("#suspendHoldTitle").html(""); |
1163 |
$("#suspendHoldTitle").html(""); |
| 1163 |
$("#suspendHoldReserveId").val(""); |
1164 |
$("#suspendHoldReserveId").val(""); |
| 1164 |
suspend_until_date.clear(); |
1165 |
suspend_until_date.clear(); |
| 1165 |
}); |
1166 |
}); |
| 1166 |
|
1167 |
|
| 1167 |
$("#suspend_all_submit").on("click", function(e){ |
1168 |
$("#suspend_all_submit").on("click", function (e) { |
| 1168 |
e.preventDefault(); |
1169 |
e.preventDefault(); |
| 1169 |
var title = _("Are you sure you want to suspend all holds?"); |
1170 |
var title = _("Are you sure you want to suspend all holds?"); |
| 1170 |
var body = _("All holds will be suspended."); |
1171 |
var body = _("All holds will be suspended."); |
| 1171 |
confirmModal( body, title, _("Yes, suspend all holds"), "", function( result ){ |
1172 |
confirmModal(body, title, _("Yes, suspend all holds"), "", function (result) { |
| 1172 |
if( result ){ |
1173 |
if (result) { |
| 1173 |
$("#suspend_all_holds").submit(); |
1174 |
$("#suspend_all_holds").submit(); |
| 1174 |
} |
|
|
| 1175 |
} |
1175 |
} |
| 1176 |
); |
1176 |
}); |
| 1177 |
}); |
1177 |
}); |
| 1178 |
|
1178 |
|
| 1179 |
$("#resume_all_submit").on("click", function(e){ |
1179 |
$("#resume_all_submit").on("click", function (e) { |
| 1180 |
e.preventDefault(); |
1180 |
e.preventDefault(); |
| 1181 |
var title = _("Are you sure you want to resume all suspended holds?"); |
1181 |
var title = _("Are you sure you want to resume all suspended holds?"); |
| 1182 |
var body = _("All holds will resume."); |
1182 |
var body = _("All holds will resume."); |
| 1183 |
confirmModal( body, title, _("Yes, resume all holds"), _("No, do not resume holds"), function( result ){ |
1183 |
confirmModal(body, title, _("Yes, resume all holds"), _("No, do not resume holds"), function (result) { |
| 1184 |
if( result ){ |
1184 |
if (result) { |
| 1185 |
$("#resume_all_holds").submit(); |
1185 |
$("#resume_all_holds").submit(); |
| 1186 |
} |
|
|
| 1187 |
} |
1186 |
} |
| 1188 |
); |
1187 |
}); |
| 1189 |
}); |
1188 |
}); |
| 1190 |
|
1189 |
|
| 1191 |
var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table"); |
1190 |
var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table"); |
| 1192 |
dTables.each(function(){ |
1191 |
dTables.each(function () { |
| 1193 |
var thIndex = $(this).find("th.psort").index(); |
1192 |
var thIndex = $(this).find("th.psort").index(); |
| 1194 |
$(this).on("init.dt", function() { |
1193 |
$(this) |
| 1195 |
tableInit( $(this).attr("id") ); |
1194 |
.on("init.dt", function () { |
|
|
1195 |
tableInit($(this).attr("id")); |
| 1196 |
}) |
1196 |
}) |
| 1197 |
.kohaTable({ |
1197 |
.kohaTable({ |
| 1198 |
order: [[ thIndex, 'asc' ]], |
1198 |
order: [[thIndex, "asc"]], |
| 1199 |
dom: '<"top"<"table_entries"><"table_controls"fB>>t', |
1199 |
dom: '<"top"<"table_entries"><"table_controls"fB>>t', |
| 1200 |
columnDefs: [ |
1200 |
columnDefs: [ |
| 1201 |
{ visible: false, "targets" : [ "hidden" ] }, |
1201 |
{ visible: false, targets: ["hidden"] }, |
| 1202 |
{ className: 'dtr-control', orderable: false, targets: -1 } |
1202 |
{ className: "dtr-control", orderable: false, targets: -1 }, |
| 1203 |
], |
1203 |
], |
| 1204 |
language: { |
1204 |
language: { |
| 1205 |
search: "_INPUT_", |
1205 |
search: "_INPUT_", |
| 1206 |
searchPlaceholder: _("Search") |
1206 |
searchPlaceholder: _("Search"), |
| 1207 |
}, |
|
|
| 1208 |
responsive: { |
| 1209 |
details: { |
| 1210 |
type: 'column', |
| 1211 |
target: -1 |
| 1212 |
} |
| 1213 |
}, |
| 1214 |
buttons: [ |
| 1215 |
/* Override default button set so that we can extend the options of print and csv */ |
| 1216 |
'clearFilter', 'copy', |
| 1217 |
{ |
| 1218 |
extend: "print", |
| 1219 |
exportOptions: { |
| 1220 |
/* Print view should show all columns (even invisible ones) unless they are .no-export */ |
| 1221 |
columns: ":not(.no-export)" |
| 1222 |
} |
| 1223 |
}, |
1207 |
}, |
| 1224 |
{ |
1208 |
responsive: { |
| 1225 |
extend: "csv", |
1209 |
details: { |
| 1226 |
exportOptions: { |
1210 |
type: "column", |
| 1227 |
/* CSV export should include all columns (even invisible ones) unless they are .no-export */ |
1211 |
target: -1, |
| 1228 |
columns: ":not(.no-export)" |
1212 |
}, |
| 1229 |
} |
1213 |
}, |
| 1230 |
} |
1214 |
buttons: [ |
| 1231 |
] |
1215 |
/* Override default button set so that we can extend the options of print and csv */ |
| 1232 |
}); |
1216 |
"clearFilter", |
|
|
1217 |
"copy", |
| 1218 |
{ |
| 1219 |
extend: "print", |
| 1220 |
exportOptions: { |
| 1221 |
/* Print view should show all columns (even invisible ones) unless they are .no-export */ |
| 1222 |
columns: ":not(.no-export)", |
| 1223 |
}, |
| 1224 |
}, |
| 1225 |
{ |
| 1226 |
extend: "csv", |
| 1227 |
exportOptions: { |
| 1228 |
/* CSV export should include all columns (even invisible ones) unless they are .no-export */ |
| 1229 |
columns: ":not(.no-export)", |
| 1230 |
}, |
| 1231 |
}, |
| 1232 |
], |
| 1233 |
}); |
| 1233 |
}); |
1234 |
}); |
| 1234 |
|
1235 |
|
| 1235 |
var dataTables = $("#recalls-table,#article-requests-table"); |
1236 |
var dataTables = $("#recalls-table,#article-requests-table"); |
| 1236 |
dataTables.each(function(){ |
1237 |
dataTables.each(function () { |
| 1237 |
$(this).kohaTable({ |
1238 |
$(this).kohaTable({ |
| 1238 |
searching: false, |
1239 |
searching: false, |
| 1239 |
paging: false, |
1240 |
paging: false, |
|
Lines 1244-1306
Link Here
|
| 1244 |
columnDefs: [{ className: "dtr-control", orderable: false, targets: -1 }], |
1245 |
columnDefs: [{ className: "dtr-control", orderable: false, targets: -1 }], |
| 1245 |
}); |
1246 |
}); |
| 1246 |
}); |
1247 |
}); |
| 1247 |
$('a[data-bs-toggle="tab"]').on('shown.bs.tab', function (event) { |
1248 |
$('a[data-bs-toggle="tab"]').on("shown.bs.tab", function (event) { |
| 1248 |
dTables.DataTable().responsive.recalc(); |
1249 |
dTables.DataTable().responsive.recalc(); |
| 1249 |
dataTables.DataTable().responsive.recalc(); |
1250 |
dataTables.DataTable().responsive.recalc(); |
| 1250 |
} ); |
1251 |
}); |
| 1251 |
|
1252 |
|
| 1252 |
$("body").on("click", "#buttons-ics", function(){ |
1253 |
$("body").on("click", "#buttons-ics", function () { |
| 1253 |
location.href="/cgi-bin/koha/opac-ics.pl"; |
1254 |
location.href = "/cgi-bin/koha/opac-ics.pl"; |
| 1254 |
}); |
1255 |
}); |
| 1255 |
|
1256 |
|
| 1256 |
if (prefs.GoogleJackets){ |
1257 |
if (prefs.GoogleJackets) { |
| 1257 |
KOHA.Google.GetCoverFromIsbn(); |
1258 |
KOHA.Google.GetCoverFromIsbn(); |
| 1258 |
} |
1259 |
} |
| 1259 |
if (prefs.OpacRenewalAllowed && can_renew && !is_debarred){ |
1260 |
if (prefs.OpacRenewalAllowed && can_renew && !is_debarred) { |
| 1260 |
$("#renewselected").submit(function(){ |
1261 |
$("#renewselected").submit(function () { |
| 1261 |
valid = false; |
1262 |
valid = false; |
| 1262 |
$("input[type=checkbox]").each(function(){ |
1263 |
$("input[type=checkbox]").each(function () { |
| 1263 |
if($(this).is(':checked')){ |
1264 |
if ($(this).is(":checked")) { |
| 1264 |
valid = true; |
1265 |
valid = true; |
| 1265 |
} |
1266 |
} |
| 1266 |
}); |
1267 |
}); |
| 1267 |
if(!valid){ |
1268 |
if (!valid) { |
| 1268 |
alert(_("Nothing has been selected. Check the box for each item you want to renew")); |
1269 |
alert(_("Nothing has been selected. Check the box for each item you want to renew")); |
| 1269 |
} |
1270 |
} |
| 1270 |
return valid; |
1271 |
return valid; |
| 1271 |
}); |
1272 |
}); |
| 1272 |
$("body").on("click","#renewselected_link",function(e){ |
1273 |
$("body").on("click", "#renewselected_link", function (e) { |
| 1273 |
e.preventDefault(); |
1274 |
e.preventDefault(); |
| 1274 |
$("#renewselected").submit(); |
1275 |
$("#renewselected").submit(); |
| 1275 |
}); |
1276 |
}); |
| 1276 |
$("body").on("click","#renewall_link, #renewall_js",function(e){ |
1277 |
$("body").on("click", "#renewall_link, #renewall_js", function (e) { |
| 1277 |
e.preventDefault(); |
1278 |
e.preventDefault(); |
| 1278 |
$("#renewall").submit(); |
1279 |
$("#renewall").submit(); |
| 1279 |
}); |
1280 |
}); |
| 1280 |
} |
1281 |
} |
| 1281 |
|
1282 |
|
| 1282 |
if (prefs.AllowCheckoutNotes){ |
1283 |
if (prefs.AllowCheckoutNotes) { |
| 1283 |
|
|
|
| 1284 |
/* If JS enabled, show button, otherwise show link to redirect to a page where note can be submitted */ |
1284 |
/* If JS enabled, show button, otherwise show link to redirect to a page where note can be submitted */ |
| 1285 |
$(".nonjs_submitnote").hide(); |
1285 |
$(".nonjs_submitnote").hide(); |
| 1286 |
|
1286 |
|
| 1287 |
$("input[name='note']").prop('readonly', false); |
1287 |
$("input[name='note']").prop("readonly", false); |
| 1288 |
$("input[name='note']").keypress(function(e){ |
1288 |
$("input[name='note']").keypress(function (e) { |
| 1289 |
/* prevent submitting of renewselected form */ |
1289 |
/* prevent submitting of renewselected form */ |
| 1290 |
if(e.which == 13) |
1290 |
if (e.which == 13) e.preventDefault(); |
| 1291 |
e.preventDefault(); |
|
|
| 1292 |
}); |
1291 |
}); |
| 1293 |
|
1292 |
|
| 1294 |
$("input[name='note']").keyup(function(e){ |
1293 |
$("input[name='note']").keyup(function (e) { |
| 1295 |
var $btn_save = $('#save_'+$(this).data('issue_id')); |
1294 |
var $btn_save = $("#save_" + $(this).data("issue_id")); |
| 1296 |
var origvalue = $(this).data('origvalue'); |
1295 |
var origvalue = $(this).data("origvalue"); |
| 1297 |
var value = $(this).val(); |
1296 |
var value = $(this).val(); |
| 1298 |
|
1297 |
|
| 1299 |
if(origvalue != value) { |
1298 |
if (origvalue != value) { |
| 1300 |
if(origvalue != "") |
1299 |
if (origvalue != "") $btn_save.text(_("Submit changes")); |
| 1301 |
$btn_save.text(_("Submit changes")); |
1300 |
else $btn_save.text(_("Submit note")); |
| 1302 |
else |
|
|
| 1303 |
$btn_save.text(_("Submit note")); |
| 1304 |
$btn_save.show(); |
1301 |
$btn_save.show(); |
| 1305 |
} else { |
1302 |
} else { |
| 1306 |
$btn_save.hide(); |
1303 |
$btn_save.hide(); |
|
Lines 1308-1427
Link Here
|
| 1308 |
}); |
1305 |
}); |
| 1309 |
} |
1306 |
} |
| 1310 |
|
1307 |
|
| 1311 |
$(".change_pickup").on("click", function(){ |
1308 |
$(".change_pickup").on("click", function () { |
| 1312 |
var hold_id = $(this).data("hold-id"); |
1309 |
var hold_id = $(this).data("hold-id"); |
| 1313 |
$(this).hide(); |
1310 |
$(this).hide(); |
| 1314 |
$("#change-pickup-location" + hold_id ).show(); |
1311 |
$("#change-pickup-location" + hold_id).show(); |
| 1315 |
}); |
1312 |
}); |
| 1316 |
|
1313 |
|
| 1317 |
if ( $('#opac-user-clubs_panel').length ) { |
1314 |
if ($("#opac-user-clubs_panel").length) { |
| 1318 |
$('#opac-user-clubs-tab').on('click', function() { |
1315 |
$("#opac-user-clubs-tab").on("click", function () { |
| 1319 |
$('#opac-user-clubs_panel').text(_("Loading...")); |
1316 |
$("#opac-user-clubs_panel").text(_("Loading...")); |
| 1320 |
$('#opac-user-clubs_panel').load(`/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=${logged_in_user_borrowernumber}`); |
1317 |
$("#opac-user-clubs_panel").load(`/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=${logged_in_user_borrowernumber}`); |
| 1321 |
}); |
1318 |
}); |
| 1322 |
} |
1319 |
} |
| 1323 |
|
1320 |
|
| 1324 |
$(".cancel_recall").click(function(e){ |
1321 |
$(".cancel_recall").click(function (e) { |
| 1325 |
return confirmDelete(_("Are you sure you want to remove this recall?")); |
1322 |
return confirmDelete(_("Are you sure you want to remove this recall?")); |
| 1326 |
}); |
1323 |
}); |
| 1327 |
|
1324 |
|
| 1328 |
$("body").on("click", ".btn-add-note", function(e){ |
1325 |
$("body").on("click", ".btn-add-note", function (e) { |
| 1329 |
e.preventDefault(); |
1326 |
e.preventDefault(); |
| 1330 |
var title = $(this).data("title"); |
1327 |
var title = $(this).data("title"); |
| 1331 |
var issue_id = $(this).data("issueid"); |
1328 |
var issue_id = $(this).data("issueid"); |
| 1332 |
var note = $("#note_" + issue_id ).val(); |
1329 |
var note = $("#note_" + issue_id).val(); |
| 1333 |
var origvalue = $("#note_" + issue_id ).data("origvalue"); |
1330 |
var origvalue = $("#note_" + issue_id).data("origvalue"); |
| 1334 |
$("#addNote").val( note ); |
1331 |
$("#addNote").val(note); |
| 1335 |
$("#addNoteIssueId").val( issue_id ); |
1332 |
$("#addNoteIssueId").val(issue_id); |
| 1336 |
$("#addNoteTitle").text( title ); |
1333 |
$("#addNoteTitle").text(title); |
| 1337 |
$("#addNoteModal").modal("show"); |
1334 |
$("#addNoteModal").modal("show"); |
| 1338 |
}); |
1335 |
}); |
| 1339 |
|
1336 |
|
| 1340 |
$("#addNoteForm").on("submit", function(e){ |
1337 |
$("#addNoteForm").on("submit", function (e) { |
| 1341 |
e.preventDefault(); |
1338 |
e.preventDefault(); |
| 1342 |
var title = $("#addNoteTitle").text(); |
1339 |
var title = $("#addNoteTitle").text(); |
| 1343 |
var issue_id = $("#addNoteIssueId").val(); |
1340 |
var issue_id = $("#addNoteIssueId").val(); |
| 1344 |
var note = $("#addNote").val(); |
1341 |
var note = $("#addNote").val(); |
| 1345 |
submitNote( title, issue_id, note ); |
1342 |
submitNote(title, issue_id, note); |
| 1346 |
}); |
1343 |
}); |
| 1347 |
|
1344 |
|
| 1348 |
$("#addNoteModal").on("hidden.bs.modal", function(){ |
1345 |
$("#addNoteModal").on("hidden.bs.modal", function () { |
| 1349 |
$("#addNoteTitle").text(""); |
1346 |
$("#addNoteTitle").text(""); |
| 1350 |
$("#addNote").val(""); |
1347 |
$("#addNote").val(""); |
| 1351 |
}); |
1348 |
}); |
| 1352 |
|
1349 |
|
| 1353 |
$(".dismiss-message-button").click(function(e){ |
1350 |
$(".dismiss-message-button").click(function (e) { |
| 1354 |
return confirmDelete(_("Are you sure you want to dismiss this message?")); |
1351 |
return confirmDelete(_("Are you sure you want to dismiss this message?")); |
| 1355 |
}); |
1352 |
}); |
| 1356 |
|
|
|
| 1357 |
}); |
1353 |
}); |
| 1358 |
|
1354 |
|
| 1359 |
function submitNote( title, issue_id, note ){ |
1355 |
function submitNote(title, issue_id, note) { |
| 1360 |
var self = $("#addNoteModal"); |
1356 |
var self = $("#addNoteModal"); |
| 1361 |
var notebutton = $("#save_" + issue_id ); |
1357 |
var notebutton = $("#save_" + issue_id); |
| 1362 |
var noteinput = $("#note_" + issue_id ); |
1358 |
var noteinput = $("#note_" + issue_id); |
| 1363 |
|
1359 |
|
| 1364 |
var ajaxData = { |
1360 |
var ajaxData = { |
| 1365 |
'action': 'issuenote', |
1361 |
action: "issuenote", |
| 1366 |
'issue_id': issue_id, |
1362 |
issue_id: issue_id, |
| 1367 |
'note': note, |
1363 |
note: note, |
| 1368 |
csrf_token: $('meta[name="csrf-token"]').attr('content'), |
1364 |
csrf_token: $('meta[name="csrf-token"]').attr("content"), |
| 1369 |
op: 'cud-add_note', |
1365 |
op: "cud-add_note", |
| 1370 |
}; |
1366 |
}; |
| 1371 |
|
1367 |
|
| 1372 |
$.ajax({ |
1368 |
$.ajax({ |
| 1373 |
url: '/cgi-bin/koha/svc/checkout_notes/', |
1369 |
url: "/cgi-bin/koha/svc/checkout_notes/", |
| 1374 |
type: 'POST', |
1370 |
type: "POST", |
| 1375 |
dataType: 'json', |
1371 |
dataType: "json", |
| 1376 |
data: ajaxData, |
1372 |
data: ajaxData, |
| 1377 |
}) |
1373 |
}) |
| 1378 |
.done(function(data) { |
1374 |
.done(function (data) { |
| 1379 |
var message = ""; |
1375 |
var message = ""; |
| 1380 |
if(data.status == 'saved') { |
1376 |
if (data.status == "saved") { |
| 1381 |
$("#notesaved").removeClass("alert-error"); |
1377 |
$("#notesaved").removeClass("alert-error"); |
| 1382 |
$("#notesaved").addClass("alert-info"); |
1378 |
$("#notesaved").addClass("alert-info"); |
| 1383 |
noteinput.data('origvalue', data.note) |
1379 |
noteinput.data("origvalue", data.note).val(data.note); |
| 1384 |
.val(data.note); |
1380 |
notebutton.text(_("Edit note")); |
| 1385 |
notebutton.text( _("Edit note" ) ); |
1381 |
$("#viewnote_" + issue_id).text(data.note); |
| 1386 |
$("#viewnote_" + issue_id ).text( data.note ); |
1382 |
message = "<p>" + _("Your note about %s has been saved and sent to the library.").format(em(title)) + "</p>"; |
| 1387 |
message = "<p>" + _("Your note about %s has been saved and sent to the library.").format( em(title) ) + "</p>"; |
1383 |
message += '<p class="checkout_note">' + data.note; |
| 1388 |
message += "<p class=\"checkout_note\">" + data.note; |
1384 |
message += |
| 1389 |
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 + "\"><i class=\"fa fa-pencil\" aria-hidden=\"true\"></i> " + _("Edit note") + "</a>"; |
1385 |
'<a href="/cgi-bin/koha/opac-issue-note.pl?issue_id=' + |
| 1390 |
message += "</p>"; |
1386 |
issue_id + |
| 1391 |
} else if(data.status == 'removed') { |
1387 |
'" class="btn btn-link btn-sm btn-add-note" data-title="' + |
| 1392 |
$("#notesaved").removeClass("alert-error"); |
1388 |
title + |
| 1393 |
$("#notesaved").addClass("alert-info"); |
1389 |
'" data-issueid="' + |
| 1394 |
noteinput.data('origvalue', "") |
1390 |
issue_id + |
| 1395 |
.val("") |
1391 |
'"><i class="fa fa-pencil" aria-hidden="true"></i> ' + |
| 1396 |
notebutton.text( _("Add note") ); |
1392 |
_("Edit note") + |
| 1397 |
$("#viewnote_" + issue_id ).text( data.note ); |
1393 |
"</a>"; |
| 1398 |
message = "<p>" + _("Your note about %s was removed.").format( em(title) ) + "</p>"; |
1394 |
message += "</p>"; |
| 1399 |
} else { |
1395 |
} else if (data.status == "removed") { |
|
|
1396 |
$("#notesaved").removeClass("alert-error"); |
| 1397 |
$("#notesaved").addClass("alert-info"); |
| 1398 |
noteinput.data("origvalue", "").val(""); |
| 1399 |
notebutton.text(_("Add note")); |
| 1400 |
$("#viewnote_" + issue_id).text(data.note); |
| 1401 |
message = "<p>" + _("Your note about %s was removed.").format(em(title)) + "</p>"; |
| 1402 |
} else { |
| 1403 |
$("#notesaved").removeClass("alert-info"); |
| 1404 |
$("#notesaved").addClass("alert-error"); |
| 1405 |
message = "<p>" + _("Your note about %s could not be saved.").format(em(title)) + "</p>"; |
| 1406 |
notebutton.text(_("Add note")); |
| 1407 |
$("#viewnote_" + issue_id).text(data.note); |
| 1408 |
message += '<p style="font-weight:bold;">' + _("Something went wrong. The note has not been saved") + "</p>"; |
| 1409 |
} |
| 1410 |
$("#notesaved").html(message); |
| 1411 |
}) |
| 1412 |
.fail(function (data) { |
| 1400 |
$("#notesaved").removeClass("alert-info"); |
1413 |
$("#notesaved").removeClass("alert-info"); |
| 1401 |
$("#notesaved").addClass("alert-error"); |
1414 |
$("#notesaved").addClass("alert-error"); |
| 1402 |
message = "<p>" + _("Your note about %s could not be saved.").format( em(title) ) + "</p>"; |
1415 |
var message = '<p style="font-weight:bold;">' + _("Something went wrong. The note has not been saved") + "</p>"; |
| 1403 |
notebutton.text( _("Add note") ); |
1416 |
$("#notesaved").html(message); |
| 1404 |
$("#viewnote_" + issue_id ).text( data.note ); |
1417 |
}) |
| 1405 |
message += "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>"; |
1418 |
.always(function () { |
| 1406 |
} |
1419 |
self.modal("hide"); |
| 1407 |
$("#notesaved").html(message); |
1420 |
$("#notesaved").show(); |
| 1408 |
}) |
1421 |
}); |
| 1409 |
.fail(function(data) { |
|
|
| 1410 |
$("#notesaved").removeClass("alert-info"); |
| 1411 |
$("#notesaved").addClass("alert-error"); |
| 1412 |
var message = "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>"; |
| 1413 |
$("#notesaved").html(message); |
| 1414 |
}) |
| 1415 |
.always(function() { |
| 1416 |
self.modal("hide"); |
| 1417 |
$("#notesaved").show(); |
| 1418 |
}); |
| 1419 |
} |
1422 |
} |
| 1420 |
|
1423 |
|
| 1421 |
function em( title ){ |
1424 |
function em(title) { |
| 1422 |
return "<em>" + title + "</em>"; |
1425 |
return "<em>" + title + "</em>"; |
| 1423 |
} |
1426 |
} |
| 1424 |
|
|
|
| 1425 |
</script> |
1427 |
</script> |
| 1426 |
[% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %] |
1428 |
[% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %] |
| 1427 |
[% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %] |
1429 |
[% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %] |
| 1428 |
- |
|
|