Last active
December 24, 2015 02:49
-
-
Save jakepruitt/6732795 to your computer and use it in GitHub Desktop.
Business Aviation Support Contact Pulling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="support_form"> | |
| <h4>Who would you like to contact?</h4> | |
| <div class="looking_for"> | |
| <label>I’m looking for:</label> | |
| <select id="contact_type"> | |
| <option>Select Contact Type</option> | |
| <option>Area Sales Managers</option> | |
| <option>Customer Support Managers</option> | |
| <option>Dealer & Service Center</option> | |
| </select> | |
| </div> | |
| <div class="country_select"> | |
| <label for="country">What country are you in?</label> | |
| <select id="country"> | |
| <option>Select Country</option> | |
| <option value="United States">United States</option> | |
| <option value="Canada">Canada</option> | |
| </select> | |
| </div> | |
| <div class="looking_for"> | |
| <label>What state are you Interested in?</label> | |
| <select id="state"> | |
| <option>Select State</option> | |
| </select> | |
| </div> | |
| <div class="support_results"> | |
| </div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery('#contact_type').on("change", function(e) { | |
| e.preventDefault(); | |
| if (jQuery(this).val() == "Area Sales Managers" || jQuery(this).val() == "Customer Support Managers") { | |
| jQuery.ajax({ | |
| contentType: "application/json", | |
| url: 'http://honeywellaero.qa.cs15.force.com/bgadir/apexremote', | |
| type: 'POST', | |
| dataType: 'json', | |
| data: JSON.stringify({ | |
| "action":"BGACSM", | |
| "method":"getASMCountryvalues", | |
| "type":"rpc", | |
| "tid":2, | |
| "ctx": { | |
| "csrf":"3dHkjCh9NKp1ID7DZteT9g7o9dbvMVxq99pTPpiz46Br7_23mN103vJPOGeLr36rLAccoA==", | |
| "vid":"066e00000004Xur", | |
| "ns":"", | |
| "ver":29 | |
| } | |
| }), | |
| success: function(result) { | |
| for (var i = 0; i < result[0]["result"].length; i++) { | |
| var country = result[0]["result"][i]; | |
| jQuery('#country').append('<option value="' + country + '">' + country + '</option>'); | |
| }; | |
| } | |
| }); | |
| } else { | |
| jQuery.ajax({ | |
| contentType: "application/json", | |
| url: 'http://honeywellaero.qa.cs15.force.com/bgadir/apexremote', | |
| type: 'POST', | |
| dataType: 'json', | |
| data: JSON.stringify({ | |
| "action":"BGAMOBDel", | |
| "method":"getCountriesFromAccounts", | |
| "data":null, | |
| "type":"rpc", | |
| "tid":2, | |
| "ctx":{ | |
| "csrf":"EcIAGN1gbhIgoz9JTsjvy6SUMMRuGHh5v8XFJKVJ6hTaWfo90KqZtfpELyl5eJY7GYVpoAn7BNsqmZgUpDhTmFXlDhg=", | |
| "vid":"066e00000004Xv6", | |
| "ns":"", | |
| "ver":29 | |
| } | |
| }), | |
| success: function(result) { | |
| for (var i = 0; i < result[0]["result"].length; i++) { | |
| var country = result[0]["result"][i]; | |
| jQuery('#country').append('<option value="' + country + '">' + country + '</option>'); | |
| }; | |
| } | |
| }); | |
| } | |
| }); | |
| jQuery('#country').on("change", function(e) { | |
| e.preventDefault(); | |
| (function (country) { | |
| var data; | |
| var action; | |
| var stateMethod; | |
| if (jQuery('#contact_type').val() == "Area Sales Managers" || jQuery('#contact_type').val() == "Customer Support Managers") { | |
| if (country == "Canada") { | |
| data = "Areas Covered Canada"; | |
| } else { | |
| data = "Area Covered US"; | |
| } | |
| action = "BGACSM"; | |
| stateMethod = "getStatevalues"; | |
| } else { | |
| data = country; | |
| action = "BGAMOBDel"; | |
| stateMethod = "getState1"; | |
| } | |
| if (country == "US" || country == "Canada") { | |
| jQuery.ajax({ | |
| contentType: "application/json", | |
| url: 'http://honeywellaero.qa.cs15.force.com/bgadir/apexremote', | |
| type: 'POST', | |
| dataType: 'json', | |
| data: JSON.stringify({ | |
| "action":action, | |
| "method":stateMethod, | |
| "data":[data], | |
| "type":"rpc", | |
| "tid":10, | |
| "ctx":{ | |
| "csrf":"1b8UBt.Mg9EjLE_VZ.yvNJGxdV8uh2N1P20dpLRlGm78tqoMY8iihMopa6mKoIkkLM3x5Q==", | |
| "vid":"066e00000004Xur", | |
| "ns":"", | |
| "ver":29 | |
| } | |
| }), | |
| success: function(result) { | |
| jQuery('#state').empty(); | |
| jQuery('#state').append("<option>Select State</option>"); | |
| for (var i = 0; i < result[0]["result"].length; i++) { | |
| var country = result[0]["result"][i]; | |
| jQuery('#state').append('<option value="' + country + '">' + country + '</option>'); } | |
| } | |
| } | |
| }); | |
| } else { | |
| jQuery.ajax({ | |
| contentType: "application/json", | |
| url: 'http://honeywellaero.qa.cs15.force.com/bgadir/apexremote', | |
| type: 'POST', | |
| dataType: 'json', | |
| data: JSON.stringify({ | |
| "action":action, | |
| "method":"getResValue", | |
| "data":[country, "--None--"], | |
| "type":"rpc", | |
| "tid":10, | |
| "ctx":{ | |
| "csrf": "6aFQli5yq1TYUPBU.zPhj88i3FNezC5jktyOOIPqQOb.7EG9oH2PiS4w_hlV3GAi4pt3yg==", | |
| "vid":"066e00000004Xur", | |
| "ns":"", | |
| "ver":29 | |
| } | |
| }), | |
| success: function(result) { | |
| jQuery('.support_results').empty(); | |
| jQuery('.support_results').append('<h4>We have found ' + result[0]["result"].length + ' contacts that can help you with your needs.</h4>'); | |
| for (var i = 0; i < result[0]["result"].length; i++) { | |
| jQuery('.support_results').append('<ul class="side_nav">' + | |
| '<li><strong>' + result[0]["result"][0]["BGAMob_Contact_Alt_Name__c"] + '</strong></li>' + | |
| '<li>' + result[0]["result"][0]["Mobile_App_Role__c"] + '</li>' + | |
| '<li class="phone">1.816.506.9667</li>' + | |
| '<li><a href="#">joanie.alderman@honeywell.com.qa</a></li>' + | |
| '</ul>'); | |
| } | |
| } | |
| }); | |
| } | |
| }) (jQuery('#country').val()); | |
| }); | |
| jQuery('#state').on("change", function(e) { | |
| e.preventDefault(); | |
| (function (country, state) { | |
| var data; | |
| var action; | |
| if (jQuery('#contact_type').val() == "Area Sales Managers" || jQuery('#contact_type').val() == "Customer Support Managers") { | |
| if (country == "Canada") { | |
| data = "Areas Covered Canada"; | |
| } else { | |
| data = "Area Covered US"; | |
| } | |
| action - "BGACSM"; | |
| } else { | |
| data = country; | |
| action = "BGAMOBDel"; | |
| } | |
| jQuery.ajax({ | |
| contentType: "application/json", | |
| url: 'http://honeywellaero.qa.cs15.force.com/bgadir/apexremote', | |
| type: 'POST', | |
| dataType: 'json', | |
| data: JSON.stringify({ | |
| "action":action, | |
| "method":"getResValue", | |
| "data":[data, state], | |
| "type":"rpc", | |
| "tid":10, | |
| "ctx":{ | |
| "csrf": "6aFQli5yq1TYUPBU.zPhj88i3FNezC5jktyOOIPqQOb.7EG9oH2PiS4w_hlV3GAi4pt3yg==", | |
| "vid":"066e00000004Xur", | |
| "ns":"", | |
| "ver":29 | |
| } | |
| }), | |
| success: function(result) { | |
| jQuery('.support_results').empty(); | |
| jQuery('.support_results').append('<h4>We have found ' + result[0]["result"].length + ' contacts that can help you with your needs.</h4>'); | |
| for (var i = 0; i < result[0]["result"].length; i++) { | |
| jQuery('.support_results').append('<ul class="side_nav">' + | |
| '<li><strong>' + result[0]["result"][0]["BGAMob_Contact_Alt_Name__c"] + '</strong></li>' + | |
| '<li>' + result[0]["result"][0]["Mobile_App_Role__c"] + '</li>' + | |
| '<li class="phone">1.816.506.9667</li>' + | |
| '<li><a href="#">joanie.alderman@honeywell.com.qa</a></li>' + | |
| '</ul>'); | |
| } | |
| } | |
| }); | |
| }) (jQuery('#country').val(), jQuery('#state').val()); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment