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