'; $("#rev_div").html(form_info); $("#track_rev").val(text_info); }); $("#submit_rev_btn").live("click",function() { var company_id = '2047378'; save_revenue_details(company_id); }); $("#cancel_rev_btn").live("click",function() { $("#rev_div").html($("#track_rev").val()); }); $('.exp_crm_default').live("click", function() { var exp_type = $(this).attr('format_row'); var emp_row = ''; var url = ''; if( exp_type == 'sugarcrm' || exp_type == 'salesforce' || exp_type == 'zoho' || exp_type == 'vtiger' || exp_type == 'pipeline' || exp_type == 'oracle' || exp_type == 'basecrm' || exp_type == 'insightly') { var emp_row = $(this).parent().attr('id'); } var row_array = emp_row.split('_'); var emp_id = row_array[1]; $.post("https://app.lead411.com/profile_page/export_check", { "employee_id": emp_id, "export_type": exp_type }, function(data) { if(data == 'allowed'){ var exp_format = 'NA'; if( (exp_type == 'salesforce') ) { var url = $("#exp_format_"+exp_type+"_"+emp_id).val(); //Research Email script - concat email address to crm url [start] var research_email = $('#email_select_'+emp_id).val(); if (typeof research_email != 'undefined') { if( (research_email != '') && (url != '') ) { if( (exp_type == 'salesforce') && (exp_format == 'leads') ) { var email = '&lea11=' +research_email+ '&'; url = url.replace("&lea11=&", email); } else if( (exp_type == 'salesforce') && (exp_format == 'contacts') ) { var email = '&con15=' +research_email+ '&'; url = url.replace("&con15=&", email); } } } //Research Email script - concat email address to crm url [end] } if( exp_type == 'sugarcrm' ) { exportToSugarCRM(emp_id, exp_format); } else if( exp_type == 'insightly' ) { exportToInsightly(emp_id, exp_format); } else if( exp_type == 'vtiger' ) { exportToVtiger(emp_id, exp_format); } else if( exp_type == 'pipeline' ) { exportToPipeline(emp_id, exp_format); } else if( exp_type == 'basecrm' ) { exportToBaseCRM(emp_id, exp_format); } else if( exp_type == 'oracle' ) { exportToOracleCRM(emp_id, exp_format); } else if( exp_type == 'zoho' ) { exportToZohoCRM(emp_id, exp_format); } else if( exp_type == 'salesforce' ) { if(url != "") { window.open(url,'_newtab'); } } else { if(url != "") window.open(url,'_newtab'); } } else if(data == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } }); }); $('.exp_crm_url').live("click", function() { var row = $(this).attr('format_row'); var exp_type = $("#exp_type_"+row).val(); var emp_row = ''; if( exp_type == 'sugarcrm' || exp_type == 'salesforce' || exp_type == 'zoho' || exp_type == 'vtiger' || exp_type == 'pipeline' || exp_type == 'oracle' || exp_type == 'basecrm' || exp_type == 'insightly') { var emp_row = $(this).parent().attr('id'); } var row_array = emp_row.split('_'); var emp_id = row_array[1]; $.post("https://app.lead411.com/profile_page/export_check", { "employee_id": emp_id, "export_type": exp_type }, function(data) { if(data == 'allowed'){ var exp_format = ''; if( $("#exp_format_type_"+row).val() == "multiple" ) { exp_format = $("input:radio[name=exp_format_"+row+"]:checked").val(); var url = $("input:radio[name=exp_format_"+row+"]:checked").attr("crm_url"); } else { var url = $("#exp_format_"+row).val(); } //Research Email script - concat email address to crm url [start] var research_email = $('#email_select_'+emp_id).val(); if (typeof research_email != 'undefined') { if( (research_email != '') && (url != '') ) { if( (exp_type == 'salesforce') && (exp_format == 'leads') ) { var email = '&lea11=' +research_email+ '&'; url = url.replace("&lea11=&", email); } else if( (exp_type == 'salesforce') && (exp_format == 'contacts') ) { var email = '&con15=' +research_email+ '&'; url = url.replace("&con15=&", email); } } } //Research Email script - concat email address to crm url [end] if( exp_type == 'sugarcrm' ) { exportToSugarCRM(emp_id, exp_format); } else if( exp_type == 'insightly' ) { exportToInsightly(emp_id, exp_format); } else if( exp_type == 'vtiger' ) { exportToVtiger(emp_id, exp_format); } else if( exp_type == 'pipeline' ) { exportToPipeline(emp_id, exp_format); } else if( exp_type == 'basecrm' ) { exportToBaseCRM(emp_id, exp_format); } else if( exp_type == 'oracle' ) { exportToOracleCRM(emp_id, exp_format); } else if( exp_type == 'zoho' ) { exportToZohoCRM(emp_id, exp_format); } else if( exp_type == 'salesforce' ) { if(url != "") { window.open(url,'_newtab'); } } else { if(url != "") window.open(url,'_newtab'); } } else if(data == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); }); //script for default crm popup & export message [start] $(".close_image_crm").live("click", function() { $(this).parents(".confirmbox").animate({opacity: 'hide'}, "slow"); }); $(".cont-tracker").live("click", function() { var emp_id = $(this).attr('data-row'); $.post("https://app.lead411.com/profile_page/addToContactTracker", { "employee_id":emp_id }, function(data){ var name = $('.employee_h1').text(); if(data == "ok"){ var msg = name+' added to Contact Tracker successfully' ; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1"){ var msg = name+' already added to Contact Tracker' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error"){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); }); $(".crm_search_yes").live("click", function() { var emp_id = $(this).attr('data-row'); var crm_type = $(this).attr('crm-type'); var crm = $(this).parent().attr('data-crm'); if(crm_type == 'list') { $("#list_crm_"+crm).click(); } else { $("#default_crm_"+emp_id).click(); } $('.crm-search-popup').hide(); }); $(".crm_search_no, .updates_link, .export-default,.export_btn_emp,.download_pref").live("click", function() { $('.crm-search-popup').hide(); }); $(".list_crm_call").live("click", function() { var crm = $(this).attr('data-crm'); var emp_row = $(this).parent().attr('id'); var row_array = emp_row.split('_'); var emp_id = row_array[1]; var exp_format = ''; var row = $(this).attr('format_row'); $.post("https://app.lead411.com/profile_page/getTeamDownloads", { "employee_id":emp_id }, function(data){ var obj = jQuery.parseJSON(data); if(obj.msg == "ok"){ if(obj.record.name == ''){ if (typeof row != 'undefined') { if( $("#exp_format_type_"+row).val() == "multiple" ) { exp_format = $("input:radio[name=exp_format_"+row+"]:checked").val(); } } var crm_result = search_contact(emp_id, crm, exp_format); if( crm_result != 'not_found' ) { $('.emp_api_popup_content').hide(); $('.crm-search-popup').animate({opacity: 'show'}, "slow"); $('.crm-se-main-text').text(crm_result); $('.crm_search_yes').attr('crm-type','list'); $('.crm-search-popup').attr('data-crm', crm); } else { $("#list_crm_"+crm).click(); } } else { $("#list_crm_"+crm).click(); } } } ); }); $(".default_crm_call").live("click", function() { $(".confirmbox").hide(); var emp_row = $(this).parent().attr('id'); var row_array = emp_row.split('_'); var emp_id = row_array[1]; var exp_msg = ''; $('#hint_msg_'+emp_id).hide(); $.post("https://app.lead411.com/profile_page/getTeamDownloads", { "employee_id":emp_id }, function(data){ var obj = jQuery.parseJSON(data); if(obj.msg == "ok"){ if(obj.record.name != ''){ $.post("https://app.lead411.com/profile_page/getExportNotifySettings", { "param": "data" }, function(data){ if(data == "ok") { $(".hint_box_crm_"+emp_id).animate({opacity: 'show'}, "slow"); exp_msg = obj.record.name+' exported to '+obj.record.crm_name+' on '+obj.record.on_date; $('#hint_msg_'+emp_id).show(); $('#hint_msg_'+emp_id).text(exp_msg); } else { $('#hint_msg_'+emp_id).hide(); $("#default_crm_"+emp_id).click(); } }); } else { var crm = $("#default_crm_"+emp_id).attr('format_row'); var crm_result = search_contact(emp_id, crm); if( crm_result != 'not_found' ) { $('.crm-search-popup').animate({opacity: 'show'}, "slow"); $('.crm-se-main-text').text(crm_result); $('.crm_search_yes').attr('crm-type','default'); } else { $("#default_crm_"+emp_id).click(); } } } else { $("#default_crm_"+emp_id).click(); } } ); }); $(".default_export_yes").click(function() { $(".confirmbox").hide(); var emp_id = $(this).attr('id'); $("#default_crm_"+emp_id).click(); }); $(".notify-export").change(function() { //save notify already export settings if(this.checked) { $.post("https://app.lead411.com/profile_page/saveNotifyExport", { "notify": 'no' }); $('.hint_default_msg').hide(); $('input:checkbox[name=notify_export]').attr('checked', true); } else { $.post("https://app.lead411.com/profile_page/saveNotifyExport", { "notify": 'yes' }); $('input:checkbox[name=notify_export]').attr('checked', false); } }); function crm_api_popup_content() { if (inside==true) { $(".confirmbox").animate({ opacity: 'hide' }, "slow"); inside==false; } } $('.confirmbox').mouseover(function() { inside = false; }); $('.confirmbox').mouseout(function() { inside = true; setTimeout(crm_api_popup_content, 750); }); //script for default crm popup & export message [end] $('.export_btn_emp').click(function(){ $(".emp_api_popup_content").slideToggle(); $('.confirmbox').hide(); $(".download_pref").hide(); $('.export-popup').hide(); var emp_id = $(this).attr('empid'); $.post("https://app.lead411.com/profile_page/getExportNotifySettings", { "param": "data" }, function(data){ if(data == "ok") { $.post("https://app.lead411.com/profile_page/getTeamDownloads", { "employee_id":emp_id }, function(data){ var obj = jQuery.parseJSON(data); if(obj.msg == "ok"){ if(obj.record.name != ''){ //var msg = obj.record.name+' exported on '+obj.record.on_date+'.'; var msg = obj.record.name+' exported to '+obj.record.crm_name+' on '+obj.record.on_date; $('.export-popup').show(); $('.export-popup').text(msg); } } else if(obj.msg == "error"){ var msg = 'There is some error while getting export details.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else { $('.export-popup').hide(); } } ); }); $('.emp_api_popup_content, .export_btn_emp').mouseover(function() { inside = false; }); $('.emp_api_popup_content, .export_btn_emp').mouseout(function() { inside = true; setTimeout(export_api_popup_content, 750); }); $(document).on('click', '.copy_link', function() { var $temp = $(" "); $("body").append($temp); var empId = $(this).attr('data-emp'); var email = $('#email_select_'+empId).val(); if(!(email) || email == ''){ email = $('.compose-mail-box').attr('data-email'); } $temp.val(email).select(); document.execCommand("copy"); $temp.remove(); }); $('.verified_email').click(function(){ $('.email-verify-pop').show(); }); $('.email-verify-pop').mouseover(function() { inside = false; }); $('.verified_email').mouseout(function() { inside = true; setTimeout(email_verify_popup_content, 750); }); $('.email-verify-pop').mouseout(function() { inside = true; setTimeout(email_verify_popup_content, 750); }); }); //function used to check user login to infusion function check_infusion(){ $.ajax({ url: 'https://app.lead411.com/profile_page/check_user_login_to_infusion', data:{param:'infusion'}, type: 'post', success: function(data) { if(data == "ok"){ $('#signin-infusion-btn').hide(); $('#exp-infusion-btn').show(); } else if(data == "fail"){ $('#exp-infusion-btn').hide(); $('#signin-infusion-btn').show(); } } }); } //Authorise infusionsoft request and get access key function infusion_auth(url){ window.open (url,"mywindow","status=1,scrollbars=1,height=422,width=333"); } //Authorise Google request and get code function google_auth(url){ window.open (url,"mywindow","status=1,scrollbars=1,height=425,width=421"); } //Authorise salesloft request and get code function salesloft_auth(url){ window.open (url,"mywindow","status=1,scrollbars=1,height=465,width=521"); } //Authorise outreach request and get code function outreach_auth(url){ window.open (url,"mywindow","status=1,scrollbars=1,height=426,width=432"); } //hide export popup on mouse out function export_api_popup_content() { if (inside==true) { $(".emp_api_popup_content").animate({ opacity: 'hide' }, "slow"); inside==false; } } //hide email verify popup on mouse out function email_verify_popup_content() { if (inside==true) { $(".email-verify-pop").animate({ opacity: 'hide' }, "slow"); inside=false; } } //insert tracking of customer function insertTracking(emp_id,type){ var research_email = $('#email_select_'+emp_id).val(); var state = unlock_contact(emp_id, 'vcard'); $.ajax({ url: 'https://app.lead411.com/profile_page/insertTrackingData', data:{employee_id:emp_id,click_type:type}, type: 'post', success: function(datastr) { //alert(datastr); if(type=="vcard"){ window.location='https://app.lead411.com/vcard/index/'+emp_id+'/'+research_email; } } }); } //update company's number of employees function save_employees_details(id) { var comp_emps = $.trim($('#comp_employees').val()); var emp_val = $( "#comp_employees option:selected" ).text(); $.post("https://app.lead411.com/profile_page/saveCompanyNoOfEmployees", { "company_id" : id, "comp_emps" : comp_emps }, function(data) { if(data == "ok") { $("#emp_div").html($("#track_emp").val()); $('#emp_txt').text(emp_val); var msg = 'Employees updated successfully.'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error") { var msg = 'Employees could not be updated'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error1") { var msg = 'Your session has expired. Please login again'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } }); } //update company's yearly revenue function save_revenue_details(id) { var comp_rev = $.trim($('#comp_revenue').val()); var rev_val = $( "#comp_revenue option:selected" ).text(); $.post("https://app.lead411.com/profile_page/saveCompanyRevenue", { "company_id" : id, "comp_rev" : comp_rev }, function(data) { if(data == "ok") { $("#rev_div").html($("#track_rev").val()); $('#rev_txt').text(rev_val); var msg = 'Revenue updated successfully.'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error") { var msg = 'Revenue could not be updated'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error1") { var msg = 'Your session has expired. Please login again'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } }); } //validate company address details and update to crm function save_details_company(cid, eid) { var comp_add = $.trim($('#comp_add').val()); var comp_city = $.trim($('#comp_city').val()); var comp_state = $.trim($('#comp_state').val()); var comp_zip = $.trim($('#comp_zip').val()); var comp_phone = $.trim($('#comp_phone').val()); var comp_fax = $.trim($('#comp_fax').val()); hideError('comp_add'); hideError('comp_city'); hideError('comp_state'); hideError('comp_zip'); hideError('comp_phone'); if (comp_add == '' || comp_add.length < 4 || comp_state == '' || comp_state.length < 2 || comp_city == '' || comp_city.length < 3 || comp_zip == '' || comp_zip.length < 5 || comp_phone == '' || comp_phone.length < 10) { if (comp_add == '') { showError('comp_add', 'Username cannot be blank'); } else if (comp_add.length < 4) { showError('comp_add', 'Username cannot be less than 4 characters'); } else { hideError('comp_add'); } if (comp_state == '') { showError('comp_state', 'State cannot be blank'); } else if (comp_state.length < 2) { showError('comp_state', 'State cannot be less than 2 characters'); } else { hideError('comp_state'); } if (comp_city == '') { showError('comp_city', 'City cannot be blank'); } else if ( comp_city.length < 3 ) { showError('comp_city', 'City cannot be less than 3 characters'); } else { hideError('comp_city'); } if (comp_zip == '') { showError('comp_zip', 'Zip cannot be blank'); } else if ( comp_zip.length < 5 ) { showError('comp_zip', 'Zip cannot be less than 5 characters'); } else { hideError('comp_zip'); } if (comp_phone == '') { showError('comp_phone', 'City cannot be blank'); } else if ( comp_phone.length < 10 ) { showError('comp_phone', 'City cannot be less than 10 characters'); } else { hideError('comp_phone'); } } else { $.post("https://app.lead411.com/profile_page/saveEmployeeDetails", { "company_id" : cid, "employee_id" : eid, "comp_add" : comp_add, "comp_city" : comp_city, "comp_state" : comp_state, "comp_zip" : comp_zip, "direct_phone" : comp_fax, "comp_phone" : comp_phone }, function(data) { if(data == "ok") { $("#comp_info").html($("#track_org").val()); $('#comp_address').text(comp_add); $('#comp_city').text(comp_city); $('#comp_zip').text(comp_zip); $('#comp_state').text(comp_state); $('#comp_phone').text(comp_phone); comp_fax = (comp_fax == '') ? 'Not Available':comp_fax; $('#comp_fax').text(comp_fax); var msg = 'Person details updated successfully.'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error") { var msg = 'Person details could not be updated'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error1") { var msg = 'Your session has expired. Please login again'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } }); } } //download vcard of employee function exportVcard(emp_id){ var result = export_check(emp_id, 'vcard'); if(result == 'allowed') { insertTracking(emp_id,'vcard'); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to Infusionsoft CRM function exportToInfusionsoft(emp_id) { var result = export_check(emp_id, 'infusionsoft'); if(result == 'allowed') { var exp_button = $('#inf_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#inf_'+emp_id).html(' '); $.post("https://app.lead411.com/infusion/infusion.php", { "employee_id": emp_id, "research_email": research_email, "option": "export" }, function(data) { $('#inf_'+emp_id).html(exp_button); $('.exp-infusion-btn').hide(); $('.signin-infusion-btn').show(); if(data == "ok"){ var state = unlock_contact(emp_id, 'infusionsoft'); var msg = 'Data exported to Infusionsoft successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Infusionsoft'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'Your API token credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to Google Contacts function exportToGoogle(emp_id) { var result = export_check(emp_id, 'google'); if(result == 'allowed') { var exp_button = $('#goo_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#goo_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/google", { "employee_id" : emp_id, "research_email": research_email, "option" : "export" }, function(data) { $('#goo_'+emp_id).html(exp_button); $('.exp-google-btn').hide(); $('.signin-google-btn').show(); if(data == "ok"){ var state = unlock_contact(emp_id, 'google'); var msg = 'Data exported to Google Contacts successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Google'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'Your API token credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to salesloft Contacts function exportToSalesloft(emp_id) { var result = export_check(emp_id, 'salesloft'); if(result == 'allowed') { var exp_button = $('#sl_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#sl_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/salesloft", { "employee_id" : emp_id, "research_email": research_email, "option" : "export" }, function(data) { $('#sl_'+emp_id).html(exp_button); $('.exp-salesloft-btn').hide(); $('.signin-salesloft-btn').show(); if(data == "ok"){ var state = unlock_contact(emp_id, 'salesloft'); var msg = 'Data exported to SalesLoft successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to SalesLoft'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'Your SalesLoft API credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Email address is required'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to Outreach.io Contacts function exportToOutreach(emp_id) { var result = export_check(emp_id, 'outreach'); if(result == 'allowed') { var exp_button = $('#out_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#out_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/outreach", { "employee_id" : emp_id, "research_email": research_email, "option" : "export" }, function(data) { $('#out_'+emp_id).html(exp_button); $('.exp-outreach-btn').hide(); $('.signin-outreach-btn').show(); if(data == "ok"){ var state = unlock_contact(emp_id, 'outreach'); var msg = 'Data exported to Outreach.io successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Outreach.io'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'Your Outreach.io API credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to Pipedrive CRM function exportToPipedrive(emp_id) { var result = export_check(emp_id, 'pipedrive'); if(result == 'allowed') { var exp_button = $('#pipe_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#pipe_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/pipedrive", { "employee_id": emp_id, "research_email": research_email }, function(data) { $('#pipe_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'pipedrive'); var msg = 'Data exported to Pipedrive successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Pipedrive'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your API token of Pipedrive account'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your API token credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to HubSpot CRM function exportToHubSpot(emp_id) { var result = export_check(emp_id, 'hubspot'); if(result == 'allowed') { var exp_button = $('#hub_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#hub_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/hubspot", { "employee_id": emp_id, "research_email": research_email }, function(data) { $('#hub_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'hubspot'); var msg = 'Data exported to HubSpot successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to HubSpot'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your API Key of HubSpot account'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your API Key credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to PCRecruiter CRM function exportToPCRecruiter(emp_id) { var result = export_check(emp_id, 'pcrecruiter'); if(result == 'allowed') { var exp_button = $('#pcr_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#pcr_'+emp_id).html(' '); $.post("https://app.lead411.com/crm/exportToPCRecruiter", { "employee_id": emp_id, "research_email": research_email }, function(data) { $('#pcr_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'pcrecruiter'); var msg = 'Data exported to PCRecruiter successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to PCRecruiter'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your credentials of PCRecruiter account'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your PCRecruiter account credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to Agile CRM function exportToAgile(emp_id) { var result = export_check(emp_id, 'agile'); if(result == 'allowed') { var exp_button = $('#agl_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#agl_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/agile", { "employee_id": emp_id, "research_email": research_email }, function(data) { $('#agl_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'agile'); var msg = 'Data exported to Agile CRM successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Agile CRM'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your Agile CRM credentials'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your Agile CRM credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to MS Dynmics CRM function exportToDynmics(emp_id){ var result = export_check(emp_id, 'ms_dynamics'); if(result == 'allowed') { var exp_button = $('#msd_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#msd_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/dynamics", { "employee_id": emp_id, "research_email": research_email }, function(data) { $('#msd_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'ms_dynamics'); var msg = 'Data exported to MS Dynamics successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to MS Dynamics'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your MS Dynamics credentials'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your MS Dynamics account credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error4") { var msg = 'Getting error while exporting data to MS Dynamics'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to Capsule CRM function exportToCapsule(emp_id) { var result = export_check(emp_id, 'capsule'); if(result == 'allowed') { var exp_button = $('#cap_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#cap_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/capsule", { "employee_id": emp_id, "research_email": research_email }, function(data) { $('#cap_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'capsule'); var msg = 'Data exported to Capsule CRM successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Capsule CRM'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your credentials of Capsule CRM account'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your Capsule CRM account credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to Nutshell CRM function exportToNutshell(emp_id) { var result = export_check(emp_id, 'nutshell'); if(result == 'allowed') { var exp_button = $('#nut_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#nut_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/callNutshell", { "employee_id": emp_id, "research_email": research_email }, function(data) { $('#nut_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'nutshell'); var msg = 'Data exported to Nutshell CRM successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Nutshell CRM'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your credentials of Nutshell CRM account'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your username of Nutshell CRM is wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error4") { var msg = 'Your API key of Nutshell CRM is wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to Highrise CRM function exportToHighrise(emp_id) { var result = export_check(emp_id, 'highrise'); if(result == 'allowed') { var exp_button = $('#high_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#high_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/highrise", { "employee_id": emp_id, "research_email": research_email }, function(data) { $('#high_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'highrise'); var msg = 'Data exported to Highrise successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Highrise'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your credentials of Highrise account'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your Highrise account has insufficient storage'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error4") { var msg = 'Your Highrise account credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to Less Annoying CRM function exportToLessAnnoying(emp_id) { var result = export_check(emp_id, 'lessannoying'); if(result == 'allowed') { var exp_button = $('#less_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#less_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/lessannoying", { "employee_id": emp_id, "research_email": research_email }, function(data) { $('#less_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'lessannoying'); var msg = 'Data exported to Less Annoying CRM successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Less Annoying CRM'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your Less Annoying CRM credentials'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your Less Annoying account credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to QuickMail.io function exportToQuickMail(emp_id) { var result = export_check(emp_id, 'quickmail'); if(result == 'allowed') { if ( $( "#email_select_"+emp_id ).length ) { if( $('#email_select_'+emp_id).val() == "" ) { var msg = 'Please select a email address from Research drop down.' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); return false; } } var exp_button = $('#qm_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#qm_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/quickmail", { "employee_id": emp_id, "research_email": research_email }, function(data) { $('#qm_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'quickmail'); var msg = 'Data exported to QuickMail.io successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to QuickMail.io'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your credentials of QuickMail.io account'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your QuickMail.io account credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error4") { var msg = 'Email address is required'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to Insightly CRM function exportToInsightly(emp_id, exp_format) { var exp_button = $('#ins_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#ins_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/insightly", { "employee_id" : emp_id, "research_email": research_email, "data_type" : exp_format }, function(data) { $('#ins_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'insightly'); var msg = 'Data exported to Insightly successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Insightly'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your API Key of Insightly account'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Data could not be exported to Insightly'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } //export employee data to Salesforce function exportToSalesforce(emp_id, exp_format) { var exp_button = $('#sfo_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#sfo_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/salesforce", { "employee_id": emp_id, "research_email": research_email, "data_type": exp_format }, function(data) { $('#sfo_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'salesforce'); var msg = 'Data exported to Salesforce successfully.'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Salesforce'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your credentials of Salesforce account'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your login credentials of Salesforce are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error4") { var msg = 'Salesforce could be down, or you have an error in configuration'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error6") { var msg = 'Salesforce Data Mapping: Last Name is required field'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error7") { var msg = 'Salesforce Data Mapping: Company is required field'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } //export employee data to sugarCRM function exportToSugarCRM(emp_id, exp_format) { var exp_button = $('#sug_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#sug_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/sugarCRM", { "employee_id" : emp_id, "research_email": research_email, "data_type" : exp_format }, function(data) { $('#sug_'+emp_id).html(exp_button); $.colorbox.close(); if(data == "ok"){ var state = unlock_contact(emp_id, 'sugarcrm'); var msg = 'Data exported to SugarCRM successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to SugarCRM'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your credentials of SugarCRM account'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your login credentials of SugarCRM are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } //export employee data to Vtiger function exportToVtiger(emp_id, exp_format) { var exp_button = $('#vtiger_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#vtiger_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/vtiger", { "employee_id" : emp_id, "research_email": research_email, "data_type" : exp_format }, function(data) { $('#vtiger_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'vtiger'); var msg = 'Data exported to Vtiger successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Vtiger'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your Vtiger account details'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your username is wrong of Vtiger account'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error4") { var msg = 'Your account details are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } //export employee data to Pipeline deals function exportToPipeline(emp_id, exp_format) { var exp_button = $('#pip_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#pip_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/pipeline", { "employee_id" : emp_id, "research_email": research_email, "data_type" : exp_format }, function(data) { $('#pip_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'pipeline'); var msg = 'Data exported to Pipeline Deals successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Pipeline'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your Pipeline API Key.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your API Key credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } //export employee data to Zoho CRM function exportToZohoCRM(emp_id, exp_format) { var exp_button = $('#zoho_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#zoho_'+emp_id).html(' '); $.post("https://app.lead411.com/crm/exportToZoho", { "employee_id": emp_id, "research_email": research_email, "data_type" : exp_format }, function(data) { $('#zoho_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'zoho'); var msg = 'Data exported to Zoho CRM successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Zoho CRM'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your Zoho Auth Token.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your Auth Token credential is wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } //export employee data to Oracle CRM function exportToOracleCRM(emp_id, exp_format) { var exp_button = $('#ora_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#ora_'+emp_id).html(' '); $.post("https://app.lead411.com/crm/exportToOracle", { "employee_id": emp_id, "research_email": research_email, "data_type" : exp_format }, function(data) { $('#ora_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'oracle'); var msg = 'Data exported to Oracle CRM successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Oracle CRM'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your credentials of Oracle CRM account'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your Oracle CRM account credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } //export employee data to Base CRM function exportToBaseCRM(emp_id, exp_format) { var exp_button = $('#base_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#base_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/basecrm", { "employee_id" : emp_id, "research_email": research_email, "data_type" : exp_format }, function(data) { $('#base_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'basecrm'); var msg = 'Data exported to Base CRM successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Base CRM'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your Base CRM Access Token.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your Access Token credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } //export employee data to Close.io CRM function exportToCloseio(emp_id) { var result = export_check(emp_id, 'closeio'); if(result == 'allowed') { var exp_button = $('#cls_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#cls_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/closeio", { "employee_id" : emp_id, "research_email": research_email }, function(data) { $('#cls_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'closeio'); var msg = 'Data exported to Close.io successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to Close.io'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your Close.io API Key.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your API Key credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to PersistIQ CRM function exportToPersistIQ(emp_id) { var result = export_check(emp_id, 'persistiq'); if(result == 'allowed') { if ( $( "#email_select_"+emp_id ).length ) { if( $('#email_select_'+emp_id).val() == "" ) { var msg = 'Please select a email address from Research drop down.' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); return false; } } var exp_button = $('#per_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#per_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/persistiq", { "employee_id" : emp_id, "research_email": research_email }, function(data) { $('#per_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'persistiq'); var msg = 'Data exported to PersistIQ successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Data could not be exported to PersistIQ'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your API Key of PersistIQ account'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your API Key credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error4") { var msg = 'Email address is required'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } //export employee data to RelateIQ function exportToRelateiq(emp_id) { var result = export_check(emp_id, 'relateiq'); if(result == 'allowed') { var exp_button = $('#riq_'+emp_id).html(); var image_url = 'https://app.lead411.com/assets/images/'; var research_email = $('#email_select_'+emp_id).val(); $('#riq_'+emp_id).html(' '); $.post("https://app.lead411.com/profile_page/relateiq", { "employee_id" : emp_id, "research_email": research_email }, function(data) { $('#riq_'+emp_id).html(exp_button); if(data == "ok"){ var state = unlock_contact(emp_id, 'relateiq'); var msg = 'Data exported to SalesforceIQ successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(data == "error1") { var msg = 'Your SalesforceIQ credentials are correct.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error2") { var msg = 'You have not submited your SalesforceIQ credentials.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(data == "error3") { var msg = 'Your SalesforceIQ credentials are wrong'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } ); } else if(result == 'insufficient_quota'){ var msg = 'You do not have any remaining downloads for this month' ; $.jGrowl(msg, { sticky: false, theme: 'error'}); } else if(result == 'error'){ var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } } function hideEmailPopUp() { $(".pop-emails").animate({ opacity: 'hide' }, "slow"); } /** * Adding Lead411 employee to the cart. * @returns {undefined} */ var sel_inner_html=''; var sel_own_color=''; function hexc(colorval) { var parts = colorval.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); delete(parts[0]); for (var i = 1; i <= 3; ++i) { parts[i] = parseInt(parts[i]).toString(16); if (parts[i].length == 1) parts[i] = '0' + parts[i]; } return '#' + parts.join(''); } function add_emp_to_cart(emp_id){ $.post("https://app.lead411.com/profile_page/ajax_add_employee_cart", { "id": emp_id }, function(data) { var obj = $.parseJSON( data ); if(obj.status == 'success'){ if( $('#email_select_'+emp_id).val() ) { var ItemArray = []; ItemArray.push({ employee_id : emp_id, email : $('#email_select_'+emp_id).val() }); $.ajax({ type: 'POST', url: "https://app.lead411.com/profile_page/saveEmployeeResearchedEmails", async:false, data: {email_data:ItemArray }, success: function(data) { //param = data; } }); } //drag_item_to_cart('people_thumb'); $('#total_cart_items').text(obj.cart_count); //$('.cart_items_header').text('('+obj.cart_count+')'); $('#total_cart_amount').text(obj.cart_total); var id=emp_id; selhtml=$('#sal_'+id).html(); sel_own_color= hexc($('#sal_'+id).css("background-color")); var button = " "; $('#sal_'+id).html(''); $('#sal_'+id).html(button); $('#sal_'+id).css('background-color','#FFA500'); var msg = 'Contacts have been added to cart successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else { var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } }); } function ajax_cart_remove(type,id,option){ $.post("https://app.lead411.com/search/removeSingleItem", { "id": id, "type": type }, function(data) { var obj = $.parseJSON( data ); $('#total_cart_items').text(obj.cart_count); //$('.cart_items_header').text('('+obj.cart_count+')'); $('#total_cart_amount').text(obj.cart_total); if(type == 'employee'){ var button = selhtml;//" "; $('#sal_'+id).html(''); $('#sal_'+id).html(button); if(sel_own_color=='' || sel_own_color=='undefined'){ sel_own_color='#4f9fa6'; } $('#sal_'+id).css('background-color',sel_own_color); } var msg = 'Contacts have been removed from the cart.'; $.jGrowl(msg, { sticky: false, theme: 'success'}); }); } /** * Adding Lead411 employee to the cart. * @returns {undefined} */ function add_emp_to_ent_cart(emp_id){ $.post("https://app.lead411.com/profile_page/ajax_add_employee_ent_cart", { "id": emp_id }, function(data) { var obj = $.parseJSON( data ); if(obj.status == 'success'){ if( $('#email_select_'+emp_id).val() ) { var ItemArray = []; ItemArray.push({ employee_id : emp_id, email : $('#email_select_'+emp_id).val() }); $.ajax({ type: 'POST', url: "https://app.lead411.com/profile_page/saveEmployeeResearchedEmails", async:false, data: {email_data:ItemArray }, success: function(data) { //param = data; } }); } //drag_item_to_cart('people_thumb'); $('#total_cart_items').text(obj.cart_count); $('.cart_items_header').text('('+obj.cart_count+')'); $('#total_cart_amount').text(obj.cart_total); var msg = 'Contact has been added to cart successfully'; $.jGrowl(msg, { sticky: false, theme: 'success'}); } else if(obj.status == 'error1'){ if( $('#email_select_'+emp_id).val() ) { var ItemArray = []; ItemArray.push({ employee_id : emp_id, email : $('#email_select_'+emp_id).val() }); $.ajax({ type: 'POST', url: "https://app.lead411.com/profile_page/saveEmployeeResearchedEmails", async:false, data: {email_data:ItemArray }, success: function(data) { //param = data; } }); } //var msg = 'Contact already added to cart'; //$.jGrowl(msg, { sticky: false, theme: 'error'}); } else { var msg = 'There was some error in processing your request. Please try again.'; $.jGrowl(msg, { sticky: false, theme: 'error'}); } }); } /*TOUT app script [start]*/ // (function() { // var tc = document.createElement('script'); // tc.type = 'text/javascript'; // tc.async = true; // tc.src = ('https://developers.toutapp.com/assets/tout_connect.js') // var s = document.getElementsByTagName('script')[0]; // s.parentNode.insertBefore(tc, s); // })(); // // var _tout_connect = _tout_connect || []; // _tout_connect.push(['setAcct', '287e26e371760aea365497c7baaff28c']); // _tout_connect.push(['subscribe', 'connected', function() { // $('#signin-tout-btn').hide(); $('#upgrade-tout-btn').show(); $('#exp-tout-btn').hide(); $(".emp_api_popup_content").css('width','341px');}]); // _tout_connect.push(['subscribe', 'not_authorized', function() { // $('#signin-tout-btn').show(); $('#upgrade-tout-btn').hide(); $('#exp-tout-btn').hide(); $(".emp_api_popup_content").css('width','341px');}]); // _tout_connect.push(['subscribe', 'push_to_tout_enabled', function() { // $('#signin-tout-btn').hide(); $('#upgrade-tout-btn').hide(); $('#exp-tout-btn').show(); $(".emp_api_popup_content").css('width','341px');}]); // // function toutapp(cont_name, cont_email, emp_id) // { // var result = export_check(emp_id, 'toutapp'); // // if(result == 'allowed') // { // var research_email = $('#email_select_'+emp_id).val(); // if (typeof research_email != 'undefined') { // if(research_email != '') { // cont_email = research_email; // } // } // // var pets = [{"email":cont_email,"name":cont_name}]; // // _tout_connect.push(['setAcct', '25d14b550bf7fc7543c25e8aa0adc44757ce7081dafd991ec3c937580f9702cf']); // _tout_connect.push(['push_to_tout', {json:pets}]); // } // else if(result == 'insufficient_quota'){ // var msg = 'You do not have any remaining downloads for this month' ; // $.jGrowl(msg, { sticky: false, theme: 'error'}); // } else if(result == 'error'){ // var msg = 'There was some error in processing your request. Please try again.'; // $.jGrowl(msg, { sticky: false, theme: 'error'}); // } // } /*TOUT app script [end]*/