|
Lines 1240-1274
Link Here
|
| 1240 |
const managedby_patron_borrowernumber = "[% managedby_patron.borrowernumber | html %]"; |
1240 |
const managedby_patron_borrowernumber = "[% managedby_patron.borrowernumber | html %]"; |
| 1241 |
const op = "[% op | html %]"; |
1241 |
const op = "[% op | html %]"; |
| 1242 |
</script> |
1242 |
</script> |
| 1243 |
|
|
|
| 1244 |
<script> |
1243 |
<script> |
| 1245 |
function select_manager(borrowernumber, borrower) { |
1244 |
function select_manager(borrowernumber, borrower) { |
| 1246 |
let tab = $('#suggestiontabs .active table').data('tab-name'); |
1245 |
let tab = $("#suggestiontabs .active table").data("tab-name"); |
| 1247 |
if ( tab ) { |
1246 |
if (tab) { |
| 1248 |
var managedby_name = $("#managedby_name-"+tab); |
1247 |
var managedby_name = $("#managedby_name-" + tab); |
| 1249 |
var managedby = $("#managedby-"+tab); |
1248 |
var managedby = $("#managedby-" + tab); |
| 1250 |
} else { |
1249 |
} else { |
| 1251 |
var managedby_name = $("#managedby_name"); |
1250 |
var managedby_name = $("#managedby_name"); |
| 1252 |
var managedby = $("#managedby"); |
1251 |
var managedby = $("#managedby"); |
| 1253 |
} |
1252 |
} |
| 1254 |
managedby_name.empty(); |
1253 |
managedby_name.empty(); |
| 1255 |
managedby.val(''); |
1254 |
managedby.val(""); |
| 1256 |
var borrowername = borrower.firstname + ' ' + borrower.surname; |
1255 |
var borrowername = borrower.firstname + " " + borrower.surname; |
| 1257 |
if (borrowernumber) { |
1256 |
if (borrowernumber) { |
| 1258 |
var managerlink = '<a href="/cgi-bin/koha/members/moremember.pl' |
1257 |
var managerlink = '<a href="/cgi-bin/koha/members/moremember.pl' + "?borrowernumber=" + borrowernumber + '">' + borrowername + "</a>"; |
| 1259 |
+ '?borrowernumber=' + borrowernumber + '">' |
|
|
| 1260 |
+ borrowername + '</a>'; |
| 1261 |
managedby_name.html(managerlink); |
1258 |
managedby_name.html(managerlink); |
| 1262 |
managedby.val(borrowernumber); |
1259 |
managedby.val(borrowernumber); |
| 1263 |
} |
1260 |
} |
| 1264 |
|
1261 |
|
| 1265 |
if (op == "save"){ |
1262 |
if (op == "save") { |
| 1266 |
var notify = $('#notify'); |
1263 |
var notify = $("#notify"); |
| 1267 |
if ( notify.length ) { |
1264 |
if (notify.length) { |
| 1268 |
if ((managedby_patron_borrowernumber && (borrowernumber == logged_in_user_borrowernumber || borrowernumber == managedby_patron_borrowernumber )) || (!managedby_patron_borrowernumber && borrowernumber == logged_in_user_borrowernumber )){ |
1265 |
if ( |
| 1269 |
$(notify).prop('checked', false).prop('disabled', true); |
1266 |
(managedby_patron_borrowernumber && (borrowernumber == logged_in_user_borrowernumber || borrowernumber == managedby_patron_borrowernumber)) || |
|
|
1267 |
(!managedby_patron_borrowernumber && borrowernumber == logged_in_user_borrowernumber) |
| 1268 |
) { |
| 1269 |
$(notify).prop("checked", false).prop("disabled", true); |
| 1270 |
} else { |
1270 |
} else { |
| 1271 |
$(notify).prop('disabled', false); |
1271 |
$(notify).prop("disabled", false); |
| 1272 |
} |
1272 |
} |
| 1273 |
} |
1273 |
} |
| 1274 |
} |
1274 |
} |
|
Lines 1276-1294
Link Here
|
| 1276 |
|
1276 |
|
| 1277 |
function select_suggester(borrowernumber, borrower) { |
1277 |
function select_suggester(borrowernumber, borrower) { |
| 1278 |
$.ajax({ |
1278 |
$.ajax({ |
| 1279 |
type: 'GET', |
1279 |
type: "GET", |
| 1280 |
url: '/api/v1/patrons/' + borrowernumber, |
1280 |
url: "/api/v1/patrons/" + borrowernumber, |
| 1281 |
headers: { |
1281 |
headers: { |
| 1282 |
"x-koha-embed": "+strings" |
1282 |
"x-koha-embed": "+strings", |
| 1283 |
}, |
1283 |
}, |
| 1284 |
success: function (data) { |
1284 |
success: function (data) { |
| 1285 |
var suggested = '<input type="hidden" id="suggestedby" name="suggestedby" value="' + data.patron_id + '" />'; |
1285 |
var suggested = '<input type="hidden" id="suggestedby" name="suggestedby" value="' + data.patron_id + '" />'; |
| 1286 |
suggested += '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' + data.patron_id + '">'; |
1286 |
suggested += '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' + data.patron_id + '">'; |
| 1287 |
suggested += data.surname.escapeHtml() + ', ' + data.firstname.escapeHtml() + ' (' + data.cardnumber.escapeHtml() + ')'; |
1287 |
suggested += data.surname.escapeHtml() + ", " + data.firstname.escapeHtml() + " (" + data.cardnumber.escapeHtml() + ")"; |
| 1288 |
suggested += '</a> '; |
1288 |
suggested += "</a> "; |
| 1289 |
suggested += data._strings.library_id.str.escapeHtml() + ' (' + data._strings.category_id.str.escapeHtml() + ')'; |
1289 |
suggested += data._strings.library_id.str.escapeHtml() + " (" + data._strings.category_id.str.escapeHtml() + ")"; |
| 1290 |
$("#tdsuggestedby").html(suggested); |
1290 |
$("#tdsuggestedby").html(suggested); |
| 1291 |
|
|
|
| 1292 |
}, |
1291 |
}, |
| 1293 |
error: function (data) { |
1292 |
error: function (data) { |
| 1294 |
alert(_("Cannot retrieve info for this patron.")); |
1293 |
alert(_("Cannot retrieve info for this patron.")); |
|
Lines 1300-1313
Link Here
|
| 1300 |
//keep a copy of all budgets before removing the inactives |
1299 |
//keep a copy of all budgets before removing the inactives |
| 1301 |
var budgetId = $("#budgetid"); |
1300 |
var budgetId = $("#budgetid"); |
| 1302 |
var disabledBudgetsCopy = budgetId.html(); |
1301 |
var disabledBudgetsCopy = budgetId.html(); |
| 1303 |
$('.b_inactive').remove(); |
1302 |
$(".b_inactive").remove(); |
| 1304 |
|
1303 |
|
| 1305 |
$('.showallfunds').click(function() { |
1304 |
$(".showallfunds").click(function () { |
| 1306 |
if ($(this).is(":checked")) { |
1305 |
if ($(this).is(":checked")) { |
| 1307 |
budgetId.html(disabledBudgetsCopy); //Puts back all the funds |
1306 |
budgetId.html(disabledBudgetsCopy); //Puts back all the funds |
| 1308 |
} |
1307 |
} else { |
| 1309 |
else { |
1308 |
$(".b_inactive").remove(); |
| 1310 |
$('.b_inactive').remove(); |
|
|
| 1311 |
} |
1309 |
} |
| 1312 |
}); |
1310 |
}); |
| 1313 |
</script> |
1311 |
</script> |
|
Lines 1330-1342
Link Here
|
| 1330 |
CAN_user_suggestions_suggestions_delete: [% CAN_user_suggestions_suggestions_delete ? 1 : 0 | html %], |
1328 |
CAN_user_suggestions_suggestions_delete: [% CAN_user_suggestions_suggestions_delete ? 1 : 0 | html %], |
| 1331 |
}); |
1329 |
}); |
| 1332 |
</script> |
1330 |
</script> |
| 1333 |
|
|
|
| 1334 |
[% INCLUDE 'datatables.inc' %] |
1331 |
[% INCLUDE 'datatables.inc' %] |
| 1335 |
<script> |
1332 |
<script> |
| 1336 |
$(document).ready(function() { |
1333 |
$(document).ready(function () { |
| 1337 |
if (has_suggestions){ |
1334 |
if (has_suggestions) { |
| 1338 |
function loadDatatable(tabName) { |
1335 |
function loadDatatable(tabName) { |
| 1339 |
let tabSuggestionData = suggestionData.find(s => s.suggestiontype === `${tabName}`) |
1336 |
let tabSuggestionData = suggestionData.find(s => s.suggestiontype === `${tabName}`); |
| 1340 |
$("#table_" + tabName).kohaTable( |
1337 |
$("#table_" + tabName).kohaTable( |
| 1341 |
{ |
1338 |
{ |
| 1342 |
order: [[4, "asc"]], |
1339 |
order: [[4, "asc"]], |
|
Lines 1356-1362
Link Here
|
| 1356 |
orderable: false, |
1353 |
orderable: false, |
| 1357 |
render: function (data, type, row, meta) { |
1354 |
render: function (data, type, row, meta) { |
| 1358 |
return '<input type="checkbox" value="%s" name="suggestionid" />'.format(row.suggestion_id); |
1355 |
return '<input type="checkbox" value="%s" name="suggestionid" />'.format(row.suggestion_id); |
| 1359 |
} |
1356 |
}, |
| 1360 |
}, |
1357 |
}, |
| 1361 |
{ |
1358 |
{ |
| 1362 |
data: "me.title", |
1359 |
data: "me.title", |
|
Lines 1364-1383
Link Here
|
| 1364 |
orderable: true, |
1361 |
orderable: true, |
| 1365 |
render: function (data, type, row, meta) { |
1362 |
render: function (data, type, row, meta) { |
| 1366 |
let node = '<a href="suggestion.pl?suggestionid=%s&op=show" title="%s">%s'.format(row.suggestion_id, _("suggestion"), row.title); |
1363 |
let node = '<a href="suggestion.pl?suggestionid=%s&op=show" title="%s">%s'.format(row.suggestion_id, _("suggestion"), row.title); |
| 1367 |
if(row.author) node += ', by %s'.format(row.author); |
1364 |
if (row.author) node += ", by %s".format(row.author); |
| 1368 |
node += '</a><br />'; |
1365 |
node += "</a><br />"; |
| 1369 |
if(row.copyright_date) node += ' © <span class="suggestion_copyrightdate">%s</span>'.format(row.copyright_date); |
1366 |
if (row.copyright_date) node += ' © <span class="suggestion_copyrightdate">%s</span>'.format(row.copyright_date); |
| 1370 |
if(row.volume_desc) node += '; <span class="suggestion_volume">%s:<em>%s</em></span>'.format(_("Volume"), row.volume_desc); |
1367 |
if (row.volume_desc) node += '; <span class="suggestion_volume">%s:<em>%s</em></span>'.format(_("Volume"), row.volume_desc); |
| 1371 |
if(row.isbn) node += '; <span class="suggestion_isbn">%s:<em>%s</em></span>'.format(_("ISBN"), row.isbn); |
1368 |
if (row.isbn) node += '; <span class="suggestion_isbn">%s:<em>%s</em></span>'.format(_("ISBN"), row.isbn); |
| 1372 |
if(row.publisher_code) node += '; <span class="suggestion_publishercode">%s %s</span>'.format(_("Published by"), row.publisher_code); |
1369 |
if (row.publisher_code) node += '; <span class="suggestion_publishercode">%s %s</span>'.format(_("Published by"), row.publisher_code); |
| 1373 |
if(row.publication_year && row.publication_year != 0) node += '; <span class="suggestion_publicationyear"><em>%s</em></span>'.format(row.publication_year); |
1370 |
if (row.publication_year && row.publication_year != 0) node += '; <span class="suggestion_publicationyear"><em>%s</em></span>'.format(row.publication_year); |
| 1374 |
if(row.publication_place) node += '; <span class="suggestion_place"><em>%s</em></span>'.format(row.publication_place); |
1371 |
if (row.publication_place) node += '; <span class="suggestion_place"><em>%s</em></span>'.format(row.publication_place); |
| 1375 |
if(row.collection_title) node += '; <span class="suggestion_collectiontitle"><em>%s</em></span>'.format(row.collection_title); |
1372 |
if (row.collection_title) node += '; <span class="suggestion_collectiontitle"><em>%s</em></span>'.format(row.collection_title); |
| 1376 |
if(row.item_type && row._strings.item_type.str) node += '; <span class="suggestion_itype"><em>%s</em></span>'.format(row._strings.item_type.str); |
1373 |
if (row.item_type && row._strings.item_type.str) node += '; <span class="suggestion_itype"><em>%s</em></span>'.format(row._strings.item_type.str); |
| 1377 |
if(row.note) node += '<div class="suggestion_note">%s</div>'.format(row.note); |
1374 |
if (row.note) node += '<div class="suggestion_note">%s</div>'.format(row.note); |
| 1378 |
if(row.archived) node += '<br /><i class="fa fa-archive"></i> %s'.format(_("Archived")); |
1375 |
if (row.archived) node += '<br /><i class="fa fa-archive"></i> %s'.format(_("Archived")); |
| 1379 |
return node; |
1376 |
return node; |
| 1380 |
} |
1377 |
}, |
| 1381 |
}, |
1378 |
}, |
| 1382 |
{ |
1379 |
{ |
| 1383 |
data: "suggester.surname:suggester.firstname:suggester.cardnumber", |
1380 |
data: "suggester.surname:suggester.firstname:suggester.cardnumber", |
|
Lines 1385-1406
Link Here
|
| 1385 |
orderable: true, |
1382 |
orderable: true, |
| 1386 |
render: function (data, type, row, meta) { |
1383 |
render: function (data, type, row, meta) { |
| 1387 |
let suggester = row.suggester; |
1384 |
let suggester = row.suggester; |
| 1388 |
if(suggester) { |
1385 |
if (suggester) { |
| 1389 |
let node = '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=%s">%s'.format(suggester.patron_id, suggester.surname); |
1386 |
let node = '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=%s">%s'.format(suggester.patron_id, suggester.surname); |
| 1390 |
if(suggester.firstname) node += ', %s'.format(suggester.firstname); |
1387 |
if (suggester.firstname) node += ", %s".format(suggester.firstname); |
| 1391 |
if(suggester.cardnumber) node += ' (%s)'.format(suggester.cardnumber); |
1388 |
if (suggester.cardnumber) node += " (%s)".format(suggester.cardnumber); |
| 1392 |
node += '</a>'; |
1389 |
node += "</a>"; |
| 1393 |
return node; |
1390 |
return node; |
| 1394 |
} |
1391 |
} |
| 1395 |
return '' |
1392 |
return ""; |
| 1396 |
} |
1393 |
}, |
| 1397 |
}, |
1394 |
}, |
| 1398 |
{ |
1395 |
{ |
| 1399 |
data: "suggester.category.name", |
1396 |
data: "suggester.category.name", |
| 1400 |
searchable: true, |
1397 |
searchable: true, |
| 1401 |
orderable: true, |
1398 |
orderable: true, |
| 1402 |
render: function (data, type, row, meta) { |
1399 |
render: function (data, type, row, meta) { |
| 1403 |
return escape_str(row.suggester ? row.suggester.category.name : ''); |
1400 |
return escape_str(row.suggester ? row.suggester.category.name : ""); |
| 1404 |
}, |
1401 |
}, |
| 1405 |
}, |
1402 |
}, |
| 1406 |
{ |
1403 |
{ |
|
Lines 1408-1414
Link Here
|
| 1408 |
searchable: false, |
1405 |
searchable: false, |
| 1409 |
orderable: true, |
1406 |
orderable: true, |
| 1410 |
render: function (data, type, row, meta) { |
1407 |
render: function (data, type, row, meta) { |
| 1411 |
return escape_str(row.suggestion_date ? $date(row.suggestion_date) : ''); |
1408 |
return escape_str(row.suggestion_date ? $date(row.suggestion_date) : ""); |
| 1412 |
}, |
1409 |
}, |
| 1413 |
}, |
1410 |
}, |
| 1414 |
{ |
1411 |
{ |
|
Lines 1416-1422
Link Here
|
| 1416 |
searchable: true, |
1413 |
searchable: true, |
| 1417 |
orderable: true, |
1414 |
orderable: true, |
| 1418 |
render: function (data, type, row, meta) { |
1415 |
render: function (data, type, row, meta) { |
| 1419 |
return escape_str(row._strings.patron_reason.str ? row._strings.patron_reason.str : ''); |
1416 |
return escape_str(row._strings.patron_reason.str ? row._strings.patron_reason.str : ""); |
| 1420 |
}, |
1417 |
}, |
| 1421 |
}, |
1418 |
}, |
| 1422 |
{ |
1419 |
{ |
|
Lines 1424-1436
Link Here
|
| 1424 |
searchable: true, |
1421 |
searchable: true, |
| 1425 |
orderable: true, |
1422 |
orderable: true, |
| 1426 |
render: function (data, type, row, meta) { |
1423 |
render: function (data, type, row, meta) { |
| 1427 |
if(row.manager) { |
1424 |
if (row.manager) { |
| 1428 |
let node = '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=%s">%s'.format(row.manager?.patron_id, row.manager?.surname); |
1425 |
let node = '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=%s">%s'.format(row.manager?.patron_id, row.manager?.surname); |
| 1429 |
if(row.manager?.firstname) node += ', %s'.format(row.manager?.firstname); |
1426 |
if (row.manager?.firstname) node += ", %s".format(row.manager?.firstname); |
| 1430 |
node += '</a>'; |
1427 |
node += "</a>"; |
| 1431 |
return node; |
1428 |
return node; |
| 1432 |
} |
1429 |
} |
| 1433 |
return '' |
1430 |
return ""; |
| 1434 |
}, |
1431 |
}, |
| 1435 |
}, |
1432 |
}, |
| 1436 |
{ |
1433 |
{ |
|
Lines 1438-1444
Link Here
|
| 1438 |
searchable: false, |
1435 |
searchable: false, |
| 1439 |
orderable: true, |
1436 |
orderable: true, |
| 1440 |
render: function (data, type, row, meta) { |
1437 |
render: function (data, type, row, meta) { |
| 1441 |
return escape_str(row.managed_date ? $date(row.managed_date) : ''); |
1438 |
return escape_str(row.managed_date ? $date(row.managed_date) : ""); |
| 1442 |
}, |
1439 |
}, |
| 1443 |
}, |
1440 |
}, |
| 1444 |
{ |
1441 |
{ |
|
Lines 1446-1458
Link Here
|
| 1446 |
searchable: true, |
1443 |
searchable: true, |
| 1447 |
orderable: true, |
1444 |
orderable: true, |
| 1448 |
render: function (data, type, row, meta) { |
1445 |
render: function (data, type, row, meta) { |
| 1449 |
if(row.last_modifier) { |
1446 |
if (row.last_modifier) { |
| 1450 |
let node = '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=%s">%s'.format(row.last_modifier?.patron_id, row.last_modifier?.surname); |
1447 |
let node = '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=%s">%s'.format(row.last_modifier?.patron_id, row.last_modifier?.surname); |
| 1451 |
if(row.last_modifier?.firstname) node += ', %s'.format(row.last_modifier?.firstname); |
1448 |
if (row.last_modifier?.firstname) node += ", %s".format(row.last_modifier?.firstname); |
| 1452 |
node += '</a>'; |
1449 |
node += "</a>"; |
| 1453 |
return node; |
1450 |
return node; |
| 1454 |
} |
1451 |
} |
| 1455 |
return '' |
1452 |
return ""; |
| 1456 |
}, |
1453 |
}, |
| 1457 |
}, |
1454 |
}, |
| 1458 |
{ |
1455 |
{ |
|
Lines 1460-1466
Link Here
|
| 1460 |
searchable: false, |
1457 |
searchable: false, |
| 1461 |
orderable: true, |
1458 |
orderable: true, |
| 1462 |
render: function (data, type, row, meta) { |
1459 |
render: function (data, type, row, meta) { |
| 1463 |
return escape_str(row.last_status_change_date ? $date(row.last_status_change_date) : ''); |
1460 |
return escape_str(row.last_status_change_date ? $date(row.last_status_change_date) : ""); |
| 1464 |
}, |
1461 |
}, |
| 1465 |
}, |
1462 |
}, |
| 1466 |
{ |
1463 |
{ |
|
Lines 1468-1474
Link Here
|
| 1468 |
searchable: false, |
1465 |
searchable: false, |
| 1469 |
orderable: true, |
1466 |
orderable: true, |
| 1470 |
render: function (data, type, row, meta) { |
1467 |
render: function (data, type, row, meta) { |
| 1471 |
return escape_str(row.last_status_change_date ? $date(row.last_status_change_date) : ''); |
1468 |
return escape_str(row.last_status_change_date ? $date(row.last_status_change_date) : ""); |
| 1472 |
}, |
1469 |
}, |
| 1473 |
}, |
1470 |
}, |
| 1474 |
{ |
1471 |
{ |
|
Lines 1476-1482
Link Here
|
| 1476 |
searchable: true, |
1473 |
searchable: true, |
| 1477 |
orderable: true, |
1474 |
orderable: true, |
| 1478 |
render: function (data, type, row, meta) { |
1475 |
render: function (data, type, row, meta) { |
| 1479 |
return escape_str(row.library?.name ? row.library.name : ''); |
1476 |
return escape_str(row.library?.name ? row.library.name : ""); |
| 1480 |
}, |
1477 |
}, |
| 1481 |
}, |
1478 |
}, |
| 1482 |
{ |
1479 |
{ |
|
Lines 1484-1490
Link Here
|
| 1484 |
searchable: true, |
1481 |
searchable: true, |
| 1485 |
orderable: true, |
1482 |
orderable: true, |
| 1486 |
render: function (data, type, row, meta) { |
1483 |
render: function (data, type, row, meta) { |
| 1487 |
return escape_str(row.fund?.name ? row.fund.name : ''); |
1484 |
return escape_str(row.fund?.name ? row.fund.name : ""); |
| 1488 |
}, |
1485 |
}, |
| 1489 |
}, |
1486 |
}, |
| 1490 |
{ |
1487 |
{ |
|
Lines 1492-1498
Link Here
|
| 1492 |
searchable: false, |
1489 |
searchable: false, |
| 1493 |
orderable: true, |
1490 |
orderable: true, |
| 1494 |
render: function (data, type, row, meta) { |
1491 |
render: function (data, type, row, meta) { |
| 1495 |
return escape_str(row.staff_note ? row.staff_note : ''); |
1492 |
return escape_str(row.staff_note ? row.staff_note : ""); |
| 1496 |
}, |
1493 |
}, |
| 1497 |
}, |
1494 |
}, |
| 1498 |
{ |
1495 |
{ |
|
Lines 1500-1516
Link Here
|
| 1500 |
searchable: true, |
1497 |
searchable: true, |
| 1501 |
orderable: true, |
1498 |
orderable: true, |
| 1502 |
render: function (data, type, row, meta) { |
1499 |
render: function (data, type, row, meta) { |
| 1503 |
let node = ''; |
1500 |
let node = ""; |
| 1504 |
if(row.status === 'ASKED') node += '<span class="status asked">%s</span>'.format(_("Pending")); |
1501 |
if (row.status === "ASKED") node += '<span class="status asked">%s</span>'.format(_("Pending")); |
| 1505 |
else if(row.status === 'ACCEPTED') node += '<span class="status accepted">%s</span>'.format(_("Accepted")); |
1502 |
else if (row.status === "ACCEPTED") node += '<span class="status accepted">%s</span>'.format(_("Accepted")); |
| 1506 |
else if(row.status === 'ORDERED') node += '<span class="status ordered">%s</span>'.format(_("Ordered")); |
1503 |
else if (row.status === "ORDERED") node += '<span class="status ordered">%s</span>'.format(_("Ordered")); |
| 1507 |
else if(row.status === 'REJECTED') node += '<span class="status rejected">%s</span>'.format(_("Rejected")); |
1504 |
else if (row.status === "REJECTED") node += '<span class="status rejected">%s</span>'.format(_("Rejected")); |
| 1508 |
else if(row.status === 'CHECKED') node += '<span class="status checked">%s</span>'.format(_("Checked")); |
1505 |
else if (row.status === "CHECKED") node += '<span class="status checked">%s</span>'.format(_("Checked")); |
| 1509 |
else if(row.status === 'AVAILABLE') node += '<span class="status available">%s</span>'.format(_("Available")); |
1506 |
else if (row.status === "AVAILABLE") node += '<span class="status available">%s</span>'.format(_("Available")); |
| 1510 |
else if(row._strings.status.str) node += '<span class="status '+ row.status +'">%s</span>'.format(row._strings.status.str); |
1507 |
else if (row._strings.status.str) node += '<span class="status ' + row.status + '">%s</span>'.format(row._strings.status.str); |
| 1511 |
else node += '<span class="status unknown">%s</span>'.format(_("Status unknown")); |
1508 |
else node += '<span class="status unknown">%s</span>'.format(_("Status unknown")); |
| 1512 |
if ( row.reason ) { |
1509 |
if (row.reason) { |
| 1513 |
node += '<div class="reason" data-reason="'+row.reason+'">('+ row.reason +')</div>'; |
1510 |
node += '<div class="reason" data-reason="' + row.reason + '">(' + row.reason + ")</div>"; |
| 1514 |
} |
1511 |
} |
| 1515 |
return node; |
1512 |
return node; |
| 1516 |
}, |
1513 |
}, |
|
Lines 1520-1573
Link Here
|
| 1520 |
searchable: false, |
1517 |
searchable: false, |
| 1521 |
orderable: false, |
1518 |
orderable: false, |
| 1522 |
render: function (data, type, row, meta) { |
1519 |
render: function (data, type, row, meta) { |
| 1523 |
if (permissions.CAN_user_suggestions_suggestions_manage){ |
1520 |
if (permissions.CAN_user_suggestions_suggestions_manage) { |
| 1524 |
let node = '<div class="btn-group dropup">' |
1521 |
let node = '<div class="btn-group dropup">'; |
| 1525 |
node += '<a class="btn btn-default btn-xs" role="button" href="suggestion.pl?suggestionid=%s&op=edit_form"><i class="fa-solid fa-pencil" aria-hidden="true"></i> %s</a>'.format(row.suggestion_id, _("Edit")) |
1522 |
node += '<a class="btn btn-default btn-xs" role="button" href="suggestion.pl?suggestionid=%s&op=edit_form"><i class="fa-solid fa-pencil" aria-hidden="true"></i> %s</a>'.format( |
| 1526 |
node += '<a class="btn btn-default btn-xs dropdown-toggle" id="more_actions_%s" role="button" data-bs-toggle="dropdown" href="#"><b class="caret"></b></a>'.format(row.suggestion_id) |
1523 |
row.suggestion_id, |
| 1527 |
node += '<ul class="dropdown-menu" role="menu" aria-labelledby="more_actions_%s">'.format(row.suggestion_id) |
1524 |
_("Edit") |
| 1528 |
if (permissions.CAN_user_suggestions_suggestions_delete){ |
1525 |
); |
| 1529 |
node += '<li><a href="#" data-op="cud-delete" data-suggestionid="%s" class="dropdown-item trigger_action">%s</a></li>'.format(row.suggestion_id, _("Delete")) |
1526 |
node += '<a class="btn btn-default btn-xs dropdown-toggle" id="more_actions_%s" role="button" data-bs-toggle="dropdown" href="#"><b class="caret"></b></a>'.format(row.suggestion_id); |
|
|
1527 |
node += '<ul class="dropdown-menu" role="menu" aria-labelledby="more_actions_%s">'.format(row.suggestion_id); |
| 1528 |
if (permissions.CAN_user_suggestions_suggestions_delete) { |
| 1529 |
node += '<li><a href="#" data-op="cud-delete" data-suggestionid="%s" class="dropdown-item trigger_action">%s</a></li>'.format(row.suggestion_id, _("Delete")); |
| 1530 |
} |
1530 |
} |
| 1531 |
if (!row.archived){ |
1531 |
if (!row.archived) { |
| 1532 |
node += '<li><a href="#" class="dropdown-item trigger_action" data-op="cud-archive" data-suggestionid="%s">%s</a></li>'.format(row.suggestion_id, _("Archive")) |
1532 |
node += '<li><a href="#" class="dropdown-item trigger_action" data-op="cud-archive" data-suggestionid="%s">%s</a></li>'.format(row.suggestion_id, _("Archive")); |
| 1533 |
} else { |
1533 |
} else { |
| 1534 |
node += '<li><a href="#" class="dropdown-item trigger_action" data-op="cud-unarchive" data-suggestionid="%s">%s</a></li>'.format(row.suggestion_id, _("Unarchive")) |
1534 |
node += '<li><a href="#" class="dropdown-item trigger_action" data-op="cud-unarchive" data-suggestionid="%s">%s</a></li>'.format(row.suggestion_id, _("Unarchive")); |
| 1535 |
} |
1535 |
} |
| 1536 |
node += '</ul></div>' |
1536 |
node += "</ul></div>"; |
| 1537 |
return node |
1537 |
return node; |
| 1538 |
} else if (permissions.CAN_user_suggestions_suggestions_delete){ |
1538 |
} else if (permissions.CAN_user_suggestions_suggestions_delete) { |
| 1539 |
return '<button data-op="cud-delete" data-suggestionid="%s" class="btn btn-xs btn-default trigger_action"><i class="fa fa-trash-can"></i> %s</button>'.format(row.suggestion_id, _("Delete")) |
1539 |
return '<button data-op="cud-delete" data-suggestionid="%s" class="btn btn-xs btn-default trigger_action"><i class="fa fa-trash-can"></i> %s</button>'.format(row.suggestion_id, _("Delete")); |
| 1540 |
} |
1540 |
} |
| 1541 |
}, |
1541 |
}, |
| 1542 |
createdCell: function (cell, cellData, rowData, rowIndex, colIndex) { |
1542 |
createdCell: function (cell, cellData, rowData, rowIndex, colIndex) { |
| 1543 |
$(cell).find(".trigger_action").on("click", function(e) { |
1543 |
$(cell) |
| 1544 |
var id = $(this).data('suggestionid'); |
1544 |
.find(".trigger_action") |
| 1545 |
var op = $(this).data('op'); |
1545 |
.on("click", function (e) { |
| 1546 |
if ( op == 'cud-delete' && !confirm(_("Are you sure you want to delete this suggestion?")) ) { |
1546 |
var id = $(this).data("suggestionid"); |
| 1547 |
e.preventDefault(); |
1547 |
var op = $(this).data("op"); |
|
|
1548 |
if (op == "cud-delete" && !confirm(_("Are you sure you want to delete this suggestion?"))) { |
| 1549 |
e.preventDefault(); |
| 1550 |
return false; |
| 1551 |
} |
| 1552 |
$('#action_form input[name="op"]').val(op); |
| 1553 |
$('#action_form input[name="suggestionid"]').val(id); |
| 1554 |
$("#action_form").submit(); |
| 1548 |
return false; |
1555 |
return false; |
| 1549 |
} |
1556 |
}); |
| 1550 |
$('#action_form input[name="op"]').val(op); |
1557 |
}, |
| 1551 |
$('#action_form input[name="suggestionid"]').val(id); |
|
|
| 1552 |
$('#action_form').submit(); |
| 1553 |
return false; |
| 1554 |
}) |
| 1555 |
} |
| 1556 |
}, |
1558 |
}, |
| 1557 |
] |
1559 |
], |
| 1558 |
}, |
1560 |
}, |
| 1559 |
suggestions_table_settings |
1561 |
suggestions_table_settings |
| 1560 |
); |
1562 |
); |
| 1561 |
} |
1563 |
} |
| 1562 |
if( $("#suggestiontabs .tab-pane.active").length < 1 ){ |
1564 |
if ($("#suggestiontabs .tab-pane.active").length < 1) { |
| 1563 |
$("#suggestiontabs a:first").tab("show"); |
1565 |
$("#suggestiontabs a:first").tab("show"); |
| 1564 |
loadDatatable($("#suggestiontabs a:first").data("tabname")) |
1566 |
loadDatatable($("#suggestiontabs a:first").data("tabname")); |
| 1565 |
$("#suggestiontabs a:first").attr("data-table_loaded", 'true') |
1567 |
$("#suggestiontabs a:first").attr("data-table_loaded", "true"); |
| 1566 |
} |
1568 |
} |
| 1567 |
|
1569 |
|
| 1568 |
suggestionData.forEach(suggestion => { |
1570 |
suggestionData.forEach(suggestion => { |
| 1569 |
$(`#suggestiontabs #${suggestion.suggestiontype}-tab`).on("click", function() { |
1571 |
$(`#suggestiontabs #${suggestion.suggestiontype}-tab`).on("click", function () { |
| 1570 |
if(!$(this).data("table_loaded")) { |
1572 |
if (!$(this).data("table_loaded")) { |
| 1571 |
loadDatatable(`${suggestion.suggestiontype}`); |
1573 |
loadDatatable(`${suggestion.suggestiontype}`); |
| 1572 |
$(this).attr("data-table_loaded", "true"); |
1574 |
$(this).attr("data-table_loaded", "true"); |
| 1573 |
} |
1575 |
} |
|
Lines 1575-1639
Link Here
|
| 1575 |
}); |
1577 |
}); |
| 1576 |
} |
1578 |
} |
| 1577 |
|
1579 |
|
| 1578 |
$("#branchcode").on('change',function(){ |
1580 |
$("#branchcode").on("change", function () { |
| 1579 |
// Modify the hidden input in the filters block from the library |
1581 |
// Modify the hidden input in the filters block from the library |
| 1580 |
// dropdown list at the top of suggestion list |
1582 |
// dropdown list at the top of suggestion list |
| 1581 |
let branchcode = $(this).val(); |
1583 |
let branchcode = $(this).val(); |
| 1582 |
$('input[name="branchcode"]').val( branchcode ); |
1584 |
$('input[name="branchcode"]').val(branchcode); |
| 1583 |
$('form[name="suggestionfilter"]').submit(); |
1585 |
$('form[name="suggestionfilter"]').submit(); |
| 1584 |
}); |
1586 |
}); |
| 1585 |
|
1587 |
|
| 1586 |
$(".checkall").click(function(e){ |
1588 |
$(".checkall").click(function (e) { |
| 1587 |
e.preventDefault(); |
1589 |
e.preventDefault(); |
| 1588 |
$(this).parents('form').find("input:checkbox").each(function(){ |
1590 |
$(this) |
| 1589 |
$(this).prop("checked", true); |
1591 |
.parents("form") |
| 1590 |
}); |
1592 |
.find("input:checkbox") |
|
|
1593 |
.each(function () { |
| 1594 |
$(this).prop("checked", true); |
| 1595 |
}); |
| 1591 |
}); |
1596 |
}); |
| 1592 |
$(".uncheckall").click(function(e){ |
1597 |
$(".uncheckall").click(function (e) { |
| 1593 |
e.preventDefault(); |
1598 |
e.preventDefault(); |
| 1594 |
$(this).parents('form').find("input:checkbox").each(function(){ |
1599 |
$(this) |
| 1595 |
$(this).prop("checked", false); |
1600 |
.parents("form") |
| 1596 |
}); |
1601 |
.find("input:checkbox") |
|
|
1602 |
.each(function () { |
| 1603 |
$(this).prop("checked", false); |
| 1604 |
}); |
| 1597 |
}); |
1605 |
}); |
| 1598 |
$(".other_reason").hide(); |
1606 |
$(".other_reason").hide(); |
| 1599 |
$("select[name='reason']").change(function(){ |
1607 |
$("select[name='reason']").change(function () { |
| 1600 |
if($(this).val() == "other"){ |
1608 |
if ($(this).val() == "other") { |
| 1601 |
$(this).hide(); |
1609 |
$(this).hide(); |
| 1602 |
$(this).siblings(".other_reason").show(); |
1610 |
$(this).siblings(".other_reason").show(); |
| 1603 |
} |
1611 |
} |
| 1604 |
}); |
1612 |
}); |
| 1605 |
|
1613 |
|
| 1606 |
$("a.cancel_note").click(function(e) { |
1614 |
$("a.cancel_note").click(function (e) { |
| 1607 |
$(this).parent().siblings("select").show().find("option[value='']").attr("selected","selected"); |
1615 |
$(this).parent().siblings("select").show().find("option[value='']").attr("selected", "selected"); |
| 1608 |
$(this).siblings("input[name='other_reason']").hide(); |
1616 |
$(this).siblings("input[name='other_reason']").hide(); |
| 1609 |
e.preventDefault(); |
1617 |
e.preventDefault(); |
| 1610 |
}); |
1618 |
}); |
| 1611 |
|
1619 |
|
| 1612 |
$("h4.local_collapse a").on("click", function(e){ |
1620 |
$("h4.local_collapse a").on("click", function (e) { |
| 1613 |
e.preventDefault(); |
1621 |
e.preventDefault(); |
| 1614 |
const target = $(this).data("target"); |
1622 |
const target = $(this).data("target"); |
| 1615 |
$("." + target).toggle(); |
1623 |
$("." + target).toggle(); |
| 1616 |
}); |
1624 |
}); |
| 1617 |
|
1625 |
|
| 1618 |
$("form.update_suggestions button[type='submit']").on("click", function(e) { |
1626 |
$("form.update_suggestions button[type='submit']").on("click", function (e) { |
| 1619 |
var submit_button = this; |
1627 |
var submit_button = this; |
| 1620 |
var op = $(submit_button).data('op'); |
1628 |
var op = $(submit_button).data("op"); |
| 1621 |
var selected_suggestions = $('form.update_suggestions').find("input[type='checkbox'][name='suggestionid']:checked"); |
1629 |
var selected_suggestions = $("form.update_suggestions").find("input[type='checkbox'][name='suggestionid']:checked"); |
| 1622 |
|
1630 |
|
| 1623 |
if ( selected_suggestions.length == 0 ) { |
1631 |
if (selected_suggestions.length == 0) { |
| 1624 |
alert(_("Please select at least one suggestion")); |
1632 |
alert(_("Please select at least one suggestion")); |
| 1625 |
e.preventDefault(); |
1633 |
e.preventDefault(); |
| 1626 |
return false; |
1634 |
return false; |
| 1627 |
} |
1635 |
} |
| 1628 |
|
1636 |
|
| 1629 |
if ( op === "cud-delete" ) { |
1637 |
if (op === "cud-delete") { |
| 1630 |
if ( ! confirm(_("Are you sure you want to delete these suggestions?")) ) { |
1638 |
if (!confirm(_("Are you sure you want to delete these suggestions?"))) { |
| 1631 |
e.preventDefault(); |
1639 |
e.preventDefault(); |
| 1632 |
return false; |
1640 |
return false; |
| 1633 |
} |
1641 |
} |
| 1634 |
} else if ( op === "cud-update_manager" ) { |
1642 |
} else if (op === "cud-update_manager") { |
| 1635 |
var managedby = $(submit_button).siblings("suggestion_managedby"); |
1643 |
var managedby = $(submit_button).siblings("suggestion_managedby"); |
| 1636 |
if ( managedby.val() == "" ) { |
1644 |
if (managedby.val() == "") { |
| 1637 |
alert(_("Please select a manager to assign to the selected suggestions")); |
1645 |
alert(_("Please select a manager to assign to the selected suggestions")); |
| 1638 |
e.preventDefault(); |
1646 |
e.preventDefault(); |
| 1639 |
return false; |
1647 |
return false; |
| 1640 |
- |
|
|