Lines 465-471
Link Here
|
465 |
let item_search_selections = JSON.parse( localStorage.getItem("item_search_selections") ) || []; |
465 |
let item_search_selections = JSON.parse( localStorage.getItem("item_search_selections") ) || []; |
466 |
if( item_search_selections.length > 0 ){ |
466 |
if( item_search_selections.length > 0 ){ |
467 |
showItemSelections( item_search_selections.length ); |
467 |
showItemSelections( item_search_selections.length ); |
468 |
$("#results input[type='checkbox']").each(function(){ |
468 |
$("#item_search input[type='checkbox']").each(function(){ |
469 |
var itemnumber = $(this).val(); |
469 |
var itemnumber = $(this).val(); |
470 |
if( item_search_selections.indexOf( itemnumber ) >= 0 ){ |
470 |
if( item_search_selections.indexOf( itemnumber ) >= 0 ){ |
471 |
$(this).prop("checked", true ); |
471 |
$(this).prop("checked", true ); |
Lines 553-559
Link Here
|
553 |
+ ' <a href="#" id="clear-row-selection"><i class="fa fa-times"></i> ' + _("Clear") + '</a>' |
553 |
+ ' <a href="#" id="clear-row-selection"><i class="fa fa-times"></i> ' + _("Clear") + '</a>' |
554 |
+ ' </div>' |
554 |
+ ' </div>' |
555 |
+ ' </div>' |
555 |
+ ' </div>' |
556 |
+ ' <table id="results">' |
556 |
+ ' <table id="item_search">' |
557 |
+ ' <thead>' + tr + '</thead>' |
557 |
+ ' <thead>' + tr + '</thead>' |
558 |
+ ' <tbody></tbody>' |
558 |
+ ' <tbody></tbody>' |
559 |
+ ' </table>' |
559 |
+ ' </table>' |
Lines 663-669
Link Here
|
663 |
}; |
663 |
}; |
664 |
|
664 |
|
665 |
var table_settings = [% TablesSettings.GetTableSettings( 'catalogue', 'itemsearch', 'results', 'json' ) | $raw %]; |
665 |
var table_settings = [% TablesSettings.GetTableSettings( 'catalogue', 'itemsearch', 'results', 'json' ) | $raw %]; |
666 |
$('#results').kohaTable( { |
666 |
$('#item_search').kohaTable( { |
667 |
"bKohaColumnsUseNames": true, |
667 |
"bKohaColumnsUseNames": true, |
668 |
"destroy": true, |
668 |
"destroy": true, |
669 |
"serverSide": true, |
669 |
"serverSide": true, |
Lines 718-724
Link Here
|
718 |
fixedHeader: false // There is a bug on this view |
718 |
fixedHeader: false // There is a bug on this view |
719 |
}, table_settings, true, null, filters_options ); |
719 |
}, table_settings, true, null, filters_options ); |
720 |
|
720 |
|
721 |
$('#results').on('draw.dt', function (e, settings) { |
721 |
$('#item_search').on('draw.dt', function (e, settings) { |
722 |
prepSelections(); |
722 |
prepSelections(); |
723 |
$('[data-bs-toggle="tooltip"]').tooltip(); |
723 |
$('[data-bs-toggle="tooltip"]').tooltip(); |
724 |
}); |
724 |
}); |
Lines 766-772
Link Here
|
766 |
|
766 |
|
767 |
$("body").on("click", "#select_all", function(e) { |
767 |
$("body").on("click", "#select_all", function(e) { |
768 |
e.preventDefault(); |
768 |
e.preventDefault(); |
769 |
$("#results input[type='checkbox']").each(function(){ |
769 |
$("#item_search input[type='checkbox']").each(function(){ |
770 |
if( $(this).prop("checked") == false ){ |
770 |
if( $(this).prop("checked") == false ){ |
771 |
$(this).prop( "checked", true ).change(); |
771 |
$(this).prop( "checked", true ).change(); |
772 |
} |
772 |
} |
Lines 775-781
Link Here
|
775 |
|
775 |
|
776 |
$("body").on("click", "#clear_all", function(e) { |
776 |
$("body").on("click", "#clear_all", function(e) { |
777 |
e.preventDefault(); |
777 |
e.preventDefault(); |
778 |
$("#results input[type='checkbox']").each(function(){ |
778 |
$("#item_search input[type='checkbox']").each(function(){ |
779 |
if( $(this).prop("checked") == true ){ |
779 |
if( $(this).prop("checked") == true ){ |
780 |
$(this).prop( "checked", false ).change(); |
780 |
$(this).prop( "checked", false ).change(); |
781 |
} |
781 |
} |
Lines 784-795
Link Here
|
784 |
|
784 |
|
785 |
$("body").on("click", "#clear-row-selection", function(e){ |
785 |
$("body").on("click", "#clear-row-selection", function(e){ |
786 |
e.preventDefault(); |
786 |
e.preventDefault(); |
787 |
$("#results input[type='checkbox']").prop("checked" ,false ).change(); |
787 |
$("#item_search input[type='checkbox']").prop("checked" ,false ).change(); |
788 |
localStorage.removeItem("item_search_selections"); |
788 |
localStorage.removeItem("item_search_selections"); |
789 |
showItemSelections( 0 ); |
789 |
showItemSelections( 0 ); |
790 |
}); |
790 |
}); |
791 |
|
791 |
|
792 |
$("body").on('change', '#results input[type="checkbox"]', function() { |
792 |
$("body").on('change', '#item_search input[type="checkbox"]', function() { |
793 |
let item_search_selections = JSON.parse( localStorage.getItem("item_search_selections") ) || []; |
793 |
let item_search_selections = JSON.parse( localStorage.getItem("item_search_selections") ) || []; |
794 |
var itemnumber = $(this).val(); |
794 |
var itemnumber = $(this).val(); |
795 |
if( $(this).prop("checked") ){ |
795 |
if( $(this).prop("checked") ){ |
Lines 859-865
Link Here
|
859 |
batch_mod_form.submit(); |
859 |
batch_mod_form.submit(); |
860 |
}); |
860 |
}); |
861 |
|
861 |
|
862 |
$("body").on('click','#results tbody td',function(e){ |
862 |
$("body").on('click','#item_search tbody td',function(e){ |
863 |
var checkbox = $(this).find("input[type=checkbox]"); |
863 |
var checkbox = $(this).find("input[type=checkbox]"); |
864 |
if (e.target.type != "checkbox") { |
864 |
if (e.target.type != "checkbox") { |
865 |
checkbox.prop('checked', !checkbox.prop("checked")); |
865 |
checkbox.prop('checked', !checkbox.prop("checked")); |