|
| 1 | +<html> |
| 2 | +<head> |
| 3 | + <script src="jquery-3.2.1.min.js" ></script> |
| 4 | + <script src="popper.js"></script> |
| 5 | + <script src="bootstrap.min.js" ></script> |
| 6 | + <scrpt src="form.js" ></script> |
| 7 | + <link rel="stylesheet" type="text/css" href="bootstrap.min.css"> |
| 8 | + <!--<link rel="stylesheet" type="text/css" href="form.css">--> |
| 9 | + <script> |
| 10 | + let infoDict = { |
| 11 | + 'United States': |
| 12 | + { |
| 13 | + 'New York': { |
| 14 | + 'New York City': { |
| 15 | + 'prefix':"HQ", |
| 16 | + 'domains':["Domain1", "Domain2"] |
| 17 | + } |
| 18 | + }, |
| 19 | + 'New Jersey': { |
| 20 | + 'Trenton': { |
| 21 | + 'prefix': "MN", |
| 22 | + 'domains': ["Domain1"] |
| 23 | + } |
| 24 | + } |
| 25 | + }, |
| 26 | + 'India': { |
| 27 | + 'prefix':"IN", |
| 28 | + 'domains':["Domain1"] |
| 29 | + } |
| 30 | + }; |
| 31 | + |
| 32 | + var countryKey = ""; |
| 33 | + var divisionKey = ""; |
| 34 | + var siteKey = ""; |
| 35 | + |
| 36 | + function stagingView() { |
| 37 | + $('#country').html(''); |
| 38 | + $('#division').html(''); |
| 39 | + $('#site').html(''); |
| 40 | + $('#division').parent().hide(); |
| 41 | + $('#site').parent().hide(); |
| 42 | + $('#domainOptions').hide(); |
| 43 | + } |
| 44 | + |
| 45 | + function populateCountryList(){ |
| 46 | + $('#country').html(''); |
| 47 | + $('#division').html(''); |
| 48 | + $('#site').html(''); |
| 49 | + $('#country').append('<option checked>-- Select Your Country --</option>'); |
| 50 | + for (var key in infoDict) { |
| 51 | + var optVal = infoDict[key]['prefix']; |
| 52 | + if (typeof optVal == "undefined") {optVal = (key);} |
| 53 | + $('#country').append('<option value="'+optVal+'">'+key+'</option>'); |
| 54 | + } |
| 55 | + } |
| 56 | + |
| 57 | + function populateDivsionList(){ |
| 58 | + $('#division').html(''); |
| 59 | + $('#division').append('<option checked>-- Select Your Division --</option>'); |
| 60 | + $('#division').parent().show(); |
| 61 | + for (var division in infoDict[countryKey]) { |
| 62 | + var divOptVal = infoDict[countryKey][division]['prefix']; |
| 63 | + if (typeof divOptVal == "undefined") {divOptVal = division;} |
| 64 | + $('#division').append('<option value="'+divOptVal+'">'+division+'</option>'); |
| 65 | + } |
| 66 | + } |
| 67 | + |
| 68 | + function populateSiteList(){ |
| 69 | + $('#site').html(''); |
| 70 | + $('#site').append('<option checked>-- Select Your Site --</option>'); |
| 71 | + $('#site').parent().show(); |
| 72 | + for (var site in infoDict[countryKey][divisionKey]) { |
| 73 | + var siteOptVal = infoDict[countryKey][divisionKey][site]['prefix']; |
| 74 | + if (typeof siteOptVal == "undefined") {siteOptVal = site;} |
| 75 | + $('#site').append('<option value="'+siteOptVal+'">'+site+'</option>'); |
| 76 | + } |
| 77 | + } |
| 78 | + |
| 79 | + function populateDomainOptions(domains) { |
| 80 | + $('#domainOptions').html(''); |
| 81 | + $('#domainOptions').show(''); |
| 82 | + if (domains.length == 1) { |
| 83 | + $('#domainOptions').append('<div class="form-check form-check-inline"><label class="form-check-label"><input id="'+domains[0]+'" value="'+domains[0]+'" name="domain" type="radio" class="form-check-input" checked></div>'+domains[0]+'</label>'); |
| 84 | + } else { |
| 85 | + for (var d = 0; d < domains.length; d++) { |
| 86 | + if (d == 0) {$('#domainOptions').append('<div class="form-check form-check-inline"><label class="form-check-label"><input id="'+domains[d]+'" value="'+domains[d]+'" name="domain" type="radio" class="form-check-input" checked></div>'+domains[d]+'</label>');} |
| 87 | + else { |
| 88 | + $('#domainOptions').append('<div class="form-check form-check-inline"><label class="form-check-label"><input id="'+domains[d]+'" value="'+domains[d]+'" name="domain" type="radio" class="form-check-input"></div>'+domains[d]+'</label>'); |
| 89 | + } |
| 90 | + } |
| 91 | + } |
| 92 | + } |
| 93 | + |
| 94 | + $('document').ready(function() { |
| 95 | + stagingView(); |
| 96 | + populateCountryList(); |
| 97 | + |
| 98 | + // Actions |
| 99 | + $('#country').change(function(){ // Country Selected |
| 100 | + $('#division').html(''); |
| 101 | + $('#site').html(''); |
| 102 | + $('#division').parent().hide(); |
| 103 | + $('#site').parent().hide(); |
| 104 | + countryKey = $('#country option:selected').val(); |
| 105 | + if (countryKey.length <= 2) { |
| 106 | + populateDomainOptions(infoDict[$('#country option:selected').text()]['domains']); |
| 107 | + } else { |
| 108 | + populateDivsionList(); |
| 109 | + $('#site').parent().hide(); |
| 110 | + } |
| 111 | + }); |
| 112 | + |
| 113 | + $('#division').change(function(){ // Division Selected |
| 114 | + $('#site').html(''); |
| 115 | + $('#site').parent().hide(); |
| 116 | + divisionKey = $('#division option:selected').val(); |
| 117 | + if (divisionKey.length <= 2) { |
| 118 | + populateDomainOptions(infoDict[countryKey][$('#division option:selected').text()]['domains']); |
| 119 | + } else { |
| 120 | + populateSiteList(); |
| 121 | + } |
| 122 | + }); |
| 123 | + $('#site').change(function(){ // Site Selected |
| 124 | + siteKey = $('#site option:selected').text(); |
| 125 | + populateDomainOptions(infoDict[countryKey][divisionKey][siteKey]['domains']); |
| 126 | + }); |
| 127 | + }); |
| 128 | + </script> |
| 129 | +</head> |
| 130 | +<body> |
| 131 | + <div class='jumbotron jumbotron-fluid'> |
| 132 | + <div class='container'> |
| 133 | + <div class='text-center'> |
| 134 | + <img src='https://placehold.it/100x50' alt='Comcast Logo' class='img-fluid' style='max-width:100px;'/> |
| 135 | + </div> |
| 136 | + <h1 class='display-4 text-center'>Welcome to your Mac!</h1> |
| 137 | + <p class='lead text-center'>We need some info to proceed.</p> |
| 138 | + </div> |
| 139 | + </div> |
| 140 | + <div class='container-fluid'> |
| 141 | + <form> |
| 142 | + <div class='row'> |
| 143 | + <div class='col'> |
| 144 | + <div class='form-group'> |
| 145 | + <label for='asset-tag'>Asset Tag</label> |
| 146 | + <input type='text' class='form-control' id='asset-tag' name='asset-tag' aria-describedby='asset-tagHelp' placeholder='Asset Tag' /> |
| 147 | + <small id='asset-tagHelp' class='form-text text-muted'>Usually found on the top lid of your computer.</small> |
| 148 | + </div> |
| 149 | + </div> |
| 150 | + <div class='col'> |
| 151 | + <img class='img-fluid' src='asset.jpg' alt='assettag image' /> |
| 152 | + </div> |
| 153 | + </div> |
| 154 | + <div class='row'> |
| 155 | + <div class='col'> |
| 156 | + <div class='form-group'> |
| 157 | + <label for='username'>Username</label> |
| 158 | + <input type='text' class='form-control' id='username' name='username' aria-describedby='usernameHelp' placeholder='Your NTID' /> |
| 159 | + <small id='usernameHelp' class='form-text text-muted'>This is your username you use to log into your machines and resources.</small> |
| 160 | + </div> |
| 161 | + </div> |
| 162 | + <div class='col'> |
| 163 | + <div class='form-group'> |
| 164 | + <label for='lastName'>Last Name</label> |
| 165 | + <input type='text' class='form-control' id='lastName' name='lastName' aria-describedby='lastNameHelp' placeholder='Your Last Name' /> |
| 166 | + <small id='lastNameHelp' class='form-text text-muted'>This is needed to properly assign the asset.</small> |
| 167 | + </div> |
| 168 | + </div> |
| 169 | + </div> |
| 170 | + <div class='row'> |
| 171 | + <div class='col'> |
| 172 | + <div class='form-group'> |
| 173 | + <label for='country'>Country</label> |
| 174 | + <select class='form-control' id='country' name='country' aria-describedby='countryHelp' > |
| 175 | + </select> |
| 176 | + <small id='countryHelp' class='form-text text-muted'>This is used to help deploy your computer properly</small> |
| 177 | + </div> |
| 178 | + </div> |
| 179 | + <div class='col'> |
| 180 | + <div class='form-group'> |
| 181 | + <label for='division'>Division</label> |
| 182 | + <select class='form-control' id='division' name='division' aria-describedby='divisionHelp' > |
| 183 | + </select> |
| 184 | + <small id='divisionHelp' class='form-text text-muted'>The state your team resides in.</small> |
| 185 | + </div> |
| 186 | + </div> |
| 187 | + </div> |
| 188 | + <div class='form-group'> |
| 189 | + <label for='site'>Site</label> |
| 190 | + <select class='form-control' id='site' name='site' aria-describedby='siteHelp' > |
| 191 | + </select> |
| 192 | + <small id='siteHelp' class='form-text text-muted'>The city your team resides in.</small> |
| 193 | + </div> |
| 194 | + <div class='form-check'> |
| 195 | + <label class='form-check-label'> |
| 196 | + <input type='checkbox' class='form-check-input' name='joinDomain' checked> |
| 197 | + Join Domain |
| 198 | + </label> |
| 199 | + </div> |
| 200 | + <div id='domainOptions'> |
| 201 | + <!-- Domain options get rendered dynamically --> |
| 202 | + </div> |
| 203 | + </form> |
| 204 | + </div> |
| 205 | + <br /> |
| 206 | + <br /> |
| 207 | + <br /> |
| 208 | +</body> |
| 209 | + |
| 210 | +</html> |
0 commit comments