var url="assets/json/",allCompaniesList="",prevButton=document.getElementById("page-prev"),nextButton=document.getElementById("page-next"),currentPage=1,itemsPerPage=16,getJSON=function(e,n){var t=new XMLHttpRequest;t.open("GET",url+e,!0),t.responseType="json",t.onload=function(){var e=t.status;n(200===e?null:e,t.response)},t.send()};function loadCompaniesListData(e,n){var t=Math.ceil(e.length/itemsPerPage);t<(n=n<1?1:n)&&(n=t),document.querySelector("#companies-list").innerHTML="";for(var a=(n-1)*itemsPerPage;a
'+e[a].companyName+'
'+e[a].companyDesc+'

'+e[a].industryType+'

'+e[a].employee+' '+e[a].location+' '+e[a].rating+' '+e[a].website+' '+e[a].since+'
");selectedPage(),1==currentPage?prevButton.parentNode.classList.add("disabled"):prevButton.parentNode.classList.remove("disabled"),currentPage==t?nextButton.parentNode.classList.add("disabled"):nextButton.parentNode.classList.remove("disabled"),jobDetailShow()}function selectedPage(){for(var e=document.getElementById("page-num").getElementsByClassName("clickPageNumber"),n=0;n"+t+"";document.addEventListener("click",function(e){"A"==e.target.nodeName&&e.target.classList.contains("clickPageNumber")&&(currentPage=e.target.textContent,loadCompaniesListData(allCompaniesList,currentPage))}),selectedPage()}function jobDetailShow(){Array.from(document.querySelectorAll("#companies-list .companiesList-card")).forEach(function(d){d.querySelector(".viewcompany-list").addEventListener("click",function(){var e=d.querySelector(".companyLogo-img").src,n=d.querySelector(".company-name").innerHTML,t=d.querySelector(".company-desc").innerHTML,a=d.querySelector(".industry-type").innerHTML,o=d.querySelector(".employee").innerHTML,i=d.querySelector(".location").innerHTML,r=d.querySelector(".rating").innerHTML,c=d.querySelector(".website").innerHTML,s=d.querySelector(".email").innerHTML,l=d.querySelector(".since").innerHTML,m=d.querySelector(".vacancy").innerHTML;document.querySelector("#company-overview .company-logo").src=e,document.querySelector("#company-overview .overview-companyname").innerHTML=n,document.querySelectorAll("#company-overview .overview-industryType").forEach(function(e){e.innerHTML=a}),document.querySelector("#company-overview .overview-companydesc").innerHTML=t,document.querySelector("#company-overview .overview-company_location").innerHTML=i,document.querySelector("#company-overview .overview-employee").innerHTML=o,document.querySelector("#company-overview .overview-vacancy").innerHTML=m,document.querySelector("#company-overview .overview-rating").innerHTML=r,document.querySelector("#company-overview .overview-website").innerHTML=c,document.querySelector("#company-overview .overview-email").innerHTML=s,document.querySelector("#company-overview .overview-since").innerHTML=l})})}getJSON("job-companies-list.json",function(e,n){null!==e?console.log("Something went wrong: "+e):(loadCompaniesListData(allCompaniesList=n,currentPage),paginationEvents())});var searchElementList=document.getElementById("searchCompany");function filterData(){for(var a=document.getElementById("datepicker").value,o=document.getElementById("idType").value,e=allCompaniesList.filter(function(e){console.log(new Date(e.postDate)<=new Date(a));var n=!1,t=!1,t="all"==e.type||"all"==o||e.type==o,n=new Date(e.postDate)<=new Date(a);return t&&n||(t&&""==a?t:t&&n&&""==a?t&&n:void 0)}),n=(0==e.length?document.getElementById("pagination-element").style.display="none":document.getElementById("pagination-element").style.display="flex",document.getElementById("page-num")),t=(n.innerHTML="",Math.ceil(e.length/itemsPerPage)),i=1;i"+i+"";loadCompaniesListData(e,currentPage)}searchElementList.addEventListener("keyup",function(){var e=searchElementList.value.toLowerCase();n=e;for(var n,e=allCompaniesList.filter(function(e){return-1!==e.companyName.toLowerCase().indexOf(n.toLowerCase())||-1!==e.industryType.toLowerCase().indexOf(n.toLowerCase())}),t=(0==e.length?document.getElementById("pagination-element").style.display="none":document.getElementById("pagination-element").style.display="flex",document.getElementById("page-num")),a=(t.innerHTML="",Math.ceil(e.length/itemsPerPage)),o=1;o"+o+"";loadCompaniesListData(e,currentPage)}),flatpickr("#datepicker",{dateFormat:"d M, Y",defaultDate:new Date,maxDate:new Date});