Hospitality Beverage Science, A.S. Certificate Advisor

by pat spag

HTML

<h1>
Hospitality Beverage Science, A.S. Certificate Advisor
</h1>
Simply select what courses you have already taken and the system will automatically enable other courses you can take. This shows only required course and takes into account pre-requisites.
<br/>

<p> link locatoin http://daytonastate.smartcatalogiq.com/2018-2019/College-Catalog/Program-Guides/A-S-Certificate/Hospitality-Beverage-Science-A-S-Certificate

</p>

No Pre Req's required here <br/>
<input type="checkbox" id="HFT1860" onclick="CC();" /> 
<label for='HFT1860'>HFT1860 Beverage Operations Management</label><br/>
<input type="checkbox" id="HFT2009" onclick="CC();" /> 
<label for='HFT2009'>HFT2009 Hospitality Professionalism</label><br/>
<input type="checkbox" id="HFT2454" onclick="CC();" /> 
<label for='HFT2454'>HFT2454 Hospitality Purchasing and Controls</label><br/>
<br/>
This is a core class taking this will unlock four other classes<br/>
<input type="checkbox" id="HFT1213" onclick="CC();" /> 
<label for='HFT1213'>HFT1213 Beverage Sanitation and Safety (Core Class)</label><br/><br/>


<input type="checkbox" id="HFT1021" onclick="CC();" disabled/> 
<label for='HFT1021'>HFT1021 Beer, Wine and Beverage Service			(Prerequisite: HFT1213)</label><br/>
<input type="checkbox" id="HFT2804" onclick="CC();" disabled/> 
<label for='HFT2804'>HFT2804 Introduction to Beverage Science		(Corequisite: HFT1213)</label><br/>
<br/><br/>



<input type="checkbox" id="FSS1287" onclick="CC();" disabled/> 
<label for='FSS1287'>FSS1287 Introduction to Craft Beer Production   (Corequisite: HFT1213)</label><br/>
Corequisite FSS1287 Must be taken along with HFT1213 (Core Class) to unlock below<br/>

<input type="checkbox" id="HFT2822" onclick="CC();" disabled/> 
<label for='HFT2822'>HFT2822 Brewery Operations				(Prerequisite: HFT1213 and FSS1287)</label><br/>

<br/><br/>

<input type="checkbox" id="FSS1270" onclick="CC();" /> 
<label for='FSS1270'>FSS1270 Introduction to Craft Beer and Wine		(Corequisite:...

CSS

input:enabled + label { 
  margin: 20px auto;
  background:rgb(255,255,0);
}

input:disabled + label{
  opacity:0.5;
  background:rgb(255,0,0);
}
input[type="checkbox"]:checked + label {
  background:rgb(153,204,102);
  font-weight:bold;
}

JavaScript

//Start code from Dr. Ron Eglanin

// The first course is course to take, followed
// by an array of pre-requisites

// courses is an array of arrays
// each element of courses contains
// a string - the course in question
// an array - an array of the pre-requisites of the course
// Note that the Checkbox id in the html is also 
// the first element of each array element of courses

var courses = [
 ['FSS1287', ['HFT1213']],//FSS1287 Introduction to Craft Beer Production		Corequisite: HFT1213
 ['HFT1021', ['HFT1213']],//HFT1021 Beer, Wine and Beverage Service			Prerequisite: HFT1213
 ['HFT2804', ['HFT1213']],//HFT2804 Introduction to Beverage Science		Corequisite: HFT1213
 ['FSS1270', ['HFT1213']],//FSS1270 Introduction to Craft Beer and Wine		Corequisite: HFT1213
 ['HFT2822', ['HFT1213','FSS1287']], //HFT2822 Brewery Operations				Prerequisite: HFT1213 and FSS1287
 ['HFT2867', ['HFT1213','FSS1270']],//HFT2867 Wine Essentials					Prerequisite: HFT1213 and FSS1270
]
  
function pr(item, index) {
   // item[0] is the course in question (string)
   var checked = true;
   
   // item[1]  is the array of pre-requisites (array of strings)
   var elementId = item[1][0];
   
   // Goes through the list of pre-requisites
   // to see if each one is met if any are not met
   // then pre-requisites are not met
   for (var i=0; i<item[1].length; i++){
     elementId = item[1][i];  
     if (!isChecked(elementId)) {
       checked=false;
     }
   }  
   // and if all are met - enables taking courses
   // checked is true/false Enable is a function call to Enable
   // item[0] is the first element of the array item - which is the 
   // course in question
   // item[0] - courses
   // item[1] - array of pre-requisite courses
   if (checked) Enable(item[0]) 
   else Disable(item[0]);
}

function CC()
{
  courses.forEach(pr);
}

function isChecked(item) {
  return (document.getElementById(item).checked == true);
}

// The function Enable sets the disabled property of the...