2ace4d0d by prami

campaign: Added filer query for elegible

1 parent 5b50cf38
...@@ -126,22 +126,32 @@ class CampaignController extends Controller { ...@@ -126,22 +126,32 @@ class CampaignController extends Controller {
126 }else{ 126 }else{
127 $queryConditions = '1'; 127 $queryConditions = '1';
128 } 128 }
129
130 $queryInCondition = Input::get("queryInCondition");
131 if($queryInCondition != 'null'){
132 $queryInCondition = str_replace('"', "'", $queryInCondition);
133 $queryInCondition = str_replace(''', "'", $queryInCondition);
134 $queryInCondition = "or elegible IN ($queryInCondition)";
135 $querySelect .= ',elegible';
136 }else{
137 $queryInCondition = '';
138 }
139
129 $queryLimit = Input::get("queryLimit"); 140 $queryLimit = Input::get("queryLimit");
130 $queryOffset = Input::get("queryOffset"); 141 $queryOffset = Input::get("queryOffset");
131 $checkedValue = Input::get("checkedValue"); 142 $checkedValue = Input::get("checkedValue");
132 $fields = explode(",", $querySelect); 143 $fields = explode(",", $querySelect);
133 144
134 $i = 1; $output = ''; 145 $i = 1; $output = '';
135 try { 146 try {
136
137 147
138 if($campaign=="All") 148 if($campaign=="All")
139 { 149 {
140 $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; 150 $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions $queryInCondition LIMIT $queryLimit OFFSET $queryOffset";
141 $sqlQuery = DB::select($selQuery); 151 $sqlQuery = DB::select($selQuery);
142 }else 152 }else
143 { 153 {
144 $selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; 154 $selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions $queryInCondition LIMIT $queryLimit OFFSET $queryOffset";
145 $sqlQuery = DB::select($selQuery); 155 $sqlQuery = DB::select($selQuery);
146 } 156 }
147 157
...@@ -159,7 +169,6 @@ class CampaignController extends Controller { ...@@ -159,7 +169,6 @@ class CampaignController extends Controller {
159 $output .= "<p class='text-danger'>".$ex->getMessage()."</p>"; 169 $output .= "<p class='text-danger'>".$ex->getMessage()."</p>";
160 return $output; 170 return $output;
161 } 171 }
162
163 if(count($sqlQuery)){ 172 if(count($sqlQuery)){
164 $output .= '<div style="overflow-x:auto;"><table class="table table-bordered"><thead><tr><th class="text-center">#</th>'; 173 $output .= '<div style="overflow-x:auto;"><table class="table table-bordered"><thead><tr><th class="text-center">#</th>';
165 foreach ($fields as $key) { 174 foreach ($fields as $key) {
...@@ -235,15 +244,25 @@ class CampaignController extends Controller { ...@@ -235,15 +244,25 @@ class CampaignController extends Controller {
235 }else{ 244 }else{
236 $queryConditions = '1'; 245 $queryConditions = '1';
237 } 246 }
247
248 $queryInCondition = Input::get("queryInCondition");
249 if($queryInCondition != 'null'){
250 $queryInCondition = str_replace('&quot;', "'", $queryInCondition);
251 $queryInCondition = str_replace('&#039;', "'", $queryInCondition);
252 $queryInCondition = "or elegible IN ($queryInCondition)";
253 $querySelect .= ',elegible';
254 }else{
255 $queryInCondition = '';
256 }
238 $queryLimit = Input::get("queryLimit"); 257 $queryLimit = Input::get("queryLimit");
239 $queryOffset = Input::get("queryOffset"); 258 $queryOffset = Input::get("queryOffset");
240 259
241 try { 260 try {
242 if($campaign=="All"){ 261 if($campaign=="All"){
243 $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; 262 $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions $queryInCondition LIMIT $queryLimit OFFSET $queryOffset";
244 $sqlQuery = DB::select($selQuery); 263 $sqlQuery = DB::select($selQuery);
245 }else{ 264 }else{
246 $selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; 265 $selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions $queryInCondition LIMIT $queryLimit OFFSET $queryOffset";
247 $sqlQuery = DB::select($selQuery); 266 $sqlQuery = DB::select($selQuery);
248 } 267 }
249 } catch(\Illuminate\Database\QueryException $ex){ 268 } catch(\Illuminate\Database\QueryException $ex){
......
...@@ -18,7 +18,7 @@ class Record extends Model{ ...@@ -18,7 +18,7 @@ class Record extends Model{
18 "exittype","dateofexit","abscondtype","abscondeddate","workflowstatus","status", 18 "exittype","dateofexit","abscondtype","abscondeddate","workflowstatus","status",
19 "clientinternalid","department","passportstatus","clientcode","laborcardpersonalid", 19 "clientinternalid","department","passportstatus","clientcode","laborcardpersonalid",
20 "dialer_status","dialer_substatus","dialer_callback","dialer_remarks","dialer_flag", 20 "dialer_status","dialer_substatus","dialer_callback","dialer_remarks","dialer_flag",
21 "dialer_lastcall","priority","crmlist_id","group"); 21 "dialer_lastcall","priority","crmlist_id","group","elegible");
22 private $keyvals=null; 22 private $keyvals=null;
23 public $dataarr=array(); 23 public $dataarr=array();
24 public $rlogarr=array(); 24 public $rlogarr=array();
......
...@@ -65,6 +65,21 @@ $dashboarduser=Auth::user(); ...@@ -65,6 +65,21 @@ $dashboarduser=Auth::user();
65 </div> 65 </div>
66 66
67 <div class="panel panel-info"> 67 <div class="panel panel-info">
68 <div class="panel-body">
69 <div class="col-md-2">
70 <label>Upload Users:</label>
71 </div>
72 <div class="col-md-6">
73 <input type="file" name="user">
74 </div>
75 <div class="col-md-2">
76 <button id="upload" class="btn btn-xs btn-info">Upload
77 </button>
78 </div>
79 </div>
80 </div>
81
82 <div class="panel panel-info">
68 <div class="panel-heading "><strong>Assigned Users List</strong><div style="float:right;"> 83 <div class="panel-heading "><strong>Assigned Users List</strong><div style="float:right;">
69 <button id="removeuser" class="btn btn-xs btn-info">Edit User 84 <button id="removeuser" class="btn btn-xs btn-info">Edit User
70 </button> 85 </button>
......
1 <?php 1 <?php
2 $queryFields = explode(",", 'usr_id,branchCode,organizationName,designation,dob,location,state,residenceAddress,residenceAddressZipCode,officeAddress,officeAddressZipCode,alternateMobile,officeNumber,referenceName,referenceMobile,referenceName2,referenceMobile2,loanStatus,product,bucket,dpd,tenureStartDate,tenureEndDate,tenureRemaining,disbursalDate,rateOfInterest,installmentNo,chequeBounceNo,reasonForLastBounce,reasonForSecondLastBounce,cycleDate,ebnb,bank,lastMonthPaymentMode,lastMonthPaymentAmount,lastMonthPaymentDate,delinquencyString,specialCode,centralECS,emi,pos,bounceCharge,penalMTD,penalLTD,overdueAmount,installmentAmountOverdue,altphone1,altphone2,altphone3,altphone4,altphone5,altphone6,altphone7,altphone8,altphone9,altphone10,priority,dialer_substatus,dialer_callback'); 2 $queryFields = explode(",", 'usr_id,branchCode,organizationName,designation,dob,location,state,residenceAddress,residenceAddressZipCode,officeAddress,officeAddressZipCode,alternateMobile,officeNumber,referenceName,referenceMobile,referenceName2,referenceMobile2,loanStatus,product,bucket,dpd,tenureStartDate,tenureEndDate,tenureRemaining,disbursalDate,rateOfInterest,installmentNo,chequeBounceNo,reasonForLastBounce,reasonForSecondLastBounce,cycleDate,ebnb,bank,lastMonthPaymentMode,lastMonthPaymentAmount,lastMonthPaymentDate,delinquencyString,specialCode,centralECS,emi,pos,bounceCharge,penalMTD,penalLTD,overdueAmount,installmentAmountOverdue,altphone1,altphone2,altphone3,altphone4,altphone5,altphone6,altphone7,altphone8,altphone9,altphone10,priority,dialer_substatus,dialer_callback,elegible');
3 ?> 3 ?>
4 <div class="row"> 4 <div class="row">
5 <div class="col-sm-12"> 5 <div class="col-sm-12">
...@@ -19,6 +19,12 @@ $queryFields = explode(",", 'usr_id,branchCode,organizationName,designation,dob, ...@@ -19,6 +19,12 @@ $queryFields = explode(",", 'usr_id,branchCode,organizationName,designation,dob,
19 <option value="{{$fields}}">{{$fields}}</option> 19 <option value="{{$fields}}">{{$fields}}</option>
20 @endforeach 20 @endforeach
21 </select> 21 </select>
22 <label style="margin-top: 5px;">ELEGIBLE FOR</label>
23 <select id="queryInCondition" multiple="" data-rel="chosen" style='width:100%' class=select2multi>
24 <option value="'CC'">CC</option>
25 <option value="'PL'">PL</option>
26 <option value="'OD'">OD</option>
27 </select>
22 <label style="margin-top: 5px;">FROM 'records' WHERE</label> 28 <label style="margin-top: 5px;">FROM 'records' WHERE</label>
23 <input type="text" class="form-control" id="queryConditions" placeholder="1" value="1"/> 29 <input type="text" class="form-control" id="queryConditions" placeholder="1" value="1"/>
24 </div> 30 </div>
...@@ -67,7 +73,7 @@ $queryFields = explode(",", 'usr_id,branchCode,organizationName,designation,dob, ...@@ -67,7 +73,7 @@ $queryFields = explode(",", 'usr_id,branchCode,organizationName,designation,dob,
67 <script> 73 <script>
68 function runSqlQuery(){ 74 function runSqlQuery(){
69 var checkedValue = $('.saveQryChck:checked').val(); 75 var checkedValue = $('.saveQryChck:checked').val();
70 var data = 'campaign={{ is_array($campaignDetails)?$campaignDetails["mkey"]:$campaignDetails->mkey }}&querySelect='+$("#querySelect").val()+'&queryConditions='+$("#queryConditions").val()+'&queryLimit='+$("#queryLimit").val()+'&queryOffset='+$("#queryOffset").val()+'&checkedValue='+checkedValue; 76 var data = 'campaign={{ is_array($campaignDetails)?$campaignDetails["mkey"]:$campaignDetails->mkey }}&querySelect='+$("#querySelect").val()+'&queryConditions='+$("#queryConditions").val()+'&queryInCondition='+$("#queryInCondition").val()+'&queryLimit='+$("#queryLimit").val()+'&queryOffset='+$("#queryOffset").val()+'&checkedValue='+checkedValue;
71 doAjax("campaign/query",data,"sqlQueryOutput","","","GET"); 77 doAjax("campaign/query",data,"sqlQueryOutput","","","GET");
72 78
73 document.getElementById("downloadButton").style = "margin: 0% 0% 0.1% 84%;display: block"; 79 document.getElementById("downloadButton").style = "margin: 0% 0% 0.1% 84%;display: block";
...@@ -92,6 +98,6 @@ function delSqlQuery(id){ ...@@ -92,6 +98,6 @@ function delSqlQuery(id){
92 98
93 function downloadOutput() 99 function downloadOutput()
94 { 100 {
95 window.open('campaign/download?campaign={{ is_array($campaignDetails)?$campaignDetails["mkey"]:$campaignDetails->mkey }}&querySelect='+$("#querySelect").val()+'&queryConditions='+$("#queryConditions").val()+'&queryLimit='+$("#queryLimit").val()+'&queryOffset='+$("#queryOffset").val());return false; 101 window.open('campaign/download?campaign={{ is_array($campaignDetails)?$campaignDetails["mkey"]:$campaignDetails->mkey }}&querySelect='+$("#querySelect").val()+'&queryConditions='+$("#queryConditions").val()+'&queryInCondition='+$("#queryInCondition").val()+'&queryLimit='+$("#queryLimit").val()+'&queryOffset='+$("#queryOffset").val());return false;
96 } 102 }
97 </script> 103 </script>
...\ No newline at end of file ...\ No newline at end of file
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!