Heera/public/assets/js/pages/job-list.init.js

1 line
9.8 KiB
JavaScript
Raw Permalink Normal View History

2024-05-16 03:46:08 +00:00
function getChartColorsArray(e){if(null!==document.getElementById(e))return e=document.getElementById(e).getAttribute("data-colors"),(e=JSON.parse(e)).map(function(e){var t=e.replace(" ","");return-1===t.indexOf(",")?getComputedStyle(document.documentElement).getPropertyValue(t)||t:2==(e=e.split(",")).length?"rgba("+getComputedStyle(document.documentElement).getPropertyValue(e[0])+","+e[1]+")":t})}var options,chart,chartDonutBasicColors=getChartColorsArray("simple_dount_chart"),url=(chartDonutBasicColors&&(options={series:[98,63,35],labels:["New Application","Approved","Rejected"],chart:{height:300,type:"donut"},legend:{position:"bottom"},dataLabels:{dropShadow:{enabled:!1}},colors:chartDonutBasicColors},(chart=new ApexCharts(document.querySelector("#simple_dount_chart"),options)).render()),"assets/json/"),allJobList="",editList=!1,prevButton=document.getElementById("page-prev"),nextButton=document.getElementById("page-next"),currentPage=1,itemsPerPage=3,getJSON=function(e,t){var n=new XMLHttpRequest;n.open("GET",url+e,!0),n.responseType="json",n.onload=function(){var e=n.status;t(200===e?null:e,n.response)},n.send()};function loadJobListData(e,t){var n=Math.ceil(e.length/itemsPerPage);n<(t=t<1?1:t)&&(t=n),document.querySelector("#job-list").innerHTML="";for(var o,a,i=(t-1)*itemsPerPage;i<t*itemsPerPage&&i<e.length;i++)e[i]&&e[i].tags&&(o=e[i].tags,a="",Array.from(o).forEach((e,t)=>{a+='<span class="badge bg-primary-subtle text-primary me-1">'+e+"</span>"})),e[i]&&(document.querySelector("#job-list").innerHTML+='<div class="card joblist-card"> <div class="card-body"> <div class="d-flex mb-4"> <div class="avatar-sm"> <div class="avatar-title bg-light rounded"> <img src="'+e[i].companyLogo+'" alt="" class="avatar-xxs companyLogo-img"> </div> </div> <div class="ms-3 flex-grow-1"> <img src="'+e[i].coverImg+'" alt="" class="d-none cover-img"> <a href="#!"><h5 class="job-title">'+e[i].jobTitle+'</h5></a> <p class="company-name text-muted mb-0">'+e[i].companyName+'</p> </div> <div> <button type="button" class="btn btn-ghost-primary btn-icon custom-toggle" data-bs-toggle="button"> <span class="icon-on"><i class="ri-bookmark-line"></i></span> <span class="icon-off"><i class="ri-bookmark-fill"></i></span> </button> </div> </div> <p class="text-muted job-description">'+e[i].description+"</p> <div>"+a+'</div> </div> <div class="card-footer border-top-dashed"> <div class="d-flex justify-content-between align-items-center flex-wrap gap-3"> <div><i class="ri-briefcase-2-line align-bottom me-1"></i> <span class="job-type">'+e[i].type+'</span></div> <div class="d-none"><span class="job-experience">'+e[i].experience+'</span></div> <div><i class="ri-map-pin-2-line align-bottom me-1"></i> <span class="job-location">'+e[i].location+'</span></div> <div><i class="ri-user-3-line align-bottom me-1"></i> '+e[i].applied+'</div> <div><i class="ri-time-line align-bottom me-1"></i> <span class="job-postdate">'+e[i].postDate+'</span></div> <div><a href="#!" class="btn btn-primary viewjob-list">View More <i class="ri-arrow-right-line align-bottom ms-1"></i></a></div> </div> </div> </div>');document.getElementById("total-result").innerHTML=e.length,selectedPage(),1==currentPage?prevButton.parentNode.classList.add("disabled"):prevButton.parentNode.classList.remove("disabled"),currentPage==n?nextButton.parentNode.classList.add("disabled"):nextButton.parentNode.classList.remove("disabled"),jobDetailShow()}function selectedPage(){for(var e=document.getElem