Lines 338-375
Link Here
|
338 |
|
338 |
|
339 |
[% IF ( deleted ) %]<div class="alert alert-info">The selected suggestions have been deleted.</div>[% END %] |
339 |
[% IF ( deleted ) %]<div class="alert alert-info">The selected suggestions have been deleted.</div>[% END %] |
340 |
|
340 |
|
341 |
[% IF (Koha.Preference( 'OPACViewOthersSuggestions' ) || loggedinusername) && (suggestions.size > 0 OR title_filter) %] |
|
|
342 |
[% SET can_delete_suggestion = 0 %] |
343 |
<form action="/cgi-bin/koha/opac-suggestions.pl" class="form-inline" id="search_suggestions_form" method="get"> |
344 |
<div class="form-row"> |
345 |
<div class="col-auto my-1"> |
346 |
<label for="title_filter">Search for:</label> |
347 |
</div> |
348 |
<div class="col-auto my-1"> |
349 |
<input type="text" name="title_filter" id="title_filter" value="[% title_filter | html %]" size="30" class="form-control form-control-sm" /> |
350 |
</div> |
351 |
[% IF Koha.Preference( 'OPACViewOthersSuggestions' ) %] |
352 |
[% IF loggedinusername %] |
353 |
<div class="col-auto my-1"> |
354 |
<label class="sr-only" for="suggested_by_anyone">Suggested by:</label> |
355 |
<select class="form-control form-control-sm" name="suggested_by_anyone" id="suggested_by_anyone"> |
356 |
[% IF suggested_by_anyone %] |
357 |
<option value="0">Suggested by me</option> |
358 |
<option value="1" selected="selected">Suggested by anyone</option> |
359 |
[% ELSE %] |
360 |
<option value="0" selected="selected">Suggested by me</option> |
361 |
<option value="1">Suggested by anyone</option> |
362 |
[% END %] |
363 |
</select> |
364 |
</div> |
365 |
[% END %] |
366 |
[% END %] |
367 |
<div class="col-auto my-1"> |
368 |
<button type="submit" class="btn btn-sm btn-primary">Go</button> |
369 |
</div> |
370 |
</div> |
371 |
</form> |
372 |
[% END %] |
373 |
[% IF suggestions.size > 0 %] |
341 |
[% IF suggestions.size > 0 %] |
374 |
[% SET can_delete_suggestion = 0 %] |
342 |
[% SET can_delete_suggestion = 0 %] |
375 |
<form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="delete_suggestions"> |
343 |
<form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="delete_suggestions"> |
Lines 403-416
Link Here
|
403 |
|
371 |
|
404 |
[% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 || loggedinusername %] |
372 |
[% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 || loggedinusername %] |
405 |
<table id="suggestt" class="table table-bordered tabled"> |
373 |
<table id="suggestt" class="table table-bordered tabled"> |
406 |
<caption class="sr-only">Your purchase suggestions<caption> |
374 |
<caption class="sr-only">Your purchase suggestions</caption> |
407 |
<thead> |
375 |
<thead> |
408 |
<tr> |
376 |
<tr> |
409 |
[% IF ( loggedinusername ) %]<th> </th>[% END %] |
377 |
[% IF ( loggedinusername ) %]<th class="NoSort"> </th>[% END %] |
410 |
<th class="all">Summary</th> |
378 |
<th class="all">Summary</th> |
411 |
<th>Suggested on</th> |
379 |
<th>Suggested on</th> |
412 |
<th>Note</th> |
380 |
<th>Note</th> |
413 |
[% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]<th>Suggested for</th>[% END %] |
381 |
[% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %] |
|
|
382 |
<th>Suggested for</th> |
383 |
<th class="hidden"></th> |
384 |
[% END %] |
414 |
[% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]<th>Managed by</th>[% END %] |
385 |
[% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]<th>Managed by</th>[% END %] |
415 |
<th>Status</th> |
386 |
<th>Status</th> |
416 |
<th></th> |
387 |
<th></th> |
Lines 427-433
Link Here
|
427 |
[% END %] |
398 |
[% END %] |
428 |
</td> |
399 |
</td> |
429 |
[% END %] |
400 |
[% END %] |
430 |
<td> |
401 |
<td class="anti-the"> |
431 |
<p> |
402 |
<p> |
432 |
<label for="id[% suggestions_loo.suggestionid | html %]"> |
403 |
<label for="id[% suggestions_loo.suggestionid | html %]"> |
433 |
[% IF suggestion.biblionumber %] |
404 |
[% IF suggestion.biblionumber %] |
Lines 461-466
Link Here
|
461 |
[% Branches.GetName(suggestion.branchcode) | html %] |
432 |
[% Branches.GetName(suggestion.branchcode) | html %] |
462 |
[% END %] |
433 |
[% END %] |
463 |
</td> |
434 |
</td> |
|
|
435 |
<td> |
436 |
[% IF logged_in_user.borrowernumber == suggestion.suggester.borrowernumber %] |
437 |
1 |
438 |
[% ELSE %] |
439 |
0 |
440 |
[% END %] |
441 |
</td> |
464 |
[% END %] |
442 |
[% END %] |
465 |
[% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %] |
443 |
[% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %] |
466 |
<td> |
444 |
<td> |
Lines 569-599
Link Here
|
569 |
[% END %] |
547 |
[% END %] |
570 |
|
548 |
|
571 |
$(function() { |
549 |
$(function() { |
572 |
$("#suggestt").dataTable($.extend(true, {}, dataTablesDefaults, { |
550 |
dataTablesDefaults.buttons.splice(1,3); // Remove copy, print, csv from button set |
|
|
551 |
var suggestions_table = $("#suggestt").DataTable($.extend(true, {}, dataTablesDefaults, { |
573 |
"order": [[ 1, "asc" ]], |
552 |
"order": [[ 1, "asc" ]], |
574 |
"autoWidth": false, |
553 |
"autoWidth": false, |
|
|
554 |
"dom": '<"top"<"table_entries"i><"table_controls"fB>>t', |
575 |
"columnDefs": [ |
555 |
"columnDefs": [ |
576 |
[% IF ( loggedinusername ) %]{ "targets": [ 0 ], "sortable": false, "searchable": false }[% END %], |
556 |
{ "targets": ["NoSort"], "sortable": false, "searchable": false }, |
|
|
557 |
{ "visible": false, "targets" : [ "hidden" ] }, |
577 |
{ "className": 'dtr-control', "orderable": false, "targets": -1 }, |
558 |
{ "className": 'dtr-control', "orderable": false, "targets": -1 }, |
|
|
559 |
{ "type": "anti-the", "targets" : [ "anti-the" ] }, |
578 |
{ responsivePriority: 1, targets: 1 } |
560 |
{ responsivePriority: 1, targets: 1 } |
579 |
], |
561 |
], |
580 |
"columns": [ |
562 |
"language": { |
581 |
[% IF ( loggedinusername ) %]null,[% END %] |
563 |
"search": "_INPUT_", |
582 |
{ "type": "anti-the" }, |
564 |
"searchPlaceholder": _("Search") |
583 |
null, |
565 |
}, |
584 |
null, |
|
|
585 |
[% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]null,[% END %] |
586 |
[% IF Koha.Preference( 'OpacSuggestionManagedBy' ) %]null,[% END %] |
587 |
null, |
588 |
null |
589 |
], |
590 |
"responsive": { |
566 |
"responsive": { |
591 |
details: { |
567 |
details: { |
592 |
type: 'column', |
568 |
type: 'column', |
593 |
target: -1 |
569 |
target: -1 |
594 |
} |
570 |
} |
595 |
}, |
571 |
}, |
|
|
572 |
initComplete: function (settings, json) { |
573 |
var tableId = settings.nTable.id; |
574 |
[% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 && loggedinusername %] |
575 |
// Add select filter |
576 |
$('#suggestt_filter').append('<label for="suggested_by_user" class="sr-only">Filter:</label>').append('<select class="form-control form-control-sm" name="suggested_by_user" id="suggested_by_user"><option value="1" selected="selected">Suggested by me</option><option value="0">Suggested by anyone</option></select>'); |
577 |
// Filter results on select change |
578 |
let suggested_by_user = $("#suggested_by_user"); |
579 |
suggested_by_user.on('change', function () { |
580 |
suggestions_table.columns(5).search($(this).val()).draw(); |
581 |
}); |
582 |
$("body").on( 'search.dt', "#" + tableId, function ( e, settings ) { |
583 |
if( settings.oPreviousSearch.sSearch == "" && suggested_by_user.val() == "1" ){ |
584 |
$("#" + tableId + "_wrapper").find(".dt_button_clear_filter").addClass("disabled"); |
585 |
} else { |
586 |
$("#" + tableId + "_wrapper").find(".dt_button_clear_filter").removeClass("disabled"); |
587 |
} |
588 |
}); |
589 |
[% ELSE %] |
590 |
$("body").on( 'search.dt', "#" + tableId, function ( e, settings ) { |
591 |
if( settings.oPreviousSearch.sSearch == "" ){ |
592 |
$("#" + tableId + "_wrapper").find(".dt_button_clear_filter").addClass("disabled"); |
593 |
} else { |
594 |
$("#" + tableId + "_wrapper").find(".dt_button_clear_filter").removeClass("disabled"); |
595 |
} |
596 |
}); |
597 |
[% END %] |
598 |
} |
596 |
})); |
599 |
})); |
|
|
600 |
$("#usersuggestions").on("click", ".dt_button_clear_filter",function(){ |
601 |
suggestions_table.search("").columns().search("").draw(); |
602 |
$("#suggested_by_user").val(1).change(); |
603 |
$(this).addClass("disabled"); |
604 |
}); |
605 |
[% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 && loggedinusername %] |
606 |
suggestions_table.columns(5).search( 1 ).draw(); |
607 |
[% END %] |
608 |
|
597 |
[% IF ( loggedinusername ) %]$("span.clearall").html("<a id=\"CheckNone\" class=\"btn btn-link btn-sm\" href=\"#\">"+_("Clear all")+"<\/a>"); |
609 |
[% IF ( loggedinusername ) %]$("span.clearall").html("<a id=\"CheckNone\" class=\"btn btn-link btn-sm\" href=\"#\">"+_("Clear all")+"<\/a>"); |
598 |
$("span.checkall").html("<a id=\"CheckAll\" class=\"btn btn-link btn-sm\" href=\"#\">"+_("Select all")+"<\/a>"); |
610 |
$("span.checkall").html("<a id=\"CheckAll\" class=\"btn btn-link btn-sm\" href=\"#\">"+_("Select all")+"<\/a>"); |
599 |
$("#CheckAll").on("click",function(e){ |
611 |
$("#CheckAll").on("click",function(e){ |