Campaign wise table creation and calling
Showing
9 changed files
with
1343 additions
and
349 deletions
| ... | @@ -10,6 +10,9 @@ use Response; | ... | @@ -10,6 +10,9 @@ use Response; |
| 10 | use App\Models\User; | 10 | use App\Models\User; |
| 11 | use SimpleXLSX; | 11 | use SimpleXLSX; |
| 12 | use App\Jobs\KHRMSLib; | 12 | use App\Jobs\KHRMSLib; |
| 13 | use App\Models\Disposition; | ||
| 14 | use App\Models\SubDisposition; | ||
| 15 | use App\Models\DispositionPlan; | ||
| 13 | 16 | ||
| 14 | class CampaignController extends Controller { | 17 | class CampaignController extends Controller { |
| 15 | 18 | ||
| ... | @@ -64,13 +67,6 @@ class CampaignController extends Controller { | ... | @@ -64,13 +67,6 @@ class CampaignController extends Controller { |
| 64 | $highestColumn = count($objWorksheet[0]); | 67 | $highestColumn = count($objWorksheet[0]); |
| 65 | $highestrow=count($objWorksheet); | 68 | $highestrow=count($objWorksheet); |
| 66 | 69 | ||
| 67 | //echo "<pre>";print_r($objWorksheet); | ||
| 68 | //echo "\n"; | ||
| 69 | //print_r($highestColumn); | ||
| 70 | //echo "\n"; | ||
| 71 | |||
| 72 | //echo $highestrow; | ||
| 73 | |||
| 74 | for($i=0;$i<$highestrow;$i++) | 70 | for($i=0;$i<$highestrow;$i++) |
| 75 | {//echo $i; | 71 | {//echo $i; |
| 76 | $excelarray[$i]=array(); | 72 | $excelarray[$i]=array(); |
| ... | @@ -88,54 +84,60 @@ class CampaignController extends Controller { | ... | @@ -88,54 +84,60 @@ class CampaignController extends Controller { |
| 88 | } | 84 | } |
| 89 | } | 85 | } |
| 90 | 86 | ||
| 91 | //echo "<pre>";print_r($excelarray); | ||
| 92 | |||
| 93 | for($i=1;$i<$highestrow;$i++) | 87 | for($i=1;$i<$highestrow;$i++) |
| 94 | { | 88 | { |
| 95 | if($excelarray[$i]["name"]!="" || $excelarray[$i]["name"]!="0" || $excelarray[$i]["name"]!=0 ) | 89 | if($excelarray[$i]["name"]!="" || $excelarray[$i]["name"]!="0" || $excelarray[$i]["name"]!=0 ) |
| 96 | { | 90 | { |
| 97 | //echo $excelarray[$i]["name"]; | 91 | //echo $excelarray[$i]["name"]; |
| 98 | if(!empty($excelarray[$i]["name"])){ | 92 | if(!empty($excelarray[$i]["name"])){ |
| 99 | $campaign = Input::get("selectCampaignField"); | 93 | $campaign = Input::get("selectCampaignField"); |
| 100 | 94 | ||
| 101 | if($campaign=="all"){ | 95 | if($campaign=="all"){ |
| 102 | $campaign=""; | 96 | $campaign=""; |
| 103 | $allcampaign=Campaign::where('mtype',"=","company")->orderBy('mkey')->get(); | 97 | $allcampaign=Campaign::where('mtype',"=","company")->orderBy('mkey')->get(); |
| 104 | foreach ($allcampaign as $mkeycampaign) | 98 | foreach ($allcampaign as $mkeycampaign) |
| 105 | { | 99 | { |
| 106 | $campaign .= $mkeycampaign->mkey.","; | 100 | $campaign .= $mkeycampaign->mkey.","; |
| 107 | } | 101 | } |
| 108 | $campaign=substr($campaign, 0, -1); | 102 | $campaign=substr($campaign, 0, -1); |
| 109 | } | 103 | } |
| 110 | 104 | ||
| 111 | $usercampaign=User::where('username','=',trim($excelarray[$i]["name"])); | 105 | $usercampaign=User::where('username','=',trim($excelarray[$i]["name"])); |
| 112 | 106 | ||
| 113 | if($usercampaign->count() > 0){ | 107 | if($usercampaign->count() > 0){ |
| 114 | $usercampaign = $usercampaign->first(); | 108 | $usercampaign = $usercampaign->first(); |
| 115 | $campaignList =$usercampaign->clients.",".$campaign; | 109 | $campaignList =$usercampaign->clients.",".$campaign; |
| 116 | $data=json_decode($usercampaign->data,true); | 110 | $data=json_decode($usercampaign->data,true); |
| 117 | if(isset($data['hrmsdata'])) | 111 | if(isset($data['hrmsdata'])) |
| 118 | { | 112 | { |
| 119 | $hrmsdata=unserialize($data['hrmsdata']); | 113 | $hrmsdata=unserialize($data['hrmsdata']); |
| 120 | $hrmsdata['clientsownerlist'] = $campaignList; | 114 | $hrmsdata['clientsownerlist'] = $campaignList; |
| 121 | $data['hrmsdata']=serialize($hrmsdata); | 115 | $data['hrmsdata']=serialize($hrmsdata); |
| 122 | }else | 116 | }else |
| 123 | { | 117 | { |
| 124 | $hrmsdata['clientsownerlist'] = $campaignList; | 118 | $hrmsdata['clientsownerlist'] = $campaignList; |
| 125 | $data['hrmsdata']=serialize($hrmsdata); | 119 | $data['hrmsdata']=serialize($hrmsdata); |
| 126 | } | 120 | } |
| 127 | $data=json_encode($data); | 121 | $data=json_encode($data); |
| 128 | $usercampaign->updated_at=date("Y-m-d H:i:s"); | 122 | $usercampaign->updated_at=date("Y-m-d H:i:s"); |
| 129 | $usercampaign->clients=$campaignList; | 123 | $usercampaign->clients=$campaignList; |
| 130 | $usercampaign->data=$data; | 124 | $usercampaign->data=$data; |
| 131 | $usercampaign->save(); | 125 | $usercampaign->save(); |
| 132 | } | 126 | }else{ |
| 133 | 127 | ||
| 134 | 128 | $discardedData[] = $excelarray[$i]["name"]; | |
| 135 | } | 129 | |
| 130 | } | ||
| 131 | |||
| 132 | } | ||
| 136 | } | 133 | } |
| 137 | } | 134 | } |
| 138 | 135 | ||
| 136 | // download discarded data | ||
| 137 | |||
| 138 | |||
| 139 | |||
| 140 | |||
| 139 | } | 141 | } |
| 140 | } | 142 | } |
| 141 | 143 | ||
| ... | @@ -237,41 +239,26 @@ class CampaignController extends Controller { | ... | @@ -237,41 +239,26 @@ class CampaignController extends Controller { |
| 237 | $gthis = new KHRMSLib(); | 239 | $gthis = new KHRMSLib(); |
| 238 | $campaign = Input::get("campaign"); | 240 | $campaign = Input::get("campaign"); |
| 239 | 241 | ||
| 240 | $mastersdata=$gthis->getCompanyMaster($campaign); | 242 | $dispositionPlans=DispositionPlan::where("status","=","active")->get(); |
| 241 | $disposition = array(); | 243 | |
| 242 | if(empty($mastersdata['dialerDispoList']))$mastersdata['dialerDispoList']=$gthis->HRCoreVars['dialerDispoList']; | 244 | $data['dispositionPlans'] = $dispositionPlans; |
| 243 | $dispoarr=explode("~",$mastersdata['dialerDispoList']); | 245 | |
| 244 | foreach($dispoarr as $dispo) | 246 | $data['selectedDispositionPlan'] = DB::table('campaign_disposition_plan') |
| 245 | { | 247 | ->join('disposition_plan', 'campaign_disposition_plan.dispo_plan_id', '=', 'disposition_plan.id') |
| 246 | if(!empty($dispo)) | 248 | //->select('disposition_plan.name as name ', 'disposition_plan.id as planid')->where("campaign","=",$campaign)->first(); |
| 247 | { | 249 | ->select('disposition_plan.name as name ', 'disposition_plan.id as planid') |
| 248 | $dispoprts=explode("|",$dispo); | 250 | ->where("campaign","=",$campaign) |
| 249 | if(sizeof($dispoprts)>=3) | 251 | ->where("disposition_plan.status","active") |
| 250 | { | 252 | ->first(); |
| 251 | $disposition[$dispoprts[1]] = $dispoprts[2]; | 253 | |
| 252 | $dispositionCode[$dispoprts[1]] = $dispoprts[0]; | 254 | $data['dispositionList'] = DB::table('campaign_disposition_plan') |
| 253 | /*$data.="dialerdispoarray['$dispoprts[1]']='$dispoprts[2]'; | 255 | ->join('disposition_plan_config', 'campaign_disposition_plan.dispo_plan_id', '=', 'disposition_plan_config.dispo_plan_id') |
| 254 | dispoClassArray['$dispoprts[0]']='$dispoprts[1]';";*/ | 256 | ->join('disposition_plan', 'disposition_plan.id', '=', 'disposition_plan_config.dispo_plan_id') |
| 255 | } | 257 | ->select('disposition_plan_config.disposition as disposition ', 'disposition_plan_config.sub_disposition as subDisposition') |
| 256 | } | 258 | ->where("campaign","=",$campaign) |
| 257 | } | 259 | ->where("disposition_plan.status","active") |
| 258 | $data['disposition'] = $disposition; | 260 | ->get(); |
| 259 | $data['dispositionCode'] = $dispositionCode; | ||
| 260 | |||
| 261 | |||
| 262 | $dispositionList=DB::table('hrms_masters')->select('*')->where('status','=','Active')->where("mkey","=",$campaign)->where("mtype","=",'coreconfig')->first(); | ||
| 263 | |||
| 264 | $dispolist=explode("~",$dispositionList->mvalue); | ||
| 265 | $dispositionList = array(); | ||
| 266 | foreach ($dispolist as $key => $dispo) { | ||
| 267 | if(!empty($dispo)) | ||
| 268 | { | ||
| 269 | $dispoprts=explode("|",$dispo); | ||
| 270 | $dispositionList[$dispoprts[1]]= $dispoprts[2]; | ||
| 271 | } | ||
| 272 | } | ||
| 273 | 261 | ||
| 274 | $data['dispositionList'] = $dispositionList; | ||
| 275 | //$campaign = Input::get("campaign"); | 262 | //$campaign = Input::get("campaign"); |
| 276 | if($campaign != ""){ | 263 | if($campaign != ""){ |
| 277 | //this condition for getting all campaign data | 264 | //this condition for getting all campaign data |
| ... | @@ -320,12 +307,10 @@ class CampaignController extends Controller { | ... | @@ -320,12 +307,10 @@ class CampaignController extends Controller { |
| 320 | 307 | ||
| 321 | if($campaign=="All") | 308 | if($campaign=="All") |
| 322 | { | 309 | { |
| 323 | // $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 324 | $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions"; | 310 | $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions"; |
| 325 | $sqlQuery = DB::select($selQuery); | 311 | $sqlQuery = DB::select($selQuery); |
| 326 | }else | 312 | }else |
| 327 | { | 313 | { |
| 328 | //$selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 329 | $selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions"; | 314 | $selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions"; |
| 330 | $sqlQuery = DB::select($selQuery); | 315 | $sqlQuery = DB::select($selQuery); |
| 331 | } | 316 | } |
| ... | @@ -336,6 +321,8 @@ class CampaignController extends Controller { | ... | @@ -336,6 +321,8 @@ class CampaignController extends Controller { |
| 336 | 321 | ||
| 337 | if(count($sqlQuery)){ | 322 | if(count($sqlQuery)){ |
| 338 | $output .='<div><label>'.count($sqlQuery).'</label></div>'; | 323 | $output .='<div><label>'.count($sqlQuery).'</label></div>'; |
| 324 | }else{ | ||
| 325 | $output .="<p class='text-danger'>No result Found.</p>"; | ||
| 339 | } | 326 | } |
| 340 | return $output; | 327 | return $output; |
| 341 | } | 328 | } |
| ... | @@ -381,7 +368,7 @@ class CampaignController extends Controller { | ... | @@ -381,7 +368,7 @@ class CampaignController extends Controller { |
| 381 | $sqlQuery = DB::select($selQuery); | 368 | $sqlQuery = DB::select($selQuery); |
| 382 | } | 369 | } |
| 383 | 370 | ||
| 384 | if($sqlQuery){ | 371 | if($selQuery!=''){ |
| 385 | 372 | ||
| 386 | $queryExist = DB::table('campaign_query')->where('query','=',$selQuery)->where('campaign', '=', $campaign)->select('id')->first(); | 373 | $queryExist = DB::table('campaign_query')->where('query','=',$selQuery)->where('campaign', '=', $campaign)->select('id')->first(); |
| 387 | 374 | ||
| ... | @@ -402,6 +389,8 @@ class CampaignController extends Controller { | ... | @@ -402,6 +389,8 @@ class CampaignController extends Controller { |
| 402 | 389 | ||
| 403 | if(count($sqlQuery)){ | 390 | if(count($sqlQuery)){ |
| 404 | $output .='<div><label>'.count($sqlQuery).'</label></div>'; | 391 | $output .='<div><label>'.count($sqlQuery).'</label></div>'; |
| 392 | }else{ | ||
| 393 | $output .="<p class='text-danger'>No result found.</p>"; | ||
| 405 | } | 394 | } |
| 406 | /*$output .= '<div style="overflow-x:auto;"><table class="table table-bordered"><thead><tr><th class="text-center">#</th>'; | 395 | /*$output .= '<div style="overflow-x:auto;"><table class="table table-bordered"><thead><tr><th class="text-center">#</th>'; |
| 407 | foreach ($fields as $key) { | 396 | foreach ($fields as $key) { |
| ... | @@ -542,7 +531,7 @@ class CampaignController extends Controller { | ... | @@ -542,7 +531,7 @@ class CampaignController extends Controller { |
| 542 | $queryCond=DB::table('campaign_query')->where('id','=',$campQryId)->where('campaign','=',$campaign)->select('where_cond'); | 531 | $queryCond=DB::table('campaign_query')->where('id','=',$campQryId)->where('campaign','=',$campaign)->select('where_cond'); |
| 543 | if($queryCond->count() > 0){ | 532 | if($queryCond->count() > 0){ |
| 544 | $queryCond = $queryCond->first(); | 533 | $queryCond = $queryCond->first(); |
| 545 | DB::update(DB::raw("UPDATE records set filter_condition='1' where $queryCond->where_cond")); | 534 | DB::update(DB::raw("UPDATE records_$campaign set filter_condition='1' where $queryCond->where_cond")); |
| 546 | } | 535 | } |
| 547 | return; | 536 | return; |
| 548 | //return "<script>simpleNotification('success','topRight','Query Logic Successfully Applied');</script>"; | 537 | //return "<script>simpleNotification('success','topRight','Query Logic Successfully Applied');</script>"; |
| ... | @@ -737,6 +726,80 @@ class CampaignController extends Controller { | ... | @@ -737,6 +726,80 @@ class CampaignController extends Controller { |
| 737 | 726 | ||
| 738 | if($id=="assigndisposition"){ | 727 | if($id=="assigndisposition"){ |
| 739 | $wakka = new KHRMSLib(); | 728 | $wakka = new KHRMSLib(); |
| 729 | $planId = Input::get('plan'); | ||
| 730 | $campaign = Input::get("selectCampaignField"); | ||
| 731 | |||
| 732 | $campaignDispositionPlan = DB::table('campaign_disposition_plan')->where('campaign','=', $campaign)->select('*'); | ||
| 733 | |||
| 734 | if($campaignDispositionPlan->count() > 0){ | ||
| 735 | DB::table('campaign_disposition_plan')->where('campaign','=', $campaign)->update(['dispo_plan_id' => $planId,'updated_at'=>date("Y-m-d H:i:s")]); | ||
| 736 | }else{ | ||
| 737 | DB::table('campaign_disposition_plan')->insert(['campaign'=>$campaign,'dispo_plan_id'=>$planId, 'created_at'=>date("Y-m-d H:i:s"),'updated_at'=>date("Y-m-d H:i:s")]); | ||
| 738 | } | ||
| 739 | |||
| 740 | $dispositionEntities = DispositionPlan::join('disposition_plan_config', 'disposition_plan.id', '=', 'disposition_plan_config.dispo_plan_id') | ||
| 741 | ->join('disposition', 'disposition.name', '=', 'disposition_plan_config.disposition') | ||
| 742 | ->select('disposition_plan.id as dispositionPlanId', 'disposition_plan.name as name','disposition_plan.status AS status','disposition.code AS code','disposition_plan_config.disposition as disposition','disposition_plan_config.sub_disposition as sub_disposition') | ||
| 743 | ->where('disposition_plan.id','=',$planId) | ||
| 744 | ->where('disposition.status','active') | ||
| 745 | ->get(); | ||
| 746 | |||
| 747 | if($dispositionEntities->count() > 0){ | ||
| 748 | $mvalue = ''; | ||
| 749 | foreach ($dispositionEntities as $key => $dispositionEntity) { | ||
| 750 | $code = $dispositionEntity->code; | ||
| 751 | $disposition = $dispositionEntity->disposition; | ||
| 752 | $subDisposition = $dispositionEntity->sub_disposition; | ||
| 753 | |||
| 754 | if(!empty($mvalue)){ | ||
| 755 | $mvalue = $mvalue."~$code|$disposition|$subDisposition"; | ||
| 756 | }else{ | ||
| 757 | $mvalue = "$code|$disposition|$subDisposition"; | ||
| 758 | } | ||
| 759 | } | ||
| 760 | |||
| 761 | $hrmsdata = DB::table('hrms_masters')->where('mkey','=', $campaign)->where('mtype','=', 'coreconfig')->select('*'); | ||
| 762 | if($hrmsdata->count() == 0){ | ||
| 763 | DB::table('hrms_masters')->insert(['mkey'=>$campaign, 'mtype'=>'coreconfig', 'mvalue'=>$mvalue,'status'=>'active']); | ||
| 764 | }else{ | ||
| 765 | $wakka->Query("update hrms_masters set mvalue='$mvalue' where mkey='$campaign' and mtype='coreconfig';"); | ||
| 766 | } | ||
| 767 | |||
| 768 | } | ||
| 769 | |||
| 770 | /*foreach ($plans as $key => $plan) { | ||
| 771 | $dispositionPlan = Disposition::join('sub_disposition', 'disposition.id', '=', 'sub_disposition.dispo_id') | ||
| 772 | ->select('disposition.id as dispoId', 'disposition.plan AS plan', 'disposition.name as disposition','disposition.code as code','disposition.status AS status', | ||
| 773 | DB::raw('count(*) as totalSubDispo, sub_disposition.id'), | ||
| 774 | DB::raw('GROUP_CONCAT(sub_disposition.name) as sunDispoName, sub_disposition.name')) | ||
| 775 | ->where("plan","=",$plan) | ||
| 776 | ->groupBy('sub_disposition.dispo_id') | ||
| 777 | ->get(); | ||
| 778 | |||
| 779 | if($dispositionPlan->count() > 0){ | ||
| 780 | $dispositionPlan = $dispositionPlan->first(); | ||
| 781 | $code = $dispositionPlan->code; | ||
| 782 | $disposition = $dispositionPlan->disposition; | ||
| 783 | $subDisposition = $dispositionPlan->sunDispoName; | ||
| 784 | |||
| 785 | $hrmsdata = DB::table('hrms_masters')->where('mkey','=', $campaign)->where('mtype','=', 'coreconfig')->select('*'); | ||
| 786 | if($hrmsdata->count() == 0){ | ||
| 787 | $mvalue = "$code|$disposition|$subDisposition"; | ||
| 788 | DB::table('hrms_masters')->insert(['mkey'=>$campaign, 'mtype'=>'coreconfig', 'mvalue'=>$mvalue,'status'=>'active']); | ||
| 789 | }else{ | ||
| 790 | $hrmsdata = $hrmsdata->first(); | ||
| 791 | if(!empty($hrmsdata->mvalue)){ | ||
| 792 | $mvalue .= $hrmsdata->mvalue."~$code|$disposition|$subDisposition"; | ||
| 793 | }else{ | ||
| 794 | $mvalue = "$code|$disposition|$subDisposition"; | ||
| 795 | } | ||
| 796 | $wakka->Query("update hrms_masters set mvalue='$mvalue' where mkey='$campaign' and mtype='coreconfig';"); | ||
| 797 | } | ||
| 798 | } | ||
| 799 | }*/ | ||
| 800 | |||
| 801 | |||
| 802 | /*$wakka = new KHRMSLib(); | ||
| 740 | $code = Input::get('code'); | 803 | $code = Input::get('code'); |
| 741 | $disposition = Input::get('disposition'); | 804 | $disposition = Input::get('disposition'); |
| 742 | $subDisposition = Input::get('subDisposition'); | 805 | $subDisposition = Input::get('subDisposition'); |
| ... | @@ -771,32 +834,40 @@ class CampaignController extends Controller { | ... | @@ -771,32 +834,40 @@ class CampaignController extends Controller { |
| 771 | $mvalue = "$code|$disposition|$subDisposition"; | 834 | $mvalue = "$code|$disposition|$subDisposition"; |
| 772 | } | 835 | } |
| 773 | $wakka->Query("update hrms_masters set mvalue='$mvalue' where mkey='$campaign' and mtype='coreconfig';"); | 836 | $wakka->Query("update hrms_masters set mvalue='$mvalue' where mkey='$campaign' and mtype='coreconfig';"); |
| 774 | } | 837 | }*/ |
| 775 | |||
| 776 | } | 838 | } |
| 777 | 839 | ||
| 778 | if($id == "sampleDataExcel"){ | 840 | if($id == "sampleDataExcel"){ |
| 779 | /*$objPHPExcel = new \PHPExcel(); | 841 | /*include_once(app_path().'/lib/phpexcel/PHPExcel.php'); |
| 780 | $objPHPExcel->getProperties() | 842 | $objPHPExcel = new \PHPExcel(); |
| 781 | ->setCreator("Temporaris") | ||
| 782 | ->setLastModifiedBy("Temporaris") | ||
| 783 | ->setTitle("Template Relevé des heures intérimaires") | ||
| 784 | ->setSubject("Template excel") | ||
| 785 | ->setDescription("Template excel permettant la création d'un ou plusieurs relevés d'heures") | ||
| 786 | ->setKeywords("Template excel"); | ||
| 787 | $objPHPExcel->setActiveSheetIndex(0); | 843 | $objPHPExcel->setActiveSheetIndex(0); |
| 788 | $objPHPExcel->getActiveSheet()->SetCellValue('A1', "12"); | 844 | $objPHPExcel->getActiveSheet()->SetCellValue('A1', "campaign"); |
| 845 | $objPHPExcel->getActiveSheet()->SetCellValue('A2', "C1"); | ||
| 846 | $objPHPExcel->getActiveSheet()->SetCellValue('A3', "C1"); | ||
| 847 | $objPHPExcel->getActiveSheet()->SetCellValue('A4', "C2"); | ||
| 848 | $objPHPExcel->getActiveSheet()->SetCellValue('A5', "C2"); | ||
| 849 | $objPHPExcel->getActiveSheet()->SetCellValue('B1', "name"); | ||
| 850 | $objPHPExcel->getActiveSheet()->SetCellValue('B2', "U1"); | ||
| 851 | $objPHPExcel->getActiveSheet()->SetCellValue('B3', "U2"); | ||
| 852 | $objPHPExcel->getActiveSheet()->SetCellValue('B4', "U1"); | ||
| 853 | $objPHPExcel->getActiveSheet()->SetCellValue('B5', "U3"); | ||
| 789 | 854 | ||
| 790 | $writer = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); | 855 | $writer = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); |
| 791 | header('Content-Type: application/vnd.ms-excel'); | 856 | header('Content-Type: application/vnd.ms-excel'); |
| 792 | header('Content-Disposition: attachment;filename="excel.xls"'); | 857 | header('Content-Disposition: attachment;filename="campaignUserMappingExcelFormat.xls"'); |
| 793 | header('Cache-Control: max-age=0'); | 858 | header('Cache-Control: max-age=0'); |
| 794 | 859 | ||
| 795 | $writer->save('php://output'); | 860 | $writer->save('php://output');*/ |
| 796 | 861 | ||
| 797 | return ;*/ | 862 | //$filepath = "assets/extras/campaignUserMappingFormat.xlsx"; |
| 863 | $action = Input::get('action'); | ||
| 798 | 864 | ||
| 799 | return view("layout.module.campaign.sampleDataExcel"); | 865 | if($action == 'upload'){ |
| 866 | $filepath = "assets/extras/MultipleUserCampaignUploadFormat.xlsx"; | ||
| 867 | }else if($action == 'bulkupload'){ | ||
| 868 | $filepath = "assets/extras/MultipleUserMultipleCampaignUploadFormat.xlsx"; | ||
| 869 | } | ||
| 870 | return Response::download($filepath); | ||
| 800 | } | 871 | } |
| 801 | 872 | ||
| 802 | return; | 873 | return; | ... | ... |
| ... | @@ -12,6 +12,7 @@ use App\Models\CRMCallArchive; | ... | @@ -12,6 +12,7 @@ use App\Models\CRMCallArchive; |
| 12 | use App\Models\CRM; | 12 | use App\Models\CRM; |
| 13 | use App\Models\CRMCampaign; | 13 | use App\Models\CRMCampaign; |
| 14 | use App\Models\CRMList; | 14 | use App\Models\CRMList; |
| 15 | use App\Models\Cutoff; | ||
| 15 | use App\Jobs\KHRMSLib; | 16 | use App\Jobs\KHRMSLib; |
| 16 | use App\Models\Sipid; | 17 | use App\Models\Sipid; |
| 17 | use App\Models\Dialline; | 18 | use App\Models\Dialline; |
| ... | @@ -148,24 +149,32 @@ class DialerController extends Controller { | ... | @@ -148,24 +149,32 @@ class DialerController extends Controller { |
| 148 | $roclientstr=array(); | 149 | $roclientstr=array(); |
| 149 | $oclientlst=$wakka->clientsReadAccess(); | 150 | $oclientlst=$wakka->clientsReadAccess(); |
| 150 | //print_r($oclientlst); | 151 | //print_r($oclientlst); |
| 151 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";} | 152 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";} |
| 152 | |||
| 153 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; | 153 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; |
| 154 | |||
| 155 | $users=array();$searchresult=""; | 154 | $users=array();$searchresult=""; |
| 156 | if(!empty($kstychCall["previewcrmid"]))$users=$wakka->getPersons("id='".$kstychCall["previewcrmid"]."' $roclientstr limit 1"); | 155 | $client=Input::get("client"); |
| 157 | else $users=$this->getCallSequencing(1); | 156 | if($client==''||$client==undefined){ |
| 157 | $client=""; | ||
| 158 | } | ||
| 159 | //$client=$this->campaignlist($client); | ||
| 160 | if(!empty($kstychCall["previewcrmid"])){ | ||
| 161 | $users=$wakka->getPersons("id='".$kstychCall["previewcrmid"]."' limit 1",$client);} | ||
| 162 | else{ | ||
| 163 | $users=$this->getCallSequencing(1); | ||
| 164 | } | ||
| 158 | //$wakka->setPersonKey($users[0]['id'],"status","Incall"); | 165 | //$wakka->setPersonKey($users[0]['id'],"status","Incall"); |
| 159 | if($users[0]['id']>0){ | 166 | if($users[0]['id']>0){ |
| 160 | Log::info("1----".$users[0]['id']); | 167 | Log::info("1----".$users[0]['id']); |
| 161 | DB::table('records')->where('id',$users[0]['id'])->update(['filter_condition'=>'2','modified'=>date("Y-m-d H:i:s")]); | 168 | if($client!=''){ |
| 169 | DB::table('records_'.$client)->where('id',$users[0]['id'])->update(['filter_condition'=>'2','modified'=>date("Y-m-d H:i:s")]); | ||
| 170 | } | ||
| 162 | } | 171 | } |
| 163 | if(!empty($users)) | 172 | if(!empty($users)) |
| 164 | { | 173 | { |
| 165 | $searchresult.="<div id=divworking></div><div style='clear:both'></div><script>kSetDData('C','previewcrmid','".$users[0]['id']."');showRecruit(\"".$users[0]['id']."\");</script>"; | 174 | $searchresult.="<div id=divworking></div><div style='clear:both'></div><script>kSetDData('C','previewcrmid','".$users[0]['id']."');showRecruit(\"".$users[0]['id']."\");</script>"; |
| 166 | 175 | ||
| 167 | $searchresult.="<div id=internalid_matchlist></div><script> | 176 | $searchresult.="<div id=internalid_matchlist></div><script> |
| 168 | doAjax('record?action=quicksearch','maintextsearch_1_txt=".$users[0]['clientinternalid']."&maintextsearch_1_span=InternalID','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ | 177 | doAjax('record?action=quicksearch','maintextsearch_1_txt=".$users[0]['clientinternalid']."&maintextsearch_1_span=InternalID&client=$client','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ |
| 169 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); | 178 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); |
| 170 | }); | 179 | }); |
| 171 | </script>"; | 180 | </script>"; |
| ... | @@ -187,7 +196,13 @@ class DialerController extends Controller { | ... | @@ -187,7 +196,13 @@ class DialerController extends Controller { |
| 187 | $oclientlst=$wakka->clientsReadAccess(); | 196 | $oclientlst=$wakka->clientsReadAccess(); |
| 188 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";} | 197 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";} |
| 189 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; | 198 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; |
| 190 | 199 | //Log::info("newcall-->> ".$roclientstr); | |
| 200 | $client=Input::get("client"); | ||
| 201 | Log::info($client); | ||
| 202 | if($client==''||$client==undefined){ | ||
| 203 | $client=''; | ||
| 204 | } | ||
| 205 | //$client=$this->campaignlist($client); | ||
| 191 | $users=array();$callnumber=$kstychCall['callnumber']; | 206 | $users=array();$callnumber=$kstychCall['callnumber']; |
| 192 | if($kstychCall['crmid']) | 207 | if($kstychCall['crmid']) |
| 193 | { | 208 | { |
| ... | @@ -213,7 +228,7 @@ class DialerController extends Controller { | ... | @@ -213,7 +228,7 @@ class DialerController extends Controller { |
| 213 | altphone7 like '%".substr($callnumber,-10)."' OR | 228 | altphone7 like '%".substr($callnumber,-10)."' OR |
| 214 | altphone8 like '%".substr($callnumber,-10)."' OR | 229 | altphone8 like '%".substr($callnumber,-10)."' OR |
| 215 | altphone9 like '%".substr($callnumber,-10)."' OR | 230 | altphone9 like '%".substr($callnumber,-10)."' OR |
| 216 | altphone10 like '%".substr($callnumber,-10)."') and id=$crmid $roclientstr "); | 231 | altphone10 like '%".substr($callnumber,-10)."') and id=$crmid ",$client); |
| 217 | 232 | ||
| 218 | 233 | ||
| 219 | } | 234 | } |
| ... | @@ -229,7 +244,7 @@ class DialerController extends Controller { | ... | @@ -229,7 +244,7 @@ class DialerController extends Controller { |
| 229 | altphone7 like '%".substr($callnumber,-10)."' OR | 244 | altphone7 like '%".substr($callnumber,-10)."' OR |
| 230 | altphone8 like '%".substr($callnumber,-10)."' OR | 245 | altphone8 like '%".substr($callnumber,-10)."' OR |
| 231 | altphone9 like '%".substr($callnumber,-10)."' OR | 246 | altphone9 like '%".substr($callnumber,-10)."' OR |
| 232 | altphone10 like '%".substr($callnumber,-10)."' $roclientstr"); | 247 | altphone10 like '%".substr($callnumber,-10)."'",$client); |
| 233 | 248 | ||
| 234 | } | 249 | } |
| 235 | 250 | ||
| ... | @@ -246,7 +261,7 @@ class DialerController extends Controller { | ... | @@ -246,7 +261,7 @@ class DialerController extends Controller { |
| 246 | altphone7 like '%$callnumber' OR | 261 | altphone7 like '%$callnumber' OR |
| 247 | altphone8 like '%$callnumber' OR | 262 | altphone8 like '%$callnumber' OR |
| 248 | altphone9 like '%$callnumber' OR | 263 | altphone9 like '%$callnumber' OR |
| 249 | altphone10 like '%$callnumber' ) and id in ($idstr) $roclientstr"); | 264 | altphone10 like '%$callnumber' ) and id in ($idstr)",$client); |
| 250 | 265 | ||
| 251 | if(!$users) | 266 | if(!$users) |
| 252 | { | 267 | { |
| ... | @@ -256,8 +271,9 @@ class DialerController extends Controller { | ... | @@ -256,8 +271,9 @@ class DialerController extends Controller { |
| 256 | 271 | ||
| 257 | if($kstychDialer['mDialerState']=="DialNext"||$kstychDialer['mDialerState']=="Progressive") | 272 | if($kstychDialer['mDialerState']=="DialNext"||$kstychDialer['mDialerState']=="Progressive") |
| 258 | { | 273 | { |
| 259 | if($kstychCall['crmid']!="")$users=$wakka->getPersons("id='".$kstychCall['crmid']."' $roclientstr limit 1"); | 274 | Log::info("crmid-->".$kstychCall['crmid']."--callnumber-->".$kstychCall['callnumber']); |
| 260 | else if($kstychCall['callnumber']!="")$users=$wakka->getPersons("mobile='".$kstychCall['callnumber']."' $roclientstr limit 1"); | 275 | if($kstychCall['crmid']!="")$users=$wakka->getPersons("id='".$kstychCall['crmid']."' limit 1",$client); |
| 276 | else if($kstychCall['callnumber']!="")$users=$wakka->getPersons("mobile='".$kstychCall['callnumber']."' $roclientstr limit 1",$client); | ||
| 261 | else $users=$this->getCallSequencing(1); | 277 | else $users=$this->getCallSequencing(1); |
| 262 | } | 278 | } |
| 263 | 279 | ||
| ... | @@ -296,7 +312,11 @@ class DialerController extends Controller { | ... | @@ -296,7 +312,11 @@ class DialerController extends Controller { |
| 296 | 312 | ||
| 297 | $calleridarr=explode(":",$callerid);$dspan="1"; | 313 | $calleridarr=explode(":",$callerid);$dspan="1"; |
| 298 | if(isset($calleridarr[1])){$callerid=$calleridarr[0];$dspan=$calleridarr[1];} | 314 | if(isset($calleridarr[1])){$callerid=$calleridarr[0];$dspan=$calleridarr[1];} |
| 299 | 315 | /*$calleridarr=explode(":",env("non_open")); | |
| 316 | $callerid=$calleridarr[0]; | ||
| 317 | $dspan =$calleridarr[1]; | ||
| 318 | }*/ | ||
| 319 | |||
| 300 | //see if user is online on this sipid | 320 | //see if user is online on this sipid |
| 301 | $sipid=Sipid::find($kstychDialer['phone']); | 321 | $sipid=Sipid::find($kstychDialer['phone']); |
| 302 | if($sipid&&$sipid->user==Auth::user()->id&&$sipid->status==1) | 322 | if($sipid&&$sipid->user==Auth::user()->id&&$sipid->status==1) |
| ... | @@ -339,13 +359,16 @@ class DialerController extends Controller { | ... | @@ -339,13 +359,16 @@ class DialerController extends Controller { |
| 339 | $crmcall->data=json_encode($tdata); | 359 | $crmcall->data=json_encode($tdata); |
| 340 | $crmcall->save(); | 360 | $crmcall->save(); |
| 341 | if($users[0]['id']>0){ | 361 | if($users[0]['id']>0){ |
| 342 | DB::table('records')->where('id',$users[0]['id'])->update(['filter_condition'=>'3','usr_id'=>Auth::user()->id]); | 362 | if($client!='')$records='records_'.$client;else $records='records'; |
| 363 | |||
| 364 | DB::table($records)->where('id',$users[0]['id'])->update(['filter_condition'=>'3','usr_id'=>Auth::user()->id]); | ||
| 365 | DB::table('records')->where('id',$users[0]['id'])->update(['usr_id'=>Auth::user()->id]); | ||
| 343 | } | 366 | } |
| 344 | //start actual calls | 367 | //start actual calls |
| 345 | $ppldata['dialer_lastcall']=date("Y-m-d H:i:s"); | 368 | $ppldata['dialer_lastcall']=date("Y-m-d H:i:s"); |
| 346 | $preppldata['peopledata'] = serialize($ppldata); | 369 | $preppldata['peopledata'] = serialize($ppldata); |
| 347 | $wakka->setPerson($ppldata['peopledata']['id'],$preppldata); | 370 | $wakka->setPerson($ppldata['peopledata']['id'],$preppldata,$client); $wakka->setPerson($ppldata['peopledata']['id'],$preppldata,""); |
| 348 | 371 | ||
| 349 | $newqueue=new Kqueue(); | 372 | $newqueue=new Kqueue(); |
| 350 | $newqueue->userToConf($sipid); | 373 | $newqueue->userToConf($sipid); |
| 351 | $newqueue=new Kqueue(); | 374 | $newqueue=new Kqueue(); |
| ... | @@ -357,7 +380,7 @@ class DialerController extends Controller { | ... | @@ -357,7 +380,7 @@ class DialerController extends Controller { |
| 357 | 380 | ||
| 358 | 381 | ||
| 359 | $searchresult.="<div id=internalid_matchlist></div><script> | 382 | $searchresult.="<div id=internalid_matchlist></div><script> |
| 360 | doAjax('record?action=quicksearch','maintextsearch_1_txt=".$users[0]['clientinternalid']."&maintextsearch_1_span=InternalID','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ | 383 | doAjax('record?action=quicksearch','maintextsearch_1_txt=".$users[0]['clientinternalid']."&maintextsearch_1_span=InternalID&client=$client','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ |
| 361 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); | 384 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); |
| 362 | }); | 385 | }); |
| 363 | </script>"; | 386 | </script>"; |
| ... | @@ -377,7 +400,8 @@ class DialerController extends Controller { | ... | @@ -377,7 +400,8 @@ class DialerController extends Controller { |
| 377 | } | 400 | } |
| 378 | else | 401 | else |
| 379 | { | 402 | { |
| 380 | $wakka->setPersonKey($users[0]['id'],"status","NoNumber"); | 403 | $wakka->setPersonKey($users[0]['id'],"status","NoNumber","",$client); |
| 404 | $wakka->setPersonKey($users[0]['id'],"status","NoNumber","",""); | ||
| 381 | 405 | ||
| 382 | return Response::make($searchresult."<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','No Number in Record!');</script>"); | 406 | return Response::make($searchresult."<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','No Number in Record!');</script>"); |
| 383 | } | 407 | } |
| ... | @@ -470,9 +494,118 @@ if($action=="addconfcall") | ... | @@ -470,9 +494,118 @@ if($action=="addconfcall") |
| 470 | return Response::make($retstr); | 494 | return Response::make($retstr); |
| 471 | } | 495 | } |
| 472 | 496 | ||
| 497 | if($action=="transfercall") | ||
| 498 | { | ||
| 499 | $retstr=""; | ||
| 500 | $callnumber=Input::get("confnumber"); | ||
| 501 | $callerid=""; | ||
| 502 | //see if user is online on this sipid | ||
| 503 | $sipid=Sipid::find($kstychDialer['phone']); | ||
| 504 | if($sipid&&$sipid->user==Auth::user()->id&&$sipid->status==1) | ||
| 505 | { | ||
| 506 | $oldcrmcall=CRMCall::find($kstychCall['callid']); | ||
| 507 | if($oldcrmcall) | ||
| 508 | { | ||
| 509 | $olddialline=Dialline::find($oldcrmcall->dialline_id); | ||
| 510 | $dspan="1";if($olddialline)$dspan=$olddialline->dspan; | ||
| 511 | |||
| 512 | // $dialline=Dialline::where("status","=","Free")->where("enabled","=","1"); | ||
| 513 | // if($dspan!="")$dialline=$dialline->where('dspan','=',$dspan); | ||
| 514 | // $dialline=$dialline->orderBy('updated_at','ASC')->first(); | ||
| 515 | |||
| 516 | if($olddialline) | ||
| 517 | { | ||
| 518 | $callerid=$oldcrmcall->did; | ||
| 519 | |||
| 520 | // $dialline->status="transfer"; | ||
| 521 | // $dialline->channel=$olddialline->channel; | ||
| 522 | // $dialline->save(); | ||
| 523 | |||
| 524 | $nowts=microtime(true)*1000; | ||
| 525 | |||
| 526 | //start the call log | ||
| 527 | $crmcall=new CRMCall(); | ||
| 528 | $crmcall->number=$callnumber; | ||
| 529 | $crmcall->user_id=Auth::user()->id; | ||
| 530 | $crmcall->sipid_id=$sipid->id; | ||
| 531 | $crmcall->crm_id=$oldcrmcall->crm_id; | ||
| 532 | $crmcall->client=$oldcrmcall->client; | ||
| 533 | $crmcall->department=$oldcrmcall->department; | ||
| 534 | $crmcall->state='New'; | ||
| 535 | $crmcall->userstatus='Transfer'; | ||
| 536 | $crmcall->usersubstatus='Transfer'; | ||
| 537 | $crmcall->type='Transfer'; | ||
| 538 | //$crmcall->dialline_id=$dialline->id; | ||
| 539 | |||
| 540 | $crmcall->setTs('ts_Wait',$nowts); | ||
| 541 | $crmcall->setTs('ts_Call',$nowts); | ||
| 542 | |||
| 543 | $crmcall->did=$callerid; | ||
| 544 | |||
| 545 | $tdata=array(); | ||
| 546 | $crmcall->data=json_encode($tdata); | ||
| 547 | $crmcall->save(); | ||
| 548 | |||
| 549 | |||
| 550 | $newqueue=new Kqueue(); | ||
| 551 | $newqueue->transferCall($sipid,$callnumber,$callerid,$crmcall,$olddialline); | ||
| 552 | //start actual calls | ||
| 553 | // $newqueue=new Kqueue(); | ||
| 554 | // $newqueue->userToConf($sipid); | ||
| 555 | // $newqueue=new Kqueue(); | ||
| 556 | // $newqueue->custToConf($sipid,$callnumber,$callerid,$crmcall,$dialline); | ||
| 557 | |||
| 558 | $retstr=$crmcall->id; | ||
| 559 | } | ||
| 560 | else | ||
| 561 | { | ||
| 562 | $retstr="Error : No Lines Free to Dial!"; | ||
| 563 | } | ||
| 564 | } | ||
| 565 | else | ||
| 566 | { | ||
| 567 | $retstr="Error : No calls to conference found!"; | ||
| 568 | } | ||
| 569 | } | ||
| 570 | else | ||
| 571 | { | ||
| 572 | $retstr="Error : You Are Not Connected!"; | ||
| 573 | } | ||
| 574 | |||
| 575 | return Response::make($retstr); | ||
| 576 | } | ||
| 577 | |||
| 578 | |||
| 473 | if($action=="hangupall") | 579 | if($action=="hangupall") |
| 474 | { | 580 | { |
| 475 | $res=0; | 581 | $res=0; |
| 582 | $aUser = Auth::user(); | ||
| 583 | If($aUser->current_dialmode == "Predictive"){ | ||
| 584 | $avgTimeArr = array(); | ||
| 585 | $user_id = $aUser->id; | ||
| 586 | $campaign = $aUser->sel_campaign; | ||
| 587 | |||
| 588 | $avgTimeArr = $this->getAvgTimeArray($campaign, $user_id); | ||
| 589 | |||
| 590 | $cutOffUsrArr = Cutoff::where('user_id', '=', $user_id)->where('c_name', '=', $campaign)->get(); | ||
| 591 | |||
| 592 | if(count($cutOffUsrArr)){ | ||
| 593 | Cutoff::where('user_id', '=', $user_id)->where('c_name', '=', $campaign)->update( | ||
| 594 | ['hangup_time' => date('Y-m-d H:i:s'), | ||
| 595 | 'avg_dispo' => $avgTimeArr['avgdisposec'] | ||
| 596 | ]); | ||
| 597 | } | ||
| 598 | else | ||
| 599 | { | ||
| 600 | $cutoff = new Cutoff(); | ||
| 601 | $cutoff->user_id = $user_id; | ||
| 602 | $cutoff->c_name = $campaign; | ||
| 603 | $cutoff->hangup_time = date('Y-m-d H:i:s'); | ||
| 604 | $cutoff->avg_dispo = $avgTimeArr['avgdisposec']; | ||
| 605 | $cutoff->avg_ring = 0; | ||
| 606 | $cutoff->save(); | ||
| 607 | } | ||
| 608 | } | ||
| 476 | $callid=intval($kstychCall['callid'])+0; | 609 | $callid=intval($kstychCall['callid'])+0; |
| 477 | $crmcall=CRMCall::find($callid); | 610 | $crmcall=CRMCall::find($callid); |
| 478 | if($crmcall&&$crmcall->user_id==Auth::user()->id) | 611 | if($crmcall&&$crmcall->user_id==Auth::user()->id) |
| ... | @@ -545,12 +678,18 @@ if($action=="closecall") | ... | @@ -545,12 +678,18 @@ if($action=="closecall") |
| 545 | { | 678 | { |
| 546 | $kstychCall["usercallback"]=date("Y-m-d H:i:s",strtotime($kstychCall["usercallback"].":00")+((Auth::user()->timezone)*60)); | 679 | $kstychCall["usercallback"]=date("Y-m-d H:i:s",strtotime($kstychCall["usercallback"].":00")+((Auth::user()->timezone)*60)); |
| 547 | } | 680 | } |
| 681 | if($kstychCall["userappointment"]!="") | ||
| 682 | { | ||
| 683 | $kstychCall["userappointment"]=date("Y-m-d H:i:s",strtotime($kstychCall["userappointment"].":00")+((Auth::user()->timezone)*60)); | ||
| 684 | } | ||
| 548 | 685 | ||
| 549 | $crmcall->setTs('ts_Close',$nowts); | 686 | $crmcall->setTs('ts_Close',$nowts); |
| 550 | 687 | ||
| 551 | $crmcall->userstatus =$kstychCall["userstatus"]; | 688 | $crmcall->userstatus =$kstychCall["userstatus"]; |
| 552 | $crmcall->usersubstatus =$kstychCall["usersubstatus"]; | 689 | $crmcall->usersubstatus =$kstychCall["usersubstatus"]; |
| 553 | $crmcall->usercallback =$kstychCall["usercallback"]; | 690 | $crmcall->usercallback =$kstychCall["usercallback"]; |
| 691 | $crmcall->userappointmentdate =$kstychCall["userappointment"]; | ||
| 692 | //$user['peopledata']["dialer_appointment"]=$kstychCall["userappointment"]; | ||
| 554 | //$kstychCall["attempt"]=''; | 693 | //$kstychCall["attempt"]=''; |
| 555 | $crmcall->attempt = isset($kstychCall["attempt"]) ? $kstychCall["attempt"] : ' '; | 694 | $crmcall->attempt = isset($kstychCall["attempt"]) ? $kstychCall["attempt"] : ' '; |
| 556 | $crmcall->call_flag="Z"; | 695 | $crmcall->call_flag="Z"; |
| ... | @@ -568,7 +707,8 @@ if($action=="closecall") | ... | @@ -568,7 +707,8 @@ if($action=="closecall") |
| 568 | { | 707 | { |
| 569 | $crmcall->crm_id=$kstychCall["crmid"]; | 708 | $crmcall->crm_id=$kstychCall["crmid"]; |
| 570 | 709 | ||
| 571 | $temparr=$wakka->getPerson($crmcall->crm_id); | 710 | $temparr=$wakka->getPerson($crmcall->crm_id,$crmcall->client); |
| 711 | Log::info("client---->in close1 --".$crmcall->client); | ||
| 572 | if(isset($temparr)&&isset($temparr['peopledata'])&&isset($temparr['peopledata']['client']))$crmcall->client=$temparr['peopledata']['client']; | 712 | if(isset($temparr)&&isset($temparr['peopledata'])&&isset($temparr['peopledata']['client']))$crmcall->client=$temparr['peopledata']['client']; |
| 573 | } | 713 | } |
| 574 | } | 714 | } |
| ... | @@ -618,12 +758,14 @@ if($action=="closecall") | ... | @@ -618,12 +758,14 @@ if($action=="closecall") |
| 618 | $tcrmcall->save(); | 758 | $tcrmcall->save(); |
| 619 | 759 | ||
| 620 | 760 | ||
| 621 | DB::table('records')->where('id',$crmcall->crm_id)->update(['filter_condition'=>'4']); | 761 | DB::table('records_'.$crmcall->client)->where('id',$crmcall->crm_id)->update(['filter_condition'=>'4']); |
| 622 | 762 | ||
| 623 | $tuser=$wakka->getPerson($tcrmid); | 763 | $tuser=$wakka->getPerson($tcrmid,$crmcall->client); |
| 764 | Log::info("client in 2-->".$crmcall->client); | ||
| 624 | $tuser['peopledata']["dialer_status"]=$kstychCall["userstatus"]; | 765 | $tuser['peopledata']["dialer_status"]=$kstychCall["userstatus"]; |
| 625 | $tuser['peopledata']["dialer_substatus"]=$kstychCall["usersubstatus"]; | 766 | $tuser['peopledata']["dialer_substatus"]=$kstychCall["usersubstatus"]; |
| 626 | $tuser['peopledata']["dialer_callback"]=$kstychCall["usercallback"]; | 767 | $tuser['peopledata']["dialer_callback"]=$kstychCall["usercallback"]; |
| 768 | $tuser['peopledata']["dialer_appointment"]=$kstychCall["userappointment"]; | ||
| 627 | $tuser['peopledata']["dialer_remarks"]=str_replace("'","",$kstychCall["userremarks"]); | 769 | $tuser['peopledata']["dialer_remarks"]=str_replace("'","",$kstychCall["userremarks"]); |
| 628 | $tuser['peopledata']["dialer_flag"]=$kstychCall["userflag"]; | 770 | $tuser['peopledata']["dialer_flag"]=$kstychCall["userflag"]; |
| 629 | 771 | ||
| ... | @@ -643,22 +785,25 @@ if($action=="closecall") | ... | @@ -643,22 +785,25 @@ if($action=="closecall") |
| 643 | $tuser['supcomntid']=$kstychCall["supcomntid"]; | 785 | $tuser['supcomntid']=$kstychCall["supcomntid"]; |
| 644 | 786 | ||
| 645 | $tuser['peopledata']["dialer_lastcall"]=date("Y-m-d H:i:s"); | 787 | $tuser['peopledata']["dialer_lastcall"]=date("Y-m-d H:i:s"); |
| 646 | $wakka->setPerson($tcrmid,$tuser); | 788 | $wakka->setPerson($tcrmid,$tuser,$crmcall->client); |
| 789 | $wakka->setPerson($tcrmid,$tuser,""); | ||
| 647 | } | 790 | } |
| 648 | } | 791 | } |
| 649 | } | 792 | } |
| 650 | } | 793 | } |
| 651 | 794 | ||
| 652 | 795 | ||
| 653 | $user=$wakka->getPerson($crmcall->crm_id); | 796 | $user=$wakka->getPerson($crmcall->crm_id,$crmcall->client); |
| 797 | Log::info("client in 3 --".$crmcall->client); | ||
| 654 | if($user['peopledata']['id']==$crmcall->crm_id) | 798 | if($user['peopledata']['id']==$crmcall->crm_id) |
| 655 | { | 799 | { |
| 656 | if($crmcall->crm_id>0){ | 800 | if($crmcall->crm_id>0){ |
| 657 | DB::table('records')->where('id',$crmcall->crm_id)->update(['filter_condition'=>'4']); | 801 | DB::table('records_'.$crmcall->client)->where('id',$crmcall->crm_id)->update(['filter_condition'=>'4']); |
| 658 | } | 802 | } |
| 659 | $user['peopledata']["dialer_status"]=$kstychCall["userstatus"]; | 803 | $user['peopledata']["dialer_status"]=$kstychCall["userstatus"]; |
| 660 | $user['peopledata']["dialer_substatus"]=$kstychCall["usersubstatus"]; | 804 | $user['peopledata']["dialer_substatus"]=$kstychCall["usersubstatus"]; |
| 661 | $user['peopledata']["dialer_callback"]=$kstychCall["usercallback"]; | 805 | $user['peopledata']["dialer_callback"]=$kstychCall["usercallback"]; |
| 806 | $user['peopledata']["dialer_appointment"]=$kstychCall["userappointment"]; | ||
| 662 | $user['peopledata']["dialer_remarks"]=str_replace("'","",$kstychCall["userremarks"]); | 807 | $user['peopledata']["dialer_remarks"]=str_replace("'","",$kstychCall["userremarks"]); |
| 663 | $user['peopledata']["dialer_flag"]=$kstychCall["userflag"]; | 808 | $user['peopledata']["dialer_flag"]=$kstychCall["userflag"]; |
| 664 | 809 | ||
| ... | @@ -688,25 +833,30 @@ if($action=="closecall") | ... | @@ -688,25 +833,30 @@ if($action=="closecall") |
| 688 | $user['agentcomments']=$kstychCall["agentcomments"]; | 833 | $user['agentcomments']=$kstychCall["agentcomments"]; |
| 689 | $user['supcomntid']=$kstychCall["supcomntid"]; | 834 | $user['supcomntid']=$kstychCall["supcomntid"]; |
| 690 | 835 | ||
| 691 | $wakka->setPerson($crmcall->crm_id,$user); | 836 | $wakka->setPerson($crmcall->crm_id,$user,$crmcall->client); |
| 692 | 837 | $wakka->setPerson($crmcall->crm_id,$user,""); | |
| 693 | //update groupid if this is not groupid TODO move to config | 838 | //update groupid if this is not groupid TODO move to config |
| 694 | if($user['peopledata']['clientcode']!=$user['peopledata']['clientinternalid']) | 839 | if($user['peopledata']['clientcode']!=$user['peopledata']['clientinternalid']) |
| 695 | { | 840 | { |
| 696 | $tusers=$wakka->getPersons(" clientinternalid='".$user['peopledata']['clientinternalid']."' limit 1"); | 841 | Log::info("client in 4 -->".$crmcall->client); |
| 842 | $tusers=$wakka->getPersons(" clientinternalid='".$user['peopledata']['clientinternalid']."' limit 1",$crmcall->client); | ||
| 697 | 843 | ||
| 698 | if(!empty($tusers)) | 844 | if(!empty($tusers)) |
| 699 | { | 845 | { |
| 700 | $tppldata=unserialize($tusers[0]['peopledata']); | 846 | $tppldata=unserialize($tusers[0]['peopledata']); |
| 701 | if($tppldata['status']=='New' || $tppldata['status']=='Incall')$wakka->setPersonKey($tusers[0]['id'],'status','Called'); | 847 | if($tppldata['status']=='New' || $tppldata['status']=='Incall'){ |
| 702 | 848 | $wakka->setPersonKey($tusers[0]['id'],'status','Called',"",$crmcall->client); | |
| 849 | $wakka->setPersonKey($tusers[0]['id'],'status','Called',"",""); | ||
| 850 | } | ||
| 703 | 851 | ||
| 704 | //print_r($tppldata['status']); | 852 | //print_r($tppldata['status']); |
| 705 | //Log::info($tppldata['status']); | 853 | //Log::info($tppldata['status']); |
| 706 | //if($tppldata['dialer_status']=='') //TODO Config | 854 | //if($tppldata['dialer_status']=='') //TODO Config |
| 707 | { | 855 | { |
| 708 | $wakka->setPersonKey($tusers[0]['id'],'dialer_status',$user['peopledata']["dialer_status"]); | 856 | $wakka->setPersonKey($tusers[0]['id'],'dialer_status',$user['peopledata']["dialer_status"],"",$crmcall->client); |
| 709 | $wakka->setPersonKey($tusers[0]['id'],'dialer_substatus',$user['peopledata']["dialer_substatus"]); | 857 | $wakka->setPersonKey($tusers[0]['id'],'dialer_status',$user['peopledata']["dialer_status"],"",""); |
| 858 | $wakka->setPersonKey($tusers[0]['id'],'dialer_substatus',$user['peopledata']["dialer_substatus"],"",$crmcall->client); | ||
| 859 | $wakka->setPersonKey($tusers[0]['id'],'dialer_substatus',$user['peopledata']["dialer_substatus"],"",""); | ||
| 710 | } | 860 | } |
| 711 | } | 861 | } |
| 712 | } | 862 | } |
| ... | @@ -830,13 +980,24 @@ if($action=="kCallAction") | ... | @@ -830,13 +980,24 @@ if($action=="kCallAction") |
| 830 | 980 | ||
| 831 | if($action=="dialerstate") | 981 | if($action=="dialerstate") |
| 832 | { | 982 | { |
| 833 | $ready=0;if($kstychDialer['mDialerState']=="Ready"&&$kstychCall['mCallState']=="Wait")$ready=1; | 983 | //$ready=0;if($kstychDialer['mDialerState']=="Ready"&&$kstychCall['mCallState']=="Wait")$ready=1; |
| 984 | $ready=0;$perpareCall=0; | ||
| 985 | if($kstychDialer['mDialerState']=="Ready"&&$kstychCall['mCallState']=="Wait") | ||
| 986 | { | ||
| 987 | $ready=1; | ||
| 988 | } | ||
| 989 | |||
| 990 | if($kstychDialer['mDialerSubState']=="Predictive"&&$kstychCall['mCallState']=="Wait") | ||
| 991 | { | ||
| 992 | $perpareCall=1; | ||
| 993 | } | ||
| 834 | $nowts=microtime(true)*1000; | 994 | $nowts=microtime(true)*1000; |
| 835 | 995 | ||
| 836 | $sipid=Sipid::find($kstychDialer['phone']); | 996 | $sipid=Sipid::find($kstychDialer['phone']); |
| 837 | if($sipid&&$sipid->user==Auth::user()->id&&$sipid->status==1) | 997 | if($sipid&&$sipid->user==Auth::user()->id&&$sipid->status==1) |
| 838 | { | 998 | { |
| 839 | $sipid->ready=$ready; | 999 | $sipid->ready=$ready; |
| 1000 | $sipid->prepare_call=$perpareCall; | ||
| 840 | $sipid->save(); | 1001 | $sipid->save(); |
| 841 | 1002 | ||
| 842 | $userlog=UserLog::where('user_id','=',Auth::user()->id)->orderBy("id","DESC")->first(); | 1003 | $userlog=UserLog::where('user_id','=',Auth::user()->id)->orderBy("id","DESC")->first(); |
| ... | @@ -845,6 +1006,71 @@ if($action=="dialerstate") | ... | @@ -845,6 +1006,71 @@ if($action=="dialerstate") |
| 845 | } | 1006 | } |
| 846 | return Response::make(""); | 1007 | return Response::make(""); |
| 847 | } | 1008 | } |
| 1009 | if($action=="usersel") | ||
| 1010 | { | ||
| 1011 | |||
| 1012 | $user = Auth::user(); | ||
| 1013 | $currDialerState = $kstychDialer['mDialerState']; | ||
| 1014 | //$client=Input::get("client"); | ||
| 1015 | if($kstychDialer['mDialerSubState'] != "") | ||
| 1016 | $currDialerState = $kstychDialer['mDialerSubState']; | ||
| 1017 | if($client!=""){ | ||
| 1018 | DB::table('users')->where('id', Auth::user()->id)->update([ | ||
| 1019 | 'sel_campaign'=>$client, | ||
| 1020 | 'current_dialmode'=>$currDialerState | ||
| 1021 | ]); | ||
| 1022 | }else{ | ||
| 1023 | DB::table('users')->where('id', Auth::user()->id)->update([ | ||
| 1024 | 'current_dialmode'=>$currDialerState | ||
| 1025 | ]); | ||
| 1026 | |||
| 1027 | } | ||
| 1028 | |||
| 1029 | $campaigndata = Sipid::select("clients")->where("user", $user->id)->where("status", "=", 1)->first(); | ||
| 1030 | |||
| 1031 | if($campaigndata) | ||
| 1032 | { | ||
| 1033 | $campdata= json_decode($campaigndata->clients); | ||
| 1034 | if(Auth::user()->id!='1'){ | ||
| 1035 | $campdata->sel_campaign=$client; | ||
| 1036 | |||
| 1037 | Sipid::where("user",$user->id)->update(["clients"=>json_encode($campdata)]); | ||
| 1038 | } | ||
| 1039 | } | ||
| 1040 | |||
| 1041 | return Response::make(""); | ||
| 1042 | } | ||
| 1043 | |||
| 1044 | if($action=="sipcleanup") | ||
| 1045 | { | ||
| 1046 | $user = Auth::user(); | ||
| 1047 | |||
| 1048 | $sipid = Sipid::where("user", $user->id)->select('id')->first(); | ||
| 1049 | |||
| 1050 | Sipid::where("user", $user->id)->update([ | ||
| 1051 | "user" => 0, | ||
| 1052 | "status" => 0, | ||
| 1053 | "ready" => 0, | ||
| 1054 | "patched" => 0, | ||
| 1055 | "prepare_call" => 0, | ||
| 1056 | "confup" => 0, | ||
| 1057 | "clients" => "" | ||
| 1058 | ]); | ||
| 1059 | |||
| 1060 | $diallines = Dialline::where('status', '!=', 'Free')->where('conf', '=', "1000".$sipid->id); | ||
| 1061 | if($diallines){ | ||
| 1062 | $diallines=$diallines->get(); | ||
| 1063 | |||
| 1064 | foreach ($diallines as $dialline) { | ||
| 1065 | $newqueue=new Kqueue(); | ||
| 1066 | $newqueue->hangupChannelS($dialline->channel,$dialline->server); | ||
| 1067 | } | ||
| 1068 | } | ||
| 1069 | if(count($sipid)){ | ||
| 1070 | exec('/usr/sbin/asterisk -rx "channel request hangup '.$sipid->id.'"'); | ||
| 1071 | exec('/usr/sbin/asterisk -rx "confbridge kick 1000'.$sipid->id.' all"'); | ||
| 1072 | } | ||
| 1073 | } | ||
| 848 | 1074 | ||
| 849 | if($action=="spychannel") | 1075 | if($action=="spychannel") |
| 850 | { | 1076 | { |
| ... | @@ -875,11 +1101,14 @@ if($action=="recarchive") | ... | @@ -875,11 +1101,14 @@ if($action=="recarchive") |
| 875 | } | 1101 | } |
| 876 | public function show($id) | 1102 | public function show($id) |
| 877 | { | 1103 | { |
| 1104 | //echo "show--->".$id; | ||
| 1105 | //exit(); | ||
| 878 | if($id=="bucketdata") | 1106 | if($id=="bucketdata") |
| 879 | { | 1107 | { |
| 1108 | //Log::info("ABCDDD----".Input::get("client")); | ||
| 880 | $client=Input::get("client",""); | 1109 | $client=Input::get("client",""); |
| 881 | $bucket=Input::get("bucket"); | 1110 | $bucket=Input::get("bucket"); |
| 882 | $currentstatus=Input::get("currentstatus"); | 1111 | //$currentstatus=Input::get("currentstatus"); |
| 883 | $legalstatus=Input::get("legalstatus"); | 1112 | $legalstatus=Input::get("legalstatus"); |
| 884 | $page=intval(Input::get('page'));if($page<1)$page=1; | 1113 | $page=intval(Input::get('page'));if($page<1)$page=1; |
| 885 | $skey=Input::get('skey'); | 1114 | $skey=Input::get('skey'); |
| ... | @@ -931,9 +1160,9 @@ public function show($id) | ... | @@ -931,9 +1160,9 @@ public function show($id) |
| 931 | $birthdate=date('m-d'); | 1160 | $birthdate=date('m-d'); |
| 932 | 1161 | ||
| 933 | $dbres=array(); | 1162 | $dbres=array(); |
| 934 | if($bucket=="CurrentQueue")$dbres=$this->getCallSequencing(20); | 1163 | if($bucket=="CurrentQueue")$dbres=$this->getCallSequencing(1); |
| 935 | else if($bucket=="Priority")$dbres=$wakka->getPersons("priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) $owclientstr ORDER BY FIELD(priority,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1) limit $bs,$bl"); | 1164 | /*else if($bucket=="Priority")$dbres=$wakka->getPersons("priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) $owclientstr ORDER BY FIELD(priority,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1) limit $bs,$bl"); |
| 936 | else if($bucket=="TotalData")$dbres=$wakka->getPersons("1=1 and currentstatus='$currentstatus' and legalstatus='$legalstatus' and status!='Noqueue' $owclientstr limit $bs,$bl"); | 1165 | else if($bucket=="TotalData")//$dbres=$wakka->getPersons("1=1 and currentstatus='$currentstatus' and legalstatus='$legalstatus' and status!='Noqueue' $owclientstr limit $bs,$bl"); |
| 937 | else if($bucket=="SearchData")$dbres=$wakka->getPersons("1=1 $roclientstrAll $skey limit $bs,$bl"); | 1166 | else if($bucket=="SearchData")$dbres=$wakka->getPersons("1=1 $roclientstrAll $skey limit $bs,$bl"); |
| 938 | else if($bucket=="NotCalled")$dbres=$wakka->getPersons("status='New' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); | 1167 | else if($bucket=="NotCalled")$dbres=$wakka->getPersons("status='New' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); |
| 939 | else if($bucket=="Called")$dbres=$wakka->getPersons("status='Called' $owclientstr limit $bs,$bl"); | 1168 | else if($bucket=="Called")$dbres=$wakka->getPersons("status='Called' $owclientstr limit $bs,$bl"); |
| ... | @@ -941,9 +1170,9 @@ public function show($id) | ... | @@ -941,9 +1170,9 @@ public function show($id) |
| 941 | else if($bucket=="Flagged-Called")$dbres=$wakka->getPersons("dialer_flag='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); | 1170 | else if($bucket=="Flagged-Called")$dbres=$wakka->getPersons("dialer_flag='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); |
| 942 | else if($bucket=="Flagged-Notcalled")$dbres=$wakka->getPersons("mf_isa='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); | 1171 | else if($bucket=="Flagged-Notcalled")$dbres=$wakka->getPersons("mf_isa='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); |
| 943 | else if($bucket=="today-birthday")$dbres=$wakka->getPersons("DATE_FORMAT(DOB,'%m-%d')='$birthdate' and priority='11' $owclientstr limit $bs,$bl"); | 1172 | else if($bucket=="today-birthday")$dbres=$wakka->getPersons("DATE_FORMAT(DOB,'%m-%d')='$birthdate' and priority='11' $owclientstr limit $bs,$bl"); |
| 944 | 1173 | */ | |
| 945 | else if($bucket=="MissedCalls") | 1174 | else if($bucket=="MissedCalls") |
| 946 | { | 1175 | {/* |
| 947 | $udidlinesstr = array(); | 1176 | $udidlinesstr = array(); |
| 948 | foreach($didlinesstr as $didlinestr){ | 1177 | foreach($didlinesstr as $didlinestr){ |
| 949 | $didlinestrArr=explode(":",$didlinestr); | 1178 | $didlinestrArr=explode(":",$didlinestr); |
| ... | @@ -972,8 +1201,6 @@ public function show($id) | ... | @@ -972,8 +1201,6 @@ public function show($id) |
| 972 | 1201 | ||
| 973 | if(count($number_list) > 0) { | 1202 | if(count($number_list) > 0) { |
| 974 | $lcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN ('" . implode("','", $number_list). "') GROUP BY number) ORDER BY id DESC"); | 1203 | $lcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN ('" . implode("','", $number_list). "') GROUP BY number) ORDER BY id DESC"); |
| 975 | //$lcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN ('" . implode("','", $number_list). "') GROUP BY number)"); | ||
| 976 | //$lcalls=$lcalls->orderBy("id","DESC"); | ||
| 977 | foreach($lcalls as $lcall) | 1204 | foreach($lcalls as $lcall) |
| 978 | { | 1205 | { |
| 979 | if($lcall->userstatus=="InboundDROP") | 1206 | if($lcall->userstatus=="InboundDROP") |
| ... | @@ -1005,7 +1232,7 @@ public function show($id) | ... | @@ -1005,7 +1232,7 @@ public function show($id) |
| 1005 | } | 1232 | } |
| 1006 | 1233 | ||
| 1007 | 1234 | ||
| 1008 | } | 1235 | */ } |
| 1009 | else if($bucket=="CallsToday")$dbres=$wakka->getPersons("dialer_lastcall>='".date("Y-m-d 00:00:00",time()+((Auth::user()->timezone)*60))."' $owclientstr limit $bs,$bl"); | 1236 | else if($bucket=="CallsToday")$dbres=$wakka->getPersons("dialer_lastcall>='".date("Y-m-d 00:00:00",time()+((Auth::user()->timezone)*60))."' $owclientstr limit $bs,$bl"); |
| 1010 | else if($bucket=="CallsMonth")$dbres=$wakka->getPersons("dialer_lastcall>='".date("Y-m-01 00:00:00",time()+((Auth::user()->timezone)*60))."' $owclientstr limit $bs,$bl"); | 1237 | else if($bucket=="CallsMonth")$dbres=$wakka->getPersons("dialer_lastcall>='".date("Y-m-01 00:00:00",time()+((Auth::user()->timezone)*60))."' $owclientstr limit $bs,$bl"); |
| 1011 | 1238 | ||
| ... | @@ -1182,8 +1409,8 @@ public function show($id) | ... | @@ -1182,8 +1409,8 @@ public function show($id) |
| 1182 | 1409 | ||
| 1183 | $calllog = DB::table('records') | 1410 | $calllog = DB::table('records') |
| 1184 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | 1411 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') |
| 1185 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | 1412 | ->select('customer_name', 'cust_id', 'mobile', 'dialer_callback', 'status','dialer_lastcall','id','dialer_status','client') |
| 1186 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00"); | 1413 | ->where("dialer_callback", "!=","0000-00-00 00:00:00"); |
| 1187 | 1414 | ||
| 1188 | if($role == 'Supervisor'){ | 1415 | if($role == 'Supervisor'){ |
| 1189 | $userName = Auth::user()->username; | 1416 | $userName = Auth::user()->username; |
| ... | @@ -1195,10 +1422,10 @@ public function show($id) | ... | @@ -1195,10 +1422,10 @@ public function show($id) |
| 1195 | $setClient =''; | 1422 | $setClient =''; |
| 1196 | }else{ | 1423 | }else{ |
| 1197 | $setClient = $client; | 1424 | $setClient = $client; |
| 1198 | $calllog = $calllog->where('records.client', '=', $client); | 1425 | $calllog = $calllog->where('client', '=', $client); |
| 1199 | } | 1426 | } |
| 1200 | 1427 | ||
| 1201 | $calllog = $calllog->whereIn("records.usr_id",[$supervisorUsers]) | 1428 | $calllog = $calllog->whereIn("usr_id",[$supervisorUsers]) |
| 1202 | ->get(); | 1429 | ->get(); |
| 1203 | 1430 | ||
| 1204 | $count = count($calllog); | 1431 | $count = count($calllog); |
| ... | @@ -1209,9 +1436,9 @@ public function show($id) | ... | @@ -1209,9 +1436,9 @@ public function show($id) |
| 1209 | $setClient =''; | 1436 | $setClient =''; |
| 1210 | }else{ | 1437 | }else{ |
| 1211 | $setClient = $client; | 1438 | $setClient = $client; |
| 1212 | $calllog = $calllog->where('records.client', '=', $client); | 1439 | $calllog = $calllog->where('client', '=', $client); |
| 1213 | } | 1440 | } |
| 1214 | $calllog = $calllog->where("records.usr_id",$user)->get(); | 1441 | $calllog = $calllog->where("usr_id",$user)->get(); |
| 1215 | 1442 | ||
| 1216 | $count = count($calllog); | 1443 | $count = count($calllog); |
| 1217 | } | 1444 | } |
| ... | @@ -1221,6 +1448,62 @@ public function show($id) | ... | @@ -1221,6 +1448,62 @@ public function show($id) |
| 1221 | $data['count'] = $count; | 1448 | $data['count'] = $count; |
| 1222 | return view("layout.module.dialer.followUp",$data); | 1449 | return view("layout.module.dialer.followUp",$data); |
| 1223 | } | 1450 | } |
| 1451 | if($id=="loadAppointmentData") | ||
| 1452 | { | ||
| 1453 | |||
| 1454 | $wakka = new KHRMSLib(); | ||
| 1455 | $user=Auth::user()->id; | ||
| 1456 | $role = Auth::user()->usertype; | ||
| 1457 | $client = Input::get("client"); | ||
| 1458 | $selection = Input::get("selection"); | ||
| 1459 | $setClient = ''; | ||
| 1460 | $count = 0; | ||
| 1461 | |||
| 1462 | $totalAppointmentCount = DB::table('records') | ||
| 1463 | ->select('customer_name', 'cust_id', 'mobile', 'dialer_appointment', 'status','dialer_lastcall','id','dialer_status','client') | ||
| 1464 | ->where("dialer_appointment", "!=","0000-00-00 00:00:00") | ||
| 1465 | ->where('dialer_appointment','>',date('Y-m-d H:i:s',time()-(7*24*60*60))); | ||
| 1466 | //print_r($totalAppointmentCount); | ||
| 1467 | if($role == 'Supervisor'){ | ||
| 1468 | $userName = Auth::user()->username; | ||
| 1469 | $supervisorUsers=$wakka->LoadAll("select id from users where supervisor='$userName';"); | ||
| 1470 | $userIds = []; | ||
| 1471 | //print_r($supervisorUsers); | ||
| 1472 | foreach ($supervisorUsers as $key => $value) $userIds[] = "'".$value['id']."'"; | ||
| 1473 | $supervisorUsers = implode(",",$userIds); | ||
| 1474 | //echo $supervisorUsers; | ||
| 1475 | if(!empty($supervisorUsers)){ | ||
| 1476 | |||
| 1477 | if($selection == 'all'){ | ||
| 1478 | $setClient =''; | ||
| 1479 | }else{ | ||
| 1480 | $setClient = $client; | ||
| 1481 | $totalAppointmentCount = $totalAppointmentCount->where('client', '=', $client); | ||
| 1482 | } | ||
| 1483 | |||
| 1484 | $totalAppointmentCount = $totalAppointmentCount->whereIn("usr_id",[$supervisorUsers]) | ||
| 1485 | ->get(); | ||
| 1486 | |||
| 1487 | $count = count($totalAppointmentCount); | ||
| 1488 | } | ||
| 1489 | |||
| 1490 | }else if($role == 'User'){ | ||
| 1491 | if($selection == 'all'){ | ||
| 1492 | $setClient =''; | ||
| 1493 | }else{ | ||
| 1494 | $setClient = $client; | ||
| 1495 | $totalAppointmentCount = $totalAppointmentCount->where('client', '=', $client); | ||
| 1496 | } | ||
| 1497 | $totalAppointmentCount = $totalAppointmentCount->where("usr_id",$user)->get(); | ||
| 1498 | |||
| 1499 | $count = count($totalAppointmentCount); | ||
| 1500 | } | ||
| 1501 | |||
| 1502 | $data['appointment'] = $totalAppointmentCount; | ||
| 1503 | $data['client'] = $setClient; | ||
| 1504 | $data['count'] = $count; | ||
| 1505 | return view("layout.module.dialer.appointment",$data); | ||
| 1506 | } | ||
| 1224 | if($id=="reports") | 1507 | if($id=="reports") |
| 1225 | { | 1508 | { |
| 1226 | return view("layout.module.dialer.reports",array()); | 1509 | return view("layout.module.dialer.reports",array()); |
| ... | @@ -1467,11 +1750,13 @@ public function show($id) | ... | @@ -1467,11 +1750,13 @@ public function show($id) |
| 1467 | //echo "OK"; | 1750 | //echo "OK"; |
| 1468 | } | 1751 | } |
| 1469 | 1752 | ||
| 1470 | private function getCallSequencing($limit) | 1753 | public function getCallSequencing($limit,$client=null) |
| 1471 | { | 1754 | { |
| 1755 | //Log::info("Inside getCall"); | ||
| 1472 | $wakka = new KHRMSLib(); | 1756 | $wakka = new KHRMSLib(); |
| 1473 | 1757 | ||
| 1474 | $roclientstr=array();$didlinesstr=array(); | 1758 | $roclientstr=array();$didlinesstr=array(); |
| 1759 | if($client==null){ | ||
| 1475 | if(Auth::user()->exten!="")$didlinesstr[]=Auth::user()->exten; | 1760 | if(Auth::user()->exten!="")$didlinesstr[]=Auth::user()->exten; |
| 1476 | $oclientlst=$wakka->clientsOwnerRWAccess(); | 1761 | $oclientlst=$wakka->clientsOwnerRWAccess(); |
| 1477 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") | 1762 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") |
| ... | @@ -1483,23 +1768,23 @@ public function show($id) | ... | @@ -1483,23 +1768,23 @@ public function show($id) |
| 1483 | } | 1768 | } |
| 1484 | 1769 | ||
| 1485 | $mroclientstr = $roclientstr; | 1770 | $mroclientstr = $roclientstr; |
| 1486 | 1771 | ||
| 1487 | $client=Input::get("client"); | 1772 | $client=Input::get("client"); |
| 1488 | //print_r($client); | 1773 | |
| 1489 | |||
| 1490 | if(!empty($roclientstr))$roclientstr="client='$client'";else $roclientstr=""; | 1774 | if(!empty($roclientstr))$roclientstr="client='$client'";else $roclientstr=""; |
| 1491 | // echo $roclientstr."Abc"; | ||
| 1492 | $users=array(); | 1775 | $users=array(); |
| 1493 | 1776 | ||
| 1494 | if(Auth::user()->usertype!="User"){$tusers=array();return $tusers;} | 1777 | if(Auth::user()->usertype!="User"){$tusers=array();return $tusers;} |
| 1495 | 1778 | }else{ | |
| 1496 | DB::table('records')->where('filter_condition','=','2')->where('modified','<',date('Y-m-d H:i:s',time()-(2*60)))->update(['filter_condition'=>'1']); | 1779 | $roclientstr="client='$client'"; |
| 1497 | 1780 | Log::info($roclientstr); | |
| 1498 | 1781 | } | |
| 1499 | // $clientDetails=$wakka->getPersonshome("$roclientstr order by dialer_lastcall asc"); | 1782 | //$client=$this->campaignlist($client); |
| 1500 | //$campaign=DB::table("campaign_query")->where('campaign', '=', $client)->where('current_queue','=','selected')->first(); | 1783 | if($client!='')$records='records_'.$client;else $records='records'; |
| 1784 | DB::table($records)->where('filter_condition','=','2')->where('modified','<',date('Y-m-d H:i:s',time()-(2*60)))->update(['filter_condition'=>'1']); | ||
| 1501 | 1785 | ||
| 1502 | $tusers=$wakka->getPersonshome("filter_condition IN('0','1','4') and $roclientstr and dialer_callback <'".date('Y-m-d H:i:s',time()+(15*60))."' and usr_id='".Auth::user()->id."' and dialer_substatus='Follow Up' limit 1;"); | 1786 | //if($client!=''){ |
| 1787 | $tusers=$wakka->getPersonshome("filter_condition IN('0','1','4') and $roclientstr and dialer_callback <'".date('Y-m-d H:i:s',time()+(15*60))."' and usr_id='".Auth::user()->id."' and dialer_substatus='Follow Up' limit 1;",$client); | ||
| 1503 | if(count($tusers)>0){ | 1788 | if(count($tusers)>0){ |
| 1504 | if($limit>0){ | 1789 | if($limit>0){ |
| 1505 | $l=1; | 1790 | $l=1; |
| ... | @@ -1516,17 +1801,17 @@ public function show($id) | ... | @@ -1516,17 +1801,17 @@ public function show($id) |
| 1516 | $limit=$limit-sizeof($tusers); | 1801 | $limit=$limit-sizeof($tusers); |
| 1517 | } | 1802 | } |
| 1518 | } | 1803 | } |
| 1804 | //Log::info("clients-->".$roclientstr); | ||
| 1519 | $campaign=DB::table("campaign_query")->where('campaign', '=', $client)->where('current_queue','=','selected')->first(); | 1805 | $campaign=DB::table("campaign_query")->where('campaign', '=', $client)->where('current_queue','=','selected')->first(); |
| 1520 | if($campaign) | 1806 | //Log::info($campaign); |
| 1807 | if($campaign) | ||
| 1521 | { | 1808 | { |
| 1522 | if(stripos($campaign->where_cond,"order by")===false){ | 1809 | if(stripos($campaign->where_cond,"order by")===false){ |
| 1523 | $orderby="order by dialer_lastcall asc"; | 1810 | $orderby="order by dialer_lastcall asc"; |
| 1524 | }else{ | 1811 | }else{ |
| 1525 | $orderby =""; | 1812 | $orderby =""; |
| 1526 | } | 1813 | } |
| 1527 | // echo "campaign1"; | 1814 | $tusers=$wakka->getPersonshome("filter_condition IN ('1','0') and dialer_callback ='0000-00-00 00:00:00' and $campaign->where_cond $orderby limit 1;",$client); |
| 1528 | //print_r($campaign); | ||
| 1529 | $tusers=$wakka->getPersonshome("filter_condition = '1' and $campaign->where_cond $orderby limit 1;"); | ||
| 1530 | //print_r($tusers); | 1815 | //print_r($tusers); |
| 1531 | if(count($tusers)>0){ | 1816 | if(count($tusers)>0){ |
| 1532 | if($limit>0){ | 1817 | if($limit>0){ |
| ... | @@ -1546,14 +1831,11 @@ public function show($id) | ... | @@ -1546,14 +1831,11 @@ public function show($id) |
| 1546 | $limit=$limit-sizeof($tusers); | 1831 | $limit=$limit-sizeof($tusers); |
| 1547 | } | 1832 | } |
| 1548 | }else{ | 1833 | }else{ |
| 1549 | // echo "campaign 2"; | ||
| 1550 | $condition=$campaign->where_cond; | 1834 | $condition=$campaign->where_cond; |
| 1551 | if(stripos($condition,"order by")!==false){ | 1835 | if(stripos($condition,"order by")!==false){ |
| 1552 | // $orderby="order by dialer_lastcall asc"; | ||
| 1553 | $condition = substr($condition,0,stripos($condition, 'order by')); | 1836 | $condition = substr($condition,0,stripos($condition, 'order by')); |
| 1554 | } | 1837 | } |
| 1555 | //$condition = substr($campaign->where_cond,0,stripos($campaign->where_cond, 'order by')); | 1838 | $tusers=$wakka->getPersonshome("filter_condition=4 and $condition order by dialer_lastcall asc limit 1;",$client); |
| 1556 | $tusers=$wakka->getPersonshome("filter_condition=4 and $condition order by dialer_lastcall asc limit 1;"); | ||
| 1557 | if($limit>0){ | 1839 | if($limit>0){ |
| 1558 | $l=1; | 1840 | $l=1; |
| 1559 | foreach($tusers as $tuser){ | 1841 | foreach($tusers as $tuser){ |
| ... | @@ -1570,7 +1852,22 @@ public function show($id) | ... | @@ -1570,7 +1852,22 @@ public function show($id) |
| 1570 | } | 1852 | } |
| 1571 | } | 1853 | } |
| 1572 | }else{ | 1854 | }else{ |
| 1573 | $clientDetails=$wakka->getPersonshome("$roclientstr and filter_condition NOT IN ('2','3') order by dialer_lastcall asc limit 1;"); | 1855 | $tusers=$wakka->getPersonshome("filter_condition NOT IN ('2','3') and status='New' order by dialer_lastcall asc limit 1;",$client); |
| 1856 | if($limit>0){ | ||
| 1857 | $l=1; | ||
| 1858 | foreach($tusers as $tuser){ | ||
| 1859 | if(!isset($users[$tuser['id']])){ | ||
| 1860 | $users[$tuser['id']]=$tuser; | ||
| 1861 | $l++; | ||
| 1862 | |||
| 1863 | if($l>$limit) | ||
| 1864 | break; | ||
| 1865 | } | ||
| 1866 | } | ||
| 1867 | |||
| 1868 | $limit=$limit-sizeof($tusers); | ||
| 1869 | } | ||
| 1870 | |||
| 1574 | //print_r($clientDetails); | 1871 | //print_r($clientDetails); |
| 1575 | //print_r($clientDetails); | 1872 | //print_r($clientDetails); |
| 1576 | 1873 | ||
| ... | @@ -1664,7 +1961,7 @@ public function show($id) | ... | @@ -1664,7 +1961,7 @@ public function show($id) |
| 1664 | }*/ | 1961 | }*/ |
| 1665 | 1962 | ||
| 1666 | 1963 | ||
| 1667 | if($limit>0) | 1964 | /*if($limit>0) |
| 1668 | { | 1965 | { |
| 1669 | $tusers = array_filter($clientDetails, function($var){ | 1966 | $tusers = array_filter($clientDetails, function($var){ |
| 1670 | return ($var['dialer_callback']>'2018-09-11 00:00:00'&&strtotime($var['dialer_callback'])<strtotime(date('Y-m-d H:i:s',time()+(15*60)))&&($var['dialer_status']=='Contacted - FollowUp - Specific' || $var['dialer_substatus']=='Followup Call' || $var['dialer_status']=='Service Call - Inbound Follow up' || $var['dialer_status'])=='Productive Call - Sales Follow Up'); | 1967 | return ($var['dialer_callback']>'2018-09-11 00:00:00'&&strtotime($var['dialer_callback'])<strtotime(date('Y-m-d H:i:s',time()+(15*60)))&&($var['dialer_status']=='Contacted - FollowUp - Specific' || $var['dialer_substatus']=='Followup Call' || $var['dialer_status']=='Service Call - Inbound Follow up' || $var['dialer_status'])=='Productive Call - Sales Follow Up'); |
| ... | @@ -1682,8 +1979,8 @@ public function show($id) | ... | @@ -1682,8 +1979,8 @@ public function show($id) |
| 1682 | } | 1979 | } |
| 1683 | 1980 | ||
| 1684 | $limit=$limit-sizeof($tusers); | 1981 | $limit=$limit-sizeof($tusers); |
| 1685 | } | 1982 | }*/ |
| 1686 | for($p=15;$p>0;$p--) | 1983 | /*for($p=15;$p>0;$p--) |
| 1687 | { | 1984 | { |
| 1688 | // echo "2"; | 1985 | // echo "2"; |
| 1689 | if($limit>0) | 1986 | if($limit>0) |
| ... | @@ -1708,8 +2005,8 @@ public function show($id) | ... | @@ -1708,8 +2005,8 @@ public function show($id) |
| 1708 | $limit=$limit-sizeof($tusers); | 2005 | $limit=$limit-sizeof($tusers); |
| 1709 | } | 2006 | } |
| 1710 | } | 2007 | } |
| 1711 | } | 2008 | }*/ |
| 1712 | if($limit>0) | 2009 | /*if($limit>0) |
| 1713 | { | 2010 | { |
| 1714 | $tusers = array_filter($clientDetails, function($var){ | 2011 | $tusers = array_filter($clientDetails, function($var){ |
| 1715 | return ($var['status']=='New'&&$var['mobile']!=''); | 2012 | return ($var['status']=='New'&&$var['mobile']!=''); |
| ... | @@ -1727,9 +2024,9 @@ public function show($id) | ... | @@ -1727,9 +2024,9 @@ public function show($id) |
| 1727 | } | 2024 | } |
| 1728 | 2025 | ||
| 1729 | $limit=$limit-sizeof($tusers); | 2026 | $limit=$limit-sizeof($tusers); |
| 1730 | } | 2027 | }*/ |
| 1731 | 2028 | ||
| 1732 | if($limit>0) | 2029 | /*if($limit>0) |
| 1733 | { | 2030 | { |
| 1734 | $tusers = array_filter($clientDetails, function($var){ | 2031 | $tusers = array_filter($clientDetails, function($var){ |
| 1735 | //return ($var['status']=='Called'&&($var['dialer_substatus']=='NC - Customer in Meeting' || $var['dialer_substatus']=='NC - Ringing / No response' || $var['dialer_substatus']=='NC - Not Reachable' || $var['dialer_substatus']=='NC - Switched off' || $var['dialer_substatus']=='NC - Third Party' || $var['dialer_status'=='Not Contacted'])); | 2032 | //return ($var['status']=='Called'&&($var['dialer_substatus']=='NC - Customer in Meeting' || $var['dialer_substatus']=='NC - Ringing / No response' || $var['dialer_substatus']=='NC - Not Reachable' || $var['dialer_substatus']=='NC - Switched off' || $var['dialer_substatus']=='NC - Third Party' || $var['dialer_status'=='Not Contacted'])); |
| ... | @@ -1748,7 +2045,7 @@ public function show($id) | ... | @@ -1748,7 +2045,7 @@ public function show($id) |
| 1748 | } | 2045 | } |
| 1749 | 2046 | ||
| 1750 | $limit=$limit-sizeof($tusers); | 2047 | $limit=$limit-sizeof($tusers); |
| 1751 | } | 2048 | }*/ |
| 1752 | 2049 | ||
| 1753 | /*if($limit>0) | 2050 | /*if($limit>0) |
| 1754 | { | 2051 | { |
| ... | @@ -1769,7 +2066,7 @@ public function show($id) | ... | @@ -1769,7 +2066,7 @@ public function show($id) |
| 1769 | $limit=$limit-sizeof($tusers); | 2066 | $limit=$limit-sizeof($tusers); |
| 1770 | }*/ | 2067 | }*/ |
| 1771 | 2068 | ||
| 1772 | if($limit>0) | 2069 | /*if($limit>0) |
| 1773 | { | 2070 | { |
| 1774 | // echo "5"; | 2071 | // echo "5"; |
| 1775 | $tusers = array_filter($clientDetails, function($var){ | 2072 | $tusers = array_filter($clientDetails, function($var){ |
| ... | @@ -1787,9 +2084,24 @@ public function show($id) | ... | @@ -1787,9 +2084,24 @@ public function show($id) |
| 1787 | } | 2084 | } |
| 1788 | 2085 | ||
| 1789 | $limit=$limit-sizeof($tusers); | 2086 | $limit=$limit-sizeof($tusers); |
| 1790 | } | 2087 | }*/ |
| 1791 | } | 2088 | } |
| 1792 | $tusers=array();foreach($users as $tuser)$tusers[]=$tuser; | 2089 | $tusers=array();foreach($users as $tuser)$tusers[]=$tuser; |
| 2090 | // } | ||
| 1793 | return $tusers; | 2091 | return $tusers; |
| 1794 | } | 2092 | } |
| 2093 | |||
| 2094 | |||
| 2095 | public function getAvgTimeArray($campaign, $user) | ||
| 2096 | { | ||
| 2097 | $avgdisposecObj = CRMCall::select(DB::Raw('(avg(disposec))/1000 as avgdisposec'))->where("client", "=", $campaign)->where("user_id", "=", $user)->orderby("id","desc")->limit(50)->where("type","!=","Inbound")->first(); | ||
| 2098 | |||
| 2099 | $avgcallsecObj = CRMCall::select(DB::Raw('(avg(callsec))/1000 as avgcallsec'))->where("client", "=", $campaign)->where("user_id", "=", $user)->orderby("id","desc")->limit(50)->where("type","!=","Inbound")->first(); | ||
| 2100 | |||
| 2101 | $returnArray['avgdisposec'] = round($avgdisposecObj->avgdisposec); | ||
| 2102 | $returnArray['avgcallsec'] = round($avgdisposecObj->avgcallsec); | ||
| 2103 | |||
| 2104 | return $returnArray; | ||
| 2105 | } | ||
| 2106 | |||
| 1795 | } | 2107 | } | ... | ... |
| ... | @@ -13,7 +13,7 @@ class KHRMSLib | ... | @@ -13,7 +13,7 @@ class KHRMSLib |
| 13 | public $dblink; | 13 | public $dblink; |
| 14 | public $user=NULL; | 14 | public $user=NULL; |
| 15 | 15 | ||
| 16 | public $EMPCacheCols="currentstatus,legalstatus,firstname,lastname,mobile,emailid,altphone1,altphone2,altphone3,altphone4,altphone5,altphone6,altphone7,altphone8,altphone9,altphone10,candidatecategory,nextfollowupdate,passportno,joiningdate,client,designation,supervisor,contracttype,saltotal,ibannumber,servicestoppeddate,employeeexitstatus,exittype,dateofexit,abscondtype,abscondeddate,workflowstatus,status,clientinternalid,department,passportstatus,clientcode,laborcardpersonalid,dialer_status,dialer_substatus,dialer_callback,dialer_remarks,dialer_flag,dialer_lastcall,priority,crmlist_id,group,bttc,service_vs_product,resolution,satisfaction,final_call_assessment,question,mf_isa,DOB,other_information,agreementid,applied_amount,city,comp_code,company,completeddate,cust_id,cust_name,customer_name,disb_date,emi_hl,eqty_amt,foir,ins_amt,int_rate,irr,loan_amount,location,mf_amt,nth,offer_amt,outstanding,pf,ph_mob,ph_off,ph_res,pl_offer,proc_fee,product_flag,profile_new,rank,segment,tenure,tu_application_id,ucic_id,filler1,filler2,filler3,filler4,filler5,filler6,filler7,filler8,filler9,filler10,filler11,filler12,filler13,filler14,filler15"; | 16 | public $EMPCacheCols="mobile,emailid,altphone1,altphone2,altphone3,altphone4,altphone5,altphone6,altphone7,altphone8,altphone9,altphone10,client,status,clientinternalid,dialer_status,dialer_substatus,dialer_callback,dialer_remarks,dialer_flag,dialer_lastcall,priority,crmlist_id,group,bttc,service_vs_product,resolution,satisfaction,final_call_assessment,question,mf_isa,DOB,other_information,agreementid,applied_amount,city,comp_code,company,completeddate,cust_id,cust_name,customer_name,disb_date,emi_hl,eqty_amt,foir,ins_amt,int_rate,irr,loan_amount,location,mf_amt,nth,offer_amt,outstanding,pf,ph_mob,ph_off,ph_res,pl_offer,proc_fee,product_flag,profile_new,rank,segment,tenure,tu_application_id,ucic_id,filler1,filler2,filler3,filler4,filler5,filler6,filler7,filler8,filler9,filler10,filler11,filler12,filler13,filler14,filler15,dialer_appointment"; |
| 17 | 17 | ||
| 18 | public $USRCacheCols="id,username,password,fullname,email,status,organization,group,data,presence,timezone,invisible,usertype,diskuse,source,meta,lteam,lteam2,supervisor,created_at,updated_at,remember_token,passwordreset,number1,number2,exten,extencontext,manager"; | 18 | public $USRCacheCols="id,username,password,fullname,email,status,organization,group,data,presence,timezone,invisible,usertype,diskuse,source,meta,lteam,lteam2,supervisor,created_at,updated_at,remember_token,passwordreset,number1,number2,exten,extencontext,manager"; |
| 19 | 19 | ||
| ... | @@ -839,6 +839,11 @@ function popMail($userid) | ... | @@ -839,6 +839,11 @@ function popMail($userid) |
| 839 | if($tuser)if($tuser->moduleACL("admin",false,false,true))$res=true; | 839 | if($tuser)if($tuser->moduleACL("admin",false,false,true))$res=true; |
| 840 | return $res; | 840 | return $res; |
| 841 | } | 841 | } |
| 842 | function getSelClient() | ||
| 843 | { | ||
| 844 | |||
| 845 | return Auth::user()->sel_campaign; | ||
| 846 | } | ||
| 842 | 847 | ||
| 843 | function getPersonOld($empid) | 848 | function getPersonOld($empid) |
| 844 | { | 849 | { |
| ... | @@ -853,11 +858,17 @@ function popMail($userid) | ... | @@ -853,11 +858,17 @@ function popMail($userid) |
| 853 | } | 858 | } |
| 854 | else return FALSE; | 859 | else return FALSE; |
| 855 | } | 860 | } |
| 856 | function getPerson($empid) | 861 | function getPerson($empid,$client) |
| 857 | { | 862 | { |
| 858 | /*if($this->getCount("records","id='$empid'")==1) | 863 | /*if($this->getCount("records","id='$empid'")==1) |
| 859 | {*/ | 864 | {*/ |
| 860 | if($empdata=$this->LoadSingle("select peopledata,modifylog,dirty from records where id='$empid';")) | 865 | if($client == ""){ |
| 866 | |||
| 867 | $records = "records"; | ||
| 868 | }else{ | ||
| 869 | $records = "records_$client"; | ||
| 870 | } | ||
| 871 | if($empdata=$this->LoadSingle("select peopledata,modifylog,dirty from $records where id='$empid';")) | ||
| 861 | { | 872 | { |
| 862 | //$empdata=$this->LoadSingle("select * from records where id='$empid';"); | 873 | //$empdata=$this->LoadSingle("select * from records where id='$empid';"); |
| 863 | $personarr['peopledata']=unserialize($empdata['peopledata']); | 874 | $personarr['peopledata']=unserialize($empdata['peopledata']); |
| ... | @@ -936,11 +947,11 @@ function popMail($userid) | ... | @@ -936,11 +947,11 @@ function popMail($userid) |
| 936 | else return FALSE; | 947 | else return FALSE; |
| 937 | } | 948 | } |
| 938 | 949 | ||
| 939 | function setPersonKey($empid,$key,$val,$username="") | 950 | function setPersonKey($empid,$key,$val,$username="",$client) |
| 940 | { | 951 | { |
| 941 | $cachestr='';if(in_array($key,$this->cachearray))$cachestr=" ,`$key`='$val' "; | 952 | $cachestr='';if(in_array($key,$this->cachearray))$cachestr=" ,`$key`='$val' "; |
| 942 | 953 | ||
| 943 | $personarr=$this->getPerson($empid); | 954 | $personarr=$this->getPerson($empid,$client); |
| 944 | if(is_array($personarr['peopledata'])) | 955 | if(is_array($personarr['peopledata'])) |
| 945 | { | 956 | { |
| 946 | if($personarr['peopledata'][$key]!=$val) | 957 | if($personarr['peopledata'][$key]!=$val) |
| ... | @@ -957,14 +968,14 @@ function popMail($userid) | ... | @@ -957,14 +968,14 @@ function popMail($userid) |
| 957 | } | 968 | } |
| 958 | $personarr['peopledata'][$key]=$val; | 969 | $personarr['peopledata'][$key]=$val; |
| 959 | 970 | ||
| 960 | $res=$this->setPerson($empid,$personarr); | 971 | $res=$this->setPerson($empid,$personarr,$client); |
| 961 | return $res; | 972 | return $res; |
| 962 | } | 973 | } |
| 963 | return true; | 974 | return true; |
| 964 | } | 975 | } |
| 965 | else return false; | 976 | else return false; |
| 966 | } | 977 | } |
| 967 | function setPerson($empid,&$personarr) | 978 | function setPerson($empid,&$personarr,$client) |
| 968 | { | 979 | { |
| 969 | //if($this->getCount("records","id='$empid'")==1&&is_array($personarr['peopledata'])) | 980 | //if($this->getCount("records","id='$empid'")==1&&is_array($personarr['peopledata'])) |
| 970 | if($empid!=""&&is_array($personarr['peopledata'])) | 981 | if($empid!=""&&is_array($personarr['peopledata'])) |
| ... | @@ -1018,14 +1029,18 @@ function popMail($userid) | ... | @@ -1018,14 +1029,18 @@ function popMail($userid) |
| 1018 | { | 1029 | { |
| 1019 | $setComntArr = array(); | 1030 | $setComntArr = array(); |
| 1020 | 1031 | ||
| 1021 | $setComntArr['clientcode']=$personarr['peopledata']['clientcode']; | 1032 | $setComntArr['clientcode']=$personarr['peopledata']['cust_id']; |
| 1022 | $setComntArr['agent']=Auth::user()->username; | 1033 | $setComntArr['agent']=Auth::user()->username; |
| 1023 | $setComntArr['agent_comments']=$personarr['agentcomments']; | 1034 | $setComntArr['agent_comments']=$personarr['agentcomments']; |
| 1024 | 1035 | ||
| 1025 | $this->setComment($setComntArr['clientcode'],$setComntArr); | 1036 | $this->setComment($setComntArr['clientcode'],$setComntArr); |
| 1026 | } | 1037 | } |
| 1027 | 1038 | if($client!=''){ | |
| 1028 | return $this->Query("update records set modified=now(),peopledata='$quoteP',modifylog='0',dirty='$quoteD' $cachestr where id='$empid' limit 1"); | 1039 | $recordsTable = 'records_'.$client; |
| 1040 | }else{ | ||
| 1041 | $recordsTable = 'records'; | ||
| 1042 | } | ||
| 1043 | return $this->Query("update $recordsTable set modified=now(),peopledata='$quoteP',modifylog='0',dirty='$quoteD' $cachestr where id='$empid' limit 1"); | ||
| 1029 | } | 1044 | } |
| 1030 | } | 1045 | } |
| 1031 | else return -1; | 1046 | else return -1; |
| ... | @@ -1144,11 +1159,16 @@ function popMail($userid) | ... | @@ -1144,11 +1159,16 @@ function popMail($userid) |
| 1144 | } | 1159 | } |
| 1145 | } | 1160 | } |
| 1146 | 1161 | ||
| 1147 | function getPersonIDs($wheresql) | 1162 | function getPersonIDs($wheresql,$client) |
| 1148 | { | 1163 | { |
| 1149 | return $this->LoadAll("select id from records where $wheresql"); | 1164 | if($client==""){ |
| 1165 | $recordsTable = "records"; | ||
| 1166 | }else{ | ||
| 1167 | $recordsTable = "records_".$client; | ||
| 1168 | } | ||
| 1169 | return $this->LoadAll("select id from $recordsTable where $wheresql"); | ||
| 1150 | } | 1170 | } |
| 1151 | function getPersonshome($wheresql) | 1171 | function getPersonshome($wheresql,$client) |
| 1152 | { | 1172 | { |
| 1153 | $sqlarr=""; | 1173 | $sqlarr=""; |
| 1154 | foreach($this->cachearray as $cachekey) | 1174 | foreach($this->cachearray as $cachekey) |
| ... | @@ -1158,10 +1178,14 @@ function popMail($userid) | ... | @@ -1158,10 +1178,14 @@ function popMail($userid) |
| 1158 | $sqlarr.=" ,`$cachekey`"; | 1178 | $sqlarr.=" ,`$cachekey`"; |
| 1159 | } | 1179 | } |
| 1160 | } | 1180 | } |
| 1161 | 1181 | if($client==""){ | |
| 1162 | return $this->LoadAll("select id".$sqlarr." from records where $wheresql;"); | 1182 | $recordsTable = "records"; |
| 1183 | }else{ | ||
| 1184 | $recordsTable = "records_".$client; | ||
| 1185 | } | ||
| 1186 | return $this->LoadAll("select id".$sqlarr." from $recordsTable where $wheresql;"); | ||
| 1163 | } | 1187 | } |
| 1164 | function getPersons($wheresql) | 1188 | function getPersons($wheresql,$client) |
| 1165 | { | 1189 | { |
| 1166 | $sqlarr=""; | 1190 | $sqlarr=""; |
| 1167 | foreach($this->cachearray as $cachekey) | 1191 | foreach($this->cachearray as $cachekey) |
| ... | @@ -1171,8 +1195,12 @@ function popMail($userid) | ... | @@ -1171,8 +1195,12 @@ function popMail($userid) |
| 1171 | $sqlarr.=" ,`$cachekey`"; | 1195 | $sqlarr.=" ,`$cachekey`"; |
| 1172 | } | 1196 | } |
| 1173 | } | 1197 | } |
| 1174 | 1198 | if($client==""){ | |
| 1175 | return $this->LoadAll("select id,created,modified,peopledata,modifylog,dirty".$sqlarr." from records where $wheresql;"); | 1199 | $recordsTable = "records"; |
| 1200 | }else{ | ||
| 1201 | $recordsTable = "records_".$client; | ||
| 1202 | } | ||
| 1203 | return $this->LoadAll("select id,created,modified,peopledata,modifylog,dirty".$sqlarr." from $recordsTable where $wheresql;"); | ||
| 1176 | } | 1204 | } |
| 1177 | 1205 | ||
| 1178 | function isWorkingEmployee(&$ppldata,$year,$month,$date=0) | 1206 | function isWorkingEmployee(&$ppldata,$year,$month,$date=0) |
| ... | @@ -1398,6 +1426,21 @@ function popMail($userid) | ... | @@ -1398,6 +1426,21 @@ function popMail($userid) |
| 1398 | //print_r($company); | 1426 | //print_r($company); |
| 1399 | return $companyar; | 1427 | return $companyar; |
| 1400 | } | 1428 | } |
| 1429 | |||
| 1430 | function getDispositionList(){ | ||
| 1431 | |||
| 1432 | $dispositionPlan = DB::table('disposition')->join('sub_disposition', 'disposition.id', '=', 'sub_disposition.dispo_id') | ||
| 1433 | ->select('disposition.id as dispoId', 'disposition.name as disposition','disposition.code as code','disposition.status AS status', | ||
| 1434 | DB::raw('count(*) as totalSubDispo, sub_disposition.id'), | ||
| 1435 | DB::raw('GROUP_CONCAT(sub_disposition.name) as sunDispoName, sub_disposition.name')) | ||
| 1436 | ->groupBy('sub_disposition.dispo_id') | ||
| 1437 | ->where('status','active') | ||
| 1438 | ->get(); | ||
| 1439 | |||
| 1440 | return $dispositionPlan; | ||
| 1441 | |||
| 1442 | } | ||
| 1443 | |||
| 1401 | function getEmailListforClient($tclient) | 1444 | function getEmailListforClient($tclient) |
| 1402 | { | 1445 | { |
| 1403 | $unameslist=array(); | 1446 | $unameslist=array(); |
| ... | @@ -1593,26 +1636,6 @@ function popMail($userid) | ... | @@ -1593,26 +1636,6 @@ function popMail($userid) |
| 1593 | } | 1636 | } |
| 1594 | function clientsReadAccess() | 1637 | function clientsReadAccess() |
| 1595 | { | 1638 | { |
| 1596 | /* $companyarr=$this->LoadAll("select * from hrms_masters where mtype='company' and status='active'"); | ||
| 1597 | $campaigns=array(); | ||
| 1598 | $now = new \DateTime(); | ||
| 1599 | foreach($companyarr as $tcompany){ | ||
| 1600 | $campaigns[]=$tcompany['mkey']; | ||
| 1601 | } | ||
| 1602 | foreach($companyarr as $tcompany){ | ||
| 1603 | $campaignstartdate = new \DateTime($tcompany['campaignstartdate']); | ||
| 1604 | $campaignenddate = new \DateTime($tcompany['campaignenddate']); | ||
| 1605 | |||
| 1606 | if(empty($tcompany['campaignstartdate']) || empty($tcompany['campaignenddate'])){ | ||
| 1607 | print_r($tcompany['mkey']); | ||
| 1608 | $campaigns[]=$tcompany['mkey']; | ||
| 1609 | }else{ | ||
| 1610 | if($campaignstartdate < $now and $campaignenddate > $now){ | ||
| 1611 | print_r($tcompany['mkey']); | ||
| 1612 | $campaigns[]=$tcompany['mkey']; | ||
| 1613 | } | ||
| 1614 | } | ||
| 1615 | }*/ | ||
| 1616 | $clientlst=array(); | 1639 | $clientlst=array(); |
| 1617 | if($this->GetBBBUserData("readotherdata")=="No") | 1640 | if($this->GetBBBUserData("readotherdata")=="No") |
| 1618 | { | 1641 | { |
| ... | @@ -1645,18 +1668,19 @@ function popMail($userid) | ... | @@ -1645,18 +1668,19 @@ function popMail($userid) |
| 1645 | } | 1668 | } |
| 1646 | $activeClientCampaign = array(); | 1669 | $activeClientCampaign = array(); |
| 1647 | $companyarr=$this->LoadAll("select * from hrms_masters where mtype='company' and status='active'"); | 1670 | $companyarr=$this->LoadAll("select * from hrms_masters where mtype='company' and status='active'"); |
| 1671 | $recordsArry=$this->LoadAll("select client from records group by client"); | ||
| 1672 | //$records=array(); | ||
| 1648 | $campaigns=array(); | 1673 | $campaigns=array(); |
| 1649 | $dashboarduser=Auth::user(); | 1674 | $dashboarduser=Auth::user(); |
| 1650 | $timeoffset = $dashboarduser->timezone; //-330; //$dashboarduser->timezone; | 1675 | $timeoffset = $dashboarduser->timezone; //-330; //$dashboarduser->timezone; |
| 1651 | $timeoffset = $timeoffset*60; | 1676 | $timeoffset = $timeoffset*60; |
| 1652 | $now = strtotime(date("Y-m-d H:i:s"))-$timeoffset; | 1677 | $now = strtotime(date("H:i:s"))-$timeoffset; |
| 1653 | |||
| 1654 | foreach($companyarr as $tcompany){ | 1678 | foreach($companyarr as $tcompany){ |
| 1655 | $campaignstartdate = strtotime($tcompany['campaignstartdate']); | 1679 | $campaignstartdate = strtotime($tcompany['campaignstartdate']); |
| 1656 | $campaignenddate = strtotime($tcompany['campaignenddate']); | 1680 | $campaignenddate = strtotime($tcompany['campaignenddate']); |
| 1657 | if($tcompany['campaignstartdate'] == '0000-00-00 00:00:00' || $tcompany['campaignenddate'] == '0000-00-00 00:00:00'){ | 1681 | if($tcompany['campaignstartdate'] == '00:00:00' and $tcompany['campaignenddate'] == '00:00:00'){ |
| 1658 | $campaigns[]=$tcompany['mkey']; | 1682 | $campaigns[]=$tcompany['mkey']; |
| 1659 | }else{ | 1683 | }else{ |
| 1660 | if($campaignstartdate < $now and $campaignenddate > $now){ | 1684 | if($campaignstartdate < $now and $campaignenddate > $now){ |
| 1661 | $campaigns[]=$tcompany['mkey']; | 1685 | $campaigns[]=$tcompany['mkey']; |
| 1662 | } | 1686 | } |
| ... | @@ -1667,12 +1691,55 @@ function popMail($userid) | ... | @@ -1667,12 +1691,55 @@ function popMail($userid) |
| 1667 | $activeClientCampaign[]=$value; | 1691 | $activeClientCampaign[]=$value; |
| 1668 | } | 1692 | } |
| 1669 | } | 1693 | } |
| 1670 | return $activeClientCampaign; | 1694 | $activeClientCampaign1=array(); |
| 1695 | foreach($recordsArry as $records){ | ||
| 1696 | if(in_array($records['client'],$activeClientCampaign)){ | ||
| 1697 | $activeClientCampaign1[]=$records['client']; | ||
| 1698 | }else{ | ||
| 1699 | continue; | ||
| 1700 | } | ||
| 1701 | } | ||
| 1702 | //Log::info($activeClientCampaign1); | ||
| 1703 | return $activeClientCampaign1; | ||
| 1671 | } | 1704 | } |
| 1672 | function clientsOwnerRWAccess() | 1705 | function clientsOwnerRWAccess() |
| 1673 | { | 1706 | { |
| 1674 | $clientlst=array_unique(array_merge(explode(",",$this->GetBBBUserData("clientsownerlist")),explode(",",$this->GetBBBUserData("clientslist")))); | 1707 | $clientlst=array_unique(array_merge(explode(",",$this->GetBBBUserData("clientsownerlist")),explode(",",$this->GetBBBUserData("clientslist")))); |
| 1675 | return $clientlst; | 1708 | $activeClientCampaign = array(); |
| 1709 | $companyarr=$this->LoadAll("select * from hrms_masters where mtype='company' and status='active'"); | ||
| 1710 | $recordsArry=$this->LoadAll("select client from records group by client"); | ||
| 1711 | //$records=array(); | ||
| 1712 | $campaigns=array(); | ||
| 1713 | $dashboarduser=Auth::user(); | ||
| 1714 | $timeoffset = $dashboarduser->timezone; //-330; //$dashboarduser->timezone; | ||
| 1715 | $timeoffset = $timeoffset*60; | ||
| 1716 | $now = strtotime(date("H:i:s"))-$timeoffset; | ||
| 1717 | foreach($companyarr as $tcompany){ | ||
| 1718 | $campaignstartdate = strtotime($tcompany['campaignstartdate']); | ||
| 1719 | $campaignenddate = strtotime($tcompany['campaignenddate']); | ||
| 1720 | if($tcompany['campaignstartdate'] == '00:00:00' and $tcompany['campaignenddate'] == '00:00:00'){ | ||
| 1721 | $campaigns[]=$tcompany['mkey']; | ||
| 1722 | }else{ | ||
| 1723 | if($campaignstartdate < $now and $campaignenddate > $now){ | ||
| 1724 | $campaigns[]=$tcompany['mkey']; | ||
| 1725 | } | ||
| 1726 | } | ||
| 1727 | } | ||
| 1728 | foreach ($clientlst as $key => $value) { | ||
| 1729 | if(in_array($value, $campaigns)){ | ||
| 1730 | $activeClientCampaign[]=$value; | ||
| 1731 | } | ||
| 1732 | } | ||
| 1733 | $activeClientCampaign1=array(); | ||
| 1734 | foreach($recordsArry as $records){ | ||
| 1735 | if(in_array($records['client'],$activeClientCampaign)){ | ||
| 1736 | $activeClientCampaign1[]=$records['client']; | ||
| 1737 | }else{ | ||
| 1738 | continue; | ||
| 1739 | } | ||
| 1740 | } | ||
| 1741 | return $activeClientCampaign1; | ||
| 1742 | //return $clientlst; | ||
| 1676 | } | 1743 | } |
| 1677 | function generateRandomString($length = 10) | 1744 | function generateRandomString($length = 10) |
| 1678 | { | 1745 | { | ... | ... |
| ... | @@ -17,6 +17,8 @@ use PAMI\Message\Event\NewstateEvent; | ... | @@ -17,6 +17,8 @@ use PAMI\Message\Event\NewstateEvent; |
| 17 | use PAMI\Message\Event\OriginateResponseEvent; | 17 | use PAMI\Message\Event\OriginateResponseEvent; |
| 18 | use PAMI\Message\Event\HangupEvent; | 18 | use PAMI\Message\Event\HangupEvent; |
| 19 | use PAMI\Message\Event\UnknownEvent; | 19 | use PAMI\Message\Event\UnknownEvent; |
| 20 | use PAMI\Message\Event\DialBeginEvent; | ||
| 21 | use PAMI\Message\Event\DialEndEvent; | ||
| 20 | 22 | ||
| 21 | use PAMI\Message\Action\AGIAction; | 23 | use PAMI\Message\Action\AGIAction; |
| 22 | use PAMI\Message\Action\SIPNotifyAction; | 24 | use PAMI\Message\Action\SIPNotifyAction; |
| ... | @@ -30,6 +32,8 @@ use PAMI\Message\Action\RedirectAction; | ... | @@ -30,6 +32,8 @@ use PAMI\Message\Action\RedirectAction; |
| 30 | use PAMI\Message\Action\ConfbridgeMuteAction; | 32 | use PAMI\Message\Action\ConfbridgeMuteAction; |
| 31 | use PAMI\Message\Action\ConfbridgeUnmuteAction; | 33 | use PAMI\Message\Action\ConfbridgeUnmuteAction; |
| 32 | use PAMI\Message\Action\ActionMessage; | 34 | use PAMI\Message\Action\ActionMessage; |
| 35 | use PAMI\Message\Action\AttendedTransferAction; | ||
| 36 | use PAMI\Message\Action\BlindTransferAction; | ||
| 33 | 37 | ||
| 34 | use App\Models\Sipid; | 38 | use App\Models\Sipid; |
| 35 | use App\Models\User; | 39 | use App\Models\User; |
| ... | @@ -103,6 +107,8 @@ class KPAMIListen implements IEventListener | ... | @@ -103,6 +107,8 @@ class KPAMIListen implements IEventListener |
| 103 | else if ($event instanceof OriginateResponseEvent){$this->OriginateResponseEvent($event);} | 107 | else if ($event instanceof OriginateResponseEvent){$this->OriginateResponseEvent($event);} |
| 104 | else if ($event instanceof HangupEvent) {$this->HangupEvent($event);} | 108 | else if ($event instanceof HangupEvent) {$this->HangupEvent($event);} |
| 105 | else if ($event instanceof UnknownEvent) {$this->UnknownEvent($event);} | 109 | else if ($event instanceof UnknownEvent) {$this->UnknownEvent($event);} |
| 110 | else if ($event instanceof DialBeginEvent) {$this->DialBeginEvent($event);} | ||
| 111 | else if ($event instanceof DialEndEvent) {$this->DialEndEvent($event);} | ||
| 106 | //else var_dump($event); | 112 | //else var_dump($event); |
| 107 | 113 | ||
| 108 | } | 114 | } |
| ... | @@ -196,14 +202,16 @@ class KPAMIListen implements IEventListener | ... | @@ -196,14 +202,16 @@ class KPAMIListen implements IEventListener |
| 196 | if($crmcall->crm_id>0) | 202 | if($crmcall->crm_id>0) |
| 197 | { | 203 | { |
| 198 | $wakka = new KHRMSLib(); | 204 | $wakka = new KHRMSLib(); |
| 199 | $record=$wakka->getPerson($crmcall->crm_id); | 205 | $record=$wakka->getPerson($crmcall->crm_id,$crmcall->client); |
| 200 | if($record) | 206 | if($record) |
| 201 | { | 207 | { |
| 208 | DB::table('records_'.$crmcall->client)->where($crmcall->crm_id)->update(['filter_condition'=>'4']); | ||
| 202 | $record["peopledata"]["dialer_status"]="FORCEDCLOSE"; | 209 | $record["peopledata"]["dialer_status"]="FORCEDCLOSE"; |
| 203 | $record["peopledata"]["dialer_substatus"]="FORCEDCLOSE"; | 210 | $record["peopledata"]["dialer_substatus"]="FORCEDCLOSE"; |
| 204 | $record["peopledata"]["dialer_callback"]=""; | 211 | $record["peopledata"]["dialer_callback"]=""; |
| 205 | $record["peopledata"]["dialer_remarks"]=""; | 212 | $record["peopledata"]["dialer_remarks"]=""; |
| 206 | $wakka->setPerson($crmcall->crm_id,$record); | 213 | $wakka->setPerson($crmcall->crm_id,$record,$crmcall->client); |
| 214 | $wakka->setPerson($crmcall->crm_id,$record,""); | ||
| 207 | } | 215 | } |
| 208 | 216 | ||
| 209 | } | 217 | } |
| ... | @@ -480,6 +488,90 @@ class KPAMIListen implements IEventListener | ... | @@ -480,6 +488,90 @@ class KPAMIListen implements IEventListener |
| 480 | $crmcall->save(); | 488 | $crmcall->save(); |
| 481 | } | 489 | } |
| 482 | } | 490 | } |
| 491 | else if($accountcodearr[1]=="a") // Code Added by AmolG: AutoDial | ||
| 492 | { | ||
| 493 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 494 | if($crmcall) | ||
| 495 | { | ||
| 496 | $nowts=microtime(true)*1000; | ||
| 497 | |||
| 498 | $crmcall->setTs('ts_Recend',$nowts); | ||
| 499 | |||
| 500 | $crmcall->state=$eventname; | ||
| 501 | $crmcall->statuscode=$cause; | ||
| 502 | $crmcall->substatus=$causetxt; | ||
| 503 | |||
| 504 | |||
| 505 | if($crmcall->type=="Auto"&&$crmcall->user_id==0) | ||
| 506 | { | ||
| 507 | $crmcall->userstatus="AutoDROP"; | ||
| 508 | $crmcall->usersubstatus="AutoDROP"; | ||
| 509 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 510 | $crmcall->setTs('ts_Recstart',$nowts); | ||
| 511 | if($crmcall->crm_id>0) | ||
| 512 | { | ||
| 513 | $wakka = new KHRMSLib(); | ||
| 514 | $record=$wakka->getPerson($crmcall->crm_id); | ||
| 515 | if($record) | ||
| 516 | { | ||
| 517 | $record["peopledata"]["status"]="Called"; | ||
| 518 | $record["peopledata"]["dialer_status"]="AutoDROP"; | ||
| 519 | $record["peopledata"]["dialer_substatus"]="AutoDROP"; | ||
| 520 | //$record["peopledata"]["dialer_lastcall"]=date("Y-m-d H:i:s"); | ||
| 521 | $wakka->setPerson($crmcall->crm_id,$record); | ||
| 522 | DB::table('records')->where('id',$crmcall->crm_id)->update(['filter_condition'=>'4']); | ||
| 523 | } | ||
| 524 | } | ||
| 525 | } | ||
| 526 | if($crmcall->type=="Auto" && $crmcall->user_id>0) | ||
| 527 | { | ||
| 528 | $crmcall->userstatus="AutoCall"; | ||
| 529 | $crmcall->usersubstatus="AutoCall"; | ||
| 530 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 531 | $crmcall->setTs('ts_Recstart',$nowts); | ||
| 532 | if($crmcall->crm_id>0) | ||
| 533 | { | ||
| 534 | $wakka = new KHRMSLib(); | ||
| 535 | $record=$wakka->getPerson($crmcall->crm_id); | ||
| 536 | if($record) | ||
| 537 | { | ||
| 538 | $record["peopledata"]["status"]="Called"; | ||
| 539 | $record["peopledata"]["dialer_status"]="AutoCall"; | ||
| 540 | $record["peopledata"]["dialer_substatus"]="AutoCall"; | ||
| 541 | $wakka->setPerson($crmcall->crm_id,$record); | ||
| 542 | } | ||
| 543 | } | ||
| 544 | } | ||
| 545 | |||
| 546 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 547 | if($dialline && ($dialline->channel==$channel || $dialline->status== "AutoCall")) | ||
| 548 | { | ||
| 549 | $dialline->status="Free"; | ||
| 550 | $dialline->conf=""; | ||
| 551 | $dialline->number=""; | ||
| 552 | $dialline->uniqueid=""; | ||
| 553 | $dialline->channel=""; | ||
| 554 | $dialline->regexstr=""; | ||
| 555 | $dialline->save(); | ||
| 556 | |||
| 557 | $tsip=Sipid::find($crmcall->sipid_id); | ||
| 558 | |||
| 559 | if(!empty($tsip)) | ||
| 560 | { | ||
| 561 | $tsip->patched=0; | ||
| 562 | $tsip->save(); | ||
| 563 | } | ||
| 564 | |||
| 565 | $newqueue=new Kqueue(); | ||
| 566 | $newqueue->sipNotify($tsip,"dialerUI","hangup","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); | ||
| 567 | } | ||
| 568 | |||
| 569 | $crmcall->addEventLog($nowts,"$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt"); | ||
| 570 | |||
| 571 | $crmcall->save(); | ||
| 572 | |||
| 573 | } | ||
| 574 | } | ||
| 483 | } | 575 | } |
| 484 | } | 576 | } |
| 485 | else | 577 | else |
| ... | @@ -569,6 +661,196 @@ class KPAMIListen implements IEventListener | ... | @@ -569,6 +661,196 @@ class KPAMIListen implements IEventListener |
| 569 | } | 661 | } |
| 570 | } | 662 | } |
| 571 | } | 663 | } |
| 664 | private function DialBeginEvent(EventMessage $event) | ||
| 665 | { | ||
| 666 | $eventname = "DialBegin"; | ||
| 667 | |||
| 668 | $channel=$event->getKey("Channel"); | ||
| 669 | $channelstate=$event->getKey("ChannelState"); | ||
| 670 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 671 | $accountcode=$event->getKey("AccountCode"); | ||
| 672 | $exten=$event->getKey("Exten"); | ||
| 673 | $priority=$event->getKey("Priority"); | ||
| 674 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 675 | |||
| 676 | $dchannel=$event->getKey("DestChannel"); | ||
| 677 | $dchannelstate=$event->getKey("DestChannelState"); | ||
| 678 | $dchannelstatedesc=$event->getKey("DestChannelStateDesc"); | ||
| 679 | $daccountcode=$event->getKey("DestAccountCode"); | ||
| 680 | $dexten=$event->getKey("DestExten"); | ||
| 681 | $dpriority=$event->getKey("DestPriority"); | ||
| 682 | $duniqueid=$event->getKey("DestUniqueid"); | ||
| 683 | |||
| 684 | $dialstring=$event->getKey("DialString"); | ||
| 685 | |||
| 686 | if($accountcode!="") | ||
| 687 | { | ||
| 688 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel\n"; | ||
| 689 | //echo "$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstring\n"; | ||
| 690 | echo "$accountcode:$eventname $dexten:$dpriority $dchannel $dialstring\n"; | ||
| 691 | |||
| 692 | $accountcodearr=explode("|",$accountcode); | ||
| 693 | if($accountcodearr[0]=="m") | ||
| 694 | { | ||
| 695 | if($accountcodearr[1]=="u") | ||
| 696 | { | ||
| 697 | $sipid=Sipid::find($accountcodearr[2]); | ||
| 698 | if($sipid) | ||
| 699 | { | ||
| 700 | $data=json_decode($sipid->clients,true); | ||
| 701 | $data['channel']=$dchannel; | ||
| 702 | $sipid->clients=json_encode($data); | ||
| 703 | $sipid->save(); | ||
| 704 | |||
| 705 | $newqueue=new Kqueue(); | ||
| 706 | $newqueue->sipNotify($sipid,"dialerUI","dialstart","u","~~".base64_encode($dchannel)); | ||
| 707 | } | ||
| 708 | } | ||
| 709 | if($accountcodearr[1]=="c") | ||
| 710 | { | ||
| 711 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 712 | if($crmcall) | ||
| 713 | { | ||
| 714 | $nowts=microtime(true)*1000; | ||
| 715 | |||
| 716 | $crmcall->setTs('ts_Call',$nowts); | ||
| 717 | |||
| 718 | $crmcall->state=$eventname; | ||
| 719 | |||
| 720 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 721 | if($dialline) | ||
| 722 | { | ||
| 723 | $dialline->channel=$dchannel; | ||
| 724 | $dialline->save(); | ||
| 725 | } | ||
| 726 | $tsip=Sipid::find($crmcall->sipid_id); | ||
| 727 | |||
| 728 | $newqueue=new Kqueue(); | ||
| 729 | $newqueue->sipNotify($tsip,"dialerUI","dialstart","c",$crmcall->id."~".$crmcall->number."~".base64_encode($dchannel)); | ||
| 730 | |||
| 731 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstring"); | ||
| 732 | |||
| 733 | $crmcall->save(); | ||
| 734 | } | ||
| 735 | } | ||
| 736 | } | ||
| 737 | |||
| 738 | } | ||
| 739 | } | ||
| 740 | |||
| 741 | private function DialEndEvent(EventMessage $event) | ||
| 742 | { | ||
| 743 | $eventname = "DialEnd"; | ||
| 744 | |||
| 745 | $channel=$event->getKey("Channel"); | ||
| 746 | $channelstate=$event->getKey("ChannelState"); | ||
| 747 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 748 | $accountcode=$event->getKey("AccountCode"); | ||
| 749 | $exten=$event->getKey("Exten"); | ||
| 750 | $priority=$event->getKey("Priority"); | ||
| 751 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 752 | |||
| 753 | $dchannel=$event->getKey("DestChannel"); | ||
| 754 | $dchannelstate=$event->getKey("DestChannelState"); | ||
| 755 | $dchannelstatedesc=$event->getKey("DestChannelStateDesc"); | ||
| 756 | $daccountcode=$event->getKey("DestAccountCode"); | ||
| 757 | $dexten=$event->getKey("DestExten"); | ||
| 758 | $dpriority=$event->getKey("DestPriority"); | ||
| 759 | $duniqueid=$event->getKey("DestUniqueid"); | ||
| 760 | |||
| 761 | $dialstatus=$event->getKey("DialStatus"); | ||
| 762 | Log::info($accountcode); | ||
| 763 | if($accountcode!="") | ||
| 764 | { | ||
| 765 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel\n"; | ||
| 766 | //echo "$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus\n"; | ||
| 767 | echo "$accountcode:$eventname $dexten:$dpriority $dchannel $dialstatus\n"; | ||
| 768 | |||
| 769 | $accountcodearr=explode("|",$accountcode); | ||
| 770 | if($accountcodearr[0]=="m") | ||
| 771 | { | ||
| 772 | if($accountcodearr[1]=="u") | ||
| 773 | { | ||
| 774 | if($dialstatus=="ANSWER") | ||
| 775 | { | ||
| 776 | $sipid=Sipid::find($accountcodearr[2]); | ||
| 777 | if($sipid) | ||
| 778 | { | ||
| 779 | $sipid->confup=1; | ||
| 780 | $sipid->save(); | ||
| 781 | } | ||
| 782 | } | ||
| 783 | } | ||
| 784 | else if($accountcodearr[1]=="c") | ||
| 785 | { | ||
| 786 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 787 | if($crmcall) | ||
| 788 | { | ||
| 789 | $nowts=microtime(true)*1000; | ||
| 790 | |||
| 791 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 792 | |||
| 793 | $crmcall->state=$eventname; | ||
| 794 | $crmcall->status=$dialstatus; | ||
| 795 | |||
| 796 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 797 | if($dialline) | ||
| 798 | { | ||
| 799 | $dialline->channel=$channel; | ||
| 800 | $dialline->save(); | ||
| 801 | } | ||
| 802 | |||
| 803 | $recfile=$crmcall->newRecFilePath(); | ||
| 804 | |||
| 805 | $tsip=Sipid::find($crmcall->sipid_id); | ||
| 806 | |||
| 807 | //start recording | ||
| 808 | $newqueue=new Kqueue(); | ||
| 809 | $newqueue->recordChannel($tsip->server,$dchannel,$recfile); | ||
| 810 | |||
| 811 | $crmcall->setTs('ts_Recstart',$nowts); | ||
| 812 | |||
| 813 | //notify UI (only the sip id) | ||
| 814 | $newqueue=new Kqueue(); | ||
| 815 | $newqueue->sipNotify($tsip,"dialerUI","dialend","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); | ||
| 816 | |||
| 817 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); | ||
| 818 | |||
| 819 | $crmcall->save(); | ||
| 820 | } | ||
| 821 | } | ||
| 822 | else if($accountcodearr[1]=="a") // Code Added by AmolG: AutoDial | ||
| 823 | { | ||
| 824 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 825 | if($crmcall) | ||
| 826 | { | ||
| 827 | $nowts=microtime(true)*1000; | ||
| 828 | |||
| 829 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 830 | |||
| 831 | $crmcall->state=$eventname; | ||
| 832 | $crmcall->status=$dialstatus; | ||
| 833 | $crmcall->uniqueid=$uniqueid; | ||
| 834 | |||
| 835 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 836 | if($dialline && $dialstatus=="ANSWER") | ||
| 837 | { | ||
| 838 | $dialline->channel=$dchannel; | ||
| 839 | $dialline->uniqueid=$uniqueid; | ||
| 840 | $dialline->status="Auto"; | ||
| 841 | $dialline->save(); | ||
| 842 | } | ||
| 843 | |||
| 844 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); | ||
| 845 | |||
| 846 | $crmcall->type="Auto"; | ||
| 847 | $crmcall->save(); | ||
| 848 | } | ||
| 849 | |||
| 850 | } | ||
| 851 | } | ||
| 852 | } | ||
| 853 | } | ||
| 572 | private function UnknownEvent(EventMessage $event) | 854 | private function UnknownEvent(EventMessage $event) |
| 573 | { | 855 | { |
| 574 | $eventname=$event->getKey("Event"); | 856 | $eventname=$event->getKey("Event"); |
| ... | @@ -705,7 +987,7 @@ class KPAMIListen implements IEventListener | ... | @@ -705,7 +987,7 @@ class KPAMIListen implements IEventListener |
| 705 | $duniqueid=$event->getKey("DestUniqueid"); | 987 | $duniqueid=$event->getKey("DestUniqueid"); |
| 706 | 988 | ||
| 707 | $dialstatus=$event->getKey("DialStatus"); | 989 | $dialstatus=$event->getKey("DialStatus"); |
| 708 | 990 | Log::info('DialEnd===>'.$channel); | |
| 709 | if($accountcode!="") | 991 | if($accountcode!="") |
| 710 | { | 992 | { |
| 711 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel\n"; | 993 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel\n"; |
| ... | @@ -742,7 +1024,7 @@ class KPAMIListen implements IEventListener | ... | @@ -742,7 +1024,7 @@ class KPAMIListen implements IEventListener |
| 742 | $dialline=Dialline::find($crmcall->dialline_id); | 1024 | $dialline=Dialline::find($crmcall->dialline_id); |
| 743 | if($dialline) | 1025 | if($dialline) |
| 744 | { | 1026 | { |
| 745 | $dialline->channel=$dchannel; | 1027 | $dialline->channel=$channel; |
| 746 | $dialline->save(); | 1028 | $dialline->save(); |
| 747 | } | 1029 | } |
| 748 | 1030 | ||
| ... | @@ -758,13 +1040,42 @@ class KPAMIListen implements IEventListener | ... | @@ -758,13 +1040,42 @@ class KPAMIListen implements IEventListener |
| 758 | 1040 | ||
| 759 | //notify UI (only the sip id) | 1041 | //notify UI (only the sip id) |
| 760 | $newqueue=new Kqueue(); | 1042 | $newqueue=new Kqueue(); |
| 761 | $newqueue->sipNotify($tsip,"dialerUI","dialend","c",$crmcall->id."~".$crmcall->number."~".base64_encode($dchannel)); | 1043 | $newqueue->sipNotify($tsip,"dialerUI","dialend","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); |
| 762 | 1044 | ||
| 763 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); | 1045 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); |
| 764 | 1046 | ||
| 765 | $crmcall->save(); | 1047 | $crmcall->save(); |
| 766 | } | 1048 | } |
| 767 | } | 1049 | } |
| 1050 | else if($accountcodearr[1]=="a") // Code Added by AmolG: AutoDial | ||
| 1051 | { | ||
| 1052 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 1053 | if($crmcall) | ||
| 1054 | { | ||
| 1055 | $nowts=microtime(true)*1000; | ||
| 1056 | |||
| 1057 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 1058 | |||
| 1059 | $crmcall->state=$eventname; | ||
| 1060 | $crmcall->status=$dialstatus; | ||
| 1061 | $crmcall->uniqueid=$uniqueid; | ||
| 1062 | |||
| 1063 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 1064 | if($dialline && $dialstatus=="ANSWER") | ||
| 1065 | { | ||
| 1066 | $dialline->channel=$dchannel; | ||
| 1067 | $dialline->uniqueid=$uniqueid; | ||
| 1068 | $dialline->status="Auto"; | ||
| 1069 | $dialline->save(); | ||
| 1070 | } | ||
| 1071 | |||
| 1072 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); | ||
| 1073 | |||
| 1074 | $crmcall->type="Auto"; | ||
| 1075 | $crmcall->save(); | ||
| 1076 | } | ||
| 1077 | |||
| 1078 | } | ||
| 768 | } | 1079 | } |
| 769 | } | 1080 | } |
| 770 | } | 1081 | } |
| ... | @@ -1028,7 +1339,8 @@ class KPAMIListen implements IEventListener | ... | @@ -1028,7 +1339,8 @@ class KPAMIListen implements IEventListener |
| 1028 | private function redirectIncoming() | 1339 | private function redirectIncoming() |
| 1029 | { | 1340 | { |
| 1030 | 1341 | ||
| 1031 | $diallines=Dialline::where('server','=',$this->sipip)->where("status","=","Inbound")->where("conf","=","")->get(); | 1342 | //$diallines=Dialline::where('server','=',$this->sipip)->where("status","=","Inbound")->where("conf","=","")->get(); |
| 1343 | $diallines=Dialline::where('server','=',$this->sipip)->whereIn("status",["Inbound","Auto"])->where("conf","=","")->get(); | ||
| 1032 | if($diallines) | 1344 | if($diallines) |
| 1033 | { | 1345 | { |
| 1034 | foreach($diallines as $dialline) | 1346 | foreach($diallines as $dialline) |
| ... | @@ -1099,7 +1411,30 @@ class KPAMIListen implements IEventListener | ... | @@ -1099,7 +1411,30 @@ class KPAMIListen implements IEventListener |
| 1099 | $first_r=0;$first_w=0;$first_a=0;$allsipids=array(); | 1411 | $first_r=0;$first_w=0;$first_a=0;$allsipids=array(); |
| 1100 | foreach($sipids as $sipid) | 1412 | foreach($sipids as $sipid) |
| 1101 | { | 1413 | { |
| 1102 | if($sipid->ready==1) | 1414 | //if($sipid->ready==1) |
| 1415 | if($sipid->ready==1&&$sipid->prepare_call==0&&$dialline->status=="Inbound") | ||
| 1416 | { | ||
| 1417 | $clientsarr=json_decode($sipid->clients,true); | ||
| 1418 | if($crmcall->client=="")$first_a=$sipid; | ||
| 1419 | else | ||
| 1420 | { | ||
| 1421 | if($clientsarr['a']!="")$clientaarr = explode(",", $clientsarr['a']); | ||
| 1422 | if(isset($clientsarr['a'])&&in_array($crmcall->client, $clientaarr))$first_a=$sipid; | ||
| 1423 | if($clientsarr['w']!="")$clientwarr = explode(",", $clientsarr['w']); | ||
| 1424 | if(isset($clientsarr['w'])&&in_array($crmcall->client, $clientwarr))$first_w=$sipid; | ||
| 1425 | if($clientsarr['r']!="")$clientrarr = explode(",", $clientsarr['r']); | ||
| 1426 | if(isset($clientsarr['r'])&&in_array($crmcall->client, $clientrarr))$first_r=$sipid; | ||
| 1427 | } | ||
| 1428 | } | ||
| 1429 | else | ||
| 1430 | { | ||
| 1431 | $allsipids[]=$sipid; | ||
| 1432 | } | ||
| 1433 | } | ||
| 1434 | |||
| 1435 | foreach($sipids as $sipid) | ||
| 1436 | { | ||
| 1437 | if($sipid->ready==1&&$sipid->prepare_call==1&&$dialline->status=="Auto") | ||
| 1103 | { | 1438 | { |
| 1104 | $clientsarr=json_decode($sipid->clients,true); | 1439 | $clientsarr=json_decode($sipid->clients,true); |
| 1105 | if($crmcall->client=="")$first_a=$sipid; | 1440 | if($crmcall->client=="")$first_a=$sipid; |
| ... | @@ -1163,8 +1498,13 @@ class KPAMIListen implements IEventListener | ... | @@ -1163,8 +1498,13 @@ class KPAMIListen implements IEventListener |
| 1163 | 1498 | ||
| 1164 | $dialline->conf="1000".$found->id; | 1499 | $dialline->conf="1000".$found->id; |
| 1165 | $dialline->save(); | 1500 | $dialline->save(); |
| 1501 | if($crmcall->crm_id>0){ | ||
| 1502 | DB::table('records')->where('id',$crmcall->crm_id)->update(['filter_condition'=>'3','usr_id'=>$found->user]); | ||
| 1166 | 1503 | ||
| 1504 | } | ||
| 1167 | $found->ready=0; | 1505 | $found->ready=0; |
| 1506 | $found->prepare_call=0; | ||
| 1507 | $found->patched=1; | ||
| 1168 | $found->save(); | 1508 | $found->save(); |
| 1169 | 1509 | ||
| 1170 | $recfile=$crmcall->newRecFilePath(); | 1510 | $recfile=$crmcall->newRecFilePath(); |
| ... | @@ -1195,8 +1535,13 @@ class KPAMIListen implements IEventListener | ... | @@ -1195,8 +1535,13 @@ class KPAMIListen implements IEventListener |
| 1195 | { | 1535 | { |
| 1196 | foreach($allsipids as $tsip) | 1536 | foreach($allsipids as $tsip) |
| 1197 | { | 1537 | { |
| 1198 | $newqueue=new Kqueue(); | 1538 | //$newqueue=new Kqueue(); |
| 1199 | $newqueue->sipNotify($tsip,"popupalert"," Incoming Calls",$crmcall->number."|".$crmcall->client,""); | 1539 | //$newqueue->sipNotify($tsip,"popupalert"," Incoming Calls",$crmcall->number."|".$crmcall->client,""); |
| 1540 | if($dialline->status!="Auto") | ||
| 1541 | { | ||
| 1542 | $newqueue=new Kqueue(); | ||
| 1543 | $newqueue->sipNotify($tsip,"popupalert"," Incoming Calls",$crmcall->number."|".$crmcall->client,""); | ||
| 1544 | } | ||
| 1200 | } | 1545 | } |
| 1201 | } | 1546 | } |
| 1202 | else | 1547 | else |
| ... | @@ -1319,7 +1664,11 @@ class KPAMIListen implements IEventListener | ... | @@ -1319,7 +1664,11 @@ class KPAMIListen implements IEventListener |
| 1319 | $redirect=new RedirectAction($data['fromext'], $data['toext'], $data['context'], 1); | 1664 | $redirect=new RedirectAction($data['fromext'], $data['toext'], $data['context'], 1); |
| 1320 | $res=$this->_client->send($redirect); | 1665 | $res=$this->_client->send($redirect); |
| 1321 | } | 1666 | } |
| 1322 | 1667 | else if($tqueue->key=="transfer") | |
| 1668 | { | ||
| 1669 | $attendedtransferaction=new AttendedTransferAction($data['channel'],$data['exten'],$data['context'],"1"); | ||
| 1670 | $res=$this->_client->send($attendedtransferaction); | ||
| 1671 | } | ||
| 1323 | $tqueue->delete(); | 1672 | $tqueue->delete(); |
| 1324 | } | 1673 | } |
| 1325 | } | 1674 | } | ... | ... |
| ... | @@ -61,7 +61,7 @@ kstychCall['supcomntid']=''; | ... | @@ -61,7 +61,7 @@ kstychCall['supcomntid']=''; |
| 61 | kstychCall['userdata']={}; | 61 | kstychCall['userdata']={}; |
| 62 | kstychCall['previewcrmid']=''; | 62 | kstychCall['previewcrmid']=''; |
| 63 | kstychCall['callWrapupTime']=180; | 63 | kstychCall['callWrapupTime']=180; |
| 64 | kstychCall['prograssiveDelay']=10; | 64 | kstychCall['prograssiveDelay']=20; |
| 65 | kstychCall['ts_now']=0; | 65 | kstychCall['ts_now']=0; |
| 66 | 66 | ||
| 67 | kstychCall['bttc_day']=''; | 67 | kstychCall['bttc_day']=''; |
| ... | @@ -560,6 +560,7 @@ function saveCloseDialerCall(flag) | ... | @@ -560,6 +560,7 @@ function saveCloseDialerCall(flag) |
| 560 | kstychCall['userstatus']=$('#dialer_userstatus').val(); | 560 | kstychCall['userstatus']=$('#dialer_userstatus').val(); |
| 561 | kstychCall['usersubstatus']=$('#dialer_usersubstatus').val(); | 561 | kstychCall['usersubstatus']=$('#dialer_usersubstatus').val(); |
| 562 | kstychCall['usercallback']=$('#dialer_usercallback').val(); | 562 | kstychCall['usercallback']=$('#dialer_usercallback').val(); |
| 563 | kstychCall['userappointment']=$('#dialer_appointment').val(); | ||
| 563 | kstychCall["attempt"]=$('#attempt').val();//attempt dropdown value insert | 564 | kstychCall["attempt"]=$('#attempt').val();//attempt dropdown value insert |
| 564 | 565 | ||
| 565 | //kstychCall['userremarks']=$('#dialer_userremarks').val(); | 566 | //kstychCall['userremarks']=$('#dialer_userremarks').val(); |
| ... | @@ -595,8 +596,12 @@ console.log(fullRem); | ... | @@ -595,8 +596,12 @@ console.log(fullRem); |
| 595 | { | 596 | { |
| 596 | kstychCall['userstatus']="AUTOWRAPUP"; | 597 | kstychCall['userstatus']="AUTOWRAPUP"; |
| 597 | kstychCall['usersubstatus']="AUTOWRAPUP"; | 598 | kstychCall['usersubstatus']="AUTOWRAPUP"; |
| 599 | |||
| 600 | |||
| 598 | $('#dialer_usercallback').val(""); | 601 | $('#dialer_usercallback').val(""); |
| 599 | kstychCall['usercallback']=""; | 602 | kstychCall['usercallback']=""; |
| 603 | $('#dialer_appointment').val(""); | ||
| 604 | kstychCall['userappointment']=""; | ||
| 600 | kstychCall['userremarks']=""; | 605 | kstychCall['userremarks']=""; |
| 601 | kstychCall['userflag']=""; | 606 | kstychCall['userflag']=""; |
| 602 | } | 607 | } |
| ... | @@ -606,6 +611,8 @@ console.log(fullRem); | ... | @@ -606,6 +611,8 @@ console.log(fullRem); |
| 606 | kstychCall['usersubstatus']="REDIAL"; | 611 | kstychCall['usersubstatus']="REDIAL"; |
| 607 | $('#dialer_usercallback').val(""); | 612 | $('#dialer_usercallback').val(""); |
| 608 | kstychCall['usercallback']=""; | 613 | kstychCall['usercallback']=""; |
| 614 | $('#dialer_appointment').val(""); | ||
| 615 | kstychCall['userappointment']=""; | ||
| 609 | kstychCall['userremarks']=""; | 616 | kstychCall['userremarks']=""; |
| 610 | kstychCall['userflag']=""; | 617 | kstychCall['userflag']=""; |
| 611 | 618 | ||
| ... | @@ -616,11 +623,13 @@ console.log(fullRem); | ... | @@ -616,11 +623,13 @@ console.log(fullRem); |
| 616 | kstychCall['userstatus']="NORECORD"; | 623 | kstychCall['userstatus']="NORECORD"; |
| 617 | kstychCall['usersubstatus']="NORECORD"; | 624 | kstychCall['usersubstatus']="NORECORD"; |
| 618 | kstychCall['usercallback']=""; | 625 | kstychCall['usercallback']=""; |
| 626 | kstychCall['userappointment']=""; | ||
| 619 | kstychCall['userremarks']=""; | 627 | kstychCall['userremarks']=""; |
| 620 | kstychCall['userflag']=""; | 628 | kstychCall['userflag']=""; |
| 621 | kstychCall["attempt"]=""; | 629 | kstychCall["attempt"]=""; |
| 622 | 630 | ||
| 623 | $('#dialer_usercallback').val(""); | 631 | $('#dialer_usercallback').val(""); |
| 632 | $('#dialer_appointment').val(""); | ||
| 624 | } | 633 | } |
| 625 | else | 634 | else |
| 626 | { | 635 | { |
| ... | @@ -677,6 +686,40 @@ console.log(fullRem); | ... | @@ -677,6 +686,40 @@ console.log(fullRem); |
| 677 | simpleNotification('error','topRight',"Please select Callback Time date within 9AM and 7PM"); | 686 | simpleNotification('error','topRight',"Please select Callback Time date within 9AM and 7PM"); |
| 678 | return; | 687 | return; |
| 679 | } | 688 | } |
| 689 | |||
| 690 | if(kstychCall['usersubstatus'].toLowerCase().indexOf("appointment")>-1||kstychCall['userstatus'].toLowerCase().indexOf("appointment")>-1) | ||
| 691 | { | ||
| 692 | if($('#dialer_appointment').val()=="") | ||
| 693 | { | ||
| 694 | //console.log("followup"); | ||
| 695 | simpleNotification('error','topRight',"Please select Appointment Date within one month in future"); | ||
| 696 | return; | ||
| 697 | } | ||
| 698 | } | ||
| 699 | else | ||
| 700 | { | ||
| 701 | if($('#dialer_appointment').val()!="") | ||
| 702 | { | ||
| 703 | simpleNotification('error','topRight',"You Cannot input Appointment date time in this Disposition"); | ||
| 704 | return; | ||
| 705 | } | ||
| 706 | } | ||
| 707 | |||
| 708 | var date3 = new Date($('#dialer_appointment').val()); | ||
| 709 | var diff = date3.getTime() - date1.getTime(); | ||
| 710 | if(diff<0||diff>30*24*60*60*1000) | ||
| 711 | { | ||
| 712 | simpleNotification('error','topRight',"Please select Appointment date within one month in future"); | ||
| 713 | return; | ||
| 714 | } | ||
| 715 | var hours = date3.getHours(); | ||
| 716 | var mins = date3.getMinutes(); | ||
| 717 | var fullhour=hours+(mins/60); | ||
| 718 | if(fullhour<9||fullhour>19) | ||
| 719 | { | ||
| 720 | simpleNotification('error','topRight',"Please select Appointment Time date within 9AM and 7PM"); | ||
| 721 | return; | ||
| 722 | } | ||
| 680 | 723 | ||
| 681 | } | 724 | } |
| 682 | 725 | ||
| ... | @@ -780,6 +823,8 @@ function showWrapUp() | ... | @@ -780,6 +823,8 @@ function showWrapUp() |
| 780 | kstychCall['usersubstatus']="WRAPUP"; | 823 | kstychCall['usersubstatus']="WRAPUP"; |
| 781 | $('#dialer_usercallback').val(""); | 824 | $('#dialer_usercallback').val(""); |
| 782 | kstychCall['usercallback']=""; | 825 | kstychCall['usercallback']=""; |
| 826 | kstychCall['usercallback']=""; | ||
| 827 | $('#dialer_appointment').val(""); | ||
| 783 | kstychCall['userremarks']=""; | 828 | kstychCall['userremarks']=""; |
| 784 | kstychCall['userflag']=""; | 829 | kstychCall['userflag']=""; |
| 785 | 830 | ||
| ... | @@ -812,9 +857,12 @@ function resetDialer() | ... | @@ -812,9 +857,12 @@ function resetDialer() |
| 812 | 857 | ||
| 813 | var dialerResetForceState=kstychDialer['mDialerState']; | 858 | var dialerResetForceState=kstychDialer['mDialerState']; |
| 814 | var dialerResetForceSubState=kstychDialer['mDialerSubState']; | 859 | var dialerResetForceSubState=kstychDialer['mDialerSubState']; |
| 815 | 860 | if(dialerResetForceSubState != "Predictive"){ | |
| 816 | dialerResetForceState="Progressive";//Hardcoded TODO change to config | 861 | dialerResetForceState="Progressive";//Hardcoded TODO change to config |
| 817 | dialerResetForceSubState=""; | 862 | dialerResetForceSubState=""; |
| 863 | } | ||
| 864 | //dialerResetForceState="Progressive";//Hardcoded TODO change to config | ||
| 865 | //dialerResetForceSubState=""; | ||
| 818 | 866 | ||
| 819 | if(kstychCall['userstatus']=="AUTOWRAPUP") | 867 | if(kstychCall['userstatus']=="AUTOWRAPUP") |
| 820 | { | 868 | { |
| ... | @@ -876,9 +924,19 @@ function resetCallArray() | ... | @@ -876,9 +924,19 @@ function resetCallArray() |
| 876 | 924 | ||
| 877 | kSetDData('C','previewcrmid',""); | 925 | kSetDData('C','previewcrmid',""); |
| 878 | kSetDData('C','callWrapupTime',180); | 926 | kSetDData('C','callWrapupTime',180); |
| 879 | kSetDData('C','prograssiveDelay',10); | 927 | kSetDData('C','prograssiveDelay',20); |
| 928 | |||
| 929 | } | ||
| 930 | |||
| 931 | function savedialermode(client) | ||
| 932 | { | ||
| 933 | var datastr="kstychCall="+JSON.stringify(kstychCall); | ||
| 934 | datastr+="&kstychDialer="+JSON.stringify(kstychDialer); | ||
| 935 | |||
| 936 | doAjax("dialer?action=usersel&client="+client,datastr,"","","singlefail","POST"); | ||
| 880 | } | 937 | } |
| 881 | 938 | ||
| 939 | |||
| 882 | function updateDialerState(objstr,key,val,key2,val2) | 940 | function updateDialerState(objstr,key,val,key2,val2) |
| 883 | { | 941 | { |
| 884 | if(objstr=="dialer") | 942 | if(objstr=="dialer") |
| ... | @@ -889,6 +947,9 @@ function updateDialerState(objstr,key,val,key2,val2) | ... | @@ -889,6 +947,9 @@ function updateDialerState(objstr,key,val,key2,val2) |
| 889 | { | 947 | { |
| 890 | if(!key2||key2=="")kSetDData("D","mDialerSubState",""); | 948 | if(!key2||key2=="")kSetDData("D","mDialerSubState",""); |
| 891 | 949 | ||
| 950 | $("#transferCallBtn").removeClass("show").addClass("hide"); | ||
| 951 | $("#transferHangBtn").removeClass("hide").addClass("show"); | ||
| 952 | |||
| 892 | if(val=="Paused") | 953 | if(val=="Paused") |
| 893 | { | 954 | { |
| 894 | resetCallArray(); | 955 | resetCallArray(); |
| ... | @@ -934,6 +995,8 @@ function updateDialerState(objstr,key,val,key2,val2) | ... | @@ -934,6 +995,8 @@ function updateDialerState(objstr,key,val,key2,val2) |
| 934 | 995 | ||
| 935 | updateDialerState(); | 996 | updateDialerState(); |
| 936 | }); | 997 | }); |
| 998 | //if(val2=="Predictive") | ||
| 999 | savedialermode(client); | ||
| 937 | } | 1000 | } |
| 938 | } | 1001 | } |
| 939 | if(objstr=="call") | 1002 | if(objstr=="call") |
| ... | @@ -1637,6 +1700,14 @@ recursiveDTMF(); | ... | @@ -1637,6 +1700,14 @@ recursiveDTMF(); |
| 1637 | charLen=0; | 1700 | charLen=0; |
| 1638 | } | 1701 | } |
| 1639 | 1702 | ||
| 1703 | function sendTHDTMFs(){ | ||
| 1704 | dtmfVal = "*2"; | ||
| 1705 | if(validateDTMF(dtmfVal) == false){simpleNotification("error","topRight", "Invalid DTMF");return;} | ||
| 1706 | |||
| 1707 | recursiveDTMF(); | ||
| 1708 | charLen=0; | ||
| 1709 | } | ||
| 1710 | |||
| 1640 | function recursiveDTMF() { | 1711 | function recursiveDTMF() { |
| 1641 | setTimeout(function(){ | 1712 | setTimeout(function(){ |
| 1642 | var dtmfKey = dtmfVal.charAt(charLen); | 1713 | var dtmfKey = dtmfVal.charAt(charLen); | ... | ... |
| ... | @@ -40,24 +40,35 @@ use App\Models\CRMCall; | ... | @@ -40,24 +40,35 @@ use App\Models\CRMCall; |
| 40 | $mastersdata=$wakka->getCompanyMaster($tclnt); | 40 | $mastersdata=$wakka->getCompanyMaster($tclnt); |
| 41 | if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"]; | 41 | if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"]; |
| 42 | 42 | ||
| 43 | 43 | $dispoarr = []; | |
| 44 | if(empty($mastersdata['dialerDispoList']))$mastersdata['dialerDispoList']=$wakka->HRCoreVars['dialerDispoList']; | 44 | if(!empty($mastersdata['dialerDispoList'])){ |
| 45 | 45 | // $mastersdata['dialerDispoList']=$wakka->HRCoreVars['dialerDispoList']; | |
| 46 | $dispoarr=explode("~",$mastersdata['dialerDispoList']); | 46 | $dispoarr=explode("~",$mastersdata['dialerDispoList']); |
| 47 | foreach($dispoarr as $dispo) | ||
| 48 | { | ||
| 49 | if(!empty($dispo)) | ||
| 50 | { | ||
| 51 | $dispoprts=explode("|",$dispo); | ||
| 52 | if(sizeof($dispoprts)>=3) | ||
| 53 | { | ||
| 54 | if(isset($dispoclassarr[$dispoprts[0]])) | ||
| 55 | { | ||
| 56 | $dispoclassarr[$dispoprts[0]][1][]=$dispoprts[1]; | ||
| 57 | } | ||
| 58 | } | ||
| 59 | } | ||
| 60 | } | 47 | } |
| 48 | |||
| 49 | if(count($dispoarr) > 0){ | ||
| 50 | foreach($dispoarr as $dispo){ | ||
| 51 | if(!empty($dispo)) | ||
| 52 | { | ||
| 53 | $dispoprts=explode("|",$dispo); | ||
| 54 | if(sizeof($dispoprts)>=3) | ||
| 55 | { | ||
| 56 | if(isset($dispoclassarr[$dispoprts[0]])) | ||
| 57 | { | ||
| 58 | $dispoclassarr[$dispoprts[0]][1][]=$dispoprts[1]; | ||
| 59 | } | ||
| 60 | } | ||
| 61 | } | ||
| 62 | } | ||
| 63 | }else{ | ||
| 64 | $dispositionPlan = $wakka->getDispositionList(); | ||
| 65 | foreach ($dispositionPlan as $key => $value) { | ||
| 66 | $disposition = $value->disposition; | ||
| 67 | $subDisposition = $value->sunDispoName; | ||
| 68 | $data.="dialerdispoarray['$disposition']='$subDisposition';"; | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 61 | } | 72 | } |
| 62 | foreach($didlinesstr as $k=>$dids) | 73 | foreach($didlinesstr as $k=>$dids) |
| 63 | { | 74 | { |
| ... | @@ -72,7 +83,7 @@ use App\Models\CRMCall; | ... | @@ -72,7 +83,7 @@ use App\Models\CRMCall; |
| 72 | //$currentstatuses=$wakka->LoadAll("select distinct currentstatus from records where currentstatus!='' $owclientstr"); | 83 | //$currentstatuses=$wakka->LoadAll("select distinct currentstatus from records where currentstatus!='' $owclientstr"); |
| 73 | //$legalstatuses=$wakka->LoadAll("select distinct legalstatus from records where legalstatus!='' $owclientstr"); | 84 | //$legalstatuses=$wakka->LoadAll("select distinct legalstatus from records where legalstatus!='' $owclientstr"); |
| 74 | 85 | ||
| 75 | $dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status"); | 86 | //$dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status"); |
| 76 | 87 | ||
| 77 | $countStatuses = array('New', 'Called'); | 88 | $countStatuses = array('New', 'Called'); |
| 78 | foreach ($countStatuses as $status) { | 89 | foreach ($countStatuses as $status) { |
| ... | @@ -103,59 +114,59 @@ use App\Models\CRMCall; | ... | @@ -103,59 +114,59 @@ use App\Models\CRMCall; |
| 103 | 114 | ||
| 104 | if($prevData=='MTD'&&$legalStatus!='SECONDARY') | 115 | if($prevData=='MTD'&&$legalStatus!='SECONDARY') |
| 105 | { | 116 | { |
| 106 | $dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); | 117 | //$dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); |
| 107 | 118 | ||
| 108 | $TotalData=$wakka->getCount("records","status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 119 | //$TotalData=$wakka->getCount("records","status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 109 | $NotCalled=$wakka->getCount("records","status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 120 | //$NotCalled=$wakka->getCount("records","status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 110 | $TotalCalled=$wakka->getCount("records","status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 121 | //$TotalCalled=$wakka->getCount("records","status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 111 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 122 | //$Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 112 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 123 | //$Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 113 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ | 124 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ |
| 114 | $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 125 | //$NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 115 | } | 126 | } |
| 116 | 127 | ||
| 117 | if($prevData=='YTD'&&$legalStatus!='SECONDARY') | 128 | if($prevData=='YTD'&&$legalStatus!='SECONDARY') |
| 118 | { | 129 | { |
| 119 | $ydispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,old_dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,old_dialer_status"); | 130 | /*$ydispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,old_dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,old_dialer_status"); |
| 120 | 131 | ||
| 121 | $TotalData=$wakka->getCount("records","old_status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 132 | $TotalData=$wakka->getCount("records","old_status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 122 | $NotCalled=$wakka->getCount("records","old_status='New' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 133 | $NotCalled=$wakka->getCount("records","old_status='New' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 123 | $TotalCalled=$wakka->getCount("records","old_status='Called' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 134 | $TotalCalled=$wakka->getCount("records","old_status='Called' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 124 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 135 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 125 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 136 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");*/ |
| 126 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");*/ | 137 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");*/ |
| 127 | $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 138 | //$NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 128 | } | 139 | } |
| 129 | 140 | ||
| 130 | if($prevData=='MTD'&&$legalStatus=='SECONDARY') | 141 | if($prevData=='MTD'&&$legalStatus=='SECONDARY') |
| 131 | { | 142 | { |
| 132 | $dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); | 143 | /*$dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); |
| 133 | 144 | ||
| 134 | $TotalData=$wakka->getCount("records","status IN ('New', 'Called','Noqueue') and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 145 | $TotalData=$wakka->getCount("records","status IN ('New', 'Called','Noqueue') and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 135 | $NotCalled=$wakka->getCount("records","status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 146 | $NotCalled=$wakka->getCount("records","status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 136 | $TotalCalled=$wakka->getCount("records","status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 147 | $TotalCalled=$wakka->getCount("records","status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 137 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 148 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 138 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 149 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ |
| 139 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ | 150 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ |
| 140 | $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 151 | // $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 141 | } | 152 | } |
| 142 | 153 | ||
| 143 | if($prevData=='YTD'&&$legalStatus=='SECONDARY') | 154 | if($prevData=='YTD'&&$legalStatus=='SECONDARY') |
| 144 | { | 155 | { |
| 145 | $ydispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,old_dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,old_dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); | 156 | /* $ydispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,old_dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,old_dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); |
| 146 | 157 | ||
| 147 | $TotalData=$wakka->getCount("records","old_status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 158 | $TotalData=$wakka->getCount("records","old_status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 148 | $NotCalled=$wakka->getCount("records","old_status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 159 | $NotCalled=$wakka->getCount("records","old_status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 149 | $TotalCalled=$wakka->getCount("records","old_status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 160 | $TotalCalled=$wakka->getCount("records","old_status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 150 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 161 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 151 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 162 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 152 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ | 163 | */ /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ |
| 153 | $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 164 | /* $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ |
| 154 | } | 165 | } |
| 155 | 166 | ||
| 156 | $MissedCalls=0; | 167 | $MissedCalls=0; |
| 157 | 168 | ||
| 158 | $udidlinesstr = array(); | 169 | /*$udidlinesstr = array(); |
| 159 | foreach($didlinesstr as $didlinestr){ | 170 | foreach($didlinesstr as $didlinestr){ |
| 160 | $didlinestrArr=explode(":",$didlinestr); | 171 | $didlinestrArr=explode(":",$didlinestr); |
| 161 | $udidlinesstr[] = substr($didlinestrArr[0], env('didnumber')); | 172 | $udidlinesstr[] = substr($didlinestrArr[0], env('didnumber')); |
| ... | @@ -164,8 +175,8 @@ use App\Models\CRMCall; | ... | @@ -164,8 +175,8 @@ use App\Models\CRMCall; |
| 164 | $mc=CRMCall::where('userstatus','=','InboundDROP')->where('created_at','>','2018-09-11 00:00:00')->where('created_at','>',date('Y-m-d H:i:s',time()-(7*24*60*60))); | 175 | $mc=CRMCall::where('userstatus','=','InboundDROP')->where('created_at','>','2018-09-11 00:00:00')->where('created_at','>',date('Y-m-d H:i:s',time()-(7*24*60*60))); |
| 165 | $mc=$mc->where(function ($query) use($roclientlst,$udidlinesstr){ | 176 | $mc=$mc->where(function ($query) use($roclientlst,$udidlinesstr){ |
| 166 | $query->orWhereIn('client',$roclientlst)->orWhereIn('did',$udidlinesstr); | 177 | $query->orWhereIn('client',$roclientlst)->orWhereIn('did',$udidlinesstr); |
| 167 | }); | 178 | });*/ |
| 168 | $mc=$mc->get(); | 179 | /* $mc=$mc->get(); |
| 169 | 180 | ||
| 170 | $number_list=array(); | 181 | $number_list=array(); |
| 171 | foreach($mc as $key=>$tcall) | 182 | foreach($mc as $key=>$tcall) |
| ... | @@ -195,7 +206,7 @@ use App\Models\CRMCall; | ... | @@ -195,7 +206,7 @@ use App\Models\CRMCall; |
| 195 | $MissedCalls++; | 206 | $MissedCalls++; |
| 196 | } | 207 | } |
| 197 | } | 208 | } |
| 198 | } | 209 | }*/ |
| 199 | 210 | ||
| 200 | $callstoday=CRMCall::where("created_at",">=",date("Y-m-d 00:00:00"))->where("user_id","=",Auth::user()->id)->count(); | 211 | $callstoday=CRMCall::where("created_at",">=",date("Y-m-d 00:00:00"))->where("user_id","=",Auth::user()->id)->count(); |
| 201 | $callsmonth=CRMCall::where("created_at",">=",date("Y-m-01 00:00:00"))->where("user_id","=",Auth::user()->id)->count(); | 212 | $callsmonth=CRMCall::where("created_at",">=",date("Y-m-01 00:00:00"))->where("user_id","=",Auth::user()->id)->count(); |
| ... | @@ -210,38 +221,50 @@ use App\Models\CRMCall; | ... | @@ -210,38 +221,50 @@ use App\Models\CRMCall; |
| 210 | // role== user | 221 | // role== user |
| 211 | // all | 222 | // all |
| 212 | if($role == 'User'){ | 223 | if($role == 'User'){ |
| 224 | $TotalCalled= 0; | ||
| 225 | $contactedTotalCalled=0; | ||
| 226 | $calllog = []; | ||
| 227 | $campaignTotalCalled=0; | ||
| 228 | $campaignContactedTotalCalled=0; | ||
| 229 | $campaignFollowupCount = []; | ||
| 230 | $totalAppointmentCount = []; | ||
| 231 | $campaignAppointmentCount = []; | ||
| 232 | |||
| 213 | 233 | ||
| 214 | $TotalCalled=$wakka->getCount("crmcalls","user_id = $userId and created_at > '".date("Y-m-d 03:00:00")."'"); | 234 | //$TotalCalled=$wakka->getCount("crmcalls","user_id = $userId and created_at > '".date("Y-m-d 03:00:00")."'"); |
| 215 | $contactedTotalCalled=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id = $userId and created_at > '".date("Y-m-d 03:00:00")."'"); | 235 | $contactedTotalCalled=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id = $userId and created_at > '".date("Y-m-d 03:00:00")."'"); |
| 216 | 236 | ||
| 217 | $calllog = DB::table('records') | 237 | $calllog = DB::table('records') |
| 218 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | 238 | ->select('customer_name', 'cust_id', 'mobile', 'dialer_callback', 'status','dialer_lastcall','id','dialer_status','client') |
| 219 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | 239 | ->where("usr_id",$userId) |
| 220 | ->where("records.usr_id",$userId) | 240 | ->where("dialer_callback", "!=","0000-00-00 00:00:00") |
| 221 | //->where("records.dialer_substatus","Follow Up") | 241 | ->get(); |
| 222 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") | 242 | |
| 223 | //->where("crmcalls.usercallback", "!=","0000-00-00 00:00:00") | 243 | $totalAppointmentCount = DB::table('records') |
| 224 | //->where("crmcalls.created_at", ">",date("Y-m-d 08:00:00")) | 244 | ->select('customer_name', 'cust_id', 'mobile', 'dialer_appointment', 'status','dialer_lastcall','id','dialer_status','client') |
| 225 | //->where("crmcalls_archive.usercallback", "=","records.dialer_callback") | 245 | ->where("usr_id",$userId) |
| 226 | //->where("records.dialer_lastcall", "<=","crmcalls_archive.usercallback") | 246 | ->where("dialer_appointment", "!=","0000-00-00 00:00:00") |
| 247 | ->where('dialer_appointment','>',date('Y-m-d H:i:s',time()-(7*24*60*60))) | ||
| 227 | ->get(); | 248 | ->get(); |
| 228 | 249 | ||
| 229 | // campaign | 250 | // campaign |
| 230 | $campaignTotalCalled=$wakka->getCount("crmcalls","user_id = $userId and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); | 251 | //$campaignTotalCalled=$wakka->getCount("crmcalls","user_id = $userId and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); |
| 231 | 252 | ||
| 232 | $campaignContactedTotalCalled=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id = $userId and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); | 253 | $campaignContactedTotalCalled=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id = $userId and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); |
| 233 | 254 | ||
| 234 | $campaignFollowupCount = DB::table('records') | 255 | $campaignFollowupCount = DB::table('records') |
| 235 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | 256 | ->select('customer_name', 'cust_id', 'mobile', 'dialer_callback', 'status','dialer_lastcall','id','dialer_status','client') |
| 236 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | 257 | ->where("usr_id",$userId) |
| 237 | ->where("records.usr_id",$userId) | 258 | ->where("dialer_callback", "!=","0000-00-00 00:00:00") |
| 238 | //->where("records.dialer_substatus","Follow Up") | 259 | ->where('client', '=', $client) |
| 239 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") | 260 | ->get(); |
| 240 | //->where("crmcalls.usercallback", "!=","0000-00-00 00:00:00") | 261 | |
| 241 | //->where("crmcalls.created_at", ">",date("Y-m-d 08:00:00")) | 262 | $campaignAppointmentCount = DB::table('records') |
| 242 | //->where("crmcalls_archive.usercallback", "=","records.dialer_callback") | 263 | ->select('customer_name', 'cust_id', 'mobile', 'dialer_appointment', 'status','dialer_lastcall','id','dialer_status','client') |
| 243 | //->where("records.dialer_lastcall", "<=","crmcalls_archive.usercallback") | 264 | ->where("usr_id",$userId) |
| 244 | ->where('records.client', '=', $client) | 265 | ->where("dialer_appointment", "!=","0000-00-00 00:00:00") |
| 266 | ->where('client', '=', $client) | ||
| 267 | ->where('dialer_appointment','>',date('Y-m-d H:i:s',time()-(7*24*60*60))) | ||
| 245 | ->get(); | 268 | ->get(); |
| 246 | 269 | ||
| 247 | }else if($role == 'Supervisor'){ | 270 | }else if($role == 'Supervisor'){ |
| ... | @@ -250,16 +273,20 @@ use App\Models\CRMCall; | ... | @@ -250,16 +273,20 @@ use App\Models\CRMCall; |
| 250 | $userName = Auth::user()->username; | 273 | $userName = Auth::user()->username; |
| 251 | $supervisorUsers=$wakka->LoadAll("select id from users where supervisor='$userName';"); | 274 | $supervisorUsers=$wakka->LoadAll("select id from users where supervisor='$userName';"); |
| 252 | $userIds = []; | 275 | $userIds = []; |
| 276 | //print_r($supervisorUsers); | ||
| 253 | foreach ($supervisorUsers as $key => $value) $userIds[] = "'".$value['id']."'"; | 277 | foreach ($supervisorUsers as $key => $value) $userIds[] = "'".$value['id']."'"; |
| 254 | $supervisorUsers = implode(",",$userIds); | 278 | $supervisorUsers = implode(",",$userIds); |
| 255 | 279 | ||
| 256 | $supervisorTotalCalled = 0; | 280 | $supervisorTotalCalled = 0; |
| 257 | $supervisorContacted = 0; | 281 | $supervisorContacted = 0; |
| 258 | $supervisorCallLog = 0; | 282 | $supervisorCallLog = 0; |
| 283 | $supervisorAppointmentCount = 0; | ||
| 284 | |||
| 259 | 285 | ||
| 260 | $supervisorCampaignTotalCalled = 0; | 286 | $supervisorCampaignTotalCalled = 0; |
| 261 | $supervisorCampaignContacted = 0; | 287 | $supervisorCampaignContacted = 0; |
| 262 | $supervisorCampaignCallLog = 0; | 288 | $supervisorCampaignCallLog = 0; |
| 289 | $supervisorcampaignAppointCount = 0; | ||
| 263 | 290 | ||
| 264 | 291 | ||
| 265 | if(!empty($supervisorUsers)){ | 292 | if(!empty($supervisorUsers)){ |
| ... | @@ -270,18 +297,22 @@ use App\Models\CRMCall; | ... | @@ -270,18 +297,22 @@ use App\Models\CRMCall; |
| 270 | 297 | ||
| 271 | 298 | ||
| 272 | $supervisorCallLog = $calllog = DB::table('records') | 299 | $supervisorCallLog = $calllog = DB::table('records') |
| 273 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | ||
| 274 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | 300 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') |
| 275 | ->whereIn("records.usr_id",[$supervisorUsers]) | 301 | ->whereIn("records.usr_id",[$supervisorUsers]) |
| 276 | //->where("records.dialer_substatus","Follow Up") | ||
| 277 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") | 302 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") |
| 278 | //->where("crmcalls.usercallback", "!=","0000-00-00 00:00:00") | ||
| 279 | //->where("crmcalls.created_at", ">",date("Y-m-d 08:00:00")) | ||
| 280 | //->where("crmcalls_archive.usercallback", "=","records.dialer_callback") | ||
| 281 | //->where("records.dialer_lastcall", "<=","crmcalls_archive.usercallback") | ||
| 282 | ->get(); | 303 | ->get(); |
| 283 | 304 | ||
| 284 | $supervisorCallLog = count($supervisorCallLog); | 305 | $supervisorCallLog = count($supervisorCallLog); |
| 306 | |||
| 307 | /*$supervisorAppointmentCount = DB::table('records') | ||
| 308 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_appointment', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | ||
| 309 | ->whereIn("records.usr_id",[$supervisorUsers]) | ||
| 310 | //->where("records.dialer_appointment", "!=","0000-00-00 00:00:00") | ||
| 311 | ->where('records.dialer_appointment','>',date('Y-m-d H:i:s',time()-(7*24*60*60))) | ||
| 312 | ->get();*/ | ||
| 313 | $supervisorAppointmentCount = DB::select('select customer_name,cust_id,mobile,dialer_appointment,status,dialer_lastcall,client from records where usr_id in ('.$supervisorUsers.') and dialer_appointment>"'.date("Y-m-d H:i:s",time()-(7*24*60*60)).'"'); | ||
| 314 | //print_r($supervisorAppointmentCount); | ||
| 315 | $supervisorAppointmentCount = count($supervisorAppointmentCount); | ||
| 285 | // campaign | 316 | // campaign |
| 286 | 317 | ||
| 287 | $supervisorCampaignTotalCalled=$wakka->getCount("crmcalls","user_id IN ($supervisorUsers) and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); | 318 | $supervisorCampaignTotalCalled=$wakka->getCount("crmcalls","user_id IN ($supervisorUsers) and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); |
| ... | @@ -290,18 +321,22 @@ use App\Models\CRMCall; | ... | @@ -290,18 +321,22 @@ use App\Models\CRMCall; |
| 290 | 321 | ||
| 291 | 322 | ||
| 292 | $supervisorCampaignCallLog = $calllog = DB::table('records') | 323 | $supervisorCampaignCallLog = $calllog = DB::table('records') |
| 293 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | ||
| 294 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | 324 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') |
| 295 | ->whereIn("records.usr_id",[$supervisorUsers]) | 325 | ->whereIn("records.usr_id",[$supervisorUsers]) |
| 296 | //->where("records.dialer_substatus","Follow Up") | ||
| 297 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") | 326 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") |
| 298 | //->where("crmcalls.usercallback", "!=","0000-00-00 00:00:00") | ||
| 299 | //->where("crmcalls.created_at", ">",date("Y-m-d 08:00:00")) | ||
| 300 | //->where("crmcalls_archive.usercallback", "=","records.dialer_callback") | ||
| 301 | //->where("records.dialer_lastcall", "<=","crmcalls_archive.usercallback") | ||
| 302 | ->where('records.client', '=', $client) | 327 | ->where('records.client', '=', $client) |
| 303 | ->get(); | 328 | ->get(); |
| 304 | $supervisorCampaignCallLog = count($supervisorCampaignCallLog); | 329 | $supervisorCampaignCallLog = count($supervisorCampaignCallLog); |
| 330 | |||
| 331 | /*$supervisorcampaignAppointCount = DB::table('records') | ||
| 332 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_appointment', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | ||
| 333 | ->whereIn("records.usr_id",[$supervisorUsers]) | ||
| 334 | ->where("records.dialer_appointment", "!=","0000-00-00 00:00:00") | ||
| 335 | ->where('records.client', '=', $client) | ||
| 336 | ->where('records.dialer_appointment','>',date("Y-m-d H:i:s",time()-(7*24*60*60))) | ||
| 337 | ->get();*/ | ||
| 338 | $supervisorcampaignAppointCount = DB::select('select customer_name,cust_id,mobile,dialer_appointment,status,dialer_lastcall,client from records where usr_id in ('.$supervisorUsers.') and client = "'.$client.'" and dialer_appointment>"'.date("Y-m-d H:i:s",time()-(7*24*60*60)).'"'); | ||
| 339 | $supervisorcampaignAppointCount = count($supervisorcampaignAppointCount); | ||
| 305 | } | 340 | } |
| 306 | 341 | ||
| 307 | } | 342 | } |
| ... | @@ -319,8 +354,20 @@ use App\Models\CRMCall; | ... | @@ -319,8 +354,20 @@ use App\Models\CRMCall; |
| 319 | <div class=col-md-5> | 354 | <div class=col-md-5> |
| 320 | <select class='form-control selcls' id=tcampaign_select onchange='campaignSelect();'> | 355 | <select class='form-control selcls' id=tcampaign_select onchange='campaignSelect();'> |
| 321 | <?php $s=""; $i = 0; | 356 | <?php $s=""; $i = 0; |
| 357 | /* $campaignList = DB::select('select client from records group by client'); | ||
| 358 | $cab = array(); | ||
| 359 | foreach($campaignList as $camp){ | ||
| 360 | //print_r($a->client); | ||
| 361 | $cab[]=$camp->client; | ||
| 362 | }*/ | ||
| 322 | foreach($roclientlst as $c){ | 363 | foreach($roclientlst as $c){ |
| 323 | $c=trim($c); | 364 | $c=trim($c); |
| 365 | /*if(in_array($c,$cab)){ | ||
| 366 | $c=$c; | ||
| 367 | }else{ | ||
| 368 | continue; | ||
| 369 | } | ||
| 370 | */ | ||
| 324 | if(!empty($c)){ | 371 | if(!empty($c)){ |
| 325 | //if($c==$client)$s='selected'; | 372 | //if($c==$client)$s='selected'; |
| 326 | if($i == 0)$s='selected'; | 373 | if($i == 0)$s='selected'; |
| ... | @@ -343,14 +390,14 @@ use App\Models\CRMCall; | ... | @@ -343,14 +390,14 @@ use App\Models\CRMCall; |
| 343 | <div class="row"><div class="col-sm-4"><h4>Total</h4></div></div> | 390 | <div class="row"><div class="col-sm-4"><h4>Total</h4></div></div> |
| 344 | 391 | ||
| 345 | <div class="row"> | 392 | <div class="row"> |
| 346 | <div class="col-sm-4 bot"> | 393 | <!--<div class="col-sm-4 bot"> |
| 347 | <div class="new1" style="color:white;"> | 394 | <div class="new1" style="color:white;"> |
| 348 | <div class="text"> | 395 | <div class="text"> |
| 349 | <var><?php echo $TotalCalled; ?></var> | 396 | <var><?php //echo $TotalCalled; ?></var> |
| 350 | </div> | 397 | </div> |
| 351 | Called | 398 | Called |
| 352 | </div> | 399 | </div> |
| 353 | </div> | 400 | </div>--> |
| 354 | 401 | ||
| 355 | <div class="col-sm-4 bot"> | 402 | <div class="col-sm-4 bot"> |
| 356 | <div class="new1" style="color:white;"> | 403 | <div class="new1" style="color:white;"> |
| ... | @@ -371,19 +418,29 @@ use App\Models\CRMCall; | ... | @@ -371,19 +418,29 @@ use App\Models\CRMCall; |
| 371 | </div> | 418 | </div> |
| 372 | </a> | 419 | </a> |
| 373 | </div> | 420 | </div> |
| 421 | <div class="col-sm-4 bot"> | ||
| 422 | <a href="javascript:;" onclick="loadAppointmentData('all');" style="color:white;"> | ||
| 423 | <div class="new1" style="color:white;"> | ||
| 424 | <div class="text"> | ||
| 425 | <var><?php echo count($totalAppointmentCount); ?></var> | ||
| 426 | </div> | ||
| 427 | Appointment Fixed | ||
| 428 | </div> | ||
| 429 | </a> | ||
| 430 | </div> | ||
| 374 | </div> | 431 | </div> |
| 375 | 432 | ||
| 376 | <div class="row"><div class="col-sm-4"><h4>Campaign Wise</h4></div></div> | 433 | <div class="row"><div class="col-sm-4"><h4>Campaign Wise</h4></div></div> |
| 377 | 434 | ||
| 378 | <div class="row"> | 435 | <div class="row"> |
| 379 | <div class="col-sm-4 bot"> | 436 | <!---<div class="col-sm-4 bot"> |
| 380 | <div class="new1" style="color:white;"> | 437 | <div class="new1" style="color:white;"> |
| 381 | <div class="text"> | 438 | <div class="text"> |
| 382 | <var><?php echo $campaignTotalCalled; ?></var> | 439 | <var><?php //echo $campaignTotalCalled; ?></var> |
| 383 | </div> | 440 | </div> |
| 384 | Called | 441 | Called |
| 385 | </div> | 442 | </div> |
| 386 | </div> | 443 | </div>--> |
| 387 | 444 | ||
| 388 | <div class="col-sm-4 bot"> | 445 | <div class="col-sm-4 bot"> |
| 389 | <div class="new1" style="color:white;"> | 446 | <div class="new1" style="color:white;"> |
| ... | @@ -404,6 +461,16 @@ use App\Models\CRMCall; | ... | @@ -404,6 +461,16 @@ use App\Models\CRMCall; |
| 404 | </div> | 461 | </div> |
| 405 | </a> | 462 | </a> |
| 406 | </div> | 463 | </div> |
| 464 | <div class="col-sm-4 bot"> | ||
| 465 | <a href="javascript:;" onclick="loadAppointmentData('campaign');" style="color:white;"> | ||
| 466 | <div class="new1" style="color:white;"> | ||
| 467 | <div class="text"> | ||
| 468 | <var><?php echo count($campaignAppointmentCount); ?></var> | ||
| 469 | </div> | ||
| 470 | Appointment Fixed | ||
| 471 | </div> | ||
| 472 | </a> | ||
| 473 | </div> | ||
| 407 | 474 | ||
| 408 | </div> | 475 | </div> |
| 409 | <!-- <div class="row"><div class="col-sm-4"><h4>Total</h4></div></div> | 476 | <!-- <div class="row"><div class="col-sm-4"><h4>Total</h4></div></div> |
| ... | @@ -656,7 +723,7 @@ use App\Models\CRMCall; | ... | @@ -656,7 +723,7 @@ use App\Models\CRMCall; |
| 656 | <?php } ?> | 723 | <?php } ?> |
| 657 | 724 | ||
| 658 | <script> | 725 | <script> |
| 659 | 726 | client = $('#tcampaign_select').val(); | |
| 660 | <?php if($client){?> | 727 | <?php if($client){?> |
| 661 | $("#tcampaign_select").val('<?=$client?>'); | 728 | $("#tcampaign_select").val('<?=$client?>'); |
| 662 | <?php }?> | 729 | <?php }?> |
| ... | @@ -679,11 +746,20 @@ function loadFollowupData(val) | ... | @@ -679,11 +746,20 @@ function loadFollowupData(val) |
| 679 | doAjax(menu+"?client="+$("#tcampaign_select").val()+"&selection="+val,'','content','ajax_'+menu,'singlethis','GET'); | 746 | doAjax(menu+"?client="+$("#tcampaign_select").val()+"&selection="+val,'','content','ajax_'+menu,'singlethis','GET'); |
| 680 | } | 747 | } |
| 681 | 748 | ||
| 749 | function loadAppointmentData(val) | ||
| 750 | { | ||
| 751 | var menu = "dialer/loadAppointmentData"; | ||
| 752 | doAjax(menu+"?client="+$("#tcampaign_select").val()+"&selection="+val,'','content','ajax_'+menu,'singlethis','GET'); | ||
| 753 | } | ||
| 754 | |||
| 682 | 755 | ||
| 683 | function campaignSelect() | 756 | function campaignSelect() |
| 684 | { | 757 | { |
| 685 | var dashlet="Dialer"; | 758 | var dashlet="Dialer"; |
| 759 | var client = $('#tcampaign_select').val(); | ||
| 760 | console.log(); | ||
| 686 | doAjax("dashboard/dashlet?module="+dashlet+"&client="+$("#tcampaign_select").val(),"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); | 761 | doAjax("dashboard/dashlet?module="+dashlet+"&client="+$("#tcampaign_select").val(),"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); |
| 762 | savedialermode(client); | ||
| 687 | } | 763 | } |
| 688 | 764 | ||
| 689 | function dataSelect() | 765 | function dataSelect() |
| ... | @@ -695,6 +771,7 @@ function dataSelect() | ... | @@ -695,6 +771,7 @@ function dataSelect() |
| 695 | 771 | ||
| 696 | var dashlet="Dialer"; | 772 | var dashlet="Dialer"; |
| 697 | doAjax("dashboard/dashlet?module="+dashlet+"&client="+client+"&prev="+prev+"¤tStatus="+currentStatus+"&legalStatus="+legalStatus,"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); | 773 | doAjax("dashboard/dashlet?module="+dashlet+"&client="+client+"&prev="+prev+"¤tStatus="+currentStatus+"&legalStatus="+legalStatus,"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); |
| 774 | savedialermode(client); | ||
| 698 | } | 775 | } |
| 699 | 776 | ||
| 700 | function bucketSelect() | 777 | function bucketSelect() |
| ... | @@ -708,15 +785,16 @@ function bucketSelect() | ... | @@ -708,15 +785,16 @@ function bucketSelect() |
| 708 | var client = $("#tcampaign_select").val(); | 785 | var client = $("#tcampaign_select").val(); |
| 709 | 786 | ||
| 710 | var dashlet="Dialer"; | 787 | var dashlet="Dialer"; |
| 711 | |||
| 712 | doAjax("dashboard/status?module="+dashlet+"&client="+client+"&prev="+prev+"¤tStatus="+currentStatus+"&legalStatus="+legalStatus,"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); | 788 | doAjax("dashboard/status?module="+dashlet+"&client="+client+"&prev="+prev+"¤tStatus="+currentStatus+"&legalStatus="+legalStatus,"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); |
| 713 | } | 789 | } |
| 714 | //bucketSelect(); | 790 | //bucketSelect(); |
| 715 | 791 | ||
| 716 | function dialerLoadData(listname,currentstatus,legalstatus,page,skey,stxt) | 792 | function dialerLoadData(listname,currentstatus,legalstatus,page,skey,stxt) |
| 717 | { | 793 | { |
| 794 | //var client=$("#tcampaign_select").val(); | ||
| 718 | 795 | ||
| 719 | doAjax("dialer/bucketdata","client={!!$client!!}&bucket="+listname+"¤tstatus="+currentstatus+"&legalstatus="+legalstatus+'&page='+page+'&skey='+skey+'&stxt='+stxt,"bucketlistdiv","ajax_dialer_list","singlefail","GET"); | 796 | doAjax("dialer/bucketdata","client={!!$client!!}&bucket="+listname+"¤tstatus="+currentstatus+"&legalstatus="+legalstatus+'&page='+page+'&skey='+skey+'&stxt='+stxt,"bucketlistdiv","ajax_dialer_list","singlefail","GET"); |
| 797 | savedialermode("{!!$client!!}"); | ||
| 720 | } | 798 | } |
| 721 | dialerLoadData('CurrentQueue','','',1,'',''); | 799 | dialerLoadData('CurrentQueue','','',1,'',''); |
| 722 | </script> | 800 | </script> |
| ... | @@ -764,4 +842,4 @@ dialerLoadData('CurrentQueue','','',1,'',''); | ... | @@ -764,4 +842,4 @@ dialerLoadData('CurrentQueue','','',1,'',''); |
| 764 | 842 | ||
| 765 | } | 843 | } |
| 766 | 844 | ||
| 767 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 845 | </style> | ... | ... |
| ... | @@ -40,6 +40,7 @@ $searchkey3=trim(Input::get('maintextsearch_3_span')); | ... | @@ -40,6 +40,7 @@ $searchkey3=trim(Input::get('maintextsearch_3_span')); |
| 40 | $searchstr4=trim(Input::get('maintextsearch_4_txt')); | 40 | $searchstr4=trim(Input::get('maintextsearch_4_txt')); |
| 41 | $searchkey4=trim(Input::get('maintextsearch_4_span')); | 41 | $searchkey4=trim(Input::get('maintextsearch_4_span')); |
| 42 | 42 | ||
| 43 | $client=trim(Input::get('client')); | ||
| 43 | 44 | ||
| 44 | $uids=array(); | 45 | $uids=array(); |
| 45 | 46 | ||
| ... | @@ -66,12 +67,13 @@ if($searchstr1!="") | ... | @@ -66,12 +67,13 @@ if($searchstr1!="") |
| 66 | { | 67 | { |
| 67 | $matchkeys=array(); | 68 | $matchkeys=array(); |
| 68 | $prematchstr="";if(!empty($uids))$prematchstr="where id in (".implode(",",$uids).")"; | 69 | $prematchstr="";if(!empty($uids))$prematchstr="where id in (".implode(",",$uids).")"; |
| 69 | 70 | Log::info($client.'--->number 1'); | |
| 70 | $res=$wakka->LoadAll("select distinct $key from records $prematchstr"); | 71 | if($client!='')$records='records_'.$client;else $records='records'; |
| 72 | $res=$wakka->LoadAll("select distinct $key from $records $prematchstr"); | ||
| 71 | foreach($res as $tres)if($tres[$key]!=''&&stristr($tres[$key],$searchstr1))$matchkeys[]="'".$tres[$key]."'"; | 73 | foreach($res as $tres)if($tres[$key]!=''&&stristr($tres[$key],$searchstr1))$matchkeys[]="'".$tres[$key]."'"; |
| 72 | 74 | ||
| 73 | $prematchstr2="";if(!empty($uids))$prematchstr2="and id in (".implode(",",$uids).")"; | 75 | $prematchstr2="";if(!empty($uids))$prematchstr2="and id in (".implode(",",$uids).")"; |
| 74 | if(!empty($matchkeys))$tusers=$wakka->getPersonIDs("$key in (".implode(",",$matchkeys).") $prematchstr2"); | 76 | if(!empty($matchkeys))$tusers=$wakka->getPersonIDs("$key in (".implode(",",$matchkeys).") $prematchstr2",$client); |
| 75 | $uids=array();foreach($tusers as $tuser)if(isset($tuser['id']))$uids[]=$tuser['id']+0; | 77 | $uids=array();foreach($tusers as $tuser)if(isset($tuser['id']))$uids[]=$tuser['id']+0; |
| 76 | } | 78 | } |
| 77 | } | 79 | } |
| ... | @@ -182,8 +184,11 @@ if($searchstr4!="") | ... | @@ -182,8 +184,11 @@ if($searchstr4!="") |
| 182 | foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";} | 184 | foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";} |
| 183 | } | 185 | } |
| 184 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; | 186 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; |
| 187 | //$client=Input::get("client"); | ||
| 188 | Log::info($client."-->ABC---"); | ||
| 189 | Log::info($uids); | ||
| 185 | 190 | ||
| 186 | if(!empty($uids))$users=$wakka->getPersons("id in (".implode(",",$uids).") $roclientstr limit 200"); | 191 | if(!empty($uids))$users=$wakka->getPersons("id in (".implode(",",$uids).") $roclientstr limit 10;",$client); |
| 187 | 192 | ||
| 188 | if(!empty($users)) | 193 | if(!empty($users)) |
| 189 | { | 194 | { | ... | ... |
| ... | @@ -5,11 +5,9 @@ $wakka->setUserTimezone(); | ... | @@ -5,11 +5,9 @@ $wakka->setUserTimezone(); |
| 5 | $themehome=$wakka->GetThemePath('/'); | 5 | $themehome=$wakka->GetThemePath('/'); |
| 6 | $varid=Input::get('varid'); | 6 | $varid=Input::get('varid'); |
| 7 | $bkvarid=Input::get('bkvarid'); | 7 | $bkvarid=Input::get('bkvarid'); |
| 8 | |||
| 9 | $edituser=0;$noreaduser=0;$oldbkrec=0; | 8 | $edituser=0;$noreaduser=0;$oldbkrec=0; |
| 10 | $isuser=$wakka->GetUser()?1:0; | 9 | $isuser=$wakka->GetUser()?1:0; |
| 11 | $recruitdata=array(); | 10 | $recruitdata=array(); |
| 12 | |||
| 13 | if($varid=="0") | 11 | if($varid=="0") |
| 14 | { | 12 | { |
| 15 | return; | 13 | return; |
| ... | @@ -72,9 +70,9 @@ if($varid!=""||$isuser) | ... | @@ -72,9 +70,9 @@ if($varid!=""||$isuser) |
| 72 | } | 70 | } |
| 73 | else | 71 | else |
| 74 | { | 72 | { |
| 75 | 73 | ||
| 76 | $varid=intval($varid); | 74 | $varid=intval($varid); |
| 77 | $recruitdata=$wakka->getPerson($varid); | 75 | $recruitdata=$wakka->getPerson($varid,""); |
| 78 | } | 76 | } |
| 79 | 77 | ||
| 80 | 78 | ... | ... |
| ... | @@ -85,6 +85,7 @@ $(document).ready(function(){ | ... | @@ -85,6 +85,7 @@ $(document).ready(function(){ |
| 85 | { | 85 | { |
| 86 | //doAjax('social/{!!Auth::user()->id!!}','show=wizard','welcome_wizard_body','ajax_wizard_show','singlefail','GET'); | 86 | //doAjax('social/{!!Auth::user()->id!!}','show=wizard','welcome_wizard_body','ajax_wizard_show','singlefail','GET'); |
| 87 | } | 87 | } |
| 88 | $('#transferButton').popover({title: "<b>Transfer Current Call</b>", content: '<div class="input-group"><input type="text" class="form-control" placeholder="Number" id=transfercalltxt><span class="input-group-btn"><button class="btn btn-default" type="button" onclick="transfercallconf();return false;" id="transferCallBtn"><i class="glyphicon glyphicon-transfer"></i></button><button class="btn btn-danger hide" type="button" onclick="sendTHDTMFs();return false;" id="transferHangBtn">×</button></span></div>', html: true, placement: "bottom"}); | ||
| 88 | }); | 89 | }); |
| 89 | 90 | ||
| 90 | function hrmsSearch() | 91 | function hrmsSearch() |
| ... | @@ -198,35 +199,39 @@ function createSearchRecordDiv(divid) | ... | @@ -198,35 +199,39 @@ function createSearchRecordDiv(divid) |
| 198 | 199 | ||
| 199 | <?php | 200 | <?php |
| 200 | $userdialmode=Auth::user()->dialmode_assign; | 201 | $userdialmode=Auth::user()->dialmode_assign; |
| 202 | $client=Auth::user()->sel_campaign; | ||
| 201 | $userdialmode=explode(",",$userdialmode); | 203 | $userdialmode=explode(",",$userdialmode); |
| 202 | //print_r($userdialmode); | 204 | //print_r($userdialmode); |
| 203 | if(in_array('Progressive',$userdialmode)) | 205 | if(in_array('Progressive',$userdialmode)) |
| 204 | { ?> | 206 | { ?> |
| 205 | <li><a href="#" onclick='updateDialerState("dialer","mDialerState","Progressive");return false;'><b>Progressive</b></a></li> | 207 | <li><a href="#" onclick='updateDialerState("dialer","mDialerState","Progressive");savedialermode(<?php echo $client; ?>);return false;'><b>Progressive</b></a></li> |
| 206 | <?php | 208 | <?php |
| 207 | } | 209 | } |
| 208 | if(in_array('Manual',$userdialmode)){?> | 210 | if(in_array('Manual',$userdialmode)){?> |
| 209 | 211 | ||
| 210 | 212 | ||
| 211 | <li id=dialerManualAllowLI><a href="#" onclick='updateDialerState("dialer","mDialerState","Manual");return false;'><b>Manual</b></a></li> | 213 | <li id=dialerManualAllowLI><a href="#" onclick='updateDialerState("dialer","mDialerState","Manual");savedialermode();return false;'><b>Manual</b></a></li> |
| 212 | 214 | ||
| 213 | 215 | ||
| 214 | <?php } if(in_array('Incoming',$userdialmode)){ ?> | 216 | <?php } if(in_array('Incoming',$userdialmode)){ ?> |
| 215 | <li style='background:#36bc9b'><a href="#" onclick='updateDialerState("dialer","mDialerState","Ready","mDialerSubState","Incoming");return false;'><b>Incoming</b></a></li> | 217 | <li style='background:#36bc9b'><a href="#" onclick='updateDialerState("dialer","mDialerState","Ready","mDialerSubState","Incoming");savedialermode();return false;'><b>Incoming</b></a></li> |
| 218 | |||
| 219 | <?php } if(in_array('Predictive',$userdialmode)){?> | ||
| 220 | <li style='background:#68cc9e'><a href="#" onclick='updateDialerState("dialer","mDialerState","Ready","mDialerSubState","Predictive");savedialermode();return false;'><b>Predictive</b></a></li> | ||
| 216 | <?php } ?> | 221 | <?php } ?> |
| 217 | <!--<li><a href="#" onclick='updateDialerState("dialer","mDialerState","DialNext");return false;'><b>DialNext</b></a></li>--> | 222 | <!--<li><a href="#" onclick='updateDialerState("dialer","mDialerState","DialNext");return false;'><b>DialNext</b></a></li>--> |
| 218 | 223 | ||
| 219 | <li><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","Manual");return false;'><b>Paused</b></a></li> | 224 | <li><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","Manual");savedialermode();return false;'><b>Paused</b></a></li> |
| 220 | 225 | ||
| 221 | 226 | ||
| 222 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","AgentBriefing");return false;'><b>AgentBriefing</b></a></li> | 227 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","AgentBriefing");savedialermode();return false;'><b>AgentBriefing</b></a></li> |
| 223 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","TeamMeeting");return false;'><b>TeamMeeting</b></a></li> | 228 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","TeamMeeting");savedialermode();return false;'><b>TeamMeeting</b></a></li> |
| 224 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","QualityFeedback");return false;'><b>QualityFeedback</b></a></li> | 229 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","QualityFeedback");savedialermode();return false;'><b>QualityFeedback</b></a></li> |
| 225 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","LunchBreak");return false;'><b>LunchBreak</b></a></li> | 230 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","LunchBreak");savedialermode();return false;'><b>LunchBreak</b></a></li> |
| 226 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","TeaBreak");return false;'><b>TeaBreak</b></a></li> | 231 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","TeaBreak");savedialermode();return false;'><b>TeaBreak</b></a></li> |
| 227 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","UtilityBreak");return false;'><b>UtilityBreak</b></a></li> | 232 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","UtilityBreak");savedialermode();return false;'><b>UtilityBreak</b></a></li> |
| 228 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","FloorAnnouncements");return false;'><b>FloorAnnouncements</b></a></li> | 233 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","FloorAnnouncements");savedialermode();return false;'><b>FloorAnnouncements</b></a></li> |
| 229 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","DownTime");return false;'><b>DownTime</b></a></li> | 234 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","DownTime");savedialermode();return false;'><b>DownTime</b></a></li> |
| 230 | 235 | ||
| 231 | 236 | ||
| 232 | </ul> | 237 | </ul> |
| ... | @@ -234,9 +239,7 @@ function createSearchRecordDiv(divid) | ... | @@ -234,9 +239,7 @@ function createSearchRecordDiv(divid) |
| 234 | </div> | 239 | </div> |
| 235 | 240 | ||
| 236 | <input class="form-control" id="manualdialnumber_txt" style='width:200px' type="text" /> | 241 | <input class="form-control" id="manualdialnumber_txt" style='width:200px' type="text" /> |
| 237 | |||
| 238 | <span class="input-group-addon btn btn-default" id=manualdial_btn dialaction=dialnext onclick='updateDialerState("action",$(this).attr("dialaction"),$("#manualdialnumber_txt").val());'></span> | 242 | <span class="input-group-addon btn btn-default" id=manualdial_btn dialaction=dialnext onclick='updateDialerState("action",$(this).attr("dialaction"),$("#manualdialnumber_txt").val());'></span> |
| 239 | |||
| 240 | </div> | 243 | </div> |
| 241 | 244 | ||
| 242 | 245 | ||
| ... | @@ -255,12 +258,13 @@ function createSearchRecordDiv(divid) | ... | @@ -255,12 +258,13 @@ function createSearchRecordDiv(divid) |
| 255 | <i class='fa fa-fw fa-phone'></i> <span id=spandialer_num onclick='dialerDispNumberClick();return false;'></span> | 258 | <i class='fa fa-fw fa-phone'></i> <span id=spandialer_num onclick='dialerDispNumberClick();return false;'></span> |
| 256 | </a> | 259 | </a> |
| 257 | </div> | 260 | </div> |
| 258 | |||
| 259 | <div id=dialerToggleViewDiv style='float:right;margin-right:20px;'> | 261 | <div id=dialerToggleViewDiv style='float:right;margin-right:20px;'> |
| 260 | 262 | <?php if(Auth::user()->id=='1'){ ?> | |
| 263 | <button class="btn btn-circle btn-default" id="transferButton"><i class="glyphicon glyphicon-transfer"></i></button> | ||
| 264 | <?php } ?> | ||
| 261 | <button class="btn btn-circle btn-default" ><i class="fa fa-phone"></i></button> | 265 | <button class="btn btn-circle btn-default" ><i class="fa fa-phone"></i></button> |
| 262 | <i class="fa fa-long-arrow-left"></i> | 266 | <i class="fa fa-long-arrow-left"></i> |
| 263 | 267 | ||
| 264 | <div class="dropdown dropdown-icons" id=connections_div_dtmf> | 268 | <div class="dropdown dropdown-icons" id=connections_div_dtmf> |
| 265 | <a data-toggle="dropdown" href="#" class="btn btn-stroke btn-success btn-circle dropdown-toggle"><i class="fa fa-th"></i> </a> | 269 | <a data-toggle="dropdown" href="#" class="btn btn-stroke btn-success btn-circle dropdown-toggle"><i class="fa fa-th"></i> </a> |
| 266 | <ul class="dropdown-menu"> | 270 | <ul class="dropdown-menu"> |
| ... | @@ -365,12 +369,51 @@ function createSearchRecordDiv(divid) | ... | @@ -365,12 +369,51 @@ function createSearchRecordDiv(divid) |
| 365 | $("#topdialerconfcall").hide(); | 369 | $("#topdialerconfcall").hide(); |
| 366 | 370 | ||
| 367 | } | 371 | } |
| 372 | |||
| 373 | function transfercallconf() | ||
| 374 | { | ||
| 375 | var confnumber=$("#transfercalltxt").val(); | ||
| 376 | if(confnumber==''||confnumber.length<2) | ||
| 377 | { | ||
| 378 | simpleNotification('error','topRight',"Empty Number"); | ||
| 379 | return; | ||
| 380 | } | ||
| 381 | if(!kcallHasConnection(kstychCall['callnumber'])||kstychCall['ts_Dispo']>1) | ||
| 382 | { | ||
| 383 | simpleNotification('error','topRight',"No call to transfer"); | ||
| 384 | return; | ||
| 385 | } | ||
| 386 | |||
| 387 | $("#transferCallBtn").removeClass("show").addClass("hide"); | ||
| 388 | $("#transferHangBtn").removeClass("hide").addClass("show"); | ||
| 389 | |||
| 390 | var datastr="kstychCall="+JSON.stringify(kstychCall); | ||
| 391 | datastr+="&kstychDialer="+JSON.stringify(kstychDialer); | ||
| 392 | //kcallNewConnection(confnumber); | ||
| 393 | doAjax('dialer?action=transfercall&confnumber='+confnumber,datastr,'__fake__div__', 'ajax_confdial','singlefail','POST', function(retstr){ | ||
| 394 | if(retstr.responseText.indexOf('Error')<0) | ||
| 395 | { | ||
| 396 | // kcallSetConnection(confnumber,'callid',retstr.responseText); | ||
| 397 | // kcallSetConnection(confnumber,'ts_Call',getNowTS()); | ||
| 398 | |||
| 399 | updateDialerState(); | ||
| 400 | } | ||
| 401 | else | ||
| 402 | { | ||
| 403 | simpleNotification('error','topRight',retstr.responseText); | ||
| 404 | } | ||
| 405 | }); | ||
| 406 | |||
| 407 | $("#topdialerconfcall").hide(); | ||
| 408 | |||
| 409 | } | ||
| 410 | |||
| 368 | </script> | 411 | </script> |
| 369 | </div> | 412 | </div> |
| 370 | </div> | 413 | </div> |
| 371 | </div> | 414 | </div> |
| 372 | <div style='clear:both'></div> | 415 | <div style='clear:both'></div> |
| 373 | 416 | ||
| 374 | </div> | 417 | </div> |
| 375 | <div class="modal-body" id=kDialer_modal_body> | 418 | <div class="modal-body" id=kDialer_modal_body> |
| 376 | <div id=dialerToggleViewMainDiv style=''> | 419 | <div id=dialerToggleViewMainDiv style=''> | ... | ... |
-
Please register or sign in to post a comment