// Admin settings -> monitor if pro schema is activated and reflect in the dashboard home

// Identify each activated icon on dash home
const schema_status_article_icon = document.getElementById('schema_status_article_icon');
const schema_status_recipe_icon = document.getElementById('schema_status_recipe_icon');
const schema_status_video_icon = document.getElementById('schema_status_video_icon');
const schema_status_software_icon = document.getElementById('schema_status_software_icon');
const schema_status_events_icon = document.getElementById('schema_status_events_icon');
const schema_status_job_icon = document.getElementById('schema_status_job_icon');
const schema_status_person_icon = document.getElementById('schema_status_person_icon');
const schema_status_course_icon = document.getElementById('schema_status_course_icon');

// Identify each checkbox 
const checkbox_article_posts_activate = document.getElementById('checkbox_article_posts_activate');
const checkbox_recipe_posts_activate = document.getElementById('checkbox_recipe_posts_activate');
const checkbox_video_posts_activate = document.getElementById('checkbox_video_posts_activate');
const software_schema_posts_active = document.getElementById('checkbox_software_posts_activate');
const events_schema_posts_active = document.getElementById('checkbox_events_posts_activate');
const checkbox_job_posts_activate = document.getElementById('checkbox_job_posts_activate');
const checkbox_person_posts_activate = document.getElementById('checkbox_person_posts_activate');
const checkbox_course_posts_activate = document.getElementById('checkbox_course_posts_activate');

// Schema status on load checkers
if (checkbox_article_posts_activate.checked ) {

    schema_status_article_icon.style.background = '#ff7601';
    schema_status_article_icon.textContent = 'activated';
    
} else {
    
    schema_status_article_icon.style.background = '#112e76';
    schema_status_article_icon.textContent = 'not activated';
    
}
if (checkbox_recipe_posts_activate.checked ) {

    schema_status_recipe_icon.style.background = '#ff7601';
    schema_status_recipe_icon.textContent = 'activated';
    
} else {
    
    schema_status_recipe_icon.style.background = '#112e76';
    schema_status_recipe_icon.textContent = 'not activated';
    
}
if (checkbox_video_posts_activate.checked ) {

    schema_status_video_icon.style.background = '#ff7601';
    schema_status_video_icon.textContent = 'activated';
    
} else {
    
    schema_status_video_icon.style.background = '#112e76';
    schema_status_video_icon.textContent = 'not activated';
    
}
if (software_schema_posts_active.checked ) {

    schema_status_software_icon.style.background = '#ff7601';
    schema_status_software_icon.textContent = 'activated';
    
} else {
    
    schema_status_software_icon.style.background = '#112e76';
    schema_status_software_icon.textContent = 'not activated';
    
}
if (events_schema_posts_active.checked ) {

    schema_status_events_icon.style.background = '#ff7601';
    schema_status_events_icon.textContent = 'activated';
    
} else {
    
    schema_status_events_icon.style.background = '#112e76';
    schema_status_events_icon.textContent = 'not activated';
    
}
if (checkbox_job_posts_activate.checked ) {

    schema_status_job_icon.style.background = '#ff7601';
    schema_status_job_icon.textContent = 'activated';
    
} else {
    
    schema_status_job_icon.style.background = '#112e76';
    schema_status_job_icon.textContent = 'not activated';
    
}
if (checkbox_person_posts_activate.checked ) {

    schema_status_person_icon.style.background = '#ff7601';
    schema_status_person_icon.textContent = 'activated';
    
} else {
    
    schema_status_person_icon.style.background = '#112e76';
    schema_status_person_icon.textContent = 'not activated';
    
}
if (checkbox_course_posts_activate.checked ) {

    schema_status_course_icon.style.background = '#ff7601';
    schema_status_course_icon.textContent = 'activated';
    
} else {
    
    schema_status_course_icon.style.background = '#112e76';
    schema_status_course_icon.textContent = 'not activated';
    
}

// checkbox onlclick listeners to update if it is actovated on dashboard
checkbox_article_posts_activate.addEventListener('click', function handleClick() {
    
if (checkbox_article_posts_activate.checked ) {

    schema_status_article_icon.style.background = '#ff7601';
    schema_status_article_icon.textContent = 'activated';
    
} else {
    
    schema_status_article_icon.style.background = '#112e76';
    schema_status_article_icon.textContent = 'not activated';
    
}
});

checkbox_recipe_posts_activate.addEventListener('click', function handleClick() {
    
if (checkbox_recipe_posts_activate.checked ) {

    schema_status_recipe_icon.style.background = '#ff7601';
    schema_status_recipe_icon.textContent = 'activated';
    
} else {
    
    schema_status_recipe_icon.style.background = '#112e76';
    schema_status_recipe_icon.textContent = 'not activated';
    
}
});

checkbox_video_posts_activate.addEventListener('click', function handleClick() {
    
if (checkbox_video_posts_activate.checked ) {

    schema_status_video_icon.style.background = '#ff7601';
    schema_status_video_icon.textContent = 'activated';
    
} else {
    
    schema_status_video_icon.style.background = '#112e76';
    schema_status_video_icon.textContent = 'not activated';
    
}
});

software_schema_posts_active.addEventListener('click', function handleClick() {
    
if (software_schema_posts_active.checked ) {

    schema_status_software_icon.style.background = '#ff7601';
    schema_status_software_icon.textContent = 'activated';
    
} else {
    
    schema_status_software_icon.style.background = '#112e76';
    schema_status_software_icon.textContent = 'not activated';
    
}
});

events_schema_posts_active.addEventListener('click', function handleClick() {
    
if (events_schema_posts_active.checked ) {

    schema_status_events_icon.style.background = '#ff7601';
    schema_status_events_icon.textContent = 'activated';
    
} else {
    
    schema_status_events_icon.style.background = '#112e76';
    schema_status_events_icon.textContent = 'not activated';
    
}
});

checkbox_job_posts_activate.addEventListener('click', function handleClick() {
    
if (checkbox_job_posts_activate.checked ) {

    schema_status_job_icon.style.background = '#ff7601';
    schema_status_job_icon.textContent = 'activated';
    
} else {
    
    schema_status_job_icon.style.background = '#112e76';
    schema_status_job_icon.textContent = 'not activated';
    
}
});

checkbox_person_posts_activate.addEventListener('click', function handleClick() {
    
if (checkbox_person_posts_activate.checked ) {

    schema_status_person_icon.style.background = '#ff7601';
    schema_status_person_icon.textContent = 'activated';
    
} else {
    
    schema_status_person_icon.style.background = '#112e76';
    schema_status_person_icon.textContent = 'not activated';
    
}
});

checkbox_course_posts_activate.addEventListener('click', function handleClick() {
    
if (checkbox_course_posts_activate.checked ) {

    schema_status_course_icon.style.background = '#ff7601';
    schema_status_course_icon.textContent = 'activated';
    
} else {
    
    schema_status_course_icon.style.background = '#112e76';
    schema_status_course_icon.textContent = 'not activated';
    
}
});