popup show if current campaing is inactive
Showing
4 changed files
with
74 additions
and
128 deletions
| ... | @@ -144,18 +144,31 @@ class DialerController extends Controller { | ... | @@ -144,18 +144,31 @@ class DialerController extends Controller { |
| 144 | if($action=="previewnext") | 144 | if($action=="previewnext") |
| 145 | { | 145 | { |
| 146 | $wakka = new KHRMSLib(); | 146 | $wakka = new KHRMSLib(); |
| 147 | $client=Input::get("client"); | ||
| 147 | 148 | ||
| 148 | $roclientstr=array(); | 149 | $roclientstr=array(); |
| 150 | $activeClients = array(); | ||
| 149 | $oclientlst=$wakka->clientsReadAccess(); | 151 | $oclientlst=$wakka->clientsReadAccess(); |
| 150 | //print_r($oclientlst); | 152 | |
| 151 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";} | 153 | if(!empty($oclientlst)){ |
| 154 | foreach($oclientlst as $tclnt){ | ||
| 155 | if($tclnt!=""){ | ||
| 156 | $roclientstr[]="'$tclnt'"; | ||
| 157 | $activeClients[] = $tclnt; | ||
| 158 | } | ||
| 159 | } | ||
| 160 | } | ||
| 161 | |||
| 162 | if(!in_array($client, $activeClients)){ | ||
| 163 | return Response::make("false"); | ||
| 164 | } | ||
| 152 | 165 | ||
| 153 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; | 166 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; |
| 154 | 167 | ||
| 155 | $users=array();$searchresult=""; | 168 | $users=array();$searchresult=""; |
| 156 | if(!empty($kstychCall["previewcrmid"]))$users=$wakka->getPersons("id='".$kstychCall["previewcrmid"]."' $roclientstr limit 1"); | 169 | if(!empty($kstychCall["previewcrmid"]))$users=$wakka->getPersons("id='".$kstychCall["previewcrmid"]."' $roclientstr limit 1"); |
| 157 | else $users=$this->getCallSequencing(1); | 170 | else $users=$this->getCallSequencing(1); |
| 158 | //$wakka->setPersonKey($users[0]['id'],"status","Incall"); | 171 | |
| 159 | if($users[0]['id']>0){ | 172 | if($users[0]['id']>0){ |
| 160 | Log::info("1----".$users[0]['id']); | 173 | 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")]); | 174 | 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 { | ... | @@ -175,7 +188,6 @@ class DialerController extends Controller { |
| 175 | $searchresult.="<div id=internalid_matchlist></div><script>createSearchRecordDiv('internalid_matchlist');</script>"; | 188 | $searchresult.="<div id=internalid_matchlist></div><script>createSearchRecordDiv('internalid_matchlist');</script>"; |
| 176 | } | 189 | } |
| 177 | 190 | ||
| 178 | |||
| 179 | return Response::make($searchresult); | 191 | return Response::make($searchresult); |
| 180 | } | 192 | } |
| 181 | 193 | ||
| ... | @@ -260,7 +272,7 @@ class DialerController extends Controller { | ... | @@ -260,7 +272,7 @@ class DialerController extends Controller { |
| 260 | else if($kstychCall['callnumber']!="")$users=$wakka->getPersons("mobile='".$kstychCall['callnumber']."' $roclientstr limit 1"); | 272 | else if($kstychCall['callnumber']!="")$users=$wakka->getPersons("mobile='".$kstychCall['callnumber']."' $roclientstr limit 1"); |
| 261 | else $users=$this->getCallSequencing(1); | 273 | else $users=$this->getCallSequencing(1); |
| 262 | } | 274 | } |
| 263 | 275 | Log::info($users); | |
| 264 | $searchresult='<div style="clear:both"></div><div id=divworking></div><div style="clear:both"></div>'; | 276 | $searchresult='<div style="clear:both"></div><div id=divworking></div><div style="clear:both"></div>'; |
| 265 | if(!empty($users)) | 277 | if(!empty($users)) |
| 266 | { | 278 | { |
| ... | @@ -287,7 +299,7 @@ class DialerController extends Controller { | ... | @@ -287,7 +299,7 @@ class DialerController extends Controller { |
| 287 | 299 | ||
| 288 | } | 300 | } |
| 289 | } | 301 | } |
| 290 | 302 | Log::info('Number='.$callnumber); | |
| 291 | if($callnumber!=""&&intval($callnumber)>0) | 303 | if($callnumber!=""&&intval($callnumber)>0) |
| 292 | { | 304 | { |
| 293 | $mastersdata=$wakka->getCompanyMaster($ppldata['client']); | 305 | $mastersdata=$wakka->getCompanyMaster($ppldata['client']); |
| ... | @@ -1485,10 +1497,8 @@ public function show($id) | ... | @@ -1485,10 +1497,8 @@ public function show($id) |
| 1485 | $mroclientstr = $roclientstr; | 1497 | $mroclientstr = $roclientstr; |
| 1486 | 1498 | ||
| 1487 | $client=Input::get("client"); | 1499 | $client=Input::get("client"); |
| 1488 | //print_r($client); | ||
| 1489 | 1500 | ||
| 1490 | if(!empty($roclientstr))$roclientstr="client='$client'";else $roclientstr=""; | 1501 | if(!empty($roclientstr))$roclientstr="client='$client'";else $roclientstr=""; |
| 1491 | // echo $roclientstr."Abc"; | ||
| 1492 | $users=array(); | 1502 | $users=array(); |
| 1493 | 1503 | ||
| 1494 | if(Auth::user()->usertype!="User"){$tusers=array();return $tusers;} | 1504 | if(Auth::user()->usertype!="User"){$tusers=array();return $tusers;} |
| ... | @@ -1524,17 +1534,12 @@ public function show($id) | ... | @@ -1524,17 +1534,12 @@ public function show($id) |
| 1524 | }else{ | 1534 | }else{ |
| 1525 | $orderby =""; | 1535 | $orderby =""; |
| 1526 | } | 1536 | } |
| 1527 | // echo "campaign1"; | ||
| 1528 | //print_r($campaign); | ||
| 1529 | $tusers=$wakka->getPersonshome("filter_condition = '1' and $campaign->where_cond $orderby limit 1;"); | 1537 | $tusers=$wakka->getPersonshome("filter_condition = '1' and $campaign->where_cond $orderby limit 1;"); |
| 1530 | //print_r($tusers); | ||
| 1531 | if(count($tusers)>0){ | 1538 | if(count($tusers)>0){ |
| 1532 | if($limit>0){ | 1539 | if($limit>0){ |
| 1533 | $l=1; | 1540 | $l=1; |
| 1534 | foreach($tusers as $tuser){ | 1541 | foreach($tusers as $tuser){ |
| 1535 | //Log::info($tuser); | ||
| 1536 | if(!isset($users[$tuser['id']])){ | 1542 | if(!isset($users[$tuser['id']])){ |
| 1537 | //Log::info("2-".$users[$tuser['id']]); | ||
| 1538 | $users[$tuser['id']]=$tuser; | 1543 | $users[$tuser['id']]=$tuser; |
| 1539 | $l++; | 1544 | $l++; |
| 1540 | 1545 | ||
| ... | @@ -1546,13 +1551,11 @@ public function show($id) | ... | @@ -1546,13 +1551,11 @@ public function show($id) |
| 1546 | $limit=$limit-sizeof($tusers); | 1551 | $limit=$limit-sizeof($tusers); |
| 1547 | } | 1552 | } |
| 1548 | }else{ | 1553 | }else{ |
| 1549 | // echo "campaign 2"; | ||
| 1550 | $condition=$campaign->where_cond; | 1554 | $condition=$campaign->where_cond; |
| 1551 | if(stripos($condition,"order by")!==false){ | 1555 | if(stripos($condition,"order by")!==false){ |
| 1552 | // $orderby="order by dialer_lastcall asc"; | ||
| 1553 | $condition = substr($condition,0,stripos($condition, 'order by')); | 1556 | $condition = substr($condition,0,stripos($condition, 'order by')); |
| 1554 | } | 1557 | } |
| 1555 | //$condition = substr($campaign->where_cond,0,stripos($campaign->where_cond, 'order by')); | 1558 | |
| 1556 | $tusers=$wakka->getPersonshome("filter_condition=4 and $condition order by dialer_lastcall asc limit 1;"); | 1559 | $tusers=$wakka->getPersonshome("filter_condition=4 and $condition order by dialer_lastcall asc limit 1;"); |
| 1557 | if($limit>0){ | 1560 | if($limit>0){ |
| 1558 | $l=1; | 1561 | $l=1; |
| ... | @@ -1571,98 +1574,6 @@ public function show($id) | ... | @@ -1571,98 +1574,6 @@ public function show($id) |
| 1571 | } | 1574 | } |
| 1572 | }else{ | 1575 | }else{ |
| 1573 | $clientDetails=$wakka->getPersonshome("$roclientstr and filter_condition NOT IN ('2','3') order by dialer_lastcall asc limit 1;"); | 1576 | $clientDetails=$wakka->getPersonshome("$roclientstr and filter_condition NOT IN ('2','3') order by dialer_lastcall asc limit 1;"); |
| 1574 | //print_r($clientDetails); | ||
| 1575 | //print_r($clientDetails); | ||
| 1576 | |||
| 1577 | /*if($limit>0) | ||
| 1578 | { | ||
| 1579 | $tusers = array_filter($clientDetails, function($var){ | ||
| 1580 | 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))); | ||
| 1581 | }); | ||
| 1582 | |||
| 1583 | $l=1; | ||
| 1584 | foreach($tusers as $tuser){ | ||
| 1585 | if(!isset($users[$tuser['id']])){ | ||
| 1586 | $users[$tuser['id']]=$tuser; | ||
| 1587 | $l++; | ||
| 1588 | |||
| 1589 | if($l>$limit) | ||
| 1590 | break; | ||
| 1591 | } | ||
| 1592 | } | ||
| 1593 | |||
| 1594 | $limit=$limit-sizeof($tusers); | ||
| 1595 | }*/ | ||
| 1596 | |||
| 1597 | /*if($limit>0) | ||
| 1598 | { | ||
| 1599 | if(!empty($didlinesstr)) | ||
| 1600 | { | ||
| 1601 | $udidlinesstr = array(); | ||
| 1602 | foreach($didlinesstr as $didlinestr){ | ||
| 1603 | $didlinestrArr=explode(":",$didlinestr); | ||
| 1604 | $udidlinesstr[] = substr($didlinestrArr[0], env('didnumber')); | ||
| 1605 | } | ||
| 1606 | $tusers=array(); | ||
| 1607 | |||
| 1608 | $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))); | ||
| 1609 | $mc=$mc->where(function ($query) use($mroclientstr,$udidlinesstr){ | ||
| 1610 | $query->orWhereIn('client',$mroclientstr)->orWhereIn('did',$udidlinesstr); | ||
| 1611 | }); | ||
| 1612 | $mc=$mc->get(); | ||
| 1613 | |||
| 1614 | $number_list=array(); | ||
| 1615 | foreach($mc as $key=>$tcall){ | ||
| 1616 | |||
| 1617 | $tccal=substr($tcall->number,-10); | ||
| 1618 | $mc_number=CRMCall::where('userstatus','!=','InboundDROP') | ||
| 1619 | ->where('created_at','>',$tcall->created_at) | ||
| 1620 | ->where('number','like',"%".$tccal."%") | ||
| 1621 | ->orderBy("id","DESC") | ||
| 1622 | ->first(); | ||
| 1623 | |||
| 1624 | $mccount= count($mc_number); | ||
| 1625 | if($mccount==0){ | ||
| 1626 | $number_list[] = $tcall->number; | ||
| 1627 | } | ||
| 1628 | } | ||
| 1629 | |||
| 1630 | $othermissedcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN | ||
| 1631 | ('" . implode("','", $number_list). "') GROUP BY number )"); | ||
| 1632 | |||
| 1633 | // $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(); | ||
| 1634 | |||
| 1635 | /* Changes For Missed Call - 14/02/17 */ | ||
| 1636 | |||
| 1637 | /*foreach($othermissedcalls as $othermissedcall) | ||
| 1638 | { | ||
| 1639 | $crmnumber = substr($othermissedcall->number, -10); | ||
| 1640 | |||
| 1641 | $tcall=array_filter($clientDetails, function($var) use ($crmnumber){ | ||
| 1642 | return ($var['mobile']==$crmnumber); | ||
| 1643 | }); | ||
| 1644 | |||
| 1645 | if($tcall) | ||
| 1646 | { | ||
| 1647 | $tcall = array_values($tcall); | ||
| 1648 | $tcall = $tcall[0]; | ||
| 1649 | |||
| 1650 | if(isset($tcall['id']) || $tcall['dialer_status']=="InboundDROP") | ||
| 1651 | { | ||
| 1652 | $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); | ||
| 1653 | } | ||
| 1654 | } | ||
| 1655 | |||
| 1656 | } | ||
| 1657 | |||
| 1658 | /* Changes For Missed Call - 14/02/17 */ | ||
| 1659 | |||
| 1660 | /*foreach($tusers as $tuser)if(!isset($users[$tuser['id']]))$users[$tuser['id']]=$tuser; | ||
| 1661 | |||
| 1662 | $limit=$limit-sizeof($tusers); | ||
| 1663 | } | ||
| 1664 | }*/ | ||
| 1665 | |||
| 1666 | 1577 | ||
| 1667 | if($limit>0) | 1578 | if($limit>0) |
| 1668 | { | 1579 | { |
| ... | @@ -1750,25 +1661,6 @@ public function show($id) | ... | @@ -1750,25 +1661,6 @@ public function show($id) |
| 1750 | $limit=$limit-sizeof($tusers); | 1661 | $limit=$limit-sizeof($tusers); |
| 1751 | } | 1662 | } |
| 1752 | 1663 | ||
| 1753 | /*if($limit>0) | ||
| 1754 | { | ||
| 1755 | $tusers = array_filter($clientDetails, function($var){ | ||
| 1756 | return ($var['status']=='Called'&&$var['dialer_status']=='Contacted - Follow-Up - Generic'); | ||
| 1757 | }); | ||
| 1758 | $l=1; | ||
| 1759 | foreach($tusers as $tuser){ | ||
| 1760 | if(!isset($users[$tuser['id']])){ | ||
| 1761 | $users[$tuser['id']]=$tuser; | ||
| 1762 | $l++; | ||
| 1763 | |||
| 1764 | if($l>$limit) | ||
| 1765 | break; | ||
| 1766 | } | ||
| 1767 | } | ||
| 1768 | |||
| 1769 | $limit=$limit-sizeof($tusers); | ||
| 1770 | }*/ | ||
| 1771 | |||
| 1772 | if($limit>0) | 1664 | if($limit>0) |
| 1773 | { | 1665 | { |
| 1774 | // echo "5"; | 1666 | // echo "5"; | ... | ... |
| ... | @@ -915,6 +915,22 @@ function updateDialerState(objstr,key,val,key2,val2) | ... | @@ -915,6 +915,22 @@ function updateDialerState(objstr,key,val,key2,val2) |
| 915 | { | 915 | { |
| 916 | doAjax('dialer?action=previewnext&client='+client,datastr,'dialersearchresults', 'ajax_manualdial2','singlefail','POST', | 916 | doAjax('dialer?action=previewnext&client='+client,datastr,'dialersearchresults', 'ajax_manualdial2','singlefail','POST', |
| 917 | function(retstr){ | 917 | function(retstr){ |
| 918 | if(retstr.responseText == "false"){ | ||
| 919 | |||
| 920 | $("#tcampaign_select option").each(function(){ | ||
| 921 | var opt = $(this).val(); | ||
| 922 | if(opt == client){ | ||
| 923 | $(this).remove(); | ||
| 924 | } | ||
| 925 | }); | ||
| 926 | var errorModel = $('#showInacitveClientErrMess'); | ||
| 927 | errorModel.find('.modal-body').text("Your current campaign "+client +' is no more active.'); | ||
| 928 | errorModel.modal('show'); | ||
| 929 | //$('#showInacitveClientErrMess').modal('show'); | ||
| 930 | |||
| 931 | campaignSelect(); | ||
| 932 | } | ||
| 933 | |||
| 918 | if(kstychCall['previewcrmid']!="") | 934 | if(kstychCall['previewcrmid']!="") |
| 919 | { | 935 | { |
| 920 | kSetDData('C','previewcrmid',""); | 936 | kSetDData('C','previewcrmid',""); | ... | ... |
| ... | @@ -30,7 +30,7 @@ | ... | @@ -30,7 +30,7 @@ |
| 30 | <div class="col-sm-4 bot"> | 30 | <div class="col-sm-4 bot"> |
| 31 | <a href="javascript:;" onclick="menuAction('disposition');return false;" style="color:white;"> | 31 | <a href="javascript:;" onclick="menuAction('disposition');return false;" style="color:white;"> |
| 32 | <div class="new1"> | 32 | <div class="new1"> |
| 33 | <div class="icon"> <i class="fa fa-users"></i></div> | 33 | <div class="icon"> <i class="fa fa-list"></i></div> |
| 34 | Disposition List | 34 | Disposition List |
| 35 | </div> | 35 | </div> |
| 36 | </a> | 36 | </a> | ... | ... |
| ... | @@ -45,6 +45,26 @@ if(!isset($data['personal']))$data['personal']=array(); | ... | @@ -45,6 +45,26 @@ if(!isset($data['personal']))$data['personal']=array(); |
| 45 | background: #48cfae; | 45 | background: #48cfae; |
| 46 | padding: 2px; | 46 | padding: 2px; |
| 47 | } | 47 | } |
| 48 | |||
| 49 | #showInacitveClientErrMess { | ||
| 50 | text-align: center; | ||
| 51 | padding: 0!important; | ||
| 52 | } | ||
| 53 | |||
| 54 | #showInacitveClientErrMess:before { | ||
| 55 | content: ''; | ||
| 56 | display: inline-block; | ||
| 57 | height: 100%; | ||
| 58 | vertical-align: middle; | ||
| 59 | margin-right: -4px; | ||
| 60 | } | ||
| 61 | |||
| 62 | #showInacitveClientErrMess .modal-dialog { | ||
| 63 | display: inline-block; | ||
| 64 | text-align: left; | ||
| 65 | vertical-align: middle; | ||
| 66 | } | ||
| 67 | |||
| 48 | </style> | 68 | </style> |
| 49 | 69 | ||
| 50 | <script> | 70 | <script> |
| ... | @@ -60,6 +80,11 @@ $("#topuserdropmenu > li").hover(function() { | ... | @@ -60,6 +80,11 @@ $("#topuserdropmenu > li").hover(function() { |
| 60 | function() { | 80 | function() { |
| 61 | $(this).removeClass('active'); | 81 | $(this).removeClass('active'); |
| 62 | }); | 82 | }); |
| 83 | |||
| 84 | $( document ).ready(function() { | ||
| 85 | |||
| 86 | }); | ||
| 87 | |||
| 63 | </script> | 88 | </script> |
| 64 | 89 | ||
| 65 | 90 | ||
| ... | @@ -181,6 +206,19 @@ function createSearchRecordDiv(divid) | ... | @@ -181,6 +206,19 @@ function createSearchRecordDiv(divid) |
| 181 | </div> | 206 | </div> |
| 182 | </div> | 207 | </div> |
| 183 | </div> | 208 | </div> |
| 209 | <div class="modal" id="showInacitveClientErrMess"> | ||
| 210 | <div class="modal-dialog" > | ||
| 211 | <div class="modal-content"> | ||
| 212 | <div class="modal-header"> | ||
| 213 | <button type="button" class="close" id="errorClose" aria-hidden="true">×</button> | ||
| 214 | </div> | ||
| 215 | <div class="modal-body"> | ||
| 216 | </div> | ||
| 217 | |||
| 218 | </div> | ||
| 219 | </div> | ||
| 220 | </div> | ||
| 221 | |||
| 184 | 222 | ||
| 185 | <div class="modal" id="kDialer_modal"> | 223 | <div class="modal" id="kDialer_modal"> |
| 186 | <div class="modal-dialog" style='width:95%;'> | 224 | <div class="modal-dialog" style='width:95%;'> | ... | ... |
-
Please register or sign in to post a comment