function getTargetContainer() { let dt = document.querySelector('#embedJobs'); return dt; } function setStyles() { let stylesTag = document.createElement('style'); let styles = ` @import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap') body { background-color: #f4f4f4; color: #333; line-height: 1.6; padding: 20px; } .card { background-color: #fff; padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); border-radius: 4px; } .card h3 { margin-top: 0; margin-bottom: 10px; font-size: 20px; } .card p { margin-bottom: 10px; font-size: 14px; } .card strong { font-weight: bold; } .card button { background-color: #007BFF; color: white; border: none; padding: 10px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin-top: 10px; cursor: pointer; border-radius: 5px; transition: background-color 0.3s; } .card button:hover { background-color: #0056b3; } .main-container { background-color: #f4f4f4; color: #333; line-height: 1.6; padding: 20px; max-width: 1250px; margin-left: 30px; margin-right: 30px; } body { margin: 0; padding: 0; font-family: Arial, sans-serif; } .no-found-card { max-width: 600px; margin: 100px auto; text-align: center; background-color: #fff; padding: 20px; border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); } h1 { color: #333; } p { color: #666; } .btn { display: inline-block; padding: 10px 20px; background-color: #007bff; color: #fff; text-decoration: none; border-radius: 5px; transition: background-color 0.3s; } .btn:hover { background-color: #0056b3; } `; stylesTag.textContent = styles; document.head.appendChild(stylesTag); } function createJobFilterContainer() { let mainContainer = document.createElement("div"); mainContainer.id = "fh-main-container"; mainContainer.classList.add("fh-main-container"); getTargetContainer().appendChild(mainContainer); let jobFilterContainer = document.createElement("div"); jobFilterContainer.id = "fh-embed-jobs-filters"; jobFilterContainer.classList.add("fh-col-lg-3", "fh-col-sm-12", "fh-pr-lg-3", "fh-mb-4"); let filterView = `

Open Positions

`; jobFilterContainer.innerHTML = filterView; mainContainer.appendChild(jobFilterContainer); } function createJobWidgetContainer() { let jobWidget = document.createElement("div"); jobWidget.id = "fh-job-widget"; jobWidget.classList.add("fh-col-lg-9", "fh-col-sm-12", "fh-pl-lg-3"); document.querySelector('#fh-main-container').appendChild(jobWidget); } function initialize(isCareersPage) { setStyles(); createJobFilterContainer(); createJobWidgetContainer(); if (!isCareersPage) { createHeaderContainer(); createFooterContainer(); } } document.addEventListener("DOMContentLoaded", function() { loadEmbedJobs(); }); function loadEmbedJobs(isCareersPage = true) { initialize(isCareersPage); let jobList = []; function jobWidget() { jobList = [{"positionId":616,"positionTitle":"Java FSD","department":null,"experience":"2-4 Years","postDaysAgo":"176 days ago","expireDate":"2024-08-31","applylink":"https://hrms.fabhr.in/#/recruitment/ats/applyJob/616/1/computronics.in/COM-1741-computronics.in","jobDescription":null,"noOfposition":"1","jobType":"Full Time","location":"Indore Madhya Pradesh"},{"positionId":673,"positionTitle":"Infrastructure and sppourt Network Engin","department":null,"experience":"4-6 Years","postDaysAgo":"176 days ago","expireDate":"2024-11-30","applylink":"https://hrms.fabhr.in/#/recruitment/ats/applyJob/673/1/computronics.in/COM-145-computronics.in","jobDescription":null,"noOfposition":"1","jobType":"Full Time","location":"Mumbai Maharashtra"}]; if (!isCareersPage) { const companyInfo = companyJson; } if (jobList.length > 0) jobWidgetTemplate(jobList); } jobWidget(); addNoCacheMetaTags(); //function for when user input document.getElementById('jobSearchInput') .onkeyup = () => { let searchQuery = document.querySelector('#jobSearchInput').value; searchQuery = searchQuery ? searchQuery.toLowerCase() : searchQuery; let searchList = JSON.parse(JSON.stringify(jobList)); let filterList = []; if (searchQuery) { searchList.forEach(job => { if (job.positionTitle.toLowerCase().startsWith(searchQuery)) { if (!filterList.includes(job)) { filterList.push(job); } } else if (job.experience.toLowerCase().startsWith(searchQuery)) { if (!filterList.includes(job)) { filterList.push(job); } } else if (job.noOfposition.toLowerCase().startsWith(searchQuery)) { if (!filterList.includes(job)) { filterList.push(job); } } else if (job.postDaysAgo.toLowerCase().startsWith(searchQuery)) { if (!filterList.includes(job)) { filterList.push(job); } } else if (job.jobType.toLowerCase().startsWith(searchQuery)) { if (!filterList.includes(job)) { filterList.push(job); } } else if (job.location.toLowerCase().startsWith(searchQuery)) { if (!filterList.includes(job)) { filterList.push(job); } } }); if (filterList.length > 0) { jobWidgetTemplate(filterList); } else { notFoundTemplate(); document.getElementById('back-visit').onclick = () => { document.querySelector('#jobSearchInput').value = ""; jobWidget(); }; } } else { jobWidget(); filterList = []; } }; } function jobWidgetTemplate(jobList) { console.log(jobList); let jobWidget = document.querySelector('#fh-job-widget'); while (jobWidget.hasChildNodes()) { jobWidget.removeChild(jobWidget.firstChild); } if (jobList.length > 0) { jobList.map((job)=>{ const card = document.createElement('div'); card.id = "card"; card.classList.add('card'); card.innerHTML = `

${job.positionTitle}   ${job.noOfposition} Jobs

${job.postDaysAgo}

${job.experience}

${job.jobType}

${job.location}

${new Date(job.expireDate).toDateString()}

View Details `; jobWidget.appendChild(card); }); } } function notFoundTemplate() { let jobWidget = document.querySelector('#fh-job-widget'); let card = document.querySelector('#card'); while (jobWidget.hasChildNodes()) { jobWidget.removeChild(jobWidget.firstChild); } let notFoundText = `

No Jobs Found

There are no available jobs.

Go Back
`; let notFoundCard = document.createElement('div'); notFoundCard.id = 'no-found-card'; notFoundCard.className = 'no-found-card'; notFoundCard.innerHTML = notFoundText; jobWidget.appendChild(notFoundCard); } //no cache in browser function addNoCacheMetaTags() { // Create meta tag for Cache-Control var cacheControlMeta = document.createElement('meta'); cacheControlMeta.setAttribute('http-equiv', 'Cache-Control'); cacheControlMeta.setAttribute('content', 'no-cache, no-store, must-revalidate'); // Create meta tag for Pragma var pragmaMeta = document.createElement('meta'); pragmaMeta.setAttribute('http-equiv', 'Pragma'); pragmaMeta.setAttribute('content', 'no-cache'); // Create meta tag for Expires var expiresMeta = document.createElement('meta'); expiresMeta.setAttribute('http-equiv', 'Expires'); expiresMeta.setAttribute('content', '0'); // Get the head element and append the meta tags var head = document.getElementsByTagName('head')[0]; head.appendChild(cacheControlMeta); head.appendChild(pragmaMeta); head.appendChild(expiresMeta); }