function generateJobAds(activeCount, inactiveCount) { const container = document.getElementById('extra-job-ads-content'); container.innerHTML = ''; // Clear existing content // Update the tab text with the total number of job ads const totalJobAds = activeCount + inactiveCount; const extraJobAdsTab = document.getElementById('extra-job-ads-tab'); extraJobAdsTab.textContent = `Extra job ads (${totalJobAds})`; // Generate active job ads for (let i = 1; i <= activeCount; i++) { const activeAdContainer = document.createElement('div'); activeAdContainer.className = 'job-ad-container mb-4'; const activeAdTitle = document.createElement('p'); activeAdTitle.className = 'job-ad-title text-gray-800'; activeAdTitle.textContent = `Extra job ad #${i} (currently in use)`; const activeAd = document.createElement('div'); activeAd.className = 'job-ad-detail active-job-ad p-4 bg-white rounded-lg shadow'; activeAd.innerHTML = `

Currently active

<Job ad title>

Expiry Date

DD month YYYY (X days remaining)

`; activeAdContainer.appendChild(activeAdTitle); activeAdContainer.appendChild(activeAd); container.appendChild(activeAdContainer); } // Generate inactive job ads for (let i = 1; i <= inactiveCount; i++) { const inactiveAdContainer = document.createElement('div'); inactiveAdContainer.className = 'job-ad-container mb-4'; const inactiveAdTitle = document.createElement('p'); inactiveAdTitle.className = 'job-ad-title text-gray-800'; inactiveAdTitle.textContent = `Extra job ad #${i + activeCount}`; const inactiveAd = document.createElement('div'); inactiveAd.className = 'job-ad-detail inactive-job-ad p-4 bg-white rounded-lg shadow'; inactiveAd.innerHTML = `

Ready to be used / Not active

`; inactiveAdContainer.appendChild(inactiveAdTitle); inactiveAdContainer.appendChild(inactiveAd); container.appendChild(inactiveAdContainer); } } function showExtraJobAdsTab() { document.getElementById('extra-job-ads-content').classList.remove('hidden'); document.getElementById('extra-job-ads-tab').classList.add('custom-tab-active'); document.getElementById('extra-job-ads-tab').classList.remove('custom-tab-inactive'); loadComponent('buttons-container', 'components/Button.html', () => { document.getElementById('button-text').innerText = 'GET EXTRA JOB ADS'; const buttonElement = document.getElementById('button-element'); buttonElement.classList.add('bg-black', 'text-white'); buttonElement.innerHTML += ` `; }); // Generate job ads dynamically generateJobAds(2, 1); }