Created
October 3, 2014 19:30
-
-
Save kbjohnson90/6d22226b73024ae7137d to your computer and use it in GitHub Desktop.
AutoAccelerator Activity Filter
This file contains 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
var type_options = document.getElementsByName("type_advanced[]")[0].options; | |
var select_type = ['Call', 'Task']; | |
multiselect(type_options, select_type); | |
var status_options = document.getElementsByName("status_advanced[]")[0].options; | |
var select_status = ['Scheduled (Calls,Appointments)', 'Scheduled (Tasks)']; | |
multiselect(status_options, select_status); | |
document.getElementById("activeOPP").checked = true; | |
var sales_stage_options = document.getElementsByName("sales_stage_advanced[]")[0].options; | |
var select_sales_stage = ['Prospecting', 'Appointment Set', 'Meet & Greet', 'Qualification', "Needs Analysis", 'Locating Vehicle', 'Demo', 'TradeEvaluation', 'Price Quoted', 'Negotiation', 'Mnager T/O', 'Write Up', 'Credit App Submitted', 'Pending Finance', 'LoanApproval', 'Deposit', 'Service Pending', 'Delayed Decision', 'Customer Unresponsive', 'Sold-Vehicle Ordered', 'Sold-Pending Finance', 'Sold-Pending Delivery']; | |
multiselect(sales_stage_options, select_sales_stage); | |
var today_prior_options = document.getElementById("today_prior_advanced").options; | |
var select_today_prior = [' Yes']; | |
multiselect(today_prior_options, select_today_prior); | |
//var users_options = document.getElementsByName("assigned_user_id_advanced[]")[0].options; | |
//var select_users = []; | |
//multiselect(users_options, select_users); | |
/** | |
* Multiselect | |
* | |
* @param array | |
* @param array | |
*/ | |
function multiselect(options, values) { | |
for (var j = 0; j < values.length; j++) { | |
for(var i = 0; i < options.length; i++) { | |
console.log( 'Testing' ); | |
if ( options[i].innerHTML == values[j] ) { | |
options[i].selected = true; | |
console.log( options[i].innerHTML + ' is selected' ); | |
} else { | |
console.log( options[i].innerHTML + " != " + values[j] ); | |
} | |
} | |
} | |
} |
This file contains 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
javascript:(function()%7B%2F**%20This%20is%20a%20JavaScript%20Scratchpad.**%20Enter%20some%20JavaScript%2C%20then%20Right%20Click%20or%20choose%20from%20the%20Execute%20Menu%3A*%201.%20Run%20to%20evaluate%20the%20selected%20text%20(Ctrl%2BR)%2C*%202.%20Inspect%20to%20bring%20up%20an%20Object%20Inspector%20on%20the%20result%20(Ctrl%2BI)%2C%20or%2C*%203.%20Display%20to%20insert%20the%20result%20in%20a%20comment%20after%20the%20selection.%20(Ctrl%2BL)*%2Fvar%20type_options%20%3D%20document.getElementsByName(%22type_advanced%5B%5D%22)%5B0%5D.options%3Bvar%20select_type%20%3D%20%5B'Call'%2C%20'Task'%5D%3Bmultiselect(type_options%2C%20select_type)%3Bvar%20status_options%20%3D%20document.getElementsByName(%22status_advanced%5B%5D%22)%5B0%5D.options%3Bvar%20select_status%20%3D%20%5B'Scheduled%20(Calls%2CAppointments)'%2C%20'Scheduled%20(Tasks)'%5D%3Bmultiselect(status_options%2C%20select_status)%3Bdocument.getElementById(%22activeOPP%22).checked%20%3D%20true%3Bvar%20sales_stage_options%20%3D%20document.getElementsByName(%22sales_stage_advanced%5B%5D%22)%5B0%5D.options%3Bvar%20select_sales_stage%20%3D%20%5B'Prospecting'%2C%20'Appointment%20Set'%2C%20'Meet%20%26%20Greet'%2C%20'Qualification'%2C%20%22Needs%20Analysis%22%2C%20'Locating%20Vehicle'%2C%20'Demo'%2C%20'TradeEvaluation'%2C%20'Price%20Quoted'%2C%20'Negotiation'%2C%20'Mnager%20T%2FO'%2C%20'Write%20Up'%2C%20'Credit%20App%20Submitted'%2C%20'Pending%20Finance'%2C%20'LoanApproval'%2C%20'Deposit'%2C%20'Service%20Pending'%2C%20'Delayed%20Decision'%2C%20'Customer%20Unresponsive'%2C%20'Sold-Vehicle%20Ordered'%2C%20'Sold-Pending%20Finance'%2C%20'Sold-Pending%20Delivery'%5D%3Bmultiselect(sales_stage_options%2C%20select_sales_stage)%3Bvar%20today_prior_options%20%3D%20document.getElementById(%22today_prior_advanced%22).options%3Bvar%20select_today_prior%20%3D%20%5B'%20Yes'%5D%3Bmultiselect(today_prior_options%2C%20select_today_prior)%3B%2F%2Fvar%20users_options%20%3D%20document.getElementsByName(%22assigned_user_id_advanced%5B%5D%22)%5B0%5D.options%3B%2F%2Fvar%20select_users%20%3D%20%5B%5D%3B%2F%2Fmultiselect(users_options%2C%20select_users)%3B%2F***%20Multiselect**%20%40param%20array*%20%40param%20array*%2Ffunction%20multiselect(options%2C%20values)%20%7Bfor%20(var%20j%20%3D%200%3B%20j%20%3C%20values.length%3B%20j%2B%2B)%20%7Bfor(var%20i%20%3D%200%3B%20i%20%3C%20options.length%3B%20i%2B%2B)%20%7Bconsole.log(%20'Testing'%20)%3Bif%20(%20options%5Bi%5D.innerHTML%20%3D%3D%20values%5Bj%5D%20)%20%7Boptions%5Bi%5D.selected%20%3D%20true%3Bconsole.log(%20options%5Bi%5D.innerHTML%20%2B%20'%20is%20selected'%20)%3B%7D%20else%20%7Bconsole.log(%20options%5Bi%5D.innerHTML%20%2B%20%22%20!%3D%20%22%20%2B%20values%5Bj%5D%20)%3B%7D%7D%7D%7D%7D)() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment