Agent mapping and filters
Showing
15 changed files
with
1285 additions
and
0 deletions
| 1 | <?php namespace App\Http\Controllers; | ||
| 2 | |||
| 3 | use DB; | ||
| 4 | use Auth; | ||
| 5 | use Input; | ||
| 6 | use App\Models\Campaign; | ||
| 7 | use App\Services\FormBuilder; | ||
| 8 | use Illuminate\Http\Request; | ||
| 9 | use Response; | ||
| 10 | use App\Models\User; | ||
| 11 | |||
| 12 | class CampaignController extends Controller { | ||
| 13 | |||
| 14 | public function __construct() | ||
| 15 | { | ||
| 16 | $this->middleware('auth'); | ||
| 17 | $this->middleware('module_access'); | ||
| 18 | } | ||
| 19 | |||
| 20 | public function index() | ||
| 21 | { | ||
| 22 | $data['campaignList'] = Campaign::where('mtype',"=","company")->orderBy('mkey')->get(); | ||
| 23 | $dashboarduser=Auth::user(); | ||
| 24 | if($dashboarduser->usertype != 'Admin'){ | ||
| 25 | $allusers=User::where(function ($query) use($dashboarduser) { | ||
| 26 | $query->where('supervisor','=',$dashboarduser->username) | ||
| 27 | ->orWhere('lteam2','=',$dashboarduser->username) | ||
| 28 | ->orWhere('lteam','=',$dashboarduser->username); | ||
| 29 | })->get(); | ||
| 30 | } | ||
| 31 | else | ||
| 32 | { | ||
| 33 | $allusers=DB::table('users')->select('*')->where('status','=','Active')->get(); | ||
| 34 | } | ||
| 35 | foreach($allusers as $alluser) | ||
| 36 | { | ||
| 37 | |||
| 38 | $username[] = $alluser->username; | ||
| 39 | } | ||
| 40 | |||
| 41 | //$data['client'] = $client; | ||
| 42 | if(isset($username))$data['username'] = $username; | ||
| 43 | return view("layout.module.campaign.index",$data); | ||
| 44 | } | ||
| 45 | |||
| 46 | public function create() | ||
| 47 | { | ||
| 48 | } | ||
| 49 | |||
| 50 | public function store(Request $request) | ||
| 51 | { | ||
| 52 | $action = Input::get("action"); | ||
| 53 | |||
| 54 | // if($action=="createCampaign") | ||
| 55 | // { | ||
| 56 | // $this->validate($request,[ | ||
| 57 | // 'campaignName' => 'required|alpha_dash', | ||
| 58 | // ]); | ||
| 59 | |||
| 60 | // $campaignName = Input::get("campaignName"); | ||
| 61 | |||
| 62 | // if($campaignName != ""){ | ||
| 63 | // Campaign::insert(["mkey"=>$campaignName,"mtype"=>"company"]); | ||
| 64 | // $data['campaignDetails'] = Campaign::where("mtype","=","company")->where("mkey","=",$campaignName)->first(); | ||
| 65 | // return view("layout.module.campaign.campaign",$data); | ||
| 66 | // }else{ | ||
| 67 | // return "<script>simpleNotification('error','topRight','Campaign name should not be blank.');</script><br/><p class='text-danger text-center'>Campaign name should not be blank.</p>"; | ||
| 68 | // } | ||
| 69 | // } | ||
| 70 | |||
| 71 | // if($action=="buildForm") | ||
| 72 | // { | ||
| 73 | // $rawData = Input::get("rawData"); | ||
| 74 | // $fb = new FormBuilder(); | ||
| 75 | // $output = $fb->buildForm($rawData); | ||
| 76 | // return $output; | ||
| 77 | // } | ||
| 78 | |||
| 79 | // if($action=="dataUpload") | ||
| 80 | // { | ||
| 81 | // return view("layout.module.campaign.campaignTabData"); | ||
| 82 | // } | ||
| 83 | } | ||
| 84 | |||
| 85 | public function show($id) | ||
| 86 | { | ||
| 87 | if($id=="show") | ||
| 88 | { | ||
| 89 | $campaign = Input::get("campaign"); | ||
| 90 | if($campaign != ""){ | ||
| 91 | //this condition for getting all campaign data | ||
| 92 | if($campaign == "all") | ||
| 93 | { | ||
| 94 | $data['campaignDetails']['mkey'] ="All"; | ||
| 95 | |||
| 96 | $data['dataCountByStatus'] = DB::table("records")->select(DB::Raw('status, count(*) as recordCount'))->groupBy('status')->get(); | ||
| 97 | $data['dataCountByDisposition'] = DB::table("records")->select(DB::Raw('dialer_status, count(*) as recordCount'))->groupBy('dialer_status')->get(); | ||
| 98 | $data['queryLogs'] = DB::table("campaign_query")->get(); | ||
| 99 | // $data['dataList'] = DB::table("records")->select(DB::Raw('list_id, count(*) as recordCount'))->where("client","=",$campaign)->groupBy('list_id')->get(); | ||
| 100 | $userassignedcampign=DB::table('users')->select('username','clients')->whereRaw(' FIND_IN_SET(?,clients)', [$campaign])->get(); | ||
| 101 | return view("layout.module.campaign.campaign",$data,compact('userassignedcampign')); | ||
| 102 | |||
| 103 | }else{ | ||
| 104 | $data['campaignDetails'] = Campaign::where("mtype","=","company")->where("mkey","=",$campaign)->first(); | ||
| 105 | $data['dataCountByStatus'] = DB::table("records")->select(DB::Raw('status, count(*) as recordCount'))->where("client","=",$campaign)->groupBy('status')->get(); | ||
| 106 | $data['dataCountByDisposition'] = DB::table("records")->select(DB::Raw('dialer_status, count(*) as recordCount'))->where("client","=",$campaign)->groupBy('dialer_status')->get(); | ||
| 107 | $data['queryLogs'] = DB::table("campaign_query")->where('campaign', '=', $campaign)->get(); | ||
| 108 | // $data['dataList'] = DB::table("records")->select(DB::Raw('list_id, count(*) as recordCount'))->where("client","=",$campaign)->groupBy('list_id')->get(); | ||
| 109 | $userassignedcampign=DB::table('users')->select('username','clients')->whereRaw(' FIND_IN_SET(?,clients)', [$campaign])->get(); | ||
| 110 | return view("layout.module.campaign.campaign",$data,compact('userassignedcampign')); | ||
| 111 | } | ||
| 112 | |||
| 113 | }else{ | ||
| 114 | return "<script>simpleNotification('error','topRight','Campaign name should not be blank.');</script><br/><p class='text-danger text-center'>Campaign name should not be blank.</p>"; | ||
| 115 | } | ||
| 116 | } | ||
| 117 | |||
| 118 | if($id=="query") | ||
| 119 | { | ||
| 120 | $campaign = Input::get("campaign"); | ||
| 121 | $querySelect = Input::get("querySelect"); | ||
| 122 | $queryConditions = Input::get("queryConditions"); | ||
| 123 | if($queryConditions){ | ||
| 124 | $queryConditions = str_replace('"', "'", $queryConditions); | ||
| 125 | $queryConditions = str_replace(''', "'", $queryConditions); | ||
| 126 | }else{ | ||
| 127 | $queryConditions = '1'; | ||
| 128 | } | ||
| 129 | $queryLimit = Input::get("queryLimit"); | ||
| 130 | $queryOffset = Input::get("queryOffset"); | ||
| 131 | $checkedValue = Input::get("checkedValue"); | ||
| 132 | $fields = explode(",", $querySelect); | ||
| 133 | |||
| 134 | $i = 1; $output = ''; | ||
| 135 | try { | ||
| 136 | |||
| 137 | |||
| 138 | if($campaign=="All") | ||
| 139 | { | ||
| 140 | $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 141 | $sqlQuery = DB::select($selQuery); | ||
| 142 | }else | ||
| 143 | { | ||
| 144 | $selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 145 | $sqlQuery = DB::select($selQuery); | ||
| 146 | } | ||
| 147 | |||
| 148 | if($checkedValue=="on") | ||
| 149 | { | ||
| 150 | $queryExist = DB::table('campaign_query')->where('query','=',$selQuery)->where('campaign', '=', $campaign)->select('id')->first(); | ||
| 151 | |||
| 152 | if(empty($queryExist)) | ||
| 153 | { | ||
| 154 | DB::table('campaign_query')->insert(['campaign'=>$campaign, 'query'=>$selQuery, 'select_col'=>$querySelect,'where_cond'=>"client = '$campaign' AND $queryConditions"]); | ||
| 155 | } | ||
| 156 | } | ||
| 157 | |||
| 158 | } catch(\Illuminate\Database\QueryException $ex){ | ||
| 159 | $output .= "<p class='text-danger'>".$ex->getMessage()."</p>"; | ||
| 160 | return $output; | ||
| 161 | } | ||
| 162 | |||
| 163 | if(count($sqlQuery)){ | ||
| 164 | $output .= '<div style="overflow-x:auto;"><table class="table table-bordered"><thead><tr><th class="text-center">#</th>'; | ||
| 165 | foreach ($fields as $key) { | ||
| 166 | $output .= '<th class="text-center">'.trim($key).'</th>'; | ||
| 167 | } | ||
| 168 | $output .= "</tr></thed><tbody>"; | ||
| 169 | foreach($sqlQuery as $row){ | ||
| 170 | $output .= '<tr><th class="text-center">'.$i.'</th>'; | ||
| 171 | foreach ($fields as $key) { | ||
| 172 | $output .= '<td>'.trim($row->$key).'</td>'; | ||
| 173 | } | ||
| 174 | $output .= "</tr>"; | ||
| 175 | $i++; | ||
| 176 | } | ||
| 177 | }else{ | ||
| 178 | $output .= '<h5 class="text-danger"><i class="fa fa-exclamation-circle"></i> No Result!</h5>'; | ||
| 179 | } | ||
| 180 | $output .= '</tbody></table></div>'; | ||
| 181 | return $output; | ||
| 182 | } | ||
| 183 | |||
| 184 | if($id=="fquery") | ||
| 185 | { | ||
| 186 | $output = '';$i = 1; | ||
| 187 | $campaign = Input::get("campaign"); | ||
| 188 | |||
| 189 | $id = Input::get("id"); | ||
| 190 | |||
| 191 | $queryTxt = DB::table('campaign_query')->where('id','=', $id)->select('query','select_col')->first(); | ||
| 192 | |||
| 193 | $fields = explode(",", $queryTxt->select_col); | ||
| 194 | |||
| 195 | $sqlQuery = DB::select($queryTxt->query); | ||
| 196 | |||
| 197 | if(count($sqlQuery)){ | ||
| 198 | $output .= '<div style="overflow-x:auto;"><table class="table table-bordered"><thead><tr><th class="text-center">#</th>'; | ||
| 199 | foreach ($fields as $key) { | ||
| 200 | $output .= '<th class="text-center">'.trim($key).'</th>'; | ||
| 201 | } | ||
| 202 | $output .= "</tr></thed><tbody>"; | ||
| 203 | foreach($sqlQuery as $row){ | ||
| 204 | $output .= '<tr><th class="text-center">'.$i.'</th>'; | ||
| 205 | foreach ($fields as $key) { | ||
| 206 | $output .= '<td>'.trim($row->$key).'</td>'; | ||
| 207 | } | ||
| 208 | $output .= "</tr>"; | ||
| 209 | $i++; | ||
| 210 | } | ||
| 211 | }else{ | ||
| 212 | $output .= '<h5 class="text-danger"><i class="fa fa-exclamation-circle"></i> No Result!</h5>'; | ||
| 213 | } | ||
| 214 | |||
| 215 | return $output; | ||
| 216 | } | ||
| 217 | |||
| 218 | if($id=="delete") | ||
| 219 | { | ||
| 220 | $id = Input::get("id"); | ||
| 221 | |||
| 222 | DB::table('campaign_query')->where('id','=', $id)->delete(); | ||
| 223 | |||
| 224 | return; | ||
| 225 | } | ||
| 226 | |||
| 227 | if($id=="download") | ||
| 228 | { | ||
| 229 | $campaign = Input::get("campaign"); | ||
| 230 | $querySelect = Input::get("querySelect"); | ||
| 231 | $queryConditions = Input::get("queryConditions"); | ||
| 232 | if($queryConditions){ | ||
| 233 | $queryConditions = str_replace('"', "'", $queryConditions); | ||
| 234 | $queryConditions = str_replace(''', "'", $queryConditions); | ||
| 235 | }else{ | ||
| 236 | $queryConditions = '1'; | ||
| 237 | } | ||
| 238 | $queryLimit = Input::get("queryLimit"); | ||
| 239 | $queryOffset = Input::get("queryOffset"); | ||
| 240 | |||
| 241 | try { | ||
| 242 | if($campaign=="All"){ | ||
| 243 | $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 244 | $sqlQuery = DB::select($selQuery); | ||
| 245 | }else{ | ||
| 246 | $selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 247 | $sqlQuery = DB::select($selQuery); | ||
| 248 | } | ||
| 249 | } catch(\Illuminate\Database\QueryException $ex){ | ||
| 250 | $output .= "<p class='text-danger'>".$ex->getMessage()."</p>"; | ||
| 251 | return $output; | ||
| 252 | } | ||
| 253 | |||
| 254 | $data['fieldsarr'] = explode(",", $querySelect); | ||
| 255 | $data['alist'] = $sqlQuery; | ||
| 256 | |||
| 257 | return view("layout.module.campaign.download",$data); | ||
| 258 | } | ||
| 259 | |||
| 260 | if($id=="getDataFormat") | ||
| 261 | { | ||
| 262 | return view("layout.module.campaign.campaignTabData"); | ||
| 263 | } | ||
| 264 | |||
| 265 | if($id=="addCurrQueue") | ||
| 266 | { | ||
| 267 | $campQryId = Input::get("radioValue"); | ||
| 268 | |||
| 269 | DB::table('campaign_query')->where('id','!=', $campQryId)->update(['current_queue'=>'']); | ||
| 270 | DB::table('campaign_query')->where('id','=', $campQryId)->update(['current_queue'=>'selected']); | ||
| 271 | |||
| 272 | return Response::make("<script>simpleNotification('success','topRight','Query Logic added successfully!');</script>"); | ||
| 273 | } | ||
| 274 | if($id=="assigncampaign") | ||
| 275 | { | ||
| 276 | $agentsNewArr = array(); | ||
| 277 | |||
| 278 | $agents = Input::get('agents'); | ||
| 279 | $campaign = Input::get("selectCampaignField"); | ||
| 280 | $agentsArr = explode(",", $agents); | ||
| 281 | $hrmsdata['clientsownerlist'] = array(); | ||
| 282 | $campaignList=""; | ||
| 283 | if($campaign=="all") | ||
| 284 | { | ||
| 285 | $campaign=""; | ||
| 286 | $allcampaign=Campaign::where('mtype',"=","company")->orderBy('mkey')->get(); | ||
| 287 | foreach ($allcampaign as $mkeycampaign) | ||
| 288 | { | ||
| 289 | $campaign .= $mkeycampaign->mkey.","; | ||
| 290 | } | ||
| 291 | $campaign=substr($campaign, 0, -1); | ||
| 292 | foreach ($agentsArr as $key => $agent) | ||
| 293 | { | ||
| 294 | $usercampaign=DB::table('users')->where('username','=',$agent)->select('clients','data')->first(); | ||
| 295 | $data=json_decode($usercampaign->data,true); | ||
| 296 | if(isset($data['hrmsdata'])){ | ||
| 297 | $hrmsdata=unserialize($data['hrmsdata']); | ||
| 298 | |||
| 299 | $hrmsdata['clientsownerlist'].=",".$campaign; | ||
| 300 | $data['hrmsdata']=serialize($hrmsdata); | ||
| 301 | }else{ | ||
| 302 | $hrmsdata['clientsownerlist'] =$campaign; | ||
| 303 | $data['hrmsdata']=serialize($hrmsdata); | ||
| 304 | } | ||
| 305 | $data=json_encode($data); | ||
| 306 | |||
| 307 | |||
| 308 | DB::statement("update users set updated_at='".date("Y-m-d H:i:s")."',clients='$campaign',data='$data' where username='$agent'"); | ||
| 309 | } | ||
| 310 | } | ||
| 311 | else | ||
| 312 | { | ||
| 313 | |||
| 314 | foreach ($agentsArr as $key => $agent) | ||
| 315 | { | ||
| 316 | $usercampaign=User::where('username','=',$agent)->first(); | ||
| 317 | |||
| 318 | $campaignList =$usercampaign->clients.",".$campaign; | ||
| 319 | $data=json_decode($usercampaign->data,true); | ||
| 320 | if(isset($data['hrmsdata'])) | ||
| 321 | { | ||
| 322 | $hrmsdata=unserialize($data['hrmsdata']); | ||
| 323 | $hrmsdata['clientsownerlist'] = $campaignList; | ||
| 324 | $data['hrmsdata']=serialize($hrmsdata); | ||
| 325 | }else | ||
| 326 | { | ||
| 327 | $hrmsdata['clientsownerlist'] = $campaignList; | ||
| 328 | $data['hrmsdata']=serialize($hrmsdata); | ||
| 329 | } | ||
| 330 | $data=json_encode($data); | ||
| 331 | |||
| 332 | $usercampaign->updated_at=date("Y-m-d H:i:s"); | ||
| 333 | $usercampaign->clients=$campaignList; | ||
| 334 | $usercampaign->data=$data; | ||
| 335 | $usercampaign->save(); | ||
| 336 | |||
| 337 | //DB::statement("update users set updated_at='".date("Y-m-d H:i:s")."',clients='$campaign1',data='$data' where username='$agent'"); | ||
| 338 | } | ||
| 339 | } | ||
| 340 | |||
| 341 | return; | ||
| 342 | } | ||
| 343 | |||
| 344 | if($id=="removecampaign") | ||
| 345 | { | ||
| 346 | $agentsNewArr = array(); | ||
| 347 | $agents = Input::get('agents'); | ||
| 348 | $campaign = Input::get("selectCampaignField"); | ||
| 349 | $agentsArr = explode(",", $agents); | ||
| 350 | $hrmsdata['clientsownerlist'] = array(); | ||
| 351 | $campaignList=""; | ||
| 352 | |||
| 353 | if($campaign) | ||
| 354 | { | ||
| 355 | $usercampaignall=User::where('clients','like','%'.$campaign.'%')->pluck('username')->toArray(); | ||
| 356 | $removeagentsArr=array(); | ||
| 357 | if ($usercampaignall) | ||
| 358 | { | ||
| 359 | $removeagentsArr=array_diff($usercampaignall,$agentsArr); | ||
| 360 | } | ||
| 361 | foreach ($removeagentsArr as $key => $agent) | ||
| 362 | { | ||
| 363 | $usercampaign=DB::table('users')->where('username','=',$agent)->select('clients','data')->first(); | ||
| 364 | $data=json_decode($usercampaign->data,true); | ||
| 365 | $clients=$usercampaign->clients; | ||
| 366 | |||
| 367 | if($clients) | ||
| 368 | { | ||
| 369 | $clients_arr=explode(",",$clients); | ||
| 370 | $update_campaign[]=$campaign; | ||
| 371 | $update_clients=array_diff($clients_arr, $update_campaign); | ||
| 372 | $finalcampaign= implode(",",$update_clients); | ||
| 373 | } | ||
| 374 | |||
| 375 | if(isset($data['hrmsdata'])) | ||
| 376 | { | ||
| 377 | $hrmsdata=unserialize($data['hrmsdata']); | ||
| 378 | $hrms_arr=explode(",", $hrmsdata['clientsownerlist']); | ||
| 379 | $update_campaign[]=$campaign; | ||
| 380 | $update_hrms=array_diff($hrms_arr, $update_campaign); | ||
| 381 | $hrmsdata['clientsownerlist']= implode(",",$update_hrms); | ||
| 382 | $data['hrmsdata']=serialize($hrmsdata); | ||
| 383 | $data=json_encode($data); | ||
| 384 | |||
| 385 | } | ||
| 386 | |||
| 387 | DB::statement("update users set updated_at='".date("Y-m-d H:i:s")."',clients='$finalcampaign',data='$data' where username='$agent'"); | ||
| 388 | } | ||
| 389 | } | ||
| 390 | |||
| 391 | return; | ||
| 392 | } | ||
| 393 | } | ||
| 394 | |||
| 395 | public function edit($id) | ||
| 396 | { | ||
| 397 | } | ||
| 398 | |||
| 399 | public function update($id) | ||
| 400 | { | ||
| 401 | } | ||
| 402 | |||
| 403 | public function destroy($id) | ||
| 404 | { | ||
| 405 | } | ||
| 406 | |||
| 407 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -45,6 +45,7 @@ Route::group(['middleware' => ['web']], function () { | ... | @@ -45,6 +45,7 @@ Route::group(['middleware' => ['web']], function () { |
| 45 | Route::resource('master','MasterController'); | 45 | Route::resource('master','MasterController'); |
| 46 | Route::resource('admin','AdminController'); | 46 | Route::resource('admin','AdminController'); |
| 47 | Route::resource('record','RecordController'); | 47 | Route::resource('record','RecordController'); |
| 48 | Route::resource('campaign','CampaignController'); | ||
| 48 | 49 | ||
| 49 | Route::resource('dialer','DialerController'); | 50 | Route::resource('dialer','DialerController'); |
| 50 | Route::resource('hr','HRController'); | 51 | Route::resource('hr','HRController'); | ... | ... |
application/app/Models/Campaign.php
0 → 100755
| ... | @@ -109,6 +109,10 @@ return [ | ... | @@ -109,6 +109,10 @@ return [ |
| 109 | "RecordingQC"=>["menuAction('dialer/recqc');","A"], | 109 | "RecordingQC"=>["menuAction('dialer/recqc');","A"], |
| 110 | "RecordingArchive"=>["menuAction('dialer/recarchive');","A"], | 110 | "RecordingArchive"=>["menuAction('dialer/recarchive');","A"], |
| 111 | ]], | 111 | ]], |
| 112 | |||
| 113 | "Campaign" => ["disp"=>"Campaign","icon"=>"file","dash"=>"","onclick"=>"menuAction('campaign');"], | ||
| 114 | |||
| 115 | |||
| 112 | "Admin" => ["disp"=>"Admin","icon"=>"gear","dash"=>"", | 116 | "Admin" => ["disp"=>"Admin","icon"=>"gear","dash"=>"", |
| 113 | "submenu"=>["Masters"=>["showBlock('Masters');"], | 117 | "submenu"=>["Masters"=>["showBlock('Masters');"], |
| 114 | "Delete Record"=>["showBlock('DeletePerson');"], | 118 | "Delete Record"=>["showBlock('DeletePerson');"], | ... | ... |
| 1 | @include("layout/module/campaign/formBuilder") | ||
| 2 | |||
| 3 | @if($campaignDetails) | ||
| 4 | <hr style="margin-top: 10px;margin-bottom: 10px;" /> | ||
| 5 | <div class="row"> | ||
| 6 | <div class="col-sm-2"> | ||
| 7 | <h4 class="text-center"><span class="text-info"> {{ is_array($campaignDetails)?$campaignDetails['mkey']:$campaignDetails->mkey}}</span> <small>campaign</small></h4> | ||
| 8 | <ul class="list-group"> | ||
| 9 | <li class="list-group-item active">By Call Status</li> | ||
| 10 | <?php $totalRecordsByStatus = 0; ?> | ||
| 11 | @foreach($dataCountByStatus as $data) | ||
| 12 | <li class="list-group-item"> | ||
| 13 | {{ $data->status ? $data->status : '- Blank -' }} <span class="badge">{{$data->recordCount}}</span> | ||
| 14 | </li> | ||
| 15 | <?php $totalRecordsByStatus += $data->recordCount; ?> | ||
| 16 | @endforeach | ||
| 17 | <li class="list-group-item" style="background-color:#f6f7fb;"> | ||
| 18 | <strong>Total</strong> <span class="badge"><strong>{{ isset($totalRecordsByStatus) ? $totalRecordsByStatus : '0' }}</strong></span> | ||
| 19 | </li> | ||
| 20 | </ul> | ||
| 21 | |||
| 22 | <ul class="list-group"> | ||
| 23 | <li class="list-group-item active">By Disposition</li> | ||
| 24 | <?php $totalRecordsByDisposition = 0; ?> | ||
| 25 | @foreach($dataCountByDisposition as $data) | ||
| 26 | <li class="list-group-item"> | ||
| 27 | {{ $data->dialer_status ? $data->dialer_status : '- Blank -' }} <span class="badge">{{$data->recordCount}}</span> | ||
| 28 | </li> | ||
| 29 | <?php $totalRecordsByDisposition += $data->recordCount; ?> | ||
| 30 | @endforeach | ||
| 31 | <li class="list-group-item" style="background-color:#f6f7fb;"> | ||
| 32 | <strong>Total</strong> <span class="badge"><strong>{{ isset($totalRecordsByDisposition) ? $totalRecordsByDisposition : '0' }}</strong></span> | ||
| 33 | </li> | ||
| 34 | </ul> | ||
| 35 | </div> | ||
| 36 | <div class="col-sm-10"> | ||
| 37 | <div> | ||
| 38 | <ul class="nav nav-tabs" role="tablist"> | ||
| 39 | <!-- <li role="presentation"> | ||
| 40 | <a href="#ctCrm" aria-controls="home" role="tab" data-toggle="tab">CRM</a> | ||
| 41 | </li> | ||
| 42 | <li role="presentation"> | ||
| 43 | <a href="#ctScript" aria-controls="profile" role="tab" data-toggle="tab">Script</a> | ||
| 44 | </li> | ||
| 45 | <li role="presentation"> | ||
| 46 | <a href="#ctFeedback" aria-controls="messages" role="tab" data-toggle="tab">Feedback</a> | ||
| 47 | </li> | ||
| 48 | <li role="presentation"> | ||
| 49 | <a href="#ctSettings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a> | ||
| 50 | </li> | ||
| 51 | <li role="presentation"> | ||
| 52 | <a href="#ctData" aria-controls="data" role="tab" data-toggle="tab">Data</a> | ||
| 53 | </li> --> | ||
| 54 | <li role="presentation" class="active"> | ||
| 55 | <a href="#ctSql" aria-controls="sql" role="tab" data-toggle="tab">SQL</a> | ||
| 56 | </li> | ||
| 57 | <li role="presentation"> | ||
| 58 | <a href="#ctSql1" aria-controls="sql" role="tab" data-toggle="tab">CQ Condition</a> | ||
| 59 | </li> | ||
| 60 | <li role="presentation"> | ||
| 61 | <a href="#assign" aria-controls="sql" role="tab" data-toggle="tab">Assign</a> | ||
| 62 | </li> | ||
| 63 | </ul> | ||
| 64 | <div class="tab-content"> | ||
| 65 | <!-- <div role="tabpanel" class="tab-pane" id="ctCrm"> | ||
| 66 | </div> | ||
| 67 | <div role="tabpanel" class="tab-pane" id="ctScript"> | ||
| 68 | </div> | ||
| 69 | <div role="tabpanel" class="tab-pane" id="ctFeedback"> | ||
| 70 | </div> | ||
| 71 | <div role="tabpanel" class="tab-pane" id="ctSettings"> | ||
| 72 | </div> | ||
| 73 | <div role="tabpanel" class="tab-pane" id="ctData"> | ||
| 74 | </div> --> | ||
| 75 | <div role="tabpanel" class="tab-pane active" id="ctSql"> | ||
| 76 | @include("layout/module/campaign/campaignTabSql") | ||
| 77 | </div> | ||
| 78 | <div role="tabpanel" class="tab-pane" id="ctSql1"> | ||
| 79 | @include("layout/module/campaign/campaignTabSqlCond") | ||
| 80 | </div> | ||
| 81 | <div role="tabpanel" class="tab-pane" id="assign"> | ||
| 82 | @include("layout/module/campaign/campaignAssignToAgents") | ||
| 83 | </div> | ||
| 84 | </div> | ||
| 85 | </div> | ||
| 86 | </div> | ||
| 87 | </div> | ||
| 88 | @else | ||
| 89 | <br/> | ||
| 90 | <p class="text-danger text-center">Campaign not found.</p> | ||
| 91 | @endif | ||
| 92 | |||
| 93 | <style> | ||
| 94 | .tab-pane{padding: 10px;border: 1px solid #ed5564;border-top: none;} | ||
| 95 | .nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus{border: 1px solid #ed5564;border-bottom-color: transparent;} | ||
| 96 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php | ||
| 2 | $dashboarduser=Auth::user(); | ||
| 3 | if($dashboarduser->usertype != 'Admin'){ | ||
| 4 | $allusers=User::where(function ($query) use($dashboarduser) { | ||
| 5 | $query->where('supervisor','=',$dashboarduser->username) | ||
| 6 | ->orWhere('lteam2','=',$dashboarduser->username) | ||
| 7 | ->orWhere('lteam','=',$dashboarduser->username); | ||
| 8 | })->get(); | ||
| 9 | } | ||
| 10 | else | ||
| 11 | { | ||
| 12 | $allusers=DB::table('users')->select('*')->where('status','=','Active')->get(); | ||
| 13 | } | ||
| 14 | |||
| 15 | foreach($userassignedcampign as $userassigned) | ||
| 16 | { | ||
| 17 | $userassignedcamp[] = $userassigned->username; | ||
| 18 | } | ||
| 19 | |||
| 20 | foreach($allusers as $alluser) | ||
| 21 | { | ||
| 22 | if (isset($userassignedcamp)) { | ||
| 23 | if (!in_array($alluser->username, $userassignedcamp)) | ||
| 24 | { | ||
| 25 | $username[] = $alluser->username; | ||
| 26 | } | ||
| 27 | } | ||
| 28 | else{ | ||
| 29 | $username[] = $alluser->username; | ||
| 30 | } | ||
| 31 | |||
| 32 | } | ||
| 33 | foreach($allusers as $user) | ||
| 34 | { | ||
| 35 | $campaigns=$user->clients; | ||
| 36 | if(isset($data->hrmsdata)) | ||
| 37 | {print_r('man');echo "<br><br>"; | ||
| 38 | $hrmsdata=unserialize($data['hrmsdata']); | ||
| 39 | // $campaignList = $hrmsdata['clientsownerlist'];print_r($campaignList); | ||
| 40 | } | ||
| 41 | //$username[] = $alluser->username; | ||
| 42 | } | ||
| 43 | |||
| 44 | //$data['client'] = $client; | ||
| 45 | // if(isset($username))$data->username = $username; | ||
| 46 | ?> | ||
| 47 | <div class="row"> | ||
| 48 | <div class="col-md-12"> | ||
| 49 | <div class="panel panel-info"> | ||
| 50 | <div class="panel-body"> | ||
| 51 | <div class="col-md-2"> | ||
| 52 | <label>Select User:</label> | ||
| 53 | </div> | ||
| 54 | <div class="col-md-6"> | ||
| 55 | <select id="username" class="select2multi" style='width:100%' multiple=""> | ||
| 56 | <option value></option> | ||
| 57 | <?php if(isset($username))foreach($username as $user){;echo "<option value='$user'>$user</option>";} ?> | ||
| 58 | </select> | ||
| 59 | </div> | ||
| 60 | <div class="col-md-2"> | ||
| 61 | <button id="assigncampaign" class="btn btn-xs btn-info">Assign Campaign | ||
| 62 | </button> | ||
| 63 | </div> | ||
| 64 | </div> | ||
| 65 | </div> | ||
| 66 | |||
| 67 | <div class="panel panel-info"> | ||
| 68 | <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 | ||
| 70 | </button> | ||
| 71 | </div></div> | ||
| 72 | <div class="panel-body"> | ||
| 73 | |||
| 74 | <div class="col-md-12" id="dbs"> | ||
| 75 | @foreach ($userassignedcampign as $row) | ||
| 76 | |||
| 77 | <div class="col-md-1">{{$row->username}}</div> | ||
| 78 | |||
| 79 | @endforeach | ||
| 80 | </div> | ||
| 81 | <div class="col-md-12" id="abs" style="display:none"> | ||
| 82 | <div class="col-md-6"> | ||
| 83 | <select id="username1" class="select2multi" style='width:100%' multiple=""> | ||
| 84 | <option value></option> | ||
| 85 | <?php if(isset($userassignedcamp))foreach($userassignedcamp as $userassigned){;echo "<option value='$userassigned' selected>$userassigned</option>";} ?> | ||
| 86 | </select> | ||
| 87 | </div> | ||
| 88 | <div class="col-md-2"> | ||
| 89 | <button id="removecampaign" class="btn btn-xs btn-info">Save | ||
| 90 | </button> | ||
| 91 | </div> | ||
| 92 | </div> | ||
| 93 | |||
| 94 | |||
| 95 | </div> | ||
| 96 | </div> | ||
| 97 | </div> | ||
| 98 | </div> | ||
| 99 | |||
| 100 | <script> | ||
| 101 | function addInQueue(){ | ||
| 102 | var data = 'radioValue='+$("input[name='query']:checked").val(); | ||
| 103 | |||
| 104 | doAjax("campaign/addCurrQueue",data,"","","","GET"); | ||
| 105 | } | ||
| 106 | |||
| 107 | $('#assigncampaign').click(function() | ||
| 108 | { | ||
| 109 | var agents = $('#username').val(); | ||
| 110 | var selectCampaignField = $('#selectCampaignField').val(); | ||
| 111 | |||
| 112 | |||
| 113 | if(agents&&selectCampaignField) | ||
| 114 | { | ||
| 115 | var postdata='agents='+agents; | ||
| 116 | postdata+='&selectCampaignField='+selectCampaignField; | ||
| 117 | doAjax("campaign/assigncampaign",postdata,"campaignDetailsArea","","","GET",function(retrstr){ | ||
| 118 | doAjax("campaign/show","campaign="+selectCampaignField,"campaignDetailsArea","","","GET"); | ||
| 119 | simpleNotification('Success','topRight',"Campaign assign suceesfully!"); | ||
| 120 | $("#usrname").select2("val", "Select User..."); | ||
| 121 | $("#selectCampaignField").select("val", "Select Dial Mode..."); | ||
| 122 | |||
| 123 | }); | ||
| 124 | } | ||
| 125 | else | ||
| 126 | { | ||
| 127 | $("#campaignDetailsArea").html('<br/><p class="text-danger text-center">Please select the campaign and user.</p>'); | ||
| 128 | } | ||
| 129 | |||
| 130 | }); | ||
| 131 | |||
| 132 | $("#removeuser").click(function(){ | ||
| 133 | $("#dbs").hide(); | ||
| 134 | $("#abs").toggle(); | ||
| 135 | }); | ||
| 136 | $('#removecampaign').click(function() | ||
| 137 | { | ||
| 138 | var agents = $('#username1').val(); | ||
| 139 | var selectCampaignField = $('#selectCampaignField').val(); | ||
| 140 | |||
| 141 | |||
| 142 | if(selectCampaignField) | ||
| 143 | { | ||
| 144 | var postdata='agents='+agents; | ||
| 145 | postdata+='&selectCampaignField='+selectCampaignField; | ||
| 146 | doAjax("campaign/removecampaign",postdata,"campaignDetailsArea","","","GET",function(retrstr){ | ||
| 147 | doAjax("campaign/show","campaign="+selectCampaignField,"campaignDetailsArea","","","GET") | ||
| 148 | simpleNotification('Success','topRight',"Campaign assign suceesfully!"); | ||
| 149 | $("#usrname").select2("val", "Select User..."); | ||
| 150 | $("#selectCampaignField").select("val", "Select Dial Mode..."); | ||
| 151 | |||
| 152 | }); | ||
| 153 | } | ||
| 154 | else | ||
| 155 | { | ||
| 156 | $("#campaignDetailsArea").html('<br/><p class="text-danger text-center">Please select the campaign and user.</p>'); | ||
| 157 | } | ||
| 158 | |||
| 159 | }); | ||
| 160 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <div class="row"> | ||
| 2 | <div class="btn-group pull-right"> | ||
| 3 | <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-fw fa-plus-square"></i> Add Field <span class="caret"></span> | ||
| 4 | </button> | ||
| 5 | <ul class="dropdown-menu"> | ||
| 6 | <li><a href="#" onclick="fbAddField('layout','addCrmArea');return false;"><i class="fa fa-fw fa-th-large"></i> Layout</a></li> | ||
| 7 | <li><a href="#" onclick="fbAddField('text','addCrmArea');return false;"><i class="fa fa-fw fa-font"></i> Text</a></li> | ||
| 8 | <li><a href="#" onclick="fbAddField('select','addCrmArea');return false;"><i class="fa fa-fw fa-indent"></i> Select Box</a></li> | ||
| 9 | <li><a href="#" onclick="fbAddField('date','addCrmArea');return false;"><i class="fa fa-fw fa-calendar"></i> Date</a></li> | ||
| 10 | <li><a href="#" onclick="fbAddField('textArea','addCrmArea');return false;"><i class="fa fa-fw fa-list-alt"></i> Text Area</a></li> | ||
| 11 | </ul> | ||
| 12 | </div> | ||
| 13 | </div> | ||
| 14 | |||
| 15 | <div class="modal fade" id="fbAddFieldForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
| 16 | <div class="modal-dialog" role="document"> | ||
| 17 | <div class="modal-content"> | ||
| 18 | <div class="modal-body" id="fbAddFieldFormContent"></div> | ||
| 19 | </div> | ||
| 20 | </div> | ||
| 21 | </div> | ||
| 22 | |||
| 23 | <hr style="margin:5px 0;border: 1px solid #ed5564;" /> | ||
| 24 | <div id="addCrmArea"></div> | ||
| 25 | |||
| 26 | <script> | ||
| 27 | var feedbackForm = '{"formData":{"row1":{"column1":{"columnName":"Personal Information","columnCount":"6","fields":{"customerName":{"type":"text","name":"customerName","title":"Customer Name","required":true,"default":"","editable":true},"customerType":{"type":"select","name":"customerType","title":"Customer Type","required":true,"options":"Existing,New,MNP,Corporate","default":"Existing","editable":true},"customerAddress":{"type":"textArea","name":"customerAddress","title":"Customer Address","required":true,"default":"","editable":true},"birthDate":{"type":"date","name":"birthDate","title":"Birth Date","required":true,"default":"","editable":true}}},"column2":{"columnName":"Plan Details","columnCount":"6","fields":{"planName":{"type":"text","name":"planName","title":"Plan Name","required":true,"default":"","editable":true},"planType":{"type":"select","name":"planType","title":"Plan Type","required":true,"options":"Prepaid,Postpaid","default":"Postpaid","editable":true},"planIncludes":{"type":"textArea","name":"planIncludes","title":"Plan Includes","required":true,"default":"","editable":true}}}}},"formFields":"customerName,customerType,customerAddress,birthDate,planName,planType,planIncludes"}'; | ||
| 28 | |||
| 29 | doAjax("campaign","action=buildForm&rawData="+feedbackForm,"addCrmArea","","","POST"); | ||
| 30 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php | ||
| 2 | |||
| 3 | use App\Models\Campaign; | ||
| 4 | |||
| 5 | ini_set("precision", 15); | ||
| 6 | |||
| 7 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 8 | |||
| 9 | if ($_SERVER["REQUEST_METHOD"] == "POST") | ||
| 10 | { | ||
| 11 | $errorMsg = ""; $successMsg = "";$successCount = 0; | ||
| 12 | |||
| 13 | if($_FILES['file']['tmp_name']) | ||
| 14 | { | ||
| 15 | if($_FILES['file']['type'] == "application/vnd.ms-excel") | ||
| 16 | { | ||
| 17 | $fileUploadLimit = 52428800; // files size is in bytes | ||
| 18 | if($_FILES['file']['size'] < $fileUploadLimit) | ||
| 19 | { | ||
| 20 | if ($_POST["uploadFileType"] == "customerInfo" && $_POST["campaignName"] != "") | ||
| 21 | { | ||
| 22 | $inputFileType = "Excel5"; | ||
| 23 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 24 | $objPHPExcel = $objReader->load($_FILES['file']['tmp_name']); | ||
| 25 | $objWorksheet = $objPHPExcel->getActiveSheet(); | ||
| 26 | $highestColumn = PHPExcel_Cell::columnIndexFromString($objPHPExcel->getActiveSheet()->getHighestColumn()); | ||
| 27 | $highestrow=$objPHPExcel->getActiveSheet()->getHighestRow(); | ||
| 28 | $excelarray=array();$keys=array(); | ||
| 29 | $listId = time(); | ||
| 30 | |||
| 31 | $dataColumns = ['id'=>'Id','unique_id'=>'Customer Unique Id','firstname'=>'First Name','lastname'=>'Last Name','mobile'=>'Mobile','phones'=>'Other Phones']; | ||
| 32 | |||
| 33 | $campaign=Campaign::where('mkey','=',$_POST["campaignName"])->where('mtype','=','company')->first(); | ||
| 34 | if($campaign->crm != ""){ | ||
| 35 | $crmColumns = json_decode($campaign->crm); | ||
| 36 | $crmColumns = (array)$crmColumns->formFields; | ||
| 37 | } | ||
| 38 | |||
| 39 | for($i=1;$i<=$highestrow;$i++){ | ||
| 40 | $excelarray[$i]=array(); | ||
| 41 | for($head = 0; $head < $highestColumn; $head++){ | ||
| 42 | if($i==1){ | ||
| 43 | $keys[$head]=trim($objWorksheet->getCellByColumnAndRow($head,$i)->getValue()); | ||
| 44 | }else{ | ||
| 45 | $excelarray[$i][$keys[$head]]=trim($objWorksheet->getCellByColumnAndRow($head, $i)->getValue()); | ||
| 46 | } | ||
| 47 | } | ||
| 48 | } | ||
| 49 | // print_r($crmColumns);exit; | ||
| 50 | for($i=3;$i<=$highestrow;$i++) | ||
| 51 | { | ||
| 52 | if($excelarray[$i]["id"]==""){ | ||
| 53 | $crmData = []; | ||
| 54 | if(isset($crmColumns)){ | ||
| 55 | foreach ($crmColumns as $key => $value) { | ||
| 56 | array_push($crmData, [$key => $excelarray[$i][$key]]); | ||
| 57 | } | ||
| 58 | } | ||
| 59 | $data = ["list_id"=>$listId, | ||
| 60 | "unique_id"=>$excelarray[$i]["unique_id"], | ||
| 61 | "firstname"=>$excelarray[$i]["firstname"], | ||
| 62 | "lastname"=>$excelarray[$i]["lastname"], | ||
| 63 | "mobile"=>$excelarray[$i]["mobile"], | ||
| 64 | "phones"=>$excelarray[$i]["phones"], | ||
| 65 | "crm"=>serialize($crmData), | ||
| 66 | "client"=>$_POST["campaignName"], | ||
| 67 | "status"=>"New", | ||
| 68 | 'created'=>date('Y-m-d H:i:s'), | ||
| 69 | 'modified'=>date('Y-m-d H:i:s')]; | ||
| 70 | $addToDB = DB::table('records')->insert($data); | ||
| 71 | $successCount++; | ||
| 72 | }else{ | ||
| 73 | $excelarray[$i]["id"]=intval($excelarray[$i]["id"]); | ||
| 74 | } | ||
| 75 | continue; | ||
| 76 | // $lanq = DB::table('records')->select('id')->where('lan', '=', $excelarray[$i]["lan"])->first(); | ||
| 77 | // if($lanq){ | ||
| 78 | // $excelarray[$i]["id"]=intval($lanq->id); | ||
| 79 | // }else{ | ||
| 80 | // $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s'))); | ||
| 81 | // } | ||
| 82 | |||
| 83 | if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1) | ||
| 84 | { | ||
| 85 | $empdata=$wakka->getPerson($excelarray[$i]["id"]); | ||
| 86 | // $ppldata=$empdata["peopledata"]; | ||
| 87 | // $createdlog=$empdata['modifylog']; | ||
| 88 | // $fdirty=$empdata['dirty']; | ||
| 89 | |||
| 90 | // $createdlog[$updatetime]=$username."::"; | ||
| 91 | // $createdlog["updated"]=$updatetime; | ||
| 92 | |||
| 93 | $newdata=$ppldata; | ||
| 94 | if($isadmin||strstr($clientlst,$ppldata['client'])) | ||
| 95 | { | ||
| 96 | $editflag=0; | ||
| 97 | foreach($excelarray[$i] as $key => $value) | ||
| 98 | { | ||
| 99 | $value = preg_replace('/[^A-Za-z0-9\., -]/', '', $value); | ||
| 100 | |||
| 101 | if(isset($kformlib->HRFieldNames[$key])) | ||
| 102 | { | ||
| 103 | if($value!="") | ||
| 104 | { | ||
| 105 | if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC | ||
| 106 | { | ||
| 107 | $value=str_replace("'"," ",$value); | ||
| 108 | if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).","; | ||
| 109 | |||
| 110 | $fdirty[$key]=1;$editflag=1; | ||
| 111 | |||
| 112 | if($triggers=='Yes') | ||
| 113 | { | ||
| 114 | $kformlib->empAnalytics($excelarray[$i]["id"],$ppldata,$key,$value,$ppldata[$key]); | ||
| 115 | $kformlib->empWorkflowTrigger($excelarray[$i]["id"],$ppldata['client'],$key,$value,$ppldata[$key],$ppldata,$newdata); | ||
| 116 | } | ||
| 117 | $newdata[$key]=$value; | ||
| 118 | } | ||
| 119 | //else $message.="same $excelarray[$i][id]:$key:$value, "; | ||
| 120 | } | ||
| 121 | //else $message.="empty $excelarray[$i][id]:$key, "; | ||
| 122 | }else{ | ||
| 123 | // $message.="Invalid key :$key, "; | ||
| 124 | } | ||
| 125 | } | ||
| 126 | if($editflag) | ||
| 127 | { | ||
| 128 | $empdata["peopledata"]=$newdata; | ||
| 129 | $empdata['modifylog']=$createdlog; | ||
| 130 | $empdata['dirty']=$fdirty; | ||
| 131 | |||
| 132 | $wakka->setPerson($excelarray[$i]["id"],$empdata); | ||
| 133 | $success.=$excelarray[$i]["id"].","; | ||
| 134 | $successCount++; | ||
| 135 | } | ||
| 136 | }else{ | ||
| 137 | $errorMsg.="No access to $excelarray[$i][id], "; | ||
| 138 | } | ||
| 139 | } | ||
| 140 | } | ||
| 141 | $successMsg .= "Data Uploaded ($successCount)."; // : $success."; | ||
| 142 | } | ||
| 143 | }else{ | ||
| 144 | $errorMsg .= "File size too large, Please check file size should be less then ".($fileUploadLimit / (1024*1024))."mb."; | ||
| 145 | } | ||
| 146 | }else{ | ||
| 147 | $errorMsg .= "File format not valid, Please attach Excel file (.xls) and try upload again."; | ||
| 148 | } | ||
| 149 | @unlink($_FILES['file']); | ||
| 150 | }else{ | ||
| 151 | $errorMsg .= "File not found, Please attach file and try upload again."; | ||
| 152 | } | ||
| 153 | if(isset($successMsg) && $successMsg!="")echo "Success! <br/>".$successMsg; | ||
| 154 | if(isset($errorMsg) && $errorMsg!="")echo "Error! <br/>".$errorMsg; | ||
| 155 | } | ||
| 156 | else | ||
| 157 | { | ||
| 158 | if(isset($_GET['format']) && $_GET['format'] == 'dataUpload'){ | ||
| 159 | if(isset($_GET['campaign']) && $_GET['campaign'] != ''){ | ||
| 160 | $dataColumns = ['id'=>'Id','unique_id'=>'Customer Unique Id','firstname'=>'First Name','lastname'=>'Last Name','mobile'=>'Mobile','phones'=>'Other Phones']; | ||
| 161 | |||
| 162 | $campaign=Campaign::where('mkey','=',$_GET['campaign'])->where('mtype','=','company')->first(); | ||
| 163 | if($campaign->crm != ''){ | ||
| 164 | $crmColumns = json_decode($campaign->crm); | ||
| 165 | if($crmColumns->formFields)$dataColumns = array_merge($dataColumns,(array) $crmColumns->formFields); | ||
| 166 | } | ||
| 167 | $PHPExcelObj = new PHPExcel(); $head=0; | ||
| 168 | foreach($dataColumns as $key => $value){ | ||
| 169 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 170 | $PHPExcelObj->getActiveSheet()->setCellValue($colstr."1", $key); | ||
| 171 | $PHPExcelObj->getActiveSheet()->setCellValue($colstr."2", $value); | ||
| 172 | $head++; | ||
| 173 | } | ||
| 174 | $objWriter = PHPExcel_IOFactory::createWriter($PHPExcelObj, 'Excel5'); | ||
| 175 | $objWriter->save('php://output'); | ||
| 176 | |||
| 177 | header('Content-Type: application/vnd.ms-excel'); | ||
| 178 | header('Content-Disposition: attachment;filename="DataUploadFormat.xls"'); | ||
| 179 | header('Cache-Control: max-age=0'); | ||
| 180 | return; | ||
| 181 | }else{ | ||
| 182 | echo "Campaign not found"; | ||
| 183 | return; | ||
| 184 | } | ||
| 185 | } | ||
| 186 | ?> | ||
| 187 | <div class="row"> | ||
| 188 | <div class="col-sm-12"> | ||
| 189 | <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> | ||
| 190 | <div class="panel panel-info"> | ||
| 191 | <div class="panel-heading" role="tab" id="headingOne" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> | ||
| 192 | <strong><i class="fa fa-upload"></i> Data Upload</strong> | ||
| 193 | <span class="badge pull-right"><i class="fa fa-sort"></i></span> | ||
| 194 | </div> | ||
| 195 | <div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne"> | ||
| 196 | <div class="panel-body"> | ||
| 197 | <div class="tab_generic"> | ||
| 198 | <p><span style="color:#f00;"><strong>Instruction</strong></span> (Works only if you have 'Write access" to the records) Please create an Excel-2003 format file with header as field-keys and rows containing record data. Extream Care is should be taken during bulk upload as previous values will be overwritten and lost.</p> | ||
| 199 | <hr style="margin-bottom: 10px;" /> | ||
| 200 | <div class="row"> | ||
| 201 | <div class="col-sm-3"> | ||
| 202 | <p><strong>Get Format</strong></p> | ||
| 203 | <button type="submit" class="btn btn-success" onclick="getDataFormat();return false;"><i class="fa fa-download"></i> Get Format</button> | ||
| 204 | </div> | ||
| 205 | <div class="col-sm-9"> | ||
| 206 | <p><strong>Upload File</strong></p> | ||
| 207 | <form method="POST" enctype="multipart/form-data" target="resultArea" action="campaign?action=dataUpload" class="form-inline"> | ||
| 208 | <input type="hidden" name="_token" value="{{ csrf_token() }}" /> | ||
| 209 | <input type="hidden" name="uploadFileType" value="customerInfo"/> | ||
| 210 | <input type="hidden" name="campaignName" value="{{ $campaignDetails->mkey }}"/> | ||
| 211 | <div class="form-group"> | ||
| 212 | <input type="file" class="form-control" name="file" required="required" /> | ||
| 213 | </div> | ||
| 214 | <div class="form-group"> | ||
| 215 | <button type="submit" class="btn btn-success"><i class="fa fa-upload"></i> Upload</button> | ||
| 216 | </div> | ||
| 217 | </form> | ||
| 218 | </div> | ||
| 219 | </div> | ||
| 220 | <hr style="margin-top: 10px;margin-bottom: 10px;" /> | ||
| 221 | <span>Result</span> | ||
| 222 | <iframe name=resultArea id="resultArea" style="width: 100%;border:1px solid #ccc;"></iframe> | ||
| 223 | </div> | ||
| 224 | </div> | ||
| 225 | </div> | ||
| 226 | </div> | ||
| 227 | |||
| 228 | <div class="panel panel-info"> | ||
| 229 | <div class="panel-heading" role="tab" id="headingTwo" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> | ||
| 230 | <strong><i class="fa fa-table"></i> Data List</strong> | ||
| 231 | <span class="badge pull-right"><i class="fa fa-sort"></i></span> | ||
| 232 | </div> | ||
| 233 | <div id="collapseTwo" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingTwo"> | ||
| 234 | <div class="panel-body"> | ||
| 235 | @if(isset($dataList) && count($dataList)) | ||
| 236 | <table class="table table-bordered" style="margin-bottom: 0;"> | ||
| 237 | <head><tr class="active"> | ||
| 238 | <th>List Id</th> | ||
| 239 | <th>Record Count</th> | ||
| 240 | </tr></head> | ||
| 241 | <body> | ||
| 242 | @foreach($dataList as $data) | ||
| 243 | <tr> | ||
| 244 | <td>{{ $data->list_id }}</td> | ||
| 245 | <td>{{ $data->recordCount }}</td> | ||
| 246 | </tr> | ||
| 247 | @endforeach | ||
| 248 | </body> | ||
| 249 | </table> | ||
| 250 | @else | ||
| 251 | <p>No data found</p> | ||
| 252 | @endif | ||
| 253 | </div> | ||
| 254 | </div> | ||
| 255 | </div> | ||
| 256 | </div> | ||
| 257 | </div> | ||
| 258 | </div> | ||
| 259 | |||
| 260 | <script type="text/javascript"> | ||
| 261 | function getDataFormat(){ | ||
| 262 | var campaign = $("#selectCampaignField").val(); | ||
| 263 | window.open('campaign/getDataFormat?format=dataUpload&campaign='+campaign);return false; | ||
| 264 | } | ||
| 265 | </script> | ||
| 266 | |||
| 267 | <?php | ||
| 268 | } | ||
| 269 | ?> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <div class="row"> | ||
| 2 | <div class="btn-group pull-right"> | ||
| 3 | <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-fw fa-plus-square"></i> Add Field <span class="caret"></span> | ||
| 4 | </button> | ||
| 5 | <ul class="dropdown-menu"> | ||
| 6 | <li><a href="#" onclick="fbAddField('layout','addFieldArea');return false;"><i class="fa fa-fw fa-th-large"></i> Layout</a></li> | ||
| 7 | <li><a href="#" onclick="fbAddField('text','addFieldArea');return false;"><i class="fa fa-fw fa-font"></i> Text</a></li> | ||
| 8 | <li><a href="#" onclick="fbAddField('select','addFieldArea');return false;"><i class="fa fa-fw fa-indent"></i> Select Box</a></li> | ||
| 9 | <li><a href="#" onclick="fbAddField('date','addFieldArea');return false;"><i class="fa fa-fw fa-calendar"></i> Date</a></li> | ||
| 10 | <li><a href="#" onclick="fbAddField('textArea','addFieldArea');return false;"><i class="fa fa-fw fa-list-alt"></i> Text Area</a></li> | ||
| 11 | </ul> | ||
| 12 | </div> | ||
| 13 | </div> | ||
| 14 | |||
| 15 | <div class="modal fade" id="fbAddFieldForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
| 16 | <div class="modal-dialog" role="document"> | ||
| 17 | <div class="modal-content"> | ||
| 18 | <div class="modal-body" id="fbAddFieldFormContent"></div> | ||
| 19 | </div> | ||
| 20 | </div> | ||
| 21 | </div> | ||
| 22 | |||
| 23 | <hr style="margin:5px 0;border: 1px solid #ed5564;" /> | ||
| 24 | <div id="addFieldArea"></div> | ||
| 25 | |||
| 26 | <script> | ||
| 27 | var feedbackForm = '{"formData":{"row1":{"column1":{"columnName":"Personal Information","columnCount":"6","fields":{"customerName":{"type":"text","name":"customerName","title":"Customer Name","required":true,"default":"","editable":true},"customerType":{"type":"select","name":"customerType","title":"Customer Type","required":true,"options":"Existing,New,MNP,Corporate","default":"Existing","editable":true},"customerAddress":{"type":"textArea","name":"customerAddress","title":"Customer Address","required":true,"default":"","editable":true},"birthDate":{"type":"date","name":"birthDate","title":"Birth Date","required":true,"default":"","editable":true}}},"column2":{"columnName":"Plan Details","columnCount":"6","fields":{"planName":{"type":"text","name":"planName","title":"Plan Name","required":true,"default":"","editable":true},"planType":{"type":"select","name":"planType","title":"Plan Type","required":true,"options":"Prepaid,Postpaid","default":"Postpaid","editable":true},"planIncludes":{"type":"textArea","name":"planIncludes","title":"Plan Includes","required":true,"default":"","editable":true}}}}},"formFields":"customerName,customerType,customerAddress,birthDate,planName,planType,planIncludes"}'; | ||
| 28 | |||
| 29 | doAjax("campaign","action=buildForm&rawData="+feedbackForm,"addFieldArea","","","POST"); | ||
| 30 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <div class="row"> | ||
| 2 | <div class="col-sm-12"> | ||
| 3 | <div class="panel panel-info"> | ||
| 4 | <div class="panel-heading"><strong>Agent Script</strong></div> | ||
| 5 | <div class="panel-body"> | ||
| 6 | <div> | ||
| 7 | <div class="form-group" style="margin-bottom: 5px;"> | ||
| 8 | <textarea class="form-control" rows="10" id="agentScript" placeholder="Enter your script here">{{ $campaignDetails->script }}</textarea> | ||
| 9 | </div> | ||
| 10 | <div class="form-group" style="margin-bottom: 0;"> | ||
| 11 | <span>Add agent script here</span> | ||
| 12 | <button type="submit" class="btn btn-success pull-right"><i class="glyphicon glyphicon-floppy-disk"></i> Save</button> | ||
| 13 | </div> | ||
| 14 | </div> | ||
| 15 | </div> | ||
| 16 | </div> | ||
| 17 | </div> | ||
| 18 | </div> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 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'); | ||
| 3 | ?> | ||
| 4 | <div class="row"> | ||
| 5 | <div class="col-sm-12"> | ||
| 6 | <div class="panel panel-info"> | ||
| 7 | <div class="panel-heading"><strong>Query</strong></div> | ||
| 8 | <div class="panel-body"> | ||
| 9 | <div class="form-group" style="margin-bottom: 8px;"> | ||
| 10 | <label>SELECT</label> | ||
| 11 | <select id="querySelect" multiple="" data-rel="chosen" style='width:100%' class=select2multi> | ||
| 12 | <option value="currentstatus" selected="selected">currentstatus</option> | ||
| 13 | <option value="legalstatus" selected="selected">legalstatus</option> | ||
| 14 | <option value="mobile" selected="selected">mobile</option> | ||
| 15 | <option value="status" selected="selected">status</option> | ||
| 16 | <option value="dialer_status" selected="selected">dialer_status</option> | ||
| 17 | <option value="dialer_substatus" selected="selected">dialer_substatus</option> | ||
| 18 | @foreach($queryFields as $fields) | ||
| 19 | <option value="{{$fields}}">{{$fields}}</option> | ||
| 20 | @endforeach | ||
| 21 | </select> | ||
| 22 | <label style="margin-top: 5px;">FROM 'records' WHERE</label> | ||
| 23 | <input type="text" class="form-control" id="queryConditions" placeholder="1" value="1"/> | ||
| 24 | </div> | ||
| 25 | <div class="form-inline"> | ||
| 26 | <div class="form-group" style="display: block;"> | ||
| 27 | <label>LIMIT</label> | ||
| 28 | <input type="text" class="form-control" id="queryLimit" placeholder="30" value="30" style="width:50px;" /> | ||
| 29 | <label>OFFSET</label> | ||
| 30 | <input type="text" class="form-control" id="queryOffset" placeholder="0" value="0" style="width:50px;" /> | ||
| 31 | <label>;</label> | ||
| 32 | <span style="margin: 1% 0 0 38%">Select Checkbox To Save Current Query</span><input type="checkbox" class="saveQryChck" style="margin: 1% 0 0 2%"> | ||
| 33 | <button type="submit" class="btn btn-success pull-right" onclick="runSqlQuery();return false;"><i class="glyphicon glyphicon-ok"></i> Run Query</button> | ||
| 34 | </div> | ||
| 35 | </div> | ||
| 36 | </div> | ||
| 37 | </div> | ||
| 38 | |||
| 39 | <div class="panel-group"> | ||
| 40 | <div class="panel panel-default"> | ||
| 41 | <div class="panel-heading"> | ||
| 42 | <h4 class="panel-title"> | ||
| 43 | <a data-toggle="collapse" href="#collapse1">Show Previous Queries</a> | ||
| 44 | </h4> | ||
| 45 | </div> | ||
| 46 | <div id="collapse1" class="panel-collapse collapse"> | ||
| 47 | <ul class="list-group"> | ||
| 48 | @foreach($queryLogs as $queryLog) | ||
| 49 | <li class="list-group-item"><a onclick="runFSqlQuery({{$queryLog->id}});return false;" style="cursor:pointer">{{$queryLog->query}} </a> <i class="glyphicon glyphicon-trash pull-right" onclick="delSqlQuery({{$queryLog->id}});return false;"></i></li> | ||
| 50 | @endforeach | ||
| 51 | </ul> | ||
| 52 | <div class="panel-footer">*Please Refresh Current Campaign To See Updated Saved Queries</div> | ||
| 53 | </div> | ||
| 54 | </div> | ||
| 55 | </div> | ||
| 56 | <br><br> | ||
| 57 | |||
| 58 | <div class="panel panel-info"> | ||
| 59 | <div class="panel-heading" id="appendButton"><strong>Output</strong><button type="submit" class="btn btn-default btn-sm" onclick="downloadOutput();return false;" style="margin: 0 0 0.1% 84%;display: none" id="downloadButton"><i class="glyphicon glyphicon-download"></i> Download</button></div> | ||
| 60 | <div class="panel-body" id="sqlQueryOutput"> | ||
| 61 | <p><i class="fa fa-exclamation-circle"></i> Press Run Query button to see output!</p> | ||
| 62 | </div> | ||
| 63 | </div> | ||
| 64 | </div> | ||
| 65 | </div> | ||
| 66 | |||
| 67 | <script> | ||
| 68 | function runSqlQuery(){ | ||
| 69 | 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; | ||
| 71 | doAjax("campaign/query",data,"sqlQueryOutput","","","GET"); | ||
| 72 | |||
| 73 | document.getElementById("downloadButton").style = "margin: 0% 0% 0.1% 84%;display: block"; | ||
| 74 | } | ||
| 75 | |||
| 76 | function runFSqlQuery(id){ | ||
| 77 | var data = 'campaign={{ is_array($campaignDetails)?$campaignDetails["mkey"]:$campaignDetails->mkey }}&id='+id+'&querySelect='+$("#querySelect").val(); | ||
| 78 | doAjax("campaign/fquery",data,"sqlQueryOutput","","","GET"); | ||
| 79 | |||
| 80 | document.getElementById("downloadButton").style = "margin: 0% 0% 0.1% 84%;display: block"; | ||
| 81 | } | ||
| 82 | |||
| 83 | function delSqlQuery(id){ | ||
| 84 | var data = 'id='+id; | ||
| 85 | var value = '{{ is_array($campaignDetails)?$campaignDetails["mkey"]:$campaignDetails->mkey }}'; | ||
| 86 | doAjax("campaign/delete",data,"sqlQueryOutput","","","GET"); | ||
| 87 | |||
| 88 | doAjax("campaign/show","campaign="+value,"campaignDetailsArea","","","GET",function(response){ | ||
| 89 | $("#campaignRefresh").html('<div class="form-group"><button onclick="campaignDetailsShow($(\'#selectCampaignField option:selected\').val());return false;" class="btn btn-xs btn-info">Refresh Campaign</button></div>'); | ||
| 90 | }); | ||
| 91 | } | ||
| 92 | |||
| 93 | function downloadOutput() | ||
| 94 | { | ||
| 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; | ||
| 96 | } | ||
| 97 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <div class="row"> | ||
| 2 | <div class="col-sm-12"> | ||
| 3 | <div class="panel panel-info"> | ||
| 4 | <div class="panel-heading"><strong>Query List</strong></div> | ||
| 5 | <div class="panel-body" id=""> | ||
| 6 | <ul class="list-group"> | ||
| 7 | <li class="list-group-item"><input type="radio" name="query" id="currQuery" value="" checked>Default</li> | ||
| 8 | @foreach($queryLogs as $queryLog) | ||
| 9 | <li class="list-group-item"><input type="radio" name="query" id="currQuery" value="{{$queryLog->id}}" {{$queryLog->current_queue?"checked":""}}>{{$queryLog->query}}</li> | ||
| 10 | @endforeach | ||
| 11 | </ul> | ||
| 12 | |||
| 13 | <div class="form-inline"> | ||
| 14 | <div class="form-group" style="display: block;"> | ||
| 15 | <button type="submit" class="btn btn-success pull-right" onclick="addInQueue();return false;"><i class="glyphicon glyphicon-plus"></i> Add In Queue</button> | ||
| 16 | </div> | ||
| 17 | </div> | ||
| 18 | </div> | ||
| 19 | </div> | ||
| 20 | </div> | ||
| 21 | </div> | ||
| 22 | |||
| 23 | <script> | ||
| 24 | function addInQueue(){ | ||
| 25 | var data = 'radioValue='+$("input[name='query']:checked").val(); | ||
| 26 | // var checkedValue = $('.saveQryChck:checked').val(); | ||
| 27 | // var data = 'campaign={{ is_array($campaignDetails)?$campaignDetails["mkey"]:$campaignDetails->mkey }}&querySelect='+$("#querySelect").val()+'&queryConditions='+$("#queryConditions").val()+'&queryLimit='+$("#queryLimit").val()+'&queryOffset='+$("#queryOffset").val()+'&checkedValue='+checkedValue; | ||
| 28 | doAjax("campaign/addCurrQueue",data,"","","","GET"); | ||
| 29 | } | ||
| 30 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php | ||
| 2 | |||
| 3 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 4 | |||
| 5 | $inputFileType = "Excel5"; | ||
| 6 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 7 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 8 | $baseRow = 2; | ||
| 9 | |||
| 10 | $tcol=0;$extrahdrarr=array(); | ||
| 11 | |||
| 12 | $highestColumn = sizeof($fieldsarr); | ||
| 13 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 14 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 15 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $fieldsarr[$head]); | ||
| 16 | } | ||
| 17 | |||
| 18 | $ii=1; | ||
| 19 | foreach($alist as $aline) | ||
| 20 | { | ||
| 21 | $row = $baseRow++; $col = 0; | ||
| 22 | |||
| 23 | foreach ($fieldsarr as $key) { | ||
| 24 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit(trim($aline->$key)); | ||
| 25 | } | ||
| 26 | |||
| 27 | } | ||
| 28 | |||
| 29 | header('Content-Type: application/vnd.ms-excel'); | ||
| 30 | header('Content-Disposition: attachment;filename="Output.xls"'); | ||
| 31 | header('Cache-Control: max-age=0'); | ||
| 32 | |||
| 33 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 34 | $objWriter->save('php://output'); | ||
| 35 | |||
| 36 | return ; | ||
| 37 | |||
| 38 | ?> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <script> | ||
| 2 | function addDatePicker(selector){ | ||
| 3 | $('#'+selector).datepicker({dateFormat:'yy-mm-dd',inline:true,changeYear:true,changeMonth:true,selectOtherMonths:true,yearRange:'1947:2022'}); | ||
| 4 | $('#'+selector).datepicker("show"); | ||
| 5 | } | ||
| 6 | |||
| 7 | function fbAddField(type,area){ | ||
| 8 | var output = ''; | ||
| 9 | if(type == 'layout'){ | ||
| 10 | |||
| 11 | } | ||
| 12 | $('#fbAddFieldFormContent').append(type); | ||
| 13 | $('#fbAddFieldForm').modal('show'); | ||
| 14 | |||
| 15 | $('#'+area).append(type); | ||
| 16 | } | ||
| 17 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <div class="container-fluid"> | ||
| 2 | <div class="layout-app"> | ||
| 3 | <div class="row"> | ||
| 4 | <div class="col-md-12"> | ||
| 5 | <div class="col-separator col-separator-first col-unscrollable box"> | ||
| 6 | <div class="innerAll"> | ||
| 7 | <h4>Campaign</h4> | ||
| 8 | <hr style="margin-bottom: 10px;" /> | ||
| 9 | |||
| 10 | <div class="row"> | ||
| 11 | <div class="col-lg-4"> | ||
| 12 | <div class="form-inline"> | ||
| 13 | <div class="form-group"> | ||
| 14 | <label>Select Campaign</label> | ||
| 15 | </div> | ||
| 16 | <div class="form-group"> | ||
| 17 | <select class="form-control" id="selectCampaignField" onchange="campaignDetailsShow(this.value);return false;"> | ||
| 18 | <option value="">Select Campaign</option> | ||
| 19 | <option value="all">All</option> | ||
| 20 | @foreach($campaignList as $campaign) | ||
| 21 | <option value="{{ $campaign->mkey }}">{{ $campaign->mkey }}</option> | ||
| 22 | @endforeach | ||
| 23 | </select> | ||
| 24 | |||
| 25 | </div> | ||
| 26 | |||
| 27 | <span id="campaignRefresh"></span> | ||
| 28 | </div> | ||
| 29 | </div> | ||
| 30 | |||
| 31 | <!-- <div class="col-lg-6"> | ||
| 32 | <form class="form-inline text-right"> | ||
| 33 | <div class="form-group"> | ||
| 34 | <label>Create Campaign</label> | ||
| 35 | </div> | ||
| 36 | <div class="form-group"> | ||
| 37 | <input type="text" class="form-control" id="campaignName" placeholder="Campaign Name"> | ||
| 38 | </div> | ||
| 39 | <button type="button" class="btn btn-success" onclick="createCampaign();"><i class="glyphicon glyphicon-plus"></i> ADD</button> | ||
| 40 | </form> | ||
| 41 | </div> --> | ||
| 42 | </div> | ||
| 43 | |||
| 44 | <div id="campaignDetailsArea"></div> | ||
| 45 | </div> | ||
| 46 | </div> | ||
| 47 | </div> | ||
| 48 | </div> | ||
| 49 | |||
| 50 | </div> | ||
| 51 | </div> | ||
| 52 | |||
| 53 | <script> | ||
| 54 | function campaignDetailsShow(value){ | ||
| 55 | if(value){ | ||
| 56 | doAjax("campaign/show","campaign="+value,"campaignDetailsArea","","","GET",function(response){ | ||
| 57 | $("#campaignRefresh").html('<div class="form-group"><button onclick="campaignDetailsShow($(\'#selectCampaignField option:selected\').val());return false;" class="btn btn-xs btn-info">Refresh Campaign</button></div>'); | ||
| 58 | }); | ||
| 59 | }else{ | ||
| 60 | $("#campaignDetailsArea").html('<br/><p class="text-danger text-center">Please select the campaign.</p>'); | ||
| 61 | } | ||
| 62 | } | ||
| 63 | |||
| 64 | // function createCampaign(){ | ||
| 65 | // var campaignName = $('#campaignName').val(); | ||
| 66 | // if(campaignName){ | ||
| 67 | // if( /[^a-zA-Z0-9]/.test(campaignName)){ | ||
| 68 | // simpleNotification('error','topRight','Campaign name is not alphanumeric.'); | ||
| 69 | // }else{ | ||
| 70 | // var dataStr = "action=createCampaign&campaignName="+campaignName; | ||
| 71 | // doAjax("campaign",dataStr,"campaignDetailsArea","","","POST",function(response){ | ||
| 72 | // // console.log(response.responseText); | ||
| 73 | // }); | ||
| 74 | // } | ||
| 75 | // }else{ | ||
| 76 | // simpleNotification('error','topRight','Campaign name should not be blank.'); | ||
| 77 | // } | ||
| 78 | // } | ||
| 79 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment