JezK
Edit File: ajax (copy).php
<?php include('classes/class_professional_videoconsultation.php'); $videocon=new professional_videoconsultation(); if(isset($_REQUEST['action']) && $_REQUEST['action']=="forgetpwd") { $forgetpwd=$videocon->forgetPassword($_REQUEST); } if(isset($_REQUEST['action']) && $_REQUEST['action']=='resendotp'){ // $bid=$_REQUEST['bid']; // $mobile=$_REQUEST['mobilenum']; $id=$videocon->encrypt_decrypt('decrypt',$_REQUEST['mid']); $businessDet = $videocon->getBusinessDetails($id); $sentotp=$videocon->sendOtp($businessDet['mobile'],$businessDet['country_code'],$businessDet['id']); if($sentotp>0){ echo "1"; }else{ echo "2"; } } else if(isset($_REQUEST['action']) && $_REQUEST['action']=='checkcurrentpassword') { $checkcurpwd=$videocon->checkCurrentPassword($_SESSION['pid'],$_REQUEST); echo $checkcurpwd; } else if(isset($_REQUEST['action']) && $_REQUEST['action']=='sendotp') { $mobile = $_REQUEST['mobile']; $checkMobile = $videocon->checkMobileNumber($mobile); // echo $checkMobile ;exit; if($checkMobile>0) { $businessDet = $videocon->getBusinessDet($mobile); $sendOtp = $videocon->sendOtp($mobile,$businessDet['country_code'],$businessDet['id']); if($sendOtp ==1) { echo $videocon->encrypt_decrypt('encrypt',$businessDet['id']); } else{ echo 0; } } else{ echo -1; } }else if(isset($_REQUEST['action']) && $_REQUEST['action'] =='verifyotp') { // echo $_REQUEST['mobile']." ".$_REQUEST['otp'] ;exit; $id=$videocon->encrypt_decrypt('decrypt',$_REQUEST['mid']); $businessDet = $videocon->getBusinessDetails($id); if($businessDet>0) { $otpVerified = $videocon->otpverification($id,$_REQUEST['mobile'],$_REQUEST['otp']); echo $otpVerified; }else{ echo -3; } } else if(isset($_REQUEST['mode']) && $_REQUEST['mode']=='country') { $countryID = $_REQUEST['countryID']; $state = $videocon->getStates($countryID); $stateid=''; if(isset($_REQUEST['stateID']) && $_REQUEST['stateID']!=''){ $stateid=$_REQUEST['stateID']; } $stavalues ='<option value="">Select State</option>'; foreach($state as $k=>$v) { $selected=""; if($v['id']==$stateid){ $selected="Selected"; } $stavalues.="<option value='".$v['id']."' ".$selected.">".$v['name']."</option>"; } echo $stavalues; } else if(isset($_REQUEST['mode']) && $_REQUEST['mode']=='state') { $cityid=''; if(isset($_REQUEST['cityID']) && $_REQUEST['cityID']!=''){ $cityid=$_REQUEST['cityID']; } $countryID = $_REQUEST['stateID']; $cities = $videocon->getCities($countryID); $cityValues="<option value=''>Select City</option>"; foreach($cities as $k=>$v) { $selected=""; if($v['id']==$cityid){ $selected="Selected"; } $cityValues.="<option value='".$v['id']."' ".$selected.">".$v['name']."</option>"; } echo $cityValues; } else if(isset($_REQUEST['action']) && $_REQUEST['action']=='appointments') { $data=''; if(isset($_REQUEST['type'])) { $minValue = isset($_REQUEST["min"])?$_REQUEST["min"]:0; $maxValue = 10; $getappiontments=$videocon->getUserAppiontments($minValue,$maxValue,$_REQUEST['type'],$_REQUEST['fromdate'],$_REQUEST['todate'],$_REQUEST['seltype']); //print_r($getappiontments); if(count($getappiontments)>0) { foreach ($getappiontments as $k => $v) { $d1=date('jS',strtotime($v['slot_date'])); $d2=date('M',strtotime($v['slot_date'])); $d3=date('Y',strtotime($v['slot_date'])); $userDet=$videocon->getUsers('id',$v['user_id']); $val = (isset($getava['0']['fullname']) && $getava['0']['fullname']!='')?$getava['0']['business_name']:''; if($_REQUEST['type']==1) { $data.='<div class="container pb-1 pt-3"> <div class="row border-bottom my-0"> <div class="col-12 col-sm-12 col-md-6 col-lg-6"> <figure class="d-flex"> <small class="bg-secondary px-4 py-2 mr-3">'.$d1.' <br /> '.$d2.' <br /> '.$d3.'</small> <figcaption> <h6 class="user-name text-muted">'.$userDet['0']['fullname'].'</h6> <h6 class="user-name">'.date('M d, l',strtotime($v['slot_date'])).'</h6> <h6 class="user-name"><span class="text-muted">Slots Time:</span> '.$v['slot_times'].'</h6> </figcaption> </figure> </div>'; $explodetimes=explode(",",$v['slot_times']); $joinAppointment=False; for($g=0;$g<count($explodetimes);$g++) { $expTimes=explode("-",$explodetimes[$g]); if($expTimes['0']>date('H:i') || $expTimes['1']>date('H:i')) { $joinAppointment=TRUE; } } if($v['slot_date']==date('Y-m-d') && $v['booking_status']==4 && $joinAppointment) { //$data.='<div class="col-12 col-sm-12 col-md-6 col-lg-6 text-right py-4"><button class="btn btn-primary appointment-btns w-50 p-1"><a href="../opentok_archive/web/index.php?joincall&id='.$videocon->encrypt_decrypt('encrypt',$_SESSION['id']).'" >Join Call</a></button></div> '; $data.='<div class="col-12 col-sm-12 col-md-6 col-lg-6 text-right py-4"><button class="btn btn-primary appointment-btns w-50 p-1"><a href="javascript:void(0)" onclick="informToSubscriber(\''.$videocon->encrypt_decrypt('encrypt',$v['id']).'\',\''.$videocon->encrypt_decrypt('encrypt',$v['user_id']).'\');" >Join Call</a></button></div> '; /* $data.='<div class="col-12 col-sm-12 col-md-6 col-lg-6 text-right py-4"><a href="javascript:void(0);" class="btn btn-primary w-20">Join Call</a></div> '; */ } else if($v['slot_date']==date('Y-m-d') && $v['booking_status']==4 && !$joinAppointment) { $data.='<div class="col-12 col-sm-12 col-md-6 col-lg-6 text-right py-4"><a href="javascript:void(0);" class="btn btn-primary w-20">Call Time Is Over</a></div> '; } else{ if($v['booking_status']==4){ $data.='<div class="col-12 col-sm-12 col-md-6 col-lg-6 text-right py-4"> <button type="button" class="btn btn-sm btn-primary appointment-btns w-50">Accepted</button></div>'; }else{ $data.='<div class="col-12 col-sm-12 col-md-6 col-lg-6 text-right py-4"> <button type="button" class="btn bg-transparent btn-sm"><img class="img" src="img/accept.png" onclick="return bookingAccept(\''.$videocon->encrypt_decrypt('encrypt',$v['id']).'\')"/></button> <button type="button" class="btn bg-transparent btn-sm appointment-btns w-50 "><img class="img" src="img/cancel.png" onclick="return cancelconfirmed(\''.$videocon->encrypt_decrypt('encrypt',$v['id']).'\')" /></button> </div>'; } } $data.='</div> </div>'; } else if($_REQUEST['type']==2) { $data.='<div class="container pb-1 pt-3"> <div class="row border-bottom my-0"> <div class="col-12 col-sm-12 col-md-6 col-lg-6"> <figure class="d-flex"> <small class="bg-secondary px-4 py-2 mr-3">'.$d1.' <br /> '.$d2.' <br /> '.$d3.'</small> <figcaption> <h6 class="user-name text-muted">'.$userDet['0']['fullname'].'</h6> <h6 class="user-name">'.date('M d, l',strtotime($v['slot_date'])).'</h6> <h6 class="user-name"><span class="text-muted">Slots Time:</span> '.$v['slot_times'].'</h6> </figcaption> </figure> </div> <!--<div class="col-12 col-sm-12 col-md-6 col-lg-6 text-right py-4"> <button type="button" class="btn bg-transparent btn-sm"><img class="img" src="img/accept.png" /></button> <button type="button" class="btn bg-transparent btn-sm"><img class="img" src="img/cancel.png" /></button> <button type="button" class="btn bg-transparent btn-sm "><img class="img" src="img/reapply.png" /></button> </div>--> </div> </div>'; } else if($_REQUEST['type']==3) { $data.='<div class="container pb-1 pt-3"> <div class="row border-bottom my-0"> <div class="col-12 col-sm-12 col-md-6 col-lg-6"> <figure class="d-flex"> <small class="bg-secondary px-4 py-2 mr-3">'.$d1.' <br /> '.$d2.' <br /> '.$d3.'</small> <figcaption> <h6 class="user-name text-muted">'.$userDet['0']['fullname'].'</h6> <h6 class="user-name">'.date('M d, l',strtotime($v['slot_date'])).'</h6> <h6 class="user-name"><span class="text-muted">Slots Time:</span> '.$v['slot_times'].'</h6> </figcaption> </figure> </div>'; if($v['reschedule_booking_id']>0){ $data.='<div class="col-12 col-sm-12 col-md-6 col-lg-6 text-right py-4"> <button class="btn btn-sm btn-primary appointment-btns w-50">Cancelled And Rescheduled</button> </div>'; }else{ $data.='<div class="col-12 col-sm-12 col-md-6 col-lg-6 text-right py-4"> <button class="btn btn-sm btn-primary appointment-btns w-50">Cancelled</button> </div>'; } $data.='</div> </div>'; } } } } echo $data; } else if(isset($_REQUEST['action']) && $_REQUEST['action']=='bookingAccept') { $id=$videocon->encrypt_decrypt('decrypt',$_REQUEST['bid']); echo $acceptbybusiness=$videocon->acceptBooking($id); } else if(isset($_REQUEST['action']) && $_REQUEST['action']=='cancelappointment') { $id=$videocon->encrypt_decrypt('decrypt',$_REQUEST['bid']); $cancelAppoint=$videocon->cancelAppointment($id); echo $cancelAppoint; } else if(isset($_REQUEST['action']) && $_REQUEST['action']=='dashboard') { $fromdate = $_REQUEST['fromdate']; $todate = $_REQUEST['todate']; // echo $fromdate."<br>".$todate; $upcomingcnt = $videocon->upcomingCnt($fromdate,$todate); $completdCancelledCnt= $videocon->completdCancelledCnt($fromdate,$todate); // print_r($completdCancelledCnt);exit; $upcomingAmt=isset($upcomingcnt['totalamt'])?$upcomingcnt['totalamt']:0; $completedAmt=isset($completdCancelledCnt[2]['totalamt'])?$completdCancelledCnt[2]['totalamt']:0; $cancelledAmt=isset($completdCancelledCnt[3]['totalamt'])?$completdCancelledCnt[3]['totalamt']:0; $totalAmount = $upcomingAmt + $completedAmt + $cancelledAmt; $countUpcoming = $upcomingcnt['cnt']!=""?$upcomingcnt['cnt']:"0"; $completdCancelled2 = isset($completdCancelledCnt[2]['cnt'])?$completdCancelledCnt[2]['cnt']:"0"; $completdCancelledCnt3 = isset($completdCancelledCnt[3]['cnt'])?$completdCancelledCnt[3]['cnt']:"0"; $data='<div class="col-xl-3 col-md-4 col-lg-6"> <div class="wrapper count-title d-flex blue-Block pt-2 px-1"> <div class="icon"><img class="img dashboard-img1" src="img/users.png" /></div> <div class="name pt-2"> <h1 class="text-white stats-title">'.$countUpcoming.'</h1> <h6 class="text-white stats-subtitle pl-2">Upcoming</h6> </div> </div> </div> <div class="col-xl-3 col-md-4 col-lg-6"> <div class="wrapper count-title d-flex pink-Block pt-2 px-1"> <div class="icon"><img class="img dashboard-img2" src="img/completed.png" /></div> <div class="name pt-2"> <h1 class="text-white stats-title">'.$completdCancelled2.'</h1> <h6 class="text-white stats-subtitle pl-2">Completed Appointments</h6> </div> </div> </div> <div class="col-xl-3 col-md-4 col-lg-6"> <div class="wrapper count-title orange-Block d-flex pt-2 px-1"> <div class="icon"><img class="img dashboard-img3" src="img/cancelled.png" /></div> <div class="name pt-2"> <h1 class="text-white stats-title">'.$completdCancelledCnt3.'</h1> <h6 class="text-white stats-subtitle">Cancelled Appointments</h6> </div> </div> </div> <div class="col-xl-3 col-md-4 col-lg-6"> <div class="wrapper count-title green-Block d-flex pt-2 px-1"> <div class="icon"><img class="img dashboard-img4" src="img/totalincome.png" /></div> <div class="name pt-2"> <!-- <h1 class="text-white stats-title">$25K</h1> --> <h1 class="text-white stats-title">'.$totalAmount.'</h1> <h6 class="text-white stats-subtitle">Total Income</h6> </div> </div> </div>'; echo $data; } else if(isset($_REQUEST['action']) && $_REQUEST['action']=='joncalltonotify') { $bid=$videocon->encrypt_decrypt('decrypt',$_REQUEST['bid']); $uid=$videocon->encrypt_decrypt('decrypt',$_REQUEST['uid']); echo $saveNotify=$videocon->saveNotification($bid,$uid); //$notifyToUser=$videocon->notifyToSubscriber() } else if(isset($_REQUEST['action']) && $_REQUEST['action']=='getnotifications') { $array=array(); $rows=array(); $notifList = $videocon->listNotificationUser($_SESSION['pid']); $record = 0; foreach ($notifList as $key) { if($key['redirect_url'] == '') { $key['redirect_url']='/professional/appointment.php'; } $data['title'] = $key['title']; $data['msg'] = $key['message']; $data['icon'] = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ?"https" : "http") . "://" . $_SERVER['HTTP_HOST'] .'/videoconsultation_web/img/logo1.png'; $data['url'] = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ?"https" : "http") . "://" . $_SERVER['HTTP_HOST'] .'/videoconsultation_web'.$key['redirect_url']; $rows[] = $data; } $array['notif'] = $rows; $array['result'] = true; // $users->updateNotificationUser($_SESSION['id']); echo json_encode($array); } ?>