|
Lines 446-452
Link Here
|
| 446 |
let item_search_selections = JSON.parse( localStorage.getItem("item_search_selections") ) || []; |
446 |
let item_search_selections = JSON.parse( localStorage.getItem("item_search_selections") ) || []; |
| 447 |
if( item_search_selections.length > 0 ){ |
447 |
if( item_search_selections.length > 0 ){ |
| 448 |
showItemSelections( item_search_selections.length ); |
448 |
showItemSelections( item_search_selections.length ); |
| 449 |
$("#results input[type='checkbox']").each(function(){ |
449 |
$("#item_search input[type='checkbox']").each(function(){ |
| 450 |
var itemnumber = $(this).val(); |
450 |
var itemnumber = $(this).val(); |
| 451 |
if( item_search_selections.indexOf( itemnumber ) >= 0 ){ |
451 |
if( item_search_selections.indexOf( itemnumber ) >= 0 ){ |
| 452 |
$(this).prop("checked", true ); |
452 |
$(this).prop("checked", true ); |
|
Lines 534-540
Link Here
|
| 534 |
+ ' <a href="#" id="clear-row-selection"><i class="fa fa-times"></i> ' + _("Clear") + '</a>' |
534 |
+ ' <a href="#" id="clear-row-selection"><i class="fa fa-times"></i> ' + _("Clear") + '</a>' |
| 535 |
+ ' </div>' |
535 |
+ ' </div>' |
| 536 |
+ ' </div>' |
536 |
+ ' </div>' |
| 537 |
+ ' <table id="results">' |
537 |
+ ' <table id="item_search">' |
| 538 |
+ ' <thead>' + tr + '</thead>' |
538 |
+ ' <thead>' + tr + '</thead>' |
| 539 |
+ ' <tbody></tbody>' |
539 |
+ ' <tbody></tbody>' |
| 540 |
+ ' </table>' |
540 |
+ ' </table>' |
|
Lines 644-650
Link Here
|
| 644 |
}; |
644 |
}; |
| 645 |
|
645 |
|
| 646 |
var table_settings = [% TablesSettings.GetTableSettings( 'catalogue', 'itemsearch', 'results', 'json' ) | $raw %]; |
646 |
var table_settings = [% TablesSettings.GetTableSettings( 'catalogue', 'itemsearch', 'results', 'json' ) | $raw %]; |
| 647 |
$('#results').kohaTable( { |
647 |
$('#item_search').kohaTable( { |
| 648 |
"bKohaColumnsUseNames": true, |
648 |
"bKohaColumnsUseNames": true, |
| 649 |
"destroy": true, |
649 |
"destroy": true, |
| 650 |
"serverSide": true, |
650 |
"serverSide": true, |
|
Lines 699-705
Link Here
|
| 699 |
fixedHeader: false // There is a bug on this view |
699 |
fixedHeader: false // There is a bug on this view |
| 700 |
}, table_settings, true, null, filters_options ); |
700 |
}, table_settings, true, null, filters_options ); |
| 701 |
|
701 |
|
| 702 |
$('#results').on('draw.dt', function (e, settings) { |
702 |
$('#item_search').on('draw.dt', function (e, settings) { |
| 703 |
prepSelections(); |
703 |
prepSelections(); |
| 704 |
$('[data-bs-toggle="tooltip"]').tooltip(); |
704 |
$('[data-bs-toggle="tooltip"]').tooltip(); |
| 705 |
}); |
705 |
}); |
|
Lines 747-753
Link Here
|
| 747 |
|
747 |
|
| 748 |
$("body").on("click", "#select_all", function(e) { |
748 |
$("body").on("click", "#select_all", function(e) { |
| 749 |
e.preventDefault(); |
749 |
e.preventDefault(); |
| 750 |
$("#results input[type='checkbox']").each(function(){ |
750 |
$("#item_search input[type='checkbox']").each(function(){ |
| 751 |
if( $(this).prop("checked") == false ){ |
751 |
if( $(this).prop("checked") == false ){ |
| 752 |
$(this).prop( "checked", true ).change(); |
752 |
$(this).prop( "checked", true ).change(); |
| 753 |
} |
753 |
} |
|
Lines 756-762
Link Here
|
| 756 |
|
756 |
|
| 757 |
$("body").on("click", "#clear_all", function(e) { |
757 |
$("body").on("click", "#clear_all", function(e) { |
| 758 |
e.preventDefault(); |
758 |
e.preventDefault(); |
| 759 |
$("#results input[type='checkbox']").each(function(){ |
759 |
$("#item_search input[type='checkbox']").each(function(){ |
| 760 |
if( $(this).prop("checked") == true ){ |
760 |
if( $(this).prop("checked") == true ){ |
| 761 |
$(this).prop( "checked", false ).change(); |
761 |
$(this).prop( "checked", false ).change(); |
| 762 |
} |
762 |
} |
|
Lines 765-776
Link Here
|
| 765 |
|
765 |
|
| 766 |
$("body").on("click", "#clear-row-selection", function(e){ |
766 |
$("body").on("click", "#clear-row-selection", function(e){ |
| 767 |
e.preventDefault(); |
767 |
e.preventDefault(); |
| 768 |
$("#results input[type='checkbox']").prop("checked" ,false ).change(); |
768 |
$("#item_search input[type='checkbox']").prop("checked" ,false ).change(); |
| 769 |
localStorage.removeItem("item_search_selections"); |
769 |
localStorage.removeItem("item_search_selections"); |
| 770 |
showItemSelections( 0 ); |
770 |
showItemSelections( 0 ); |
| 771 |
}); |
771 |
}); |
| 772 |
|
772 |
|
| 773 |
$("body").on('change', '#results input[type="checkbox"]', function() { |
773 |
$("body").on('change', '#item_search input[type="checkbox"]', function() { |
| 774 |
let item_search_selections = JSON.parse( localStorage.getItem("item_search_selections") ) || []; |
774 |
let item_search_selections = JSON.parse( localStorage.getItem("item_search_selections") ) || []; |
| 775 |
var itemnumber = $(this).val(); |
775 |
var itemnumber = $(this).val(); |
| 776 |
if( $(this).prop("checked") ){ |
776 |
if( $(this).prop("checked") ){ |
|
Lines 840-846
Link Here
|
| 840 |
batch_mod_form.submit(); |
840 |
batch_mod_form.submit(); |
| 841 |
}); |
841 |
}); |
| 842 |
|
842 |
|
| 843 |
$("body").on('click','#results tbody td',function(e){ |
843 |
$("body").on('click','#item_search tbody td',function(e){ |
| 844 |
var checkbox = $(this).find("input[type=checkbox]"); |
844 |
var checkbox = $(this).find("input[type=checkbox]"); |
| 845 |
if (e.target.type != "checkbox") { |
845 |
if (e.target.type != "checkbox") { |
| 846 |
checkbox.prop('checked', !checkbox.prop("checked")); |
846 |
checkbox.prop('checked', !checkbox.prop("checked")); |