| Server IP : 10.200.247.200 / Your IP : 216.73.217.19 Web Server : Apache System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : jeremy ( 1001) PHP Version : 8.4.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/usa_sites/vx_testing/usa/professional-grant-services/ |
Upload File : |
<?php
session_start();
include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/ua.php');
include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/func.php');
include_once($_SERVER['DOCUMENT_ROOT'].'/vx_/site_info.php');
include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/mysql.php');
$user = $_SESSION['user'];
ob_start();
if(!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])) {
ob_start();
include_once($_SERVER['DOCUMENT_ROOT'].'/vx/usa/layout/functions/non_angular_login.php');
$login_result = ob_get_clean();
if(empty($loginErrors)) {
header("Location: ".$_SERVER['SCRIPT_NAME']);
exit(0);
}
}
function shuffle_assoc(&$array) {
$keys = array_keys($array);
shuffle($keys);
foreach($keys as $key) {
$new[$key] = $array[$key];
}
$array = $new;
return true;
}
$_SESSION['visited_professional_services'] = '1';
$client_res = $db->query("SELECT * FROM lc2{$siteCode}_lc.lc_reseller
WHERE id='".clean($user)."'");
if(!empty($client_res)) {
$client_info = $client_res[0];
$client_info['address'] = $client_info['address1'];
$client_info['cell_phone'] = phone_number($client_info['phone_1']);
$client_info['work_phone'] = phone_number($client_info['phone_1']);
$client_profile_res = $db->query("SELECT p.money,p.description FROM lc2{$siteCode}_lc.lead_profile p
LEFT JOIN lc2{$siteCode}_lc.lc_leads l ON l.id=p.lead_id
WHERE l.customerID='".clean($user)."'");
if(!empty($client_profile_res)) {
$client_info['description'] = $client_profile_res[0]['description'];
$client_info['money'] = $client_profile_res[0]['money'];
}
if($client_info['visited_professional_services_page']=='0') {
$db->query("UPDATE lc2{$siteCode}_lc.lc_reseller SET visited_professional_services_page=1 WHERE id='".clean($user)."'");
}
} else {
$client_info = array();
header("Location: index.php");
exit(0);
}
track_member_action('Page Visit','Professional Grant Services Appointment');
$is_jeremy = false;
$marketer_res = $db->query("SELECT id,marketer FROM coaching_allocator.leads
WHERE leaddb='".clean($siteCode)."'
AND leadid='".clean($user)."'");
if(!empty($marketer_res[0]['marketer'])) {
if($marketer_res[0]['marketer']=='jeremy') {
$is_jeremy = true;
}
$marketer_res = $db->query("SELECT e.username as 'marketer',e.first_name,e.work_email,s.extension
FROM surfcrm.employees e
LEFT JOIN surfcrm.softphone_logins s ON s.id=e.softphone_id
WHERE e.username='".clean($marketer_res[0]['marketer'])."'");
}
$total_available = 0;
$money_needed_danielle = true;
/*$profile_info_res = $db->get_results("SELECT money_needed,(available_savings + available_credit_cards + available_other) as total_available
FROM coaching_allocator.profile
WHERE leads_id='".clean($marketer_res[0]['id'])."'");
if(!empty($profile_info_res)) {
$total_available = $profile_info_res[0]->total_available*1;
if(!in_array($profile_info_res[0]->money_needed,array('','$10,000 - $25,000','$25,000 - $50,000','$500 - $10,000','$500-$10,000','Select...'))) {
$money_needed_danielle = false;
}
}*/
$res = $db->get_results("SELECT username FROM surfcrm.employees
WHERE `role` = 'Coaching' AND `first_login` = '0' AND `deleted` = '0' AND `username`<>'jason'");
$marketers = array();
foreach($res as $r) {
$marketers[strtolower($r->username)] = array();
}
//Assign the rest of the leads based on last 30 days sales
$contracts_signed = $db->get_results("SELECT al.marketer,COUNT(*) as c
FROM lc2synment_lc.document d
LEFT JOIN coaching_allocator.leads al ON al.synergy_client_id=d.client_id
LEFT JOIN surfcrm.employees e ON al.marketer=e.username
WHERE d.datesigned >= '".date('Y-m-d',strtotime('-30 day'))." 00:00:00'
AND e.role='Coaching' AND e.deleted=0
GROUP BY marketer");
$docs_signed_users = array();
$docs_signed_total = 0;
foreach($contracts_signed as $doc) {
$docs_signed_users[strtolower($doc->marketer)] += $doc->c;
$docs_signed_total += $doc->c;
}
//Give an extra appointment if their volume/appointment is over 300
$cpa_users = array();
$cres = $db->get_results("SELECT c.username,COUNT(*) as apps,SUM(o.total_cost) as volume
FROM surfcrm.calendar c
LEFT JOIN coaching_allocator.leads l ON l.id=c.client_id
LEFT JOIN lc2synment_lc.orders o ON o.client_id=l.synergy_client_id
WHERE c.`type_label` = 'usa_close' AND c.`start_date_time` >= '".date('Y-m-d',strtotime('-30 day'))." 00:00:00'
GROUP BY username");
if(!empty($cres)) {
foreach($cres as $cr) {
$cpa = round($cr->volume/$cr->apps,2);
if($cpa >= 300) {
$cpa_users[strtolower($cr->username)] = true;
}
}
}
$timezone_offset = 0;
if(!empty($client_info['zip'])) {
$timezone_res = $db->query("SELECT timezone FROM geo.zip_codes WHERE zip='".clean($client_info['zip'])."'");
if(!empty($timezone_res)) {
$timezone_offset = ($timezone_res[0]['timezone'] - (-7));
}
} else {
//check the area code
if(!empty($client_info['cell_phone'])) {
$only_nums = preg_replace('/[^0-9/','',$client_info['cell_phone']);
$area_code = substr($only_nums,0,3);
$timezone_res = $db->query("SELECT timezone_offset as timezone FROM geo.area_codes WHERE area_code='".clean($area_code)."'");
if(!empty($timezone_res)) {
$timezone_offset = ($timezone_res[0]['timezone'] - (-7));
}
}
}
$timezone_offset_pretty = array(
'0' => 'Mountain Time'
,'-1' => 'Pacific Time'
,'-2' => 'Alaska Time'
,'-4' => 'Hawaii Time'
,'1' => 'Central Time'
,'2' => 'Eastern Time'
);
$timezone_pretty_time = '';
if(empty($timezone_offset_pretty[$timezone_offset])) {
$timezone_offset = 0;
} else {
$timezone_pretty_time = $timezone_offset_pretty[$timezone_offset];
}
$dates = array();
$appointment_dates = array();
$first_date = date('Y-m-d');
$bus_days = 0;
while($bus_days<5) {
$first_date = date('Y-m-d',strtotime('+1 day',strtotime($first_date)));
/*if(date('w',strtotime($first_date))=='0' || date('w',strtotime($first_date))=='6') {
continue;
}*/
if(date('w',strtotime($first_date))=='0') {
continue; //Sunday
}
if(date('w',strtotime($first_date))=='6') {
//continue; //Saturday
}
if(strtotime($first_date)==strtotime('fourth thursday of November '.date('Y'))) {
continue; //Thanksgiving
}
if(strtotime($first_date)==strtotime(date('Y').'-12-25')) {
continue; //Christmas
}
$jason_over_limit = false;
$jason_cal_res = $db->get_results("SELECT COUNT(*) as c FROM surfcrm.calendar
WHERE username='jason'
AND start_date_time BETWEEN '".$db->clean($first_date)." 00:00:00' AND '".$db->clean($first_date)." 23:59:59'
AND type_label='usa_close'");
if(!empty($jason_cal_res)) {
if($jason_cal_res[0]->c*1 >= 5) {
$jason_over_limit = true;
}
}
//$appointment_count = rand(6,10);
$appointment_data = array();
$date = $first_date;
$start_time = $date.' 09:00:00';
if(strtotime($date) >= strtotime('2022-02-06')) {
//Wes can start at 7
$start_time = $date.' 07:00:00';
}
//David can start at 8
//$start_time = $date.' 08:00:00';
$end_time = $date.' 18:00:00';
//Wes works until 8pm Wed, Thur
$end_time = $date.' 20:00:00';
$usernames = array();
//if($total_available<3000 || date('w',strtotime($start_time))=='5') { //Bonnie now gets leads under $3000 08/04/2021
if(false /*date('w',strtotime($start_time))=='6'*/) { //Turned off 04/25/2022 because he isn't calling the appointments
$end_time = $date.' 12:00:00';
$usernames[] = 'davidc';
$usernames[] = 'davidc';
$usernames[] = 'davidc';
$usernames[] = 'davidc';
} elseif(false && date('w',strtotime($start_time))=='5') {
//no bonnie
$bonnie_volume = (empty($four_week_volume_setter['bonniek'])) ? 0 : $four_week_volume_setter['bonniek'];
//everybody gets 3 (except david 06/22/2021, david gets 1 now 07/01/2021), switch to it based off contracts signed mine vs team ratio
/*foreach($marketers as $marketer=>$mleads) {
if($marketer=='danielled' && $money_needed_danielle==false) {
continue;
}
if($marketer=='bonniek') {
continue;
}
$usernames[] = $marketer;
if($marketer=='davidc') {
continue;
}
$usernames[] = $marketer;
$usernames[] = $marketer;
}*/
foreach($marketers as $marketer=>$mleads) {
if($marketer=='bonniek') {
continue;
}
$ratio = round($docs_signed_users[$marketer]/$docs_signed_total*100);
if($ratio <= 10) {
$usernames[] = $marketer;
} elseif($ratio <= 15) {
$usernames[] = $marketer;
$usernames[] = $marketer;
} elseif($ratio < 20) {
$usernames[] = $marketer;
$usernames[] = $marketer;
$usernames[] = $marketer;
} else {
$usernames[] = $marketer;
$usernames[] = $marketer;
$usernames[] = $marketer;
$usernames[] = $marketer;
}
if(!empty($cpa_users[$marketer])) {
$usernames[] = $marketer;
}
}
} else {
foreach($marketers as $marketer=>$mleads) {
$ratio = round($docs_signed_users[$marketer]/$docs_signed_total*100);
if($ratio < 3) {
} elseif($ratio < 10) {
$usernames[] = $marketer;
} elseif($ratio < 15) {
$usernames[] = $marketer;
$usernames[] = $marketer;
} elseif($ratio < 20) {
$usernames[] = $marketer;
$usernames[] = $marketer;
$usernames[] = $marketer;
} else {
$usernames[] = $marketer;
$usernames[] = $marketer;
$usernames[] = $marketer;
$usernames[] = $marketer;
}
if(!empty($cpa_users[$marketer])) {
$usernames[] = $marketer;
}
}
if(!$jason_over_limit) {
//Add Jason into the mix
$usernames[] = 'jason';
$usernames[] = 'jason';
$usernames[] = 'jason';
$usernames[] = 'jason';
}
}
if(date('w',strtotime($start_time))=='6') {
$usernames[] = 'west';
$usernames[] = 'west';
$usernames[] = 'west';
$usernames[] = 'west';
}
$can_do_usernames = array();
foreach($usernames as $u) {
$can_do_usernames[$u] = $u;
}
$today = date('Y-m-d');
$appointment_count = count($usernames);
$emp_appointment_lengths = array();
$emp_appointment_lengths['bonniek'] = '30';
$emp_appointment_lengths['davidc'] = '30';
$emp_appointment_lengths['leslieg'] = '30';
$emp_appointment_lengths['chriss'] = '30';
$emp_appointment_lengths['danielled'] = '30';
$emp_appointment_lengths['west'] = '30';
$emp_appointment_lengths['jason'] = '30';
if(date('Y-m-d',strtotime($start_time))==date('Y-m-d')) {
$start_time = date('Y-m-d H',strtotime('+2 hour')).':00:00';
$now = date('Y-m-d H:i:s',strtotime('+2 hour'));
while(strtotime($start_time)<=strtotime($now)) {
$start_time = date('Y-m-d H:i:s',strtotime('+15 minute',strtotime($start_time)));
}
}
$res = $db->query("SELECT username, start_date_time, end_date_time
FROM surfcrm.calendar
WHERE username IN ('".implode("','",$usernames)."')
AND '".clean($date)."' BETWEEN DATE(start_date_time) AND DATE(end_date_time)
AND (type_id<>'2' OR type_label='usa_close')");
$emp_times = array();
$emps_appointment_can_do = array();
foreach($res as $r) {
$emp_times[strtolower($r['username'])][] = $r;
}
$check_i = 0;
while(strtotime($start_time) < strtotime($end_time)) {
$check_i++;
if($check_i >= 1000) {
break;
}
$can_do = true;
$emps_cant_do = array();
foreach($usernames as $emp) {
if(date('w',strtotime($start_time))=='6') { // Saturday
if($emp=='west') {
if(strtotime($start_time) > strtotime(date('Y-m-d',strtotime($start_time)).' 12:00:00')) {
$emps_cant_do[$emp] = $emp;
}
} else {
$emps_cant_do[$emp] = $emp;
}
} else {
if(!in_array($emp,array('west','danielled','bonniek','jason')) && strtotime($start_time) < strtotime(date('Y-m-d',strtotime($start_time)).' 09:00:00')) {
$emps_cant_do[$emp] = $emp;
}
if(!in_array($emp,array('west')) && strtotime($start_time) > strtotime(date('Y-m-d',strtotime($start_time)).' 18:00:00')) {
$emps_cant_do[$emp] = $emp;
}
if($emp=='danielled') {
if(date('w',strtotime($start_time))=='1' || date('w',strtotime($start_time))=='2' || date('w',strtotime($start_time))=='3') {
//starts at 7am M,T,W
} else {
//starts at 8am Th,F
if(strtotime($start_time) < strtotime(date('Y-m-d',strtotime($start_time)).' 08:00:00')) {
$emps_cant_do[$emp] = $emp;
}
}
if(strtotime($start_time) > strtotime(date('Y-m-d',strtotime($start_time)).' 16:00:00')) {
$emps_cant_do[$emp] = $emp;
}
}
if($emp=='bonniek' && strtotime($start_time) < strtotime(date('Y-m-d',strtotime($start_time)).' 08:00:00')) {
$emps_cant_do[$emp] = $emp;
}
if($emp=='bonniek' && strtotime($start_time) > strtotime(date('Y-m-d',strtotime($start_time)).' 16:30:00')) {
$emps_cant_do[$emp] = $emp;
}
if($emp=='bonniek' && date('w',strtotime($start_time))=='5' && strtotime($start_time) > strtotime(date('Y-m-d',strtotime($start_time)).' 11:30:00')) {
$emps_cant_do[$emp] = $emp;
}
if($emp=='chriss' && strtotime($start_time) > strtotime(date('Y-m-d',strtotime($start_time)).' 15:00:00')) {
$emps_cant_do[$emp] = $emp;
}
if($emp=='leslieg' && strtotime($start_time) > strtotime(date('Y-m-d',strtotime($start_time)).' 17:00:00')) {
$emps_cant_do[$emp] = $emp;
}
if($emp=='west') {
if(date('w',strtotime($start_time))=='4') {
//works until 8pm
} else {
if(strtotime($start_time) > strtotime(date('Y-m-d',strtotime($start_time)).' 16:00:00')) {
$emps_cant_do[$emp] = $emp;
}
if(date('w',strtotime($start_time))=='2' && strtotime($start_time) > strtotime(date('Y-m-d',strtotime($start_time)).' 15:30:00')) {
$emps_cant_do[$emp] = $emp;
}
}
}
if($emp=='jason') {
if(strtotime($start_time) < strtotime(date('Y-m-d',strtotime($start_time)).' 08:00:00') || strtotime($start_time) > strtotime(date('Y-m-d',strtotime($start_time)).' 16:00:00')) {
$emps_cant_do[$emp] = $emp;
}
if(date('w',strtotime($start_time))=='5') {
if(strtotime($start_time) < strtotime(date('Y-m-d',strtotime($start_time)).' 08:00:00') || strtotime($start_time) > strtotime(date('Y-m-d',strtotime($start_time)).' 15:30:00')) {
$emps_cant_do[$emp] = $emp;
}
}
}
}
}
foreach($emp_times as $emp=>$emp_data) {
if(in_array($emp,$emps_cant_do)) {
continue;
}
if(!empty($emp_appointment_lengths[$emp])) {
$appointment_minutes = $emp_appointment_lengths[$emp];
} else {
$appointment_minutes = '20';
}
$current_end_time = date('Y-m-d H:i:s',strtotime('+'.$appointment_minutes.' minute',strtotime($start_time)));
$ignore_me = false;
if(strtotime($start_time) < strtotime(date('Y-m-d',strtotime($start_time)).' 07:00:00') ||
strtotime($start_time) > strtotime(date('Y-m-d',strtotime($start_time)).' 19:30:00')) {
$emps_cant_do[$emp] = $emp;
$ignore_me = true;
}
if(!$ignore_me) {
foreach($emp_data as $r) {
$in_appointment = false;
if(strtotime($start_time) >= strtotime($r['start_date_time']) && strtotime($start_time) < strtotime($r['end_date_time'])) {
//start date inside of current appointment
$in_appointment = true;
} elseif(strtotime($current_end_time) > strtotime($r['start_date_time']) && strtotime($current_end_time) <= strtotime($r['end_date_time'])) {
//end date inside of current appointment
$in_appointment = true;
} elseif(strtotime($start_time) < strtotime($r['start_date_time']) && strtotime($current_end_time) > strtotime($r['end_date_time'])) {
//appointment inside of the time
$in_appointment = true;
} elseif(strtotime($start_time) >= strtotime($r['start_date_time']) && strtotime($current_end_time) <= strtotime($r['end_date_time'])) {
$in_appointment = true;
}
if($in_appointment) {
$emps_cant_do[$emp] = $emp;
break;
}
}
}
}
if(count($emps_cant_do)==count($can_do_usernames)) {
$can_do = false;
}
if($can_do) {
$emps_can_do = array();
foreach($usernames as $emp) {
if(!in_array($emp,$emps_cant_do)) {
$emps_can_do[] = $emp;
}
}
$pretty_start_time = '';
if($timezone_offset=='0') {
$pretty_start_time = date('g:i a',strtotime($start_time));
} elseif($timezone_offset*1 < 0) {
$timezone_offset_minus = $timezone_offset*-1;
$pretty_start_time = date('g:i a',strtotime('-'.$timezone_offset_minus.' hour',strtotime($start_time)));
} else {
$pretty_start_time = date('g:i a',strtotime('+'.$timezone_offset.' hour',strtotime($start_time)));
}
$appointment_key = $start_time.'|||'.implode('|',$emps_can_do);
foreach($emps_can_do as $emp_can_do) {
if(empty($emps_appointment_can_do[$emp_can_do])) {
$emps_appointment_can_do[$emp_can_do] = array();
}
if(!in_array($start_time,$emps_appointment_can_do[$emp_can_do])) {
$emps_appointment_can_do[$emp_can_do][] = $start_time;
}
}
$appointment_data[$start_time] = $pretty_start_time;
}
$start_time = date('Y-m-d H:i:s',strtotime('+15 minute',strtotime($start_time)));
}
if(count($appointment_data)<6) {
continue;
}
if(count($appointment_data)<$appointment_count) {
$appointment_count = count($appointment_data);
}
$username_counts = array();
foreach($usernames as $username) {
$username_counts[$username]++;
}
shuffle_assoc($username_counts);
//echo '<pre>'.print_r($emps_appointment_can_do,true).'</pre>';
//die();
$used_times = array();
$emps_times_used = array();
foreach($username_counts as $k=>$v) {
if(!empty($emps_appointment_can_do[$k])) {
if(count($emps_appointment_can_do[$k])<$v) {
$v = count($emps_appointment_can_do[$k]);
}
} else {
continue;
}
for($i=0;$i<$v;$i++) {
$found = false;
$num_tries = 50;
while(!$found) {
$num_tries--;
if($num_tries<0) {
break;
}
$rand = rand(0,count($emps_appointment_can_do[$k])-1);
if(!in_array($emps_appointment_can_do[$k][$rand],$used_times)) {
$used_times[] = $emps_appointment_can_do[$k][$rand];
$emps_times_used[$k][] = $emps_appointment_can_do[$k][$rand];
$found = true;
}
}
}
}
foreach($emps_times_used as $k=>$v) {
foreach($emps_times_used[$k] as $time) {
$db->query("INSERT INTO coaching_allocator.professional_services_time_impressions
(
username
,date_shown
,ts
,site_code
,client_id
) VALUES (
'".$db->clean($k)."'
,'".date('Y-m-d',strtotime($time))."'
,NOW()
,'".$db->clean($siteCode)."'
,'".$db->clean($user)."'
)");
$appointment_dates[$date][] = array('key'=>$time.'|||'.$k,'value'=>$appointment_data[$time]);
}
}
if(!empty($appointment_dates[$date])) {
uasort($appointment_dates[$date],function($a,$b) {
$date_a = substr($a['key'],0,strpos($a['key'],'|||')-1);
$date_b = substr($b['key'],0,strpos($b['key'],'|||')-1);
return strtotime($date_a) - strtotime($date_b);
});
}
/*$nums = array();
for($i=0;$i<$appointment_count;$i++) {
$found = false;
while(!$found) {
$rand = rand(0,count($appointment_data)-1);
if(!in_array($rand,$nums)) {
$nums[] = $rand;
$found = true;
}
}
}
sort($nums);
foreach($nums as $num) {
$j=0;
foreach($appointment_data as $k=>$v) {
if($j==$num) {
$appointment_dates[$date][] = array('key'=>$k,'value'=>$v);
break;
}
$j++;
}
}*/
if(!empty($appointment_dates[$first_date])) {
$dates[] = $first_date;
$bus_days++;
}
}
?>
<style>
#application_info {
padding:10px 0px 20px 0px;
position:relative;
margin-top:10px;
}
.datepicker_box,.datepicker_time_box {
width:90%;
background: #c9f1fd;
border: 1px solid #00a4d3;
border-radius: 10px;
text-align:center;
padding:10px;
}
.datepicker_date, .datepicker_time {
display:inline-block;
padding: 5px 10px;
border:2px solid black;
border-radius: 10px;
background:white;
width:90%;
margin: 5px auto;
cursor:pointer;
}
.datepicker_date.datepicker_selected, .datepicker_time.datepicker_selected {
border:2px solid #008db1;
background: #4dd7fa;
}
.vamiddle, .vamiddle input {
vertical-align:middle;
font-size:20px;
}
.vamiddle input {
margin:0px 10px;
}
.schedule_appointment {
background: #91e4fb;
border:2px solid #00a4d3;
font-size:24px;
font-style:italic;
cursor:pointer;
padding:10px 20px;
border-radius:10px;
margin-top:10px;
}
.app_area {
margin:10px 20px;
}
.video {
margin:10px auto;
width:640px;
position:relative;
}
#play_button {
position: absolute;
left: 275px;
top: 143px;
background: rgba(255,255,255,0.7);
width: 100px;
height: 100px;
padding: 0px;
border-radius: 60px;
cursor: pointer;
color: black;
padding: 14px;
}
#pause_button {
display:none;
position: absolute;
left: 275px;
top: 143px;
background: rgba(255,255,255,0.7);
width: 100px;
height: 100px;
padding: 0px;
border-radius: 60px;
cursor: pointer;
color: black;
padding: 12px 10px 10px 10px;
}
#appointment_area {
margin-top:10px;
}
#loading_area {
font-size:24px;
font-weight:bold;
}
#blocked_off {
position:absolute;
top:0px;
bottom:0px;
left:0px;
right:0px;
z-index:2;
background:rgba(255,255,255,0.7);
}
#blocked_off_text {
position:relative;
z-index:3;
color:red;
}
@media screen and (max-width: 600px) {
.video {
width:90%;
}
#pause_button, #play_button {
top:calc((100% - 50px)/2);
left:calc((100% - 50px)/2);
width:50px;
height:50px;
}
#play_button {
padding:7px;
}
#pause_button {
padding: 7px 5px;
}
#pause_button .f64, #play_button .f64 {
font-size:24px;
}
#professional_service_testimonials {
display:none;
}
#application_info {
width:95%;
padding:10px;
}
}
</style>
<script>
var current_appointment_date = '';
var current_appointment_time = '';
function select_appointment_date(me,dt,pretty_dt) {
$('#appointment_time_label').html(pretty_dt);
$('.datepicker_date.datepicker_selected').removeClass('datepicker_selected');
$(me).addClass('datepicker_selected');
current_appointment_date = dt;
$('.appointment_times').hide();
$('#appointment_times_' + dt).show();
}
function select_appointment_time(me,dt) {
$('.datepicker_time.datepicker_selected').removeClass('datepicker_selected');
$(me).addClass('datepicker_selected');
current_appointment_time = dt;
}
function schedule_appointment(me) {
var errors = '';
if(current_appointment_time=='') {
alert("You need to select an appointment time");
} else {
$(me).after('<h3>Submitting your appointment...');
$(me).hide();
$(me).removeAttr('onclick');
var str = '';
str += 'appointment_time=' + encodeURIComponent(current_appointment_time);
str += '&send_reminder_text=1';
str += '&send_reminder_email=1';
$.ajax({
method: "POST",
url: "/vx/usa/professional-grant-services/set_appointment.php",
data: str
}).done(function( msg ) {
$('#application_info').html(msg);
});
}
}
function track_video_watched() {
var str="track_video=1";
$.ajax({
method: "POST",
url: "/vx/usa/professional-grant-services/track_video_watched_appointment.php",
data: str
}).done(function( msg ) {
});
}
var tracked_video_started = false;
function track_video_started() {
if(!tracked_video_started) {
tracked_video_started = true;
var str="track_video=1";
$.ajax({
method: "POST",
url: "/vx/usa/professional-grant-services/track_video_started_appointment.php",
data: str
}).done(function( msg ) {
});
}
}
var marked_tracked = false;
function show_application_form(me) {
if(me.currentTime >= 150) {
if(!marked_tracked) {
track_video_watched();
marked_tracked = true;
}
//$('#blocked_off,#blocked_off_text').hide();
//$('#blocked_off').hide();
} else {
//$('#blocked_off,#blocked_off_text').show();
//$('#blocked_off').show();
}
}
function show_play_buttons() {
if($('video')[0].paused) {
$('#play_button').show();
$('#pause_button').hide();
} else {
$('#play_button').hide();
$('#pause_button').show();
}
}
function hide_play_buttons() {
$('#play_button,#pause_button').hide();
}
$('document').ready(function() {
$('.datepicker_date:first').click();
});
</script>
<div class="relative block" ng-controller="Members" style="height:100%; min-height:400px; margin:0px auto; max-width:1000px; background: white;">
<div style="padding:0px 10px;">
<center>
<h1>Appointment for Professional Grant Services</h1>
</center>
<?php if(!empty($marketer_res[0]['marketer']) && !$is_jeremy) { ?>
<div class="video">
<div class="row">
<div class="company_info_label">
You are currently working with <?= $marketer_res[0]['first_name'];?>.<br />
If you have any questions you can call them at 800-858-1052 ext. <?= $marketer_res[0]['extension'];?>,<br />
or email them at <?= $marketer_res[0]['work_email'];?>.
</div>
</div>
</div>
<?php } elseif($already_filled_out) { ?>
<div class="video">
<div class="row">
<h1>Your application is being reviewed</h1>
<div class="confirm_text_block">
You will receive an email and text message once a decision as been made.
</div>
</div>
</div>
<?php } else { ?>
<center>
<h3>Before you schedule your appointment with with the Admissions Director,<br />please watch this <strong>3 minute video</strong>.</h3>
<div class="video">
<video src="https://surfcrm.com/training_calls/videos/usa_professional_services_appointment.mp4" poster="https://surfcrm.com/training_calls/videos/usa_professional_services_appointment_thumb.png" ontimeupdate="show_application_form(this);" onmouseover="show_play_buttons();" onmouseout="hide_play_buttons();" style="width:100%;"></video>
<div id="play_button" onmouseover="show_play_buttons();" onmouseout="hide_play_buttons();" onclick="track_video_started(); $('video')[0].play(); show_play_buttons();"><span class="glyphicons glyphicons-play glyphicons-fw f64"></span></div>
<div id="pause_button" onmouseover="show_play_buttons();" onmouseout="hide_play_buttons();" onclick="$('video')[0].pause(); show_play_buttons();"><span class="glyphicons glyphicons-pause glyphicons-fw f64"></span></div>
</div>
</center>
<div id="application_info">
<?php /*
<div id="blocked_off"></div>
<div id="blocked_off_text">
<center><h3>You'll be able to schedule a time once you watch the video.</h3></center>
</div>
*/ ?>
<h2>Select a time to speak with an Admissions Director by phone to discuss your project</h2>
<div>
<div class="row" style="padding:20px 0px;">
<div class="col-sm-4">
<h3>Select a Date</h3>
<div class="datepicker_box">
<?php $i=0; foreach($dates as $date) { $i++; ?>
<div class="datepicker_date <?= ($i==1) ? 'datepicker_selected' : '';?>" onclick="select_appointment_date(this,'<?= $date;?>','<?= date('l, F jS',strtotime($date));?>'); return false;"><?= date('l, M j',strtotime($date));?></div>
<?php } ?>
</div>
</div>
<div class="col-sm-8">
<h3>Select an Available Time on <span id="appointment_time_label"><?= date('l, F jS',strtotime($dates[0]));?></span></h3>
<div class="datepicker_time_box">
<?php $i=0; foreach($appointment_dates as $date=>$date_data) { $i++; ?>
<div class="appointment_times" id="appointment_times_<?= $date;?>" style="<?= ($i==1) ? 'display:block;' : 'display:none;';?>">
<div class="row">
<?php $j=0; foreach($date_data as $k=>$v) { $j++; ?>
<?= ($j%2==1) ? '</div><div class="row">' : '';?>
<div class="col-sm-6">
<div class="datepicker_time" onclick="select_appointment_time(this,'<?= $v['key'];?>'); return false;"><?= $v['value'];?> <?= $timezone_pretty_time;?></div>
</div>
<?php } ?>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<div class="row">
<center>
<button class="schedule_appointment" onclick="schedule_appointment(this); return false;">Schedule Appointment</button>
</center>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<?php
$body = ob_get_clean();
$title = "Professional Grant Services : ".$_SESSION['site_name'];
include($_SERVER['DOCUMENT_ROOT'].'/vx/usa/layout/non_angular_layout.php');
?>