89ebf718 by prami

popup show if current campaing is inactive

1 parent b2b8b8c1
......@@ -144,18 +144,31 @@ class DialerController extends Controller {
if($action=="previewnext")
{
$wakka = new KHRMSLib();
$client=Input::get("client");
$roclientstr=array();
$activeClients = array();
$oclientlst=$wakka->clientsReadAccess();
//print_r($oclientlst);
if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";}
if(!empty($oclientlst)){
foreach($oclientlst as $tclnt){
if($tclnt!=""){
$roclientstr[]="'$tclnt'";
$activeClients[] = $tclnt;
}
}
}
if(!in_array($client, $activeClients)){
return Response::make("false");
}
if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr="";
$users=array();$searchresult="";
if(!empty($kstychCall["previewcrmid"]))$users=$wakka->getPersons("id='".$kstychCall["previewcrmid"]."' $roclientstr limit 1");
else $users=$this->getCallSequencing(1);
//$wakka->setPersonKey($users[0]['id'],"status","Incall");
if($users[0]['id']>0){
Log::info("1----".$users[0]['id']);
DB::table('records')->where('id',$users[0]['id'])->update(['filter_condition'=>'2','modified'=>date("Y-m-d H:i:s")]);
......@@ -175,7 +188,6 @@ class DialerController extends Controller {
$searchresult.="<div id=internalid_matchlist></div><script>createSearchRecordDiv('internalid_matchlist');</script>";
}
return Response::make($searchresult);
}
......@@ -260,7 +272,7 @@ class DialerController extends Controller {
else if($kstychCall['callnumber']!="")$users=$wakka->getPersons("mobile='".$kstychCall['callnumber']."' $roclientstr limit 1");
else $users=$this->getCallSequencing(1);
}
Log::info($users);
$searchresult='<div style="clear:both"></div><div id=divworking></div><div style="clear:both"></div>';
if(!empty($users))
{
......@@ -287,7 +299,7 @@ class DialerController extends Controller {
}
}
Log::info('Number='.$callnumber);
if($callnumber!=""&&intval($callnumber)>0)
{
$mastersdata=$wakka->getCompanyMaster($ppldata['client']);
......@@ -1485,10 +1497,8 @@ public function show($id)
$mroclientstr = $roclientstr;
$client=Input::get("client");
//print_r($client);
if(!empty($roclientstr))$roclientstr="client='$client'";else $roclientstr="";
// echo $roclientstr."Abc";
$users=array();
if(Auth::user()->usertype!="User"){$tusers=array();return $tusers;}
......@@ -1524,17 +1534,12 @@ public function show($id)
}else{
$orderby ="";
}
// echo "campaign1";
//print_r($campaign);
$tusers=$wakka->getPersonshome("filter_condition = '1' and $campaign->where_cond $orderby limit 1;");
//print_r($tusers);
if(count($tusers)>0){
if($limit>0){
$l=1;
foreach($tusers as $tuser){
//Log::info($tuser);
if(!isset($users[$tuser['id']])){
//Log::info("2-".$users[$tuser['id']]);
$users[$tuser['id']]=$tuser;
$l++;
......@@ -1546,13 +1551,11 @@ public function show($id)
$limit=$limit-sizeof($tusers);
}
}else{
// echo "campaign 2";
$condition=$campaign->where_cond;
if(stripos($condition,"order by")!==false){
// $orderby="order by dialer_lastcall asc";
$condition = substr($condition,0,stripos($condition, 'order by'));
}
//$condition = substr($campaign->where_cond,0,stripos($campaign->where_cond, 'order by'));
$tusers=$wakka->getPersonshome("filter_condition=4 and $condition order by dialer_lastcall asc limit 1;");
if($limit>0){
$l=1;
......@@ -1571,98 +1574,6 @@ public function show($id)
}
}else{
$clientDetails=$wakka->getPersonshome("$roclientstr and filter_condition NOT IN ('2','3') order by dialer_lastcall asc limit 1;");
//print_r($clientDetails);
//print_r($clientDetails);
/*if($limit>0)
{
$tusers = array_filter($clientDetails, function($var){
return ($var['dialer_status']=='InboundDROP' && $var['dialer_lastcall']>'2018-09-11 00:00:00' && $var['dialer_lastcall']>date('Y-m-d H:i:s',time()-(7*24*60*60)));
});
$l=1;
foreach($tusers as $tuser){
if(!isset($users[$tuser['id']])){
$users[$tuser['id']]=$tuser;
$l++;
if($l>$limit)
break;
}
}
$limit=$limit-sizeof($tusers);
}*/
/*if($limit>0)
{
if(!empty($didlinesstr))
{
$udidlinesstr = array();
foreach($didlinesstr as $didlinestr){
$didlinestrArr=explode(":",$didlinestr);
$udidlinesstr[] = substr($didlinestrArr[0], env('didnumber'));
}
$tusers=array();
$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)));
$mc=$mc->where(function ($query) use($mroclientstr,$udidlinesstr){
$query->orWhereIn('client',$mroclientstr)->orWhereIn('did',$udidlinesstr);
});
$mc=$mc->get();
$number_list=array();
foreach($mc as $key=>$tcall){
$tccal=substr($tcall->number,-10);
$mc_number=CRMCall::where('userstatus','!=','InboundDROP')
->where('created_at','>',$tcall->created_at)
->where('number','like',"%".$tccal."%")
->orderBy("id","DESC")
->first();
$mccount= count($mc_number);
if($mccount==0){
$number_list[] = $tcall->number;
}
}
$othermissedcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN
('" . implode("','", $number_list). "') GROUP BY number )");
// $othermissedcalls=CRMCall::where('crm_id','=','0')->where('userstatus','=','InboundDROP')->where('did','like','%'.$didlinesstr.'%')->where('created_at','>',date('Y-m-d H:i:s',time()-(7*24*60*60)))->take($limit)->groupBy('number')->get();
/* Changes For Missed Call - 14/02/17 */
/*foreach($othermissedcalls as $othermissedcall)
{
$crmnumber = substr($othermissedcall->number, -10);
$tcall=array_filter($clientDetails, function($var) use ($crmnumber){
return ($var['mobile']==$crmnumber);
});
if($tcall)
{
$tcall = array_values($tcall);
$tcall = $tcall[0];
if(isset($tcall['id']) || $tcall['dialer_status']=="InboundDROP")
{
$tusers[$othermissedcall->id]=array('id'=>$tcall['id'],'mobile'=>$othermissedcall->number,'client'=>$tcall['client'],'clientcode'=>$tcall['clientcode'],'clientinternalid'=>$tcall['clientinternalid'], 'firstname'=>$tcall['firstname'],'callid'=>$othermissedcall->id);
}
}
}
/* Changes For Missed Call - 14/02/17 */
/*foreach($tusers as $tuser)if(!isset($users[$tuser['id']]))$users[$tuser['id']]=$tuser;
$limit=$limit-sizeof($tusers);
}
}*/
if($limit>0)
{
......@@ -1750,25 +1661,6 @@ public function show($id)
$limit=$limit-sizeof($tusers);
}
/*if($limit>0)
{
$tusers = array_filter($clientDetails, function($var){
return ($var['status']=='Called'&&$var['dialer_status']=='Contacted - Follow-Up - Generic');
});
$l=1;
foreach($tusers as $tuser){
if(!isset($users[$tuser['id']])){
$users[$tuser['id']]=$tuser;
$l++;
if($l>$limit)
break;
}
}
$limit=$limit-sizeof($tusers);
}*/
if($limit>0)
{
// echo "5";
......
......@@ -915,6 +915,22 @@ function updateDialerState(objstr,key,val,key2,val2)
{
doAjax('dialer?action=previewnext&client='+client,datastr,'dialersearchresults', 'ajax_manualdial2','singlefail','POST',
function(retstr){
if(retstr.responseText == "false"){
$("#tcampaign_select option").each(function(){
var opt = $(this).val();
if(opt == client){
$(this).remove();
}
});
var errorModel = $('#showInacitveClientErrMess');
errorModel.find('.modal-body').text("Your current campaign "+client +' is no more active.');
errorModel.modal('show');
//$('#showInacitveClientErrMess').modal('show');
campaignSelect();
}
if(kstychCall['previewcrmid']!="")
{
kSetDData('C','previewcrmid',"");
......
......@@ -30,7 +30,7 @@
<div class="col-sm-4 bot">
<a href="javascript:;" onclick="menuAction('disposition');return false;" style="color:white;">
<div class="new1">
<div class="icon"> <i class="fa fa-users"></i></div>
<div class="icon"> <i class="fa fa-list"></i></div>
Disposition List
</div>
</a>
......
......@@ -45,6 +45,26 @@ if(!isset($data['personal']))$data['personal']=array();
background: #48cfae;
padding: 2px;
}
#showInacitveClientErrMess {
text-align: center;
padding: 0!important;
}
#showInacitveClientErrMess:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
margin-right: -4px;
}
#showInacitveClientErrMess .modal-dialog {
display: inline-block;
text-align: left;
vertical-align: middle;
}
</style>
<script>
......@@ -60,6 +80,11 @@ $("#topuserdropmenu > li").hover(function() {
function() {
$(this).removeClass('active');
});
$( document ).ready(function() {
});
</script>
......@@ -181,6 +206,19 @@ function createSearchRecordDiv(divid)
</div>
</div>
</div>
<div class="modal" id="showInacitveClientErrMess">
<div class="modal-dialog" >
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" id="errorClose" aria-hidden="true">&times;</button>
</div>
<div class="modal-body">
</div>
</div>
</div>
</div>
<div class="modal" id="kDialer_modal">
<div class="modal-dialog" style='width:95%;'>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!