var items = [];
app.preloader.show();
var theme_check=html.className.search("theme-dark");
var covid_check=[];
$.ajax({
type:“GET” ,
dataType :“json”,
url:“covid-19_check.php”,
async: false,
success: function(res){
covid_check=res;
}
});
$.ajax({
type:"POST",
dataType :"json",
url:"general_search_func.php",
async: false,
data: {shop:document.getElementById("usrshop").value,
theme_check:theme_check,
covid_check:covid_check},
success: function(res){
total_wos=res.length;
items=res;
document.getElementById("gen_count").innerHTML=items.length;
}
});
var virtualList = app.virtualList.create({
// List Element
el: ‘#gen_list’,
cache:false,
createUl:false,
// Pass array with items
items,
// Custom search function for searchbar
searchAll: function (query, items) {
var found = [];
for (var i = 0; i < items.length; i++) {
if (items[i].FULL_WO.toLowerCase().indexOf(query.toLowerCase()) >= 0 || query.trim() === ‘’) found.push(i);
if (items[i].WO_DESC.toLowerCase().indexOf(query.toLowerCase()) >= 0 || query.trim() === ‘’) found.push(i);
//if (items[i].COVID.toLowerCase().indexOf(query.toLowerCase()) >= 0 || query.trim() === ‘’) found.push(i);
}
found=removeDuplicates_Gen(found);
return found; //return array with mathced indexes
},
// List item Template7 template
renderItem(item) {
return <li data-id="${item.FULL_WO_ID}" style="list-style-type:none;margin-top:-45px;margin-bottom:45px;background-color:${item.BACKGROUND}"> <a href="/change_wo_data/" class="item-link item-content" data-ignore-cache="true" data-force="true"> <div class="item-inner"> <div class="item-title-row"> <div class="item-title"><b>${item.FULL_WO}</b></div> </div> <div class="item-subtitle">${item.WO_DESC}</div> {{COVID} </div> </a> <br><br> </li>
;
},
// Item height
height: app.theme === ‘ios’ ? 63 : (app.theme === ‘md’ ? 73 : 46),
});