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