9be4338a by Gopal

Javascript changes to display callbackdate time and add lead id value dynamicall…

…y using conf variable
1 parent 7a6176a2
<?php namespace App\Jobs;
use Storage;
use Auth;
use Input;
......@@ -11,7 +10,6 @@ use DB;
$dashboarduser=Auth::user();
use App\Models\SupervisonComments;
use App\Models\Record;
class KFormLib
{
private $themehome='';
......@@ -29,14 +27,12 @@ class KFormLib
public $FormSelectVals=array();
private $objcache=array();
public $HRFiledsStr="";
public $HRFieldNames=array();
public $HRFileFieldsStr="";
public $HRDateFilds="";
public $HRDropFilds="";
public $HRForms=array();
public function __construct($formstr)
{
// $user_camapign=Auth::user()->sel_campaign;
......@@ -49,17 +45,12 @@ class KFormLib
// /*echo "<pre>";
// print_r($campaign_crmfields[0]->mvalue);*/
// $crmfields_coreData=$campaign_crmfields[0]->mvalue;
// $data_test[1]=explode('=',$crmfields_coreData);
// $test=implode(" ",$data_test[1]);
//echo "<pre>".print_r($data_test[1])."Daat Test";
/*$campaign_crmfields=DB::select('select mvalue from hrms_masters where mtype=coreconfig AND mkey=$user_camapign');
$data_test[0]=explode('=',$campaign_crmfields);*/
/* Old Code for CRM*/
//$fields=explode(",",$formstr);
$fields=explode(",",$formstr);
......@@ -70,7 +61,6 @@ class KFormLib
{
$this->HRFiledsStr.=$parts[0].",";
$this->HRFieldNames[$parts[0]]=$parts[2];
if($parts[1]=="F")$this->HRFileFieldsStr.=$parts[0].",";
else if($parts[1]=="D")$this->HRDateFilds.=$parts[0].",";
else if($parts[1]=="S"||$parts[1]=="M")
......@@ -79,7 +69,6 @@ class KFormLib
if(isset($parts[11])){$this->FormSelectVals[$parts[0]]=$parts[11];}
else {$this->FormSelectVals[$parts[0]]="";}
}
$this->HRForms[$parts[3]][$parts[4]][]=array($parts[5],$parts[6],$parts[7],$parts[8],$parts[9],$parts[0],$parts[1],$parts[2],$parts[10]);
}
}
......@@ -87,7 +76,6 @@ class KFormLib
$this->themehome=url("userfiles/templates/hrms");//TODO
$this->storagehome=storage_path('app/templates/hrms');
}
public function data($config)
{
$this->varid=$this->getConfig('varid',$config,'');
......@@ -110,7 +98,6 @@ class KFormLib
if(isset($config[$str]))return $config[$str];
return $default;
}
function recruitFileLink($filename)
{
$themehome=$this->themehome;
......@@ -131,7 +118,6 @@ class KFormLib
if($this->gthis=='')$this->gthis=new KHRMSLib();
$this->FormSelectVals[$selId]=implode("~",$this->gthis->clientsReadAccess());
}
if(isset($this->FormSelectVals[$selId]))
{
$values=explode("~",$this->FormSelectVals[$selId]);sort($values);
......@@ -169,14 +155,12 @@ class KFormLib
if($dataarr[$id]!='')$selarr[]=$dataarr[$id];
$list=$this->fillSelect($id,$selarr);
$list="<option value=''>&nbsp;</option>".$list;
$data="<p style='clear:both'>
<label class=label-small_new style='width:25%'>".$this->HRFieldNames[$id].": </label>
<select id='$id' name='$id' class='form_hrm_select select2multi' style='width:50%'>$list</select>
<span class=field_desc></span><span class=validate_success></span>
<span class=validate_error>".((isset($fdirty[$id]))?$fdirtytxt:'')."</span>
</p>";
if(!$isuser||!$edituser)
{
$data="<p style='clear:both'>
......@@ -186,12 +170,10 @@ class KFormLib
<span class=validate_error>".((isset($fdirty[$id]))?$fdirtytxt:'')."</span>
</p>";
}
return $data;
}
function makeMultiSelect($id,$helptxt)
{
}
function makeTextBox($id,$size,$type="text")
{
......@@ -202,15 +184,10 @@ function makeTextBox($id,$size,$type="text")
$fdirtytxt=$this->fdirtytxt;
$isuser=$this->isuser;
$varid=$this->varid;
if(strstr($this->HRDateFilds,$id)&&!$gthis->IsAdmin()){$ro="";$formatstr='DD.MM.YYYY';}
if($type=="text")$size.=" capText";
if($id=='emailid')$maillnk=" <a href='mailto:$dataarr[$id]'>Mail</a> ";
if($gthis->IsAdmin()&&$fdirty[$id]&&strstr($gthis->HRCoreVars["RequiredApproval"],$id))$approvaltxt="<input type=button class='btn btn-green' value='Approve' onclick='approveFData(\"$id\",\"$varid\");return false;'>";
$data="<p style='clear:both'>
<label class=label-small_new style='width:25%;' title=$formatstr>".$this->HRFieldNames[$id].": </label>
<input ".($type=="file"?" style='display:inline-block' size=9":"class='$size'")." id='$id' name='$id' type='$type' value='$dataarr[$id]' $ro />
......@@ -226,11 +203,8 @@ if(!$isuser||!$edituser)
<span class=validate_success></span><span class=validate_error>".((isset($fdirty[$id]))?$fdirtytxt:'')."</span>
</p>";
}
return $data;
}
//Changes Done On 10-Sept-16 for removing Required By Manish
function makeLabelText($id,$size,$type="text")
{
......@@ -238,9 +212,7 @@ function makeLabelText($id,$size,$type="text")
$dataarr=$this->recruitdata["peopledata"];
$gthis=$this->gthis;
$fdirtytxt=$this->fdirtytxt;
if(strstr($this->HRDateFilds,$id)){$ro="readonly=readonly";$formatstr='DD.MM.YYYY';}
if($id=="ucic_id"){
$data="<p style='clear:both;background-color:#e6e5ef;'>
<label class=label-small_new style='width:25%'>".$this->HRFieldNames[$id].": </label>
......@@ -248,7 +220,6 @@ function makeLabelText($id,$size,$type="text")
<span class=field_desc id='fd$id'>".(($type=="file")?$this->recruitFileLink($dataarr[$id]):'')."</span>
<span class=validate_success></span><span class=validate_error></span>
</p>";
}else{
$data="<p style='clear:both'>
<label class=label-small_new style='width:25%'>".$this->HRFieldNames[$id].": </label>
......@@ -257,14 +228,12 @@ function makeLabelText($id,$size,$type="text")
<span class=validate_success></span><span class=validate_error></span>
</p>";
}
/*$data="<p style='clear:both'>
<label class=label-small_new style='width:25%'>".$this->HRFieldNames[$id].": </label>
<b>$dataarr[$id]</b>
<span class=field_desc id='fd$id'>".(($type=="file")?$this->recruitFileLink($dataarr[$id]):'')."</span>
<span class=validate_success></span><span class=validate_error></span>
</p>";*/
return $data;
}
function makeThumbImg($id)
......@@ -272,15 +241,12 @@ function makeThumbImg($id)
$themehome=$this->themehome;
$dataarr=$this->recruitdata["peopledata"];
$varid=$this->varid;
$fpath="$themehome/images/default.jpg";
if(file_exists($this->storagehome."/thumbs/$varid/".$dataarr[$id].".gif"))$fpath="$themehome/thumbs/$varid/".$dataarr[$id].".gif";
$data="<p style='clear:both'>
<label class=label-small_new style='width:25%'></label>
<img src='$fpath' height=100px class='image_new'>
</p>";
return $data;
}
function makeTextArea($id)
......@@ -291,7 +257,6 @@ function makeTextArea($id)
$edituser=$this->edituser;
$fdirtytxt=$this->fdirtytxt;
$isuser=$this->isuser;
$data="
<p style='clear:both'>
<label class=label-small_new style='width:25%'>".$this->HRFieldNames[$id].": </label>
......@@ -311,26 +276,20 @@ function makeTextArea($id)
}
return $data;
}
function HRTemplateString($str,$fieldsstr)
{
$ppldata=$this->recruitdata["peopledata"];
$gthis=$this->gthis;
if(!isset($this->objcache["ownerrmlist"]))$this->objcache["ownerrmlist"]=$gthis->getUserListforClient($ppldata['client']);
if(!isset($this->objcache["recruitmentrmlist"]))$this->objcache["recruitmentrmlist"]=$gthis->getRecruitmentListforClient($ppldata['client']);
if(!isset($this->objcache["acctrmlist_600"]))$this->objcache["acctrmlist_600"]=$gthis->getUserListforClientAcct($ppldata['client']);
if(!isset($this->objcache["bdmlist_600"]))$this->objcache["bdmlist_600"]=$gthis->getUserListforClientBDM($ppldata['client']);
if(!isset($this->objcache["ownerrmlist_M"]))$this->objcache["ownerrmlist_M"]=$gthis->getManagerUsers($this->objcache["ownerrmlist"]);
if(!isset($this->objcache["recruitmentrmlist_600"]))$this->objcache["ownerrmlist_M"]=$gthis->getManagerUsers($this->objcache["recruitmentrmlist"]);
$str=str_replace("{{ownerrmlist}}",$this->objcache["ownerrmlist"],$str);
$str=str_replace("{{ownerrmlist_M}}",$this->objcache["ownerrmlist"]."/".$this->objcache["ownerrmlist_M"],$str);
$str=str_replace("{{recruitmentrmlist}}",$this->objcache["recruitmentrmlist"],$str);
$str=str_replace("{{acctrmlist}}",$this->objcache["acctrmlist_600"],$str);
if($this->edituser==1)
{
$str=str_replace("{{recruitmentrmlist_600}}","RecruitmentRM- ".$this->objcache["recruitmentrmlist"]."/".$this->objcache["recruitmentrmlist_600"],$str);
......@@ -343,7 +302,6 @@ function HRTemplateString($str,$fieldsstr)
$str=str_replace("{{acctrmlist_600}}","",$str);
$str=str_replace("{{bdmlist_600}}","",$str);
}
//Log::info($str);
preg_match_all('/{{[^}]*}}/', $str, $matches);
if(!empty($matches)&&!empty($matches[0]))
......@@ -354,11 +312,9 @@ function HRTemplateString($str,$fieldsstr)
$str=str_replace($matchstr,$ppldata[$tmpelem],$str);
}
}
return $str;
}
function createFilesTab()
{
$fdirty=$this->recruitdata["dirty"];
......@@ -369,12 +325,10 @@ function HRTemplateString($str,$fieldsstr)
$storagehome=$this->storagehome;
$logarr=$this->recruitdata["modifylog"];
$varid=$this->varid;
$data="<div class=custom1 style='width:49%;float:left'>
<legend class='new-recruit_legend'>Current Files</legend>
<ul>";
$fpath="$themehome/recruits/$varid";
$storagepath="$storagehome/recruits/$varid";
if (is_dir($storagepath)&&$handle = opendir($storagepath))
......@@ -382,7 +336,6 @@ function HRTemplateString($str,$fieldsstr)
$optionsstr='<option></option>';
$fileids=explode(",",$this->HRFileFieldsStr);
foreach($fileids as $fileid)$optionsstr.="<option value='$fileid'>".$this->HRFieldNames[$fileid]."</option>";////
$ii=0;
while (false !== ($entry = readdir($handle)))
{
......@@ -392,7 +345,6 @@ function HRTemplateString($str,$fieldsstr)
$titlestr='';
$flatid="UniqueId_".$ii;
$selectstr="<select id='SEL$flatid' onchange='filesSelected(\"$flatid\",\"$entry\");' class='form_hrm_select' style='width:50%'>$optionsstr</select>";////
$pathinfo = pathinfo($entry);
$extension = strtolower($pathinfo['extension']);
if($extension=="jpg"||$extension=="png"||$extension=="jpeg"||$extension=="gif")$titlestr="<img src=\"$fpath/$entry\" width=400px>";
......@@ -409,7 +361,6 @@ function HRTemplateString($str,$fieldsstr)
<div class=custom1 style='width:49%;float:left'>
<legend class='new-recruit_legend'>Old Files</legend>
<ul>";
$fpath="$themehome/recruits/$varid";
$storagepath="$storagehome/recruits/$varid";
if (is_dir($storagepath)&&$handle = opendir($storagepath))
......@@ -449,11 +400,9 @@ $data.="</div><div style='width:49%;float:left'>
<td class='table_hrm_heading_green'>Old Values</td>
</tr>
</thead>";
if(is_array($logarr))
{
krsort($logarr);
$i=0;
foreach($logarr as $logkey=>$logval)
{
......@@ -470,21 +419,17 @@ $data.="</div><div style='width:49%;float:left'>
{
$i++;$j++;
if(sizeof($changedvals)>3)$changedvals[2]=$changedvals[sizeof($changedvals)-1];
if($j==1) $data.= "<tr><td>$logline[0]</td><td>".date("Y-m-d_H:i:s",$logkey)."</td><td>".$this->HRFieldNames[$changedvals[0]]."</td><td>$changedvals[2]</td><td>$changedvals[1]</td></tr>";
else $data.= "<tr><td></td><td></td><td>".$this->HRFieldNames[$changedvals[0]]."</td><td>$changedvals[2]</td><td>$changedvals[1]</td></tr>";
}
}
}
}
$createtime=$logarr["createtime"];
$createuser=$logarr[$createtime];
if($createuser)$data.= "<tr><td>$createuser</td><td>".date("Y-m-d H:i:s",$createtime)."</td><td colspan=3>Created</td></tr>";
}
$data.="</table></fieldset>
<fieldset>
<legend class='new-recruit_legend'>Mail Logs</legend>
<table class='footable table' cellpadding=0 cellspacing=0 style='border-bottom:black 2px solid;margin-bottom:20px'>
......@@ -504,7 +449,6 @@ $data.="</div><div style='width:49%;float:left'>
$parts=unserialize($aline['data']);
$check2=explode(" ",$parts['subject']);
if(is_array($parts['to']))$parts['to']=implode("<br>",$parts['to']);
if($dataarr['emailid']!="")
{
if(strstr($parts['to'],$dataarr['emailid'])||trim($check2[0])==$varid)
......@@ -518,20 +462,15 @@ $data.="</div><div style='width:49%;float:left'>
</tr>";
}
}
$data.="</table></fieldset>";
return $data;
}
function createTasksTab()
{
$gthis=$this->gthis;
$varid=$this->varid;
$themehome=$this->themehome;
$data="<div style='width:100%;float:left'>";
$data.="<table class='footable table' cellpadding=0 cellspacing=0 border=0>
<thead><tr>
<td class='table_hrm_heading_green'>Name</td>
......@@ -544,64 +483,51 @@ $data.="</div><div style='width:49%;float:left'>
<td class='table_hrm_heading_green'>Created By</td>
<td class='table_hrm_heading_green'></td>
</tr></thead>";
$tasksarr=$gthis->LoadAll("select * from hrms_tasks where empid='$varid' and creatorid!='System' and creatorid!='BounceMail' order by endtime desc");
foreach($tasksarr as $taskline)
{
if($taskline['username']=="")$taskline['username']=$taskline['escalation2'];
//$delstr="<a href=# onclick='deleteTask($taskline[id]);return false;'><img src='$themehome/images/x.jpg' height=10px></a>";
$attachf="<a href='".$themehome."/uploads/".$taskline['username']."/".$taskline['attachment']."' target=_blank>".substr($taskline['attachment'],0,15)."</a>";
$data.= "<tr><td>$taskline[name]</td><td>".str_replace(","," ",$taskline['username'])."</td><td title='Created: $taskline[created_at]'>$taskline[endtime]</td><td>$taskline[attachment]</td><td>$taskline[status]</td><td>$taskline[accepted]</td><td>$taskline[remarks]</td><td title=$taskline[id]>$taskline[creatorid]</td><td>$delstr</td></tr>";
}
$data.="<tr><td colspan=9><hr></td></tr>";$delstr="";
$tasksarr=$gthis->LoadAll("select * from hrms_tasks where empid='$varid' and creatorid='System' order by endtime desc");
foreach($tasksarr as $taskline)
{
if($taskline['username']=="")$taskline['username']=$taskline['escalation2'];
if($gthis->IsAdmin()||strstr($gthis->HRCoreVars["HRManagerUsers"],$gthis->GetUserName()))$delstr="<a href=# onclick='deleteTask($taskline[id]);return false;'><img src='$themehome/images/x.jpg' height=10px></a>";
$attachf="<a href='".$themehome."/uploads/".$taskline['username']."/".$taskline['attachment']."' target=_blank>".substr($taskline['attachment'],0,15)."</a>";
$data.= "<tr><td>$taskline[name]</td><td>".str_replace(","," ",$taskline['username'])."</td><td title='Created: $taskline[created_at]'>$taskline[endtime]</td><td>$taskline[attachment]</td><td>$taskline[status]</td><td>$taskline[accepted]</td><td>$taskline[remarks]</td><td title=$taskline[id]>$taskline[creatorid]</td><td>$delstr</td></tr>";
}
$data.="</table></div>";
return $data;
}
//Create Third Party CRM Tab after manual call is hit
function createCustomCRMTab($manualmobno,$leadid)
{
$leadid=DB::table('records')->where('mobile','=',$manualmobno)->pluck('LeadID');
$leadidvalue=$leadid[1];
$customcrm_leadidurl = env("customcrm_leadidurl");
$customcrm_leadid_data_url=$customcrm_leadidurl.$leadidvalue;
$data="<div style='width:100%;float:left'>";
$data="<div style='width:100%;float:left'>";
$data.="
<div id='display_crm'>
</div><div><iframe width='1080' height='760' src='https://crm.zoho.com/crm/org676480608/tab/Leads/$leadidvalue' frameborder='0' allowfullscreenframeborder='0' allowfullscreen></iframe></div></div>";
</div><div><iframe width='1080' height='760' src='$customcrm_leadid_data_url' frameborder='0' allowfullscreenframeborder='0' allowfullscreen></iframe></div></div>";
return $data;
}
function createDispoTab()
{
$gthis=$this->gthis;
$varid=$this->varid;
$themehome=$this->themehome;
$dataarr=$this->recruitdata["peopledata"];
/*$recordDetails = DB::table('records')->where('id','=',$varid)->select('*')->get();
$priority = $recordDetails[0]->priority;*/
$data="<div style='width:100%;float:left'>";
$data.="
<div style='width:49%;float:left'><fieldset><legend class='new-recruit_legend'>Call Status</legend>";
$data.="<p style='clear:both'>
......@@ -615,10 +541,12 @@ $data.="</div><div style='width:49%;float:left'>
</select>
</p>";
$data.="<p style='clear:both'>
<div id='callback_datetime'>
<label class=label-small_new style='width:25%;' title=''>Callback: </label>
<input class='form_new form_new_amend datetimepicker_dthr' id='dialer_usercallback' name='dialer_usercallback'>
</div>
</p>";
//Code to Add Callback Mode
//Code to Add Callback Mode
$data.="<p style='clear:both'>
<label class=label-small_new style='width:25%;' title='' id='callback_label'>Callback Mode: </label>
<select class='form_hrm_select' id='callback_mode' name='callback_mode'>
......@@ -626,31 +554,32 @@ $data.="</div><div style='width:49%;float:left'>
<option value='SelfCallback'>Self Callback</option>
</select>
</p>";
$data.="<script>
$(document).ready(function()
{
$('#callback_mode').hide();
$('#callback_label').hide();
$('#callback_datetime').hide();
$('#dialer_usersubstatus').click(function(){
var subsource=$('#dialer_usersubstatus').val();
if(subsource=='CALLBK-Call Back')
{
$('#callback_mode').slideDown();
$('#callback_label').slideDown();
$('#callback_datetime').slideDown();
}
else
{
$('#callback_mode').hide();
$('#callback_label').hide();
$('#callback_datetime').hide();
}
});
});
</script>";
//Code to Add Callback Mode
//CRM FORM FOR INTERESTED FORM DISPO FOR SMS
$data.="<p style='clear:both'>
<label class=label-small_new style='width:25%;' id='sol_label' title=''>Sol_ID: </label>
......@@ -692,13 +621,11 @@ $data.="<script>
<label class=label-small_new style='width:25%;' id='cus_label' title=''>Customer_Name: </label>
<input type='text' class='form_new form_new_amend' id='cust_name' name='cust_name'>
</p>";
//Commented for Third Party CRM
/*$data.="<p style='clear:both'>
<label class=label-small_new style='width:25%;' title=''>Call Remarks:</label>
<textarea id='dialer_fullremarks' name='fullremarks' style='width:70%' maxlength=4000></textarea>
</p>";*/
//CRM FORM FOR INTERESTED FORM DISPO FOR SMS
$data.="<script>
$(document).ready(function()
......@@ -714,7 +641,6 @@ $data.="<script>
$('#lms_error').hide();
$('#zone').hide();
$('#cust_name').hide();
$('#sol_label').hide();
$('#lms_label').hide();
$('#teamlead_label').hide();
......@@ -726,7 +652,6 @@ $data.="<script>
$('#lmser_label').hide();
$('#zone_label').hide();
$('#cus_label').hide();
$('#dialer_usersubstatus').click(function(){
var subsource=$('#dialer_usersubstatus').val();
if(subsource=='INTRST-Interested')
......@@ -741,7 +666,6 @@ $data.="<script>
$('#lms_error').slideDown();
$('#zone').slideDown();
$('#cust_name').slideDown();
$('#sol_label').slideDown();
$('#lms_label').slideDown();
$('#teamlead_label').slideDown();
......@@ -789,7 +713,6 @@ $data.="<script>
<label class=label-small_new style='width:25%;' title=''>Call Remarks: </label>
<textarea id='dialer_userremarks' name='dialer_userremarks' style='width:70%' maxlength=250></textarea>
</p>";*/
$attemptsval="";
......@@ -797,7 +720,6 @@ $data.="<script>
{
$attemptsval.="<option value='".$i."'>".$i."</option>";
}
/*Code for Unwanted CRM
$data.="<p style='clear:both'>
<label class=label-small_new style='width:25%;' title=''>Attempts: </label>
......@@ -805,26 +727,21 @@ $data.="<script>
</select>
</p>";*/
//Supervisor Comments - By Manish on 16/02/17
/*if($dataarr['clientcode'])
$supComnt = SupervisonComments::select('supvisor_comments','id','agent_comments')->where('clientcode','=',$dataarr['clientcode'])->first();
$data.="<p style='clear:both'>
<label class=label-small_new style='width:25%;' title=''>Supervisor Comment: </label>
<textarea id='dialer_userremarks' name='dialer_userremarks' style='width:70%' maxlength=250 readonly>".$supComnt['supvisor_comments']."</textarea>
</p>";
$data.="<p style='clear:both'>
<label class=label-small_new style='width:25%;' title=''>Agent Comment: </label>";
if($supComnt['agent_comments'])
$data.="<textarea id='agent_comment' name='agent_comment' style='width:70%' maxlength=250>".$supComnt['agent_comments']."</textarea>";
else
$data.="<textarea id='agent_comment' name='agent_comment' style='width:70%' maxlength=250></textarea>";
$data.="<input type='hidden' id='sup_comnt_id' value='".$supComnt['id']."'>
</p>";*/
/*$data.="<p style='clear:both'>
<label class=label-small_new style='width:25%;' title=''>Flag as: </label>
<select class='form_hrm_select' id='dialer_flag' name='dialer_flag'>
......@@ -846,7 +763,6 @@ $data.="<script>
<option value='Friday'>Friday</option>
<option value='Saturday'>Saturday</option>
</select>
<select class='form_hrm_select' id='bttc_hrs' name='bttc_hrs' style='margin-left:2%;background-color:#FFD2D2'>
<option value=''>Select Hour</option>
<option value='9-10'>9-10</option>
......@@ -858,18 +774,14 @@ $data.="<script>
<option value='4-5'>4-5</option>
<option value='6-7'>6-7</option>
";*/
/*$recordDetails = $recordDetails[0];*/
$bttc = explode(":",$dataarr['bttc']);
$bttc_day = $bttc[0];
$bttc_hrs = $bttc[1];
/*for($i=1;$i<=24;$i++)
{
$data.="<option value='".str_pad($i,"2","0",STR_PAD_LEFT)."'>".str_pad($i,"2","0",STR_PAD_LEFT)."</option>";
}*/
/*$data.="</select></fieldset>
<script>
\$(document).ready(function()
......@@ -879,11 +791,8 @@ $data.="<script>
});
</script>
";*/
$latestCall=CRMCall::where('crm_id','=',$this->varid)->where('ts_Call','>','0')->orderBy("created_at","DESC")->first();
/*$data.="<fieldset><legend class='new-recruit_legend'>Alt #</legend>";*/
$nextempty="";
/*$data.="<p style='clear:both'>
<label class=label-small_new style='width:25%;' title=''>Main #: </label>
......@@ -897,7 +806,6 @@ $data.="<script>
<label class=label-small_new style='width:25%;' title=''>Alt #$i: </label>
<input class='form_new form_new_amend' id='dialer_altphone_lbl_$i' name='dialer_altphone_lbl_$i' value='".$dataarr["altphone_lbl_$i"]."' disabled=disabled placeholder='Description'>
<input class='form_new form_new_amend' id='dialer_altphone$i' name='dialer_altphone$i' value='".$dataarr["altphone$i"]."' disabled=disabled placeholder='##########'>
<a href=# class='btn btn-default' onclick='dialerDelAlt($i,$this->varid);return false;'><i class='fa fa-minus'></i></a>
<a href=# class='btn btn-default' onclick='dialerQuickOpen($this->varid,\"".$dataarr["altphone$i"]."\",\"Manual\",\"\",0);return false;'><i class='fa fa-phone'></i></a>
</p>";*/
......@@ -912,26 +820,19 @@ $data.="<script>
<input class='form_new form_new_amend' id='dialer_altphone$nextempty' name='dialer_altphone$nextempty' value='' placeholder='##########'><a href=# class='btn btn-default' onclick='dialerAddAlt($nextempty,$this->varid);return false;'><i class='fa fa-plus'></i></a>
</p>";*/
}
$data.="</fieldset>
</fieldset></div>
<div style='clear:both;width:100%;'>
<div style='width:49%;float:left'>
</div>
<div style='width:49%;float:right'>
</div>
</div><br><br><br>
<div style='display:none'>
<style>
.gritter-b-center{
......@@ -950,28 +851,20 @@ $data.="<script>
<div id='angry'><img src='/assets/images/Emoticons/Angry.gif' height='240' width='255'></div>
</div>
<div style='clear:both'></div>
<script>
function dispoChange(dispo){
if(kstychCall['ts_Talk']<1||Math.ceil(((kstychCall['ts_now']-kstychCall['ts_Talk'])/1000))<10)
{
return;
}
if(dispo=='Contacted - FollowUp - Specific' || dispo=='Contacted - Follow-Up - Generic')
{
document.getElementById('serv_vs_prod').disabled=false;
document.getElementById('serv_vs_prod').style.background='#77DD77';
document.getElementById('resolution').disabled=false;
document.getElementById('resolution').style.background='#77DD77';
document.getElementById('satisfy').disabled=false;
document.getElementById('satisfy').style.background='#77DD77';
document.getElementById('final_call_assess').disabled=false;
document.getElementById('final_call_assess').style.background='#77DD77';
}
......@@ -980,29 +873,21 @@ $data.="<script>
document.getElementById('serv_vs_prod').disabled=true;
document.getElementById('serv_vs_prod').style.background='#f4f4f4';
document.getElementById('serv_vs_prod').selectedIndex=0;
document.getElementById('resolution').disabled=true;
document.getElementById('resolution').style.background='#f4f4f4';
document.getElementById('resolution').selectedIndex=0;
document.getElementById('satisfy').disabled=true;
document.getElementById('satisfy').style.background='#f4f4f4';
document.getElementById('satisfy').selectedIndex=0;
document.getElementById('final_call_assess').disabled=true;
document.getElementById('final_call_assess').style.background='#f4f4f4';
document.getElementById('final_call_assess').selectedIndex=0;
}
}
var dialerdispoarray={};var dispoClassArray={};
dialerdispoarray['']='';\n";
$mastersdata=$gthis->getCompanyMaster($client);
if(empty($mastersdata['dialerDispoList']))$mastersdata['dialerDispoList']=$gthis->HRCoreVars['dialerDispoList'];
$dispoarr=explode("~",$mastersdata['dialerDispoList']);
foreach($dispoarr as $dispo)
{
......@@ -1015,9 +900,7 @@ $data.="<script>
}
}
}
$data.="
function dialerDisoSelect()
{
if(dialerdispoarray)
......@@ -1055,17 +938,13 @@ $data.="<script>
else
{
if(empty($mastersdata['dialerCustomHTML']))$mastersdata['dialerCustomHTML']=$gthis->HRCoreVars['dialerCustomHTML'];
//$userdatahtml=str_replace("__EQ__","=",$mastersdata['dialerCustomHTML']);
$userdatahtml=str_replace("__PLUS__","+",$userdatahtml);
$userdatahtml=str_replace("{{varid}}",$this->varid,$userdatahtml);
$data.=$userdatahtml;
}
// End Relationship Tagging
//Log::info($userdatahtml);
$data.="<hr></div>";
......@@ -1073,15 +952,11 @@ $data.="<script>
//Log::info($data);
return $data;
}
function createCallsTab()
{
$data="<fieldset><legend class='new-recruit_legend'>Calls History</legend>";
$data.=" <div class=custom1 style='width:100%;'>
<h2></h2>";
$data.="<hr><br><table class='table kDataTable' cellpadding=0 cellspacing=0 border=0>
<thead><tr>
<td>#</td>
......@@ -1106,26 +981,19 @@ $data.="<script>
//Log::info($this->varid);
$k=1;
$alist=CRMCallArchive::where('crm_id','=',$this->varid)->where('ts_Close','>','0')->orderBy("created_at","DESC")->get();
$records = DB::table('records')->where('id','=',$this->varid)->select('bttc','service_vs_product','resolution','satisfaction','final_call_assessment')->get();
$callarraid='';
foreach($alist as $aline)
{
$callarraid.=$aline->id.",";
}
$callarraid=substr($callarraid,0,-1);
$callarraid=explode(",", $callarraid);
$alist_remark=DB::table('full_remark')->select('fullremark','call_id')->whereIn('call_id',$callarraid)->get();
foreach($alist_remark as $aline)
{
$remarkval[$aline->call_id]=$aline->fullremark;
}
foreach($alist as $aline)
{
$userdata="";
......@@ -1136,9 +1004,7 @@ $data.="<script>
$userdata.="<tr><td>$userdataval</td></tr>";
}
if(trim($userdata)!="")$userdata="<table>".$userdata."</table>";
$dispname="";if($aline->user_id>0){$tuser=User::find($aline->user_id);$dispname=$tuser->dispname();}
// $records = DB::table('records')->where('id','=',$aline->crm_id)->select('bttc','service_vs_product','resolution','satisfaction','final_call_assessment')->get();
$fullremarkvalue=$remarkval[$aline->id];
......@@ -1146,7 +1012,6 @@ $data.="<script>
{
$fullremarkvalue=$aline->userremarks;
}
$data.="<tr>
<td>$k</td>
<td class=''>".date("Y-m-d H:i:s",strtotime($aline->created_at)-(Auth::user()->timezone*60))."</td>
......@@ -1170,21 +1035,16 @@ $data.="<script>
$k++;
}
$data.="</table>";
$data.="</div>";
$data.="</fieldset>";
return $data;
}
//For Creating Questionaire contain
function createQaireTab()
{
$varid=$this->varid;
$dataarr=$this->recruitdata["peopledata"];
$question = explode(",",$dataarr['question']);
$qid='';
$auth_ques_count = 5;
//$where = 'id = 1';
......@@ -1214,21 +1074,17 @@ function createQaireTab()
$supervisorcomments='';
$agent_comments='';
$data = "<fieldset><div style='font-size:10px'><!-- row-app -->
<div class='row row-app'>
<div class='col-xs-12'>
<div class='col-separator col-separator-first box col-unscrollable'>
<div class='col-table' style='padding-left: 13px;padding-right: 7px;'>
<div class='innerAll' style='background: #fff;'>";
//Supervisor Recommendation - By Manish on 20-02-17
//Supervisor Recommendation - By Prashant Jadhav on 07-11-17
if($dataarr['clientcode'])
{
$supComnt = DB::table('DU_CRM_SUPERVISOR_COMMENTS')->where('V_CUSTID','=',$dataarr['clientcode'])->orderBy('V_LAST_REVIEWED_ON','DESC')->limit(3)->get();
foreach($supComnt as $supervisorcomments)
{
......@@ -1238,7 +1094,6 @@ function createQaireTab()
<label style='width:15%;' title=''>Last Review On:</label>
<label style='width:30%;' title=''>".$supervisorcomments->V_LAST_REVIEWED_ON."</label>";
$data.="&nbsp;&nbsp;&nbsp;<label style='width:15%;' title=''>Agent Comment: </label>";
if($supervisorcomments->agent_comments)
$data.="<textarea id='".$supervisorcomments->id."_agent_comment' name='agent_comment' style='width:20%;height:100px;' maxlength=250 placeholder='Only 250 Characters'>".$supervisorcomments->agent_comments."</textarea>";
else
......@@ -1248,18 +1103,13 @@ function createQaireTab()
</div>";
}
}
$data.="<legend class='task_legend'>Primary Questions</legend>
<div id='primary_ques' class='primary_ques'>";
foreach($questions as $key=> $primary_question){
$data.="<div class='row' id='subParent".$primary_question->question_no."' data-parent='".$primary_question->question_no."' style='border:solid #D3D3D3 2px;border-radius:5px;margin-top:5px;'>
<div class='row' id='rowDiv1".$primary_question->question_no."'>
<div class='col-md-4' id='appendChild1".$primary_question->question_no."'>
<div id='childParentDiv".$primary_question->question_no."'>";
if($primary_question->compulsory_qes =='imp')
{
$data.="<div class='panel panel-warning panel-heading' id='parentColorDiv".$primary_question->question_no."' style='background-color:#CD6155;cursor:pointer'>";
......@@ -1280,7 +1130,6 @@ function createQaireTab()
<input type='hidden' value='".$primary_question->questions."' id='questText_".$primary_question->question_no."'>
</div>
<div class='options_div' id='options_div".$primary_question->question_no."'>";
for($i=1;$i<=10;$i++)
{
$opt_no = 'opt_'.$i;
......@@ -1307,13 +1156,10 @@ function createQaireTab()
</div>
</div>
</div>
<div class='row' id='rowDiv2".$primary_question->question_no."'>
</div>
<div class='row' id='rowDiv3".$primary_question->question_no."'>
</div>
</div>
";
}
......@@ -1322,35 +1168,24 @@ function createQaireTab()
<input type='hidden' id='questionDateTime' value=''>
<input type='button' class='btn btn-success' value='Save' id='submitQuestionAire'>
</div>
</div>
<script>
$(document).ready(function(){
var questionArray = {};
var authQuestionArray = {};
var appendChild=1;
$('.options_div').hide();
$('#authArea').hide();
$('input:radio:checked').prop('checked', false);
var count=0;
$('#auth_question').on('click', '.options', function(){
var authQues = $(this).data('rad');
var authKey = $('#authKey_'+authQues).val();
authQuestionArray['auth_'+authKey]={};
authQuestionArray['auth_'+authKey]['auth_ques'] = $('#authQuestText_'+authQues).val();
authQuestionArray['auth_'+authKey]['auth_opt'] = $(this).text();
count++;
});
$('#submit').click(function(){
if ($('.authQuestion[type=radio]:checked').length == auth_ques_count) {
$('#form-group').hide();
......@@ -1362,132 +1197,93 @@ function createQaireTab()
alert('Please answer all authentication questions');
}
});
$('#primary_ques').on('click', '.question', function(){
if(count==0)
{
document.getElementById('questionDateTime').value='".date("Y-m-d H-i-s")."';
}
var ques = $(this).data('ques');
$('#options_div' + ques).toggle();
});
var radCount=0;
var subParent;
var appendOnce = 1;
$('#primary_ques').on('click', '.options', function(){
var ques = $(this).data('ques');
var ans = $(this).data('ans');
var currQues='';
var priParentQues;
if(parseInt($('#level'+ques).val())==1)
{
var element = $(this).parent().parent().parent().parent().parent().parent();
priParentQues = element.attr('data-parent');
subParent = priParentQues;
questionArray['Q-'+priParentQues] = {};
questionArray['Q-'+priParentQues]['prim_ques'] = $('#questText_'+ques).val();
questionArray['Q-'+priParentQues]['prim_response']=$(this).text();
questionArray['Q-'+priParentQues]['prim_txt'] = '';
$('#remark'+ques).keyup(function() {
questionArray['Q-'+priParentQues]['prim_txt']=$(this).val();
});
var hideRadioElement = $(this).parent();
var countLabel = hideRadioElement.children().size();
var radEleId = hideRadioElement.attr('id');
var labels = document.getElementById(radEleId).querySelectorAll('label');
for(var f=1;f<8;f++)
{
questionArray['Q-'+priParentQues]['fol'+f+'_ques'] = '';
questionArray['Q-'+priParentQues]['fol'+f+'_response']='';
questionArray['Q-'+priParentQues]['fol'+f+'_txt']='';
}
radCount++;
}
if(parseInt($('#level'+ques).val())==2)
{
var element = $(this).parent().parent().parent().parent().parent().parent();
priParentQues = element.attr('data-parent');
questionArray['Q-'+priParentQues]['fol1_ques'] = $('#questText_'+ques).val();
questionArray['Q-'+priParentQues]['fol1_response']=$(this).text();
questionArray['Q-'+priParentQues]['fol_txt']='';
$('#remark'+ques).keyup(function() {
questionArray['Q-'+priParentQues]['fol1_txt']=$(this).val();
});
var setAttrElement = $(this).parent().parent();
setAttrElement.attr('for','active');
var hideElement = $(this).parent().parent().parent();
var countDiv = hideElement.children().size();
for(var s=0;s<countDiv;s++)
{
var childEle = hideElement.children()[s];
if(childEle.getAttribute('for') != 'active')
document.getElementById(childEle.id).style.display='none';
}
for(var f=2;f<8;f++)
{
questionArray['Q-'+priParentQues]['fol'+f+'_ques'] = '';
questionArray['Q-'+priParentQues]['fol'+f+'_response']='';
questionArray['Q-'+priParentQues]['fol'+f+'_txt']='';
}
}
if(parseInt($('#level'+ques).val())==3)
{
var element = $(this).parent().parent().parent().parent().parent().parent();
priParentQues = element.attr('data-parent');
questionArray['Q-'+priParentQues]['fol2_ques'] = $('#questText_'+ques).val();
questionArray['Q-'+priParentQues]['fol2_response']=$(this).text();
questionArray['Q-'+priParentQues]['fol2_txt']='';
$('#remark'+ques).keyup(function() {
questionArray['Q-'+priParentQues]['fol2_txt']=$(this).val();
});
var setAttrElement = $(this).parent().parent().parent();
setAttrElement.attr('for','active');
var hideElement = $(this).parent().parent().parent().parent();
var countDiv = hideElement.children().size();
for(var s=0;s<countDiv;s++)
{
var childEle = hideElement.children()[s];
if(childEle.getAttribute('for') != 'active')
document.getElementById(childEle.id).style.display='none';
}
for(var f=3;f<8;f++)
{
questionArray['Q-'+priParentQues]['fol'+f+'_ques'] = '';
......@@ -1495,36 +1291,26 @@ function createQaireTab()
questionArray['Q-'+priParentQues]['fol'+f+'_txt']='';
}
}
if(parseInt($('#level'+ques).val())==4)
{
var element = $(this).parent().parent().parent().parent().parent().parent();
priParentQues = element.attr('data-parent');
questionArray['Q-'+priParentQues]['fol3_ques'] = $('#questText_'+ques).val();
questionArray['Q-'+priParentQues]['fol3_response']=$(this).text();
questionArray['Q-'+priParentQues]['fol3_txt']='';
$('#remark'+ques).keyup(function() {
questionArray['Q-'+priParentQues]['fol3_txt']=$(this).val();
});
var setAttrElement = $(this).parent().parent().parent();
setAttrElement.attr('for','active');
var hideElement = $(this).parent().parent().parent().parent();
var countDiv = hideElement.children().size();
for(var s=0;s<countDiv;s++)
{
var childEle = hideElement.children()[s];
if(childEle.getAttribute('for') != 'active')
document.getElementById(childEle.id).style.display='none';
}
for(var f=4;f<8;f++)
{
questionArray['Q-'+priParentQues]['fol'+f+'_ques'] = '';
......@@ -1532,35 +1318,26 @@ function createQaireTab()
questionArray['Q-'+priParentQues]['fol'+f+'_txt']='';
}
}
if(parseInt($('#level'+ques).val())==5)
{
var element = $(this).parent().parent().parent().parent().parent().parent();
priParentQues = element.attr('data-parent');
questionArray['Q-'+priParentQues]['fol4_ques'] = $('#questText_'+ques).val();
questionArray['Q-'+priParentQues]['fol4_response']=$(this).text();
questionArray['Q-'+priParentQues]['fol4_txt']='';
$('#remark'+ques).keyup(function() {
questionArray['Q-'+priParentQues]['fol4_txt']=$(this).val();
});
var setAttrElement = $(this).parent().parent().parent();
setAttrElement.attr('for','active');
var hideElement = $(this).parent().parent().parent().parent();
var countDiv = hideElement.children().size();
for(var s=0;s<countDiv;s++)
{
var childEle = hideElement.children()[s];
if(childEle.getAttribute('for') != 'active')
document.getElementById(childEle.id).style.display='none';
}
for(var f=5;f<8;f++)
{
questionArray['Q-'+priParentQues]['fol'+f+'_ques'] = '';
......@@ -1568,36 +1345,26 @@ function createQaireTab()
questionArray['Q-'+priParentQues]['fol'+f+'_txt']='';
}
}
if(parseInt($('#level'+ques).val())==6)
{
var element = $(this).parent().parent().parent().parent().parent().parent();
priParentQues = element.attr('data-parent');
questionArray['Q-'+priParentQues]['fol5_ques'] = $('#questText_'+ques).val();
questionArray['Q-'+priParentQues]['fol5_response']=$(this).text();
questionArray['Q-'+priParentQues]['fol5_txt']='';
$('#remark'+ques).keyup(function() {
questionArray['Q-'+priParentQues]['fol5_txt']=$(this).val();
});
var setAttrElement = $(this).parent().parent().parent();
setAttrElement.attr('for','active');
var hideElement = $(this).parent().parent().parent().parent();
var countDiv = hideElement.children().size();
for(var s=0;s<countDiv;s++)
{
var childEle = hideElement.children()[s];
if(childEle.getAttribute('for') != 'active')
document.getElementById(childEle.id).style.display='none';
}
for(var f=6;f<8;f++)
{
questionArray['Q-'+priParentQues]['fol'+f+'_ques'] = '';
......@@ -1605,36 +1372,26 @@ function createQaireTab()
questionArray['Q-'+priParentQues]['fol'+f+'_txt']='';
}
}
if(parseInt($('#level'+ques).val())==7)
{
var element = $(this).parent().parent().parent().parent().parent().parent();
priParentQues = element.attr('data-parent');
questionArray['Q-'+priParentQues]['fol6_ques'] = $('#questText_'+ques).val();
questionArray['Q-'+priParentQues]['fol6_response']=$(this).text();
questionArray['Q-'+priParentQues]['fol6_txt']='';
$('#remark'+ques).keyup(function() {
questionArray['Q-'+priParentQues]['fol6_txt']=$(this).val();
});
var setAttrElement = $(this).parent().parent().parent();
setAttrElement.attr('for','active');
var hideElement = $(this).parent().parent().parent().parent();
var countDiv = hideElement.children().size();
for(var s=0;s<countDiv;s++)
{
var childEle = hideElement.children()[s];
if(childEle.getAttribute('for') != 'active')
document.getElementById(childEle.id).style.display='none';
}
for(var f=7;f<8;f++)
{
questionArray['Q-'+priParentQues]['fol'+f+'_ques'] = '';
......@@ -1642,55 +1399,41 @@ function createQaireTab()
questionArray['Q-'+priParentQues]['fol'+f+'_txt']='';
}
}
if(parseInt($('#level'+ques).val())==8)
{
var element = $(this).parent().parent().parent().parent().parent().parent();
priParentQues = element.attr('data-parent');
questionArray['Q-'+priParentQues]['fol7_ques'] = $('#questText_'+ques).val();
questionArray['Q-'+priParentQues]['fol7_response']=$(this).text();
questionArray['Q-'+priParentQues]['fol7_txt']='';
$('#remark'+ques).keyup(function() {
questionArray['Q-'+priParentQues]['fol7_txt']=$(this).val();
});
var setAttrElement = $(this).parent().parent().parent();
setAttrElement.attr('for','active');
var hideElement = $(this).parent().parent().parent().parent();
var countDiv = hideElement.children().size();
for(var s=0;s<countDiv;s++)
{
var childEle = hideElement.children()[s];
if(childEle.getAttribute('for') != 'active')
document.getElementById(childEle.id).style.display='none';
}
}
if(appendOnce%2==0) {
loadQuestions(ques, ans);
}
appendOnce++;
});
function loadQuestions(ques, ans) {
var level = parseInt($('#level'+ques).val());
var next_level = level+1;
var parent_id = '".$qid."';
if(level==1)
{
prev_ques='';
}
var levelVar = parseInt($('#levelVal'+ques).val());
<!-- $('#options_div'+prev_ques).attr('style','display:none');-->
$('#options_div'+$('#parent'+level+ques).val()+' input[type=radio]').attr('disabled','disabled');
$.ajax({
......@@ -1700,20 +1443,16 @@ function createQaireTab()
},
dataType: 'html',
success: function(data) {
var childParentDiv1 = null;
var rowDiv1 = null;
var childParentDiv = null;
var childParentDiv2 = null;
var rowDiv = $('#childParentDiv'+ques).parent().parent().attr('id');
rowDiv1 = document.getElementById(rowDiv).nextElementSibling;
if(rowDiv1 != undefined)
{
var rowDiv1ID = rowDiv1.id;
$('#'+rowDiv1ID).html('');
var rowDiv2 = document.getElementById(rowDiv).nextElementSibling.nextElementSibling;
if(rowDiv2 != undefined)
{
......@@ -1721,47 +1460,35 @@ function createQaireTab()
$('#'+rowDiv2ID).html('');
}
}
childParentDiv = $('#childParentDiv'+ques).parent().attr('id');
childParentDiv1 = document.getElementById(childParentDiv).nextElementSibling;
if(childParentDiv1 != null)
{
var childParentDiv1ID = childParentDiv1.id;
$('#'+childParentDiv1ID).remove();
childParentDiv2 = document.getElementById(childParentDiv).nextElementSibling;
if(childParentDiv2 != undefined)
{
var childParentDiv2ID = childParentDiv2.id;
$('#'+childParentDiv2ID).remove();
}
}
if(level<3)
{
$('#rowDiv1'+subParent).append('<div class=\"col-md-4\" id=\"appendChild'+appendChild+ques+'\"></div>');
}
if(level>=3 && level<=5)
{
$('#rowDiv2'+subParent).append('<div class=\"col-md-4\" id=\"appendChild'+appendChild+ques+'\"></div>');
}
if(level>=6 && level<=8)
{
$('#rowDiv3'+subParent).append('<div class=\"col-md-4\" id=\"appendChild'+appendChild+ques+'\"></div>');
}
$('#appendChild'+appendChild+ques).append(data);
var parentColor = document.getElementById('parentColorDiv'+subParent).getAttribute('style');
for(var c=0;c<=8;c++){
var colorDiv = document.getElementById('subParent'+subParent).getElementsByClassName('childDiv')[c];
if(colorDiv!=undefined)
colorDiv.setAttribute('style',parentColor);
}
......@@ -1769,9 +1496,7 @@ function createQaireTab()
});
prev_ques = ques;
appendChild++;
}
$('#submitQuestionAire').click(function()
{
if(radCount==0)
......@@ -1779,7 +1504,6 @@ function createQaireTab()
alert('Please select some options first');
return;
}
var postdata='varid='+$('#varid').val();
postdata+='&mobile='+'".$dataarr["mobile"]."';
postdata+='&client='+'".$dataarr["client"]."';
......@@ -1789,14 +1513,9 @@ function createQaireTab()
postdata+='&questionArray='+encodeURIComponent(JSON.stringify(questionArray));
doAjax('questionare',postdata,'createtaskdiv','ajaxMutex_recSaveData','singlethis','POST');
});
});
function updateagentcomments(id){
var agent_comment = $('#'+id+'_agent_comment').val();
if(agent_comment)
......@@ -1805,45 +1524,34 @@ function createQaireTab()
var postdata='id='+id;
postdata+='&agent_comment='+agent_comment;
postdata+='&mobile='+'".$dataarr["mobile"]."';
doAjax('record?action=savecomment',postdata,'createtaskdiv','ajaxMutex_recSaveData','singlethis','POST');
}
else
{
alert('Please insert agent comment first');
}
}
</script>
</div>
</div>
</div>
</div>
</div></fieldset>";
return $data;
}
//QuestionAire History
function createQaireHistTab()
{
$user_id = Auth::user()->username;
$cust_id = $this->recruitdata["peopledata"]["clientcode"];
$data="";
$bulkCallID = DB::table("questionaire_details")->where('user_id','=',$user_id)->where('cust_id','=',$cust_id)->orderBy('id','desc')->select('call_id')->distinct()->get();
dy>
$custIdArr = array();
foreach($bulkCallID as $key=> $callID){
$questionAirDetails = DB::table("questionaire_details")->where('user_id','=',$user_id)->where('cust_id','=',$cust_id)->where('call_id','=',$callID->call_id)->select('*')->get();
$questionAirSortDetails = $questionAirDetails[0];
$data.="<a onclick='questionAireDiv".$key."()'><div class='panel panel-warning panel-body'>
<caption><div>
<div class='col-xs-4'><label class='col-xs-4'>Date/time</label><p class='col-xs-8'>".$questionAirSortDetails->question_time."</p></div>
......@@ -1864,7 +1572,6 @@ function createQaireHistTab()
<th>Followup7</th>
</tr>
</thead><tbody>";
foreach($questionAirDetails as $keys=> $questionAirDetail){
if($keys%2==0)
{
......@@ -1885,7 +1592,6 @@ function createQaireHistTab()
<td>".$questionAirDetail->followup6_question."</td>
<td>".$questionAirDetail->followup7_question."</td>
</tr>";
if($keys%2==0)
{
$data.="<tr style='background-color:#e6e5ef'>";
......@@ -1894,7 +1600,6 @@ function createQaireHistTab()
{
$data.="<tr style='background-color:#ffffff'>";
}
$data.="<td>".$questionAirDetail->question."</td>
<td>Response</td>
<td>".$questionAirDetail->primary_response."</td>
......@@ -1906,7 +1611,6 @@ function createQaireHistTab()
<td>".$questionAirDetail->followup6_response."</td>
<td>".$questionAirDetail->followup7_response."</td>
</tr>";
if($keys%2==0)
{
$data.="<tr style='background-color:#e6e5ef'>";
......@@ -1915,7 +1619,6 @@ function createQaireHistTab()
{
$data.="<tr style='background-color:#ffffff'>";
}
$data.="<td>".$questionAirDetail->question."</td>
<td>Text</td>
<td>".$questionAirDetail->primary_text."</td>
......@@ -1928,14 +1631,11 @@ function createQaireHistTab()
<td>".$questionAirDetail->followup7_text."</td>
</tr>";
}
$data.="
</tbody></table></div></a>
<script>
function questionAireDiv".$key."(){
var tabStyle".$key." = document.getElementById('questionAireTable".$key."').style.display;
if(tabStyle".$key."=='none')
{
document.getElementById('questionAireTable".$key."').style.display='block';
......@@ -1944,32 +1644,23 @@ $data.="
{
document.getElementById('questionAireTable".$key."').style.display='none';
}
}
</script>
";
}
// $allQuestions = DB::table("questionaire_details")->whereIn('call_id', $custIdArr)->get();
return $data;
}
function createCompManage()
{
$varid=$this->varid;
$dataarr=$this->recruitdata["peopledata"];
$callId=1;
$crmcallDetails=CRMCall::where('crm_id','=',$varid)->orderBy("created_at","DESC")->first();
if($crmcallDetails)
$callId = $crmcallDetails->id;
$compFields = DB::table("complaint_fields")->get();
$resclassUnitArr = DB::table("complaint_resol_class_unit")->get();
$custType = "<option value=''></option>";
$custBand = "<option value=''></option>";
$servType = "<option value=''></option>";
......@@ -1985,62 +1676,43 @@ function createCompManage()
$logBranchName = "<option value=''>Select...</option>";
$logBranchCode = "<option value=''></option>";
$resBranchCode = "<option value=''></option>";
foreach ($resclassUnitArr as $key => $resclassunit) {
if($resclassunit->resolve_class_unit)
$resclassUnit.= "<option value='$resclassunit->id'>$resclassunit->resolve_class_unit</option>";
}
foreach ($compFields as $key => $fields) {
if($fields->cust_type)
$custType.= "<option value='$fields->cust_type'>$fields->cust_type</option>";
if($fields->cust_band)
$custBand.= "<option value='$fields->cust_band'>$fields->cust_band</option>";
if($fields->service_type)
$servType.= "<option value='$fields->service_type'>$fields->service_type</option>";
if($fields->priority)
$priority.= "<option value='$fields->priority'>$fields->priority</option>";
if($fields->rbb)
$rbb.= "<option value='$fields->rbb'>$fields->rbb</option>";
if($fields->non_rbb)
$nonRbb.= "<option value='$fields->non_rbb'>$fields->non_rbb</option>";
if($fields->source_of_info)
$srcInfo.= "<option value='$fields->source_of_info'>$fields->source_of_info</option>";
if($fields->cust_city)
$custCity.= "<option value='$fields->cust_city'>$fields->cust_city</option>";
if($fields->acknowledge)
$ackSent.= "<option value='$fields->acknowledge'>$fields->acknowledge</option>";
if($fields->logging_branch_name)
$logBranchName.= "<option value='$fields->logging_branch_name'>$fields->logging_branch_name</option>";
if($fields->logging_branch_code)
$logBranchCode.= "<option value='$fields->logging_branch_code'>$fields->logging_branch_code</option>";
if($fields->resolving_branch_code)
$resBranchCode.= "<option value='$fields->resolving_branch_code'>$fields->resolving_branch_code</option>";
if($fields->resolving_branch_w_code)
$resolving_branch_w_code[] = explode("-", $fields->resolving_branch_w_code);
if($fields->logging_branch_w_code)
$logging_branch_w_code[] = explode("-", $fields->logging_branch_w_code);
}
$resolving_branch_w_code = json_encode($resolving_branch_w_code);
$logging_branch_w_code = json_encode($logging_branch_w_code);
$logdate=strtotime(date('Y-m-d H:i:s'))+330*60;
$data = "
<style>
.search {
......@@ -2063,7 +1735,6 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
<label class='label-small_new' style='width:29%;'>Complainant Name <span style='color:red;'>*</span></label>
<input type='text' class='form_new form_new_amend' style='width:50%;' id='compName' value=''>
</div>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>AAN</label>
<input type='number' class='form_new form_new_amend' style='width:50%;' id='aan'>
......@@ -2089,7 +1760,6 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
<label class='label-small_new' style='width:29%;'>Cust ID<span style='color:red;'>*</span></label>
<input type='number' class='form_new form_new_amend'style='width:50%;' value='' id='custId'>
</div>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>Shadow Cust ID</label>
<input type='number' class='form_new form_new_amend' style='width:50%;' id='shadCustId'>
......@@ -2101,7 +1771,6 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
<label class='label-small_new' style='width:29%;'>CASA FD/RA/DP Number</label>
<input type='number' class='form_new form_new_amend' style='width:50%;' id='casa'>
</div>
<div style='width:49%;float:left' class='search'>
<label class='label-small_new' style='width:29%;'>Docket Number<span style='color:red;'>*</span></label>
<input type='text' class='form_new form_new_amend' style='width:52%;' id='dockNum' value=''>
......@@ -2113,7 +1782,6 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
<label class='label-small_new' style='width:29%;'>Customer Name On Card</label>
<input type='text' class='form_new form_new_amend' style='width:50%;' id='custNameOnCard' value=''>
</div>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>Card Number</label>
<input type='text' class='form_new form_new_amend' style='width:50%;' id='cardNum' maxlength='16'>
......@@ -2125,7 +1793,6 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
<label class='label-small_new' style='width:29%;'>Customer Band</label>
<select id='custBand' class='form_hrm_select select2multi' style='width:50%'>$custBand</select>
</div>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>Custmer Type</label>
<select id='custType' class='form_hrm_select select2multi' style='width:50%;'>$custType</select>
......@@ -2137,7 +1804,6 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
<label class='label-small_new' style='width:29%;'>Customer Mobile<span style='color:red;'>*</span></label>
<input type='number' class='form_new form_new_amend' style='width:50%;' id='custMob' maxlength='10'>
</div>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>Contact Number</label>
<input type='number' class='form_new form_new_amend' style='width:50%;' id='contNum'>
......@@ -2149,7 +1815,6 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
<label class='label-small_new' style='width:29%;'>Email</label>
<input type='text' class='form_new form_new_amend' style='width:50%;' id='email' value='' maxlength='50'>
</div>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>Case Reference</label>
<input type='text' class='form_new form_new_amend' style='width:50%;' id='caseRef' value='' maxlength='50'>
......@@ -2161,14 +1826,12 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
<label class='label-small_new' style='width:29%;'>Source Of Information<span style='color:red;'>*</span></label>
<select id='srcInfo' class='form_hrm_select select2multi' style='width:50%'>$srcInfo</select>
</div>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>Customer City</label>
<select id='custCity' class='form_hrm_select select2multi' style='width:50%;'>$custCity</select>
</div>
</div>
<br><br><br>
<h5>Case Information</h5>
<hr/>
<br>
......@@ -2188,7 +1851,6 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
<label class='label-small_new' style='width:29%;'>Logging Branch Name<span style='color:red;'>*</span></label>
<select id='logBranchName' class='form_hrm_select select2multi' style='width:50%' readonly>$logBranchName</select>
</div>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>Logging Classification Unit<span style='color:red;'>*</span></label>
<select id='logClassUnit' class='form_hrm_select select2multi' style='width:50%' readonly>
......@@ -2204,7 +1866,6 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
<label class='label-small_new' style='width:29%;'>Logging Branch Code</label>
<input type='text' class='form_new form_new_amend' style='width:50%;' id='logBranchCode' value='' readonly>
</div>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>Acknowledge Sent</label>
<select id='ackSent' class='form_hrm_select select2multi' style='width:50%'>$ackSent</select>
......@@ -2216,7 +1877,6 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
<label class='label-small_new' style='width:29%;'>Proposed/Resolving Classification Unit</label>
<select id='resclassUnit' class='form_hrm_select select2multi' style='width:50%'>$resclassUnit</select>
</div>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>Resolving Branch Code</label>
<input type='text' class='form_new form_new_amend' style='width:50%;' id='resBranchCode' value='' readonly>
......@@ -2279,44 +1939,32 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
<input type='button' class='btn btn-default btn-md' style='margin-left:40%' value='Save' id='save'>
</div>
</div>
<script>
var addInfotext_max = 1000-$('#addInfo').val().length;
$('#addInfoText').html(addInfotext_max + ' chars remaining');
$('#addInfo').keyup(function() {
var addInfotext_length = $('#addInfo').val().length;
var addInfotext_remaining = addInfotext_max - addInfotext_length;
$('#addInfoText').html(addInfotext_remaining + ' chars remaining');
});
var noctext_max = 512-$('#noc').val().length;
$('#nocText').html(noctext_max + ' chars remaining');
$('#noc').keyup(function() {
var noctext_length = $('#noc').val().length;
var noctext_remaining = noctext_max - noctext_length;
$('#nocText').html(noctext_remaining + ' chars remaining');
});
var detailSuggesttext_max = 512-$('#detailSuggest').val().length;
$('#detailSuggestText').html(detailSuggesttext_max + ' chars remaining');
$('#detailSuggest').keyup(function() {
var detailSuggesttext_length = $('#detailSuggest').val().length;
var detailSuggesttext_remaining = detailSuggesttext_max - detailSuggesttext_length;
$('#detailSuggestText').html(detailSuggesttext_remaining + ' chars remaining');
});
$('#logBranchName').click(function()
{
var logBranchName = $(this).val();
var logging_branch_w_code = $logging_branch_w_code;
if(logBranchName)
{
for(var l in logging_branch_w_code)
......@@ -2332,12 +1980,10 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
$('#logBranchCode').val('');
}
});
$('#resBranch').click(function()
{
var resBranchVal = $(this).val();
var resolving_branch_w_code = $resolving_branch_w_code;
for(var lb in resolving_branch_w_code)
{
if((resolving_branch_w_code[lb][0]).trim()==resBranchVal)
......@@ -2346,31 +1992,25 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
}
}
});
$('#resclassUnit').click(function()
{
var resclassUnitVal = $(this).val();
//To make empty when Non rbb selected
$('#resBranchCode').val('');
$('#resBranch').select2('val', '');
if(resclassUnitVal)
{
doAjax('resclassUnit','resclassUnitVal='+encodeURIComponent(resclassUnitVal),'','','singlethis','POST',function(retstr){
var compArr = JSON.parse(retstr.responseText);
$('#resBranch').empty();
if(resclassUnitVal == '19')
{
$('#resBranch').append(\"<option value=''>Select...</option>\");
for(var i in compArr)
{
$('#resBranch').append(\"<option value='\"+compArr[i]['rbb']+\"'>\"+compArr[i]['rbb']+\"</option>\");
}
}
if(resclassUnitVal != '19')
{
for(var i in compArr)
......@@ -2378,16 +2018,12 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
$('#resBranch').append(\"<option value='\"+compArr[i]['non_rbb']+\"'>\"+compArr[i]['non_rbb']+\"</option>\");
}
}
});
var action = 'category/'+resclassUnitVal;
$('#cat').select2('val', '');
$('#cat').html('');
$('#subCat').select2('val', '');
$('#subCat').html('');
$.ajax({
type: 'get',
url: action,
......@@ -2395,39 +2031,29 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
success: function(nextRecord)
{
var catArr = nextRecord['category'];
$('#cat').append(\"<option value=''>Select Category</option>\");
for(var i in catArr)
{
$('#cat').append(\"<option value='\"+catArr[i]['id']+\"~\"+catArr[i]['category']+\"'>\"+catArr[i]['category']+\"</option>\");
}
}
});
}
});
$('#cat').click(function()
{
var catidsplit = $(this).val();
var categoryval = catidsplit.split('~');
catId = categoryval[0];
categoryvalue = categoryval[1];
var resclassUnitVal = $('#resclassUnit').val();
//To make empty when Non rbb selected
$('#subCat').select2('val', '');
if(catId)
{
var action = 'subcategory/'+catId+'/'+resclassUnitVal;
$('#subCat').html('');
$.ajax({
type: 'get',
url: action,
......@@ -2435,9 +2061,7 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
success: function(nextRecord)
{
var subCatArr = nextRecord['sub_category'];
$('#subCat').append(\"<option value=''>Select SubCategory</option>\");
for(var i in subCatArr)
{
$('#subCat').append(\"<option value='\"+subCatArr[i]+\"'>\"+subCatArr[i]+\"</option>\");
......@@ -2446,9 +2070,7 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
}
});
}
});
//To save all details
$('#save').click(function()
{
......@@ -2489,7 +2111,6 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
var compStatus = $('#compStatus').val();
var call_id = ".$callId.";
if(compName==''){
simpleNotification('error','topRight','please enter Complainant Name');
......@@ -2528,7 +2149,6 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
simpleNotification('error','topRight','please enter Nature Of Complaint');
return;
}
if(isNaN(cardNum))
{
swal('Please enter proper Card Number');
......@@ -2579,25 +2199,19 @@ foreach ($resclassUnitArr as $key => $resclassunit) {
return $data;
}
function createChildCase()
{
$callId=0;
$varid=$this->varid;
$dataarr=$this->recruitdata["peopledata"];
$resclassUnit = "<option value=''></option>";
$cat = "<option value=''></option>";
$subCat = "<option value=''></option>";
$resclassUnitArr = DB::table("complaint_resol_class_unit")->get();
foreach ($resclassUnitArr as $key => $resclassunit) {
if($resclassunit->resolve_class_unit)
$resclassUnit.= "<option value='$resclassunit->id'>$resclassunit->resolve_class_unit</option>";
}
$data = "
<style>
.search {
......@@ -2620,7 +2234,6 @@ function createChildCase()
<label class='label-small_new' style='width:29%;'>Complainant Name</label>
<input type='text' class='form_new form_new_amend' style='width:50%;' id='ccompName' value='".$dataarr['firstname']."'>
</div>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>Custmer Type</label>
<input type='text' class='form_new form_new_amend' style='width:50%;' id='ccustType' value='".$compDetails->cust_type."' readonly>
......@@ -2662,7 +2275,6 @@ function createChildCase()
<label class='label-small_new' style='width:29%;'>Resolving Classification Unit</label>
<select id='cresclassUnit' class='form_hrm_select select2multi' style='width:50%'>$resclassUnit</select>
</div>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>Resolving Branch</label>
<select id='cresBranch' class='form_hrm_select select2multi' style='width:50%'></select>
......@@ -2711,62 +2323,46 @@ function createChildCase()
<input type='button' class='btn btn-default btn-md' style='margin-left:40%' value='Save' id='Save'>
</div>
</div>
<script>
var addInfotext_max = 1000-$('#caddInfo').val().length;
$('#caddInfoText').html(addInfotext_max + ' chars remaining');
$('#caddInfo').keyup(function() {
var addInfotext_length = $('#caddInfo').val().length;
var addInfotext_remaining = addInfotext_max - addInfotext_length;
$('#caddInfoText').html(addInfotext_remaining + ' chars remaining');
});
var taskDesctext_max = 512-$('#ctaskDesc').val().length;
$('#ctaskDescText').html(taskDesctext_max + ' chars remaining');
$('#ctaskDesc').keyup(function() {
var taskDesctext_length = $('#ctaskDesc').val().length;
var taskDesctext_remaining = taskDesctext_max - taskDesctext_length;
$('#ctaskDescText').html(taskDesctext_remaining + ' chars remaining');
});
var commentstext_max = 512-$('#comments').val().length;
$('#commentsText').html(commentstext_max + ' chars remaining');
$('#comments').keyup(function() {
var commentstext_length = $('#comments').val().length;
var commentstext_remaining = commentstext_max - commentstext_length;
$('#commentsText').html(commentstext_remaining + ' chars remaining');
});
$('#cresclassUnit').click(function()
{
var resclassUnitVal = $(this).val();
//To make empty when Non rbb selected
$('#cresBranch').select2('val', '');
if(resclassUnitVal)
{
doAjax('resclassUnit','resclassUnitVal='+encodeURIComponent(resclassUnitVal),'','','singlethis','POST',function(retstr){
var compArr = JSON.parse(retstr.responseText);
$('#cresBranch').empty();
if(resclassUnitVal == '19')
{
$('#cresBranch').append(\"<option value=''>Select...</option>\");
for(var i in compArr)
{
$('#cresBranch').append(\"<option value='\"+compArr[i]['rbb']+\"'>\"+compArr[i]['rbb']+\"</option>\");
}
}
if(resclassUnitVal != '19')
{
for(var i in compArr)
......@@ -2774,16 +2370,12 @@ function createChildCase()
$('#cresBranch').append(\"<option value='\"+compArr[i]['non_rbb']+\"'>\"+compArr[i]['non_rbb']+\"</option>\");
}
}
});
var action = 'category/'+resclassUnitVal;
$('#ccat').select2('val', '');
$('#ccat').html('');
$('#csubCat').select2('val', '');
$('#csubCat').html('');
$.ajax({
type: 'get',
url: action,
......@@ -2791,34 +2383,25 @@ function createChildCase()
success: function(nextRecord)
{
var catArr = nextRecord['category'];
$('#ccat').append(\"<option value=''>Select Category</option>\");
for(var i in catArr)
{
$('#ccat').append(\"<option value='\"+catArr[i]['id']+\"'>\"+catArr[i]['category']+\"</option>\");
}
}
});
}
});
$('#ccat').click(function()
{
var catId = $(this).val();
//To make empty when Non rbb selected
$('#csubCat').select2('val', '');
if(catId)
{
var action = 'subcategory/'+catId;
$('#subCat').html('');
$.ajax({
type: 'get',
url: action,
......@@ -2826,9 +2409,7 @@ function createChildCase()
success: function(nextRecord)
{
var subCatArr = nextRecord['sub_category'];
$('#csubCat').append(\"<option value=''>Select SubCategory</option>\");
for(var i in subCatArr)
{
$('#csubCat').append(\"<option value='\"+subCatArr[i]+\"'>\"+subCatArr[i]+\"</option>\");
......@@ -2837,9 +2418,7 @@ function createChildCase()
}
});
}
});
//To save all details
$('#Save').click(function()
{
......@@ -2856,13 +2435,11 @@ function createChildCase()
var compStatus = $('#ccompStatus').val();
var comments = $('#comments').val();
var varid = '".$varid."';
if(compName==''||resBranch==''||cat==''||subCat==''||taskDesc=='')
{
alert('Complainant Name,Resolving Branch Name,Category,Subcategory,Task Description');
return;
}
var postdata='complainant_name='+encodeURIComponent(compName);
postdata+='&cust_type='+encodeURIComponent(custType);
postdata+='&service_type='+encodeURIComponent(serveType);
......@@ -2880,7 +2457,6 @@ function createChildCase()
});
</script>
";
return $data;
}
//Function for lead form creation by Gopal
......@@ -2919,7 +2495,6 @@ function createLeadEntryForm()
$data="<div style='clear:both;margin:2% 0 0 1%;border-style: dotted solid dashed;padding:2%'>
<h5>Lead Entry Form</h5>
<hr/><br>
<div style='clear:both;width:100%;'>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;font-weight:bold;'>Customer Name</label>
......@@ -2984,9 +2559,6 @@ function createLeadEntryForm()
</div>
<script>
$('#leadformSave').click(function()
{
if(kstychCall['ts_Talk']<1||Math.ceil(((getNowTS()-kstychCall['ts_Talk'])/1000))<10)
......@@ -3074,17 +2646,13 @@ function createLeadEntryForm()
}
});
</script>
";
return $data;
}
function createRacingCust()
{
$dataarr=$this->recruitdata["peopledata"];
$data="<div style='clear:both;margin:2% 0 0 1%;border-style: dotted solid dashed;padding:2%'>
<h5>Customer Information</h5>
<hr/><br>
......@@ -3095,7 +2663,6 @@ function createRacingCust()
<label class='label-small_new' style='width:50%;' >".date('Y-m-d')."</label>
</div>
<br><br>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>PB Code</label>
<input type='text' class='form_new form_new_amend'style='width:50%;' value='' id='PBcode'>
......@@ -3104,7 +2671,6 @@ function createRacingCust()
<label class='label-small_new' style='width:29%;'>PB Name</label>
<input type='text' class='form_new form_new_amend'style='width:50%;' value='' id='PBname'>
</div>
</div>
<br><br>
<div style='clear:both;width:100%;'>
......@@ -3117,7 +2683,6 @@ function createRacingCust()
<label class='label-small_new' style='width:29%;'>Supervisor Mail ID</label>
<input type='text' class='form_new form_new_amend' style='width:50%;' id='SupervisormailID'>
</div>
</div>
<br><br>
<div style='clear:both;width:100%;'>
......@@ -3130,11 +2695,9 @@ function createRacingCust()
<label class='label-small_new' style='width:29%;'>Group ID Name</label>
<input type='text' class='form_new form_new_amend' style='width:50%;' id='groupidname' value=''>
</div>
</div>
<br><br>
<div style='clear:both;width:100%;'>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>Cust ID</label>
<input type='text' class='form_new form_new_amend' style='width:50%;' id='custID' maxlength='16'>
......@@ -3143,7 +2706,6 @@ function createRacingCust()
<label class='label-small_new' style='width:29%;'>Cust Name</label>
<input type='text' class='form_new form_new_amend' style='width:50%;' id='custname' value=''>
</div>
</div>
<br><br>
<div style='clear:both;width:100%;'>
......@@ -3155,7 +2717,6 @@ function createRacingCust()
<label class='label-small_new' style='width:29%;'>Cust ID</label>
<input type='text' class='form_new form_new_amend' style='width:50%;' id='Custid' maxlength='16'>
</div>
</div>
<br><br>
<div style='clear:both;width:100%;'>
......@@ -3167,19 +2728,16 @@ function createRacingCust()
<label class='label-small_new' style='width:29%;'>Relationship With Group ID</label>
<input type='text' class='form_new form_new_amend' style='width:50%;' id='relationshipgroupid' maxlength='16'>
</div>
</div>
<br><br>
<div style='clear:both;width:100%;'>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>Grouping</label>
<select id='newGroupdditiongroup' class='form_hrm_select select2multi' style='width:50%'>
<option value='New_Group'>New Group</option>
<option value='Addition_to_group'>Addition to group</option>
<option value='Addition_to_group'>Regroup</option>
</select>
</div>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;'>Racing from</label>
......@@ -3187,18 +2745,12 @@ function createRacingCust()
</div>
</div>
<br><br><br>
<br><br>
<div style='clear:both;width:100%;'>
<input type='button' class='btn btn-default btn-md' style='margin-left:40%' value='Save' id='CRSave'>
</div>
</div>
<script>
$('#CRSave').click(function()
{
var snumber = $('#snumber').val();
......@@ -3216,7 +2768,6 @@ function createRacingCust()
var relationshipgroupid = $('#relationshipgroupid').val();
var newGroupdditiongroup = $('#newGroupdditiongroup').val();
var racingfrom = $('#racingfrom').val();
var postdata='s_no='+encodeURIComponent(snumber);
postdata+='&pb_name='+encodeURIComponent(PBname);
postdata+='&pb_code='+encodeURIComponent(PBcode);
......@@ -3235,12 +2786,9 @@ function createRacingCust()
postdata+='&mobile='+'".$dataarr["mobile"]."';
postdata+='&client='+'".$dataarr["client"]."';
postdata+='&clientcode='+'".$dataarr["clientcode"]."';
doAjax('custrace',postdata,'createtaskdiv','ajaxMutex_recSaveData','singlethis','POST');
});
</script>";
return $data;
}
//for RLP
......@@ -3251,10 +2799,8 @@ function createRLP()
$data="";
//echo "<pre>".print_r($rlpcust)."</pre>";
$data.="<fieldset><legend class='new-recruit_legend'>RLP Customer WISE</legend>";
$data.="<div class=custom1 style='width:100%;'>
<h2></h2>";
$data.="<hr><br><table class='table kDataTable' cellpadding=0 cellspacing=0 border=0>
<thead><tr>
<td class='table_hrm_heading_green'>Product</td>
......@@ -3420,18 +2966,14 @@ function createRLP()
<td></td>
</tr>
</table></div></fieldset>";
return $data;
}
function createOneAssistForm()
{
$dataarr=$this->recruitdata["peopledata"];
$data="<div style='clear:both;margin:2% 0 0 1%;border-style: dotted solid dashed;padding:2%'>
<h5>One Assist Form</h5>
<hr/><br>
<div style='clear:both;width:100%;'>
<div style='width:49%;float:left'>
<label class='label-small_new' style='width:29%;font-weight:bold;'>Customer Name</label>
......@@ -3476,7 +3018,6 @@ function createOneAssistForm()
</div>
</div>
<br><br>
<br><br>
<div style='clear:both;width:100%;'>
<div>
......@@ -3491,9 +3032,6 @@ function createOneAssistForm()
</div>
<script>
$('#oneassistformSave').click(function()
{
......@@ -3525,12 +3063,9 @@ function createOneAssistForm()
});
</script>
";
return $data;
}
function colorCodeRec($id)
{
......@@ -3538,7 +3073,6 @@ function colorCodeRec($id)
$dataarr=$this->recruitdata["peopledata"];
$gthis=$this->gthis;
$edituser=$this->edituser;
if($edituser)
{
$colorarr=array();
......@@ -3553,24 +3087,18 @@ function colorCodeRec($id)
}
return $data;
}
function CreateForm(&$frm)
{
$fdirty=$this->recruitdata["dirty"];
$dataarr=$this->recruitdata["peopledata"];
$gthis=$this->gthis;
$edituser=$this->edituser;
$recruitdata=$this->recruitdata;
$isuser=$this->isuser;
$oldbkrec=$this->oldbkrec;
$themehome=$this->themehome;
$data="";$i=1;$tabsdata='';$firsttab="active";
if(Auth::check())
{
if(Auth::user()->moduleACL("HR",true,false,false))
......@@ -3587,15 +3115,10 @@ function CreateForm(&$frm)
$frm['DialerDispo']["{{id}} {{firstname}}"][]=array();
//$frm['Feedback']["{{id}} {{firstname}}"][]=array();
$frm['CallHistory']["{{id}} {{firstname}}"][]=array();
/*if(Auth::user()->username =="B654321" || Auth::user()->username =="B12345"){
$frm['QuestionAire']["{{id}} {{firstname}}"][]=array();
$frm['QuestionAireHist']["{{id}} {{firstname}}"][]=array();}*/
//$frm['QuestionnAire']["{{id}} {{firstname}}"][]=array();
//$frm['CLP']["{{id}} {{firstname}}"][]=array();
//$frm['CLP History']["{{id}} {{firstname}}"][]=array();
......@@ -3612,25 +3135,18 @@ function CreateForm(&$frm)
}
}
}
$tabstr='<div class="tab_bar_green tabsbar-2"><ul class="row row-merge">';
foreach(array_slice($frm,1) as $tbname=>$tabs)
{
$tabname='CustomCRM';
if(($tbname=='Files/Logs'||$tbname=='Letters'||$tbname=='Tasks'||$tbname=='DialerDispo'||$tbname=='CallHistory'||$tabname='CustomCRM')&&!$isuser)continue;
if($tbname!='')
{
$tabstr.="<li class='$firsttab'><a href='#tabs-$i' data-toggle=tab>$tbname</a></li>";
$tabsdata.="<div class='$firsttab tab-pane ' id=tabs-$i>";
$firsttab='';
$fsetstr="";
foreach($tabs as $fsetname=>$fset)
{
......@@ -3640,7 +3156,6 @@ function CreateForm(&$frm)
{
if($rowval==''){$rowval=$flines[1][1];if($flines[1][0]==0)$flines[1][0]=1;$fsetstr.="<div style='float:left;width:".(100/$flines[1][0])."%'>";}
else if($rowval!=$flines[1][1]){$rowval=$flines[1][1];$fsetstr.="</div><div style='float:left;width:".(100/$flines[1][0])."%'>";}
if($flines[0]!=''&&substr($flines[0], -2)=='~1')
{
$fsetstr.="<div class=tab_generic><fieldset style='margin-right:3px;' id='fsetid_".$flines[5]."_1'><legend class='new-recruit_legend' style='background:#9CBFFF'><b style='color:white'>".substr($flines[0], 0, -2)."</b><span class='pull-right'><a href=# onclick='$(\"#fsetid_".$flines[5]."_1_div\").toggle();return false;'><i class='fa fa-sort'></i></a></span></legend><div id='fsetid_".$flines[5]."_1_div'>";
......@@ -3649,7 +3164,6 @@ function CreateForm(&$frm)
{
$fsetstr.="<div class=tab_generic><fieldset style='margin-right:3px;' id='fsetid_".$flines[5]."_1'><legend class='new-recruit_legend' style='background:#9CBFFF'><b style='color:white'>".substr($flines[0], 0, -2)."</b><span class='pull-right'><a href=# onclick='$(\"#fsetid_".$flines[5]."_1_div\").toggle();return false;'><i class='fa fa-sort'></i></a></span></legend><div id='fsetid_".$flines[5]."_1_div' style='display:none'>";
}
if(!($flines[4][2]=='0'&&!$isuser))
{
if(!($flines[4][1]=='0'&&!$edituser))
......@@ -3680,7 +3194,6 @@ function CreateForm(&$frm)
if($tbname=='CustomCRM')$tabsdata.=$this->createCustomCRMTab($manualmobno,$leadid);
if($tbname=='DialerDispo')$tabsdata.=$this->createDispoTab();
if($tbname=='CallHistory')$tabsdata.=$this->createCallsTab();
//if($tbname=='CLP')$tabsdata.=$this->createQaireTab();
//if($tbname=='CLP History')$tabsdata.=$this->createQaireHistTab();
//if($tbname=='ComplaintManagement')$tabsdata.=$this->createCompManage();
......@@ -3695,10 +3208,7 @@ function CreateForm(&$frm)
}
}
$tabstr.='</ul></div>';
$data="<div class=relativeWrap>".$tabstr.'<div class="tab-content">'.$tabsdata.'</div>'."</div>";
$data="<div id=createtaskdiv></div><div style='clear:both'></div>".$this->colorCodeRec('candidatecategory').$data.$this->CreateFormScripts();
return $data;
}
......@@ -3706,7 +3216,6 @@ function CreateForm(&$frm)
function CreateFormScripts()
{
$varid=$this->varid;
$wakka=$this->gthis;
$hrexclusiveflag=0;if(empty($this->recruitdata["peopledata"]['client']))$this->recruitdata["peopledata"]['client']='__';
if(strstr($this->HRExclusiveClients,$this->recruitdata["peopledata"]['client']))
......@@ -3720,11 +3229,9 @@ function CreateForm(&$frm)
}
}
if(!$this->isuser)$hrexclusiveflag=0;
$recordDetails = DB::table('records')->where('id','=',$varid)->select('mf_isa','emailid')->get();
$priority = $recordDetails[0]->mf_isa;
$emailid = $recordDetails[0]->emailid;
$data=" <div id=recdialog></div><br><input type=hidden name='id' id='id' value='".$this->varid."'>
<input type=hidden name='workflowstatus' id='workflowstatus' value='".$this->recruitdata["peopledata"]["workflowstatus"]."'>
<input type=hidden name=varid id=varid value='".$this->varid."'>
......@@ -3738,10 +3245,8 @@ function CreateForm(&$frm)
if('".$this->recruitdata["peopledata"]['dialer_flag']."'=='VIP')
{
\$('#dialer_flag').val('".$this->recruitdata["peopledata"]['dialer_flag']."');
dialerFlagExit=1;
}
if('".$priority."'=='VIP' && dialerFlagExit!=1)
{
\$('#dialer_flag').val('".$priority."');
......@@ -3768,14 +3273,12 @@ function CreateForm(&$frm)
function recruitData()
{
var postdata='varid='+$('#varid').val();
var varslist='".$this->HRFiledsStr."';
var varsarr=varslist.split(',');
for(var i=0;i<varsarr.length;i++)
{
if(varsarr[i]!=''&&$('#'+varsarr[i]).length)postdata+='&'+varsarr[i]+'='+encodeURIComponent($('#'+varsarr[i]).val());
}
doAjax('record?action=save',postdata,'createtaskdiv','ajaxMutex_recSaveData','singlethis','POST');
}
</script>";
......@@ -3807,7 +3310,6 @@ function CreateForm(&$frm)
function saltotal()
{
var stotal=0;
if($('#salbasic').val()=='')$('#salbasic').val('0');
if($('#salhouserent').val()=='')$('#salhouserent').val('0');
if($('#saltransport').val()=='')$('#saltransport').val('0');
......@@ -3816,7 +3318,6 @@ function CreateForm(&$frm)
if($('#salmedical').val()=='')$('#salmedical').val('0');
if($('#salelectricity').val()=='')$('#salelectricity').val('0');
if($('#salother').val()=='')$('#salother').val('0');
stotal+=parseFloat($('#salbasic').val());
stotal+=parseFloat($('#salhouserent').val());
stotal+=parseFloat($('#saltransport').val());
......@@ -3825,7 +3326,6 @@ function CreateForm(&$frm)
stotal+=parseFloat($('#salmedical').val());
stotal+=parseFloat($('#salelectricity').val());
stotal+=parseFloat($('#salother').val());
$('#saltotal').val(stotal);
}
$('#salelectricity').keyup(saltotal);
......@@ -3837,7 +3337,6 @@ function CreateForm(&$frm)
$('#salfood').keyup(saltotal);
$('#salother').keyup(saltotal);
$('#saltotal').keyup(saltotal);
function recd_sendmail(filepath){mailFile(filepath,$('#recd_to').val(),$('#recd_subject').val(),$('#recd_from').val(),encodeURIComponent($('#recd_message').val()));}
function mailFileDialog(filepath)
{
......@@ -3848,10 +3347,8 @@ function CreateForm(&$frm)
dhtml+='<p style=\"clear:both\"><label class=label-small_new style=\"width:25%\">Message:</label><textarea class=\"form_new form_new_amend\" id=recd_message style=\"width:60%\">Please find the Document Attached</textarea></p>';
dhtml+='<p style=\"clear:both\"><label class=label-small_new style=\"width:25%\">Attachment:</label>'+filepath+'</p>';
dhtml+='</fieldset>';
$('#recdialog').html('');
$('#recdialog').html(dhtml);
$('#recdialog').dialog({
autoOpen: false,
width: '70%',
......@@ -3867,7 +3364,6 @@ function CreateForm(&$frm)
});
$('#recdialog').dialog('open');
}
function deleteTask(tid)
{
var postdata='tid='+tid;
......@@ -3907,7 +3403,6 @@ function CreateForm(&$frm)
console.log('no file selected');
}
});
return false;
}
ajaxFileUpload3('pdfsplitfile',".$this->varid.");
......@@ -3951,11 +3446,8 @@ function CreateForm(&$frm)
});
</script>";
}
return $data;
}
function checkDuplicate($varid,$key,$val)
{
$gthis=$this->gthis;
......@@ -3982,7 +3474,6 @@ function checkDuplicate($varid,$key,$val)
}
}
}
function chechAlNum($val)
{
if($val=="")
......@@ -4004,10 +3495,8 @@ function validatePostData()
$ppldata=$this->recruitdata["peopledata"];
$message='';
if($wakka->getCount("records","id='$varid'")!=1)$message=" Record doesnot exists, ";
//only if active statuses
$empstatus=Input::get('currentstatus');if($empstatus=="")$empstatus="__NOCHECK__";
if(stristr($wakka->HRCoreVars['hrrecruitstatuses'],$empstatus)||stristr($wakka->HRCoreVars['hrworkingstatus'],$empstatus))
{
//$this->HRForms[$parts[3]][$parts[4]][]=array($parts[5],$parts[6],$parts[7],$parts[8],$parts[9],$parts[0],$parts[1],$parts[2],$parts[10]);
......@@ -4026,10 +3515,8 @@ function validatePostData()
{
if($vline!="")
{
$vline=str_replace("__COMMA__",",",$vline);
$fline5=Input::get($flines[5]);
//$message.="[$flines[5]|$vline] ";
if($vline=="NONEMPTY")
{
......@@ -4074,7 +3561,6 @@ function validatePostData()
}
}
}
//select values check
$dropsarr=explode(",",$this->HRDropFilds);
foreach($dropsarr as $dropitem)
......@@ -4085,7 +3571,6 @@ function validatePostData()
if(Input::get($dropitem)!=''&&Input::get($dropitem)!='undefined'&&!strstr($selvals,trim(Input::get($dropitem))))
$message.=" Wrong Value of '".$this->HRFieldNames[$dropitem]."'";
}
//date check
$datesarr=explode(",",$this->HRDateFilds);
foreach($datesarr as $dateitem)
......@@ -4102,10 +3587,8 @@ function validatePostData()
}
}
}
//client cannot be changed unless Admin
if(!$wakka->IsAdmin())if(trim($ppldata["client"])!=""&&$ppldata["client"]!=Input::get("client"))$message=" Client Cannot be changed, use Renew-Record";
if(Input::get('currentstatus')==$wakka->HRCoreVars['hrTriggerHoldStatus'])
{
$message="";//bypass checks for candidates
......@@ -4122,7 +3605,6 @@ function validatePostData()
$ppldata['varid']=Input::get('varid');
$ppldata['id']=Input::get('varid');
$client=Input::get('client');
//file vars change the file names to store,and if empty keep the old name
$tmpstr=explode(",",$this->HRFileFieldsStr);
foreach($tmpstr as $tmpelem)
......@@ -4146,7 +3628,6 @@ function validatePostData()
}
}
}
$tmpstr=explode(",",$this->HRFiledsStr);
$newdata=array();foreach($tmpstr as $key)
{
......@@ -4160,12 +3641,10 @@ function validatePostData()
{
if(strstr($changearr[$changearr["updated"]],$key)==FALSE)$changearr[$changearr["updated"]].="$key|".str_replace(array("|",",")," ",$val)."|".str_replace(array("|",",")," ",$wakka->safeString($newval)).",";
$this->recruitdata['dirty'][$key]=1;
$this->empWorkflowTrigger($ppldata['varid'],$client,$key,$newval,$val,$ppldata,$newdata);
$this->empAnalytics($ppldata['varid'],$ppldata,$key,$newval,$val);
}
}
foreach($tmpstr as $tmpelem)
{
if(Input::exists($tmpelem))
......@@ -4174,8 +3653,6 @@ function validatePostData()
if($ppldata[$tmpelem]=="")unset($ppldata[$tmpelem]);
}
}
//run holded up triggers if
if($newdata["currentstatus"]!=$wakka->HRCoreVars['hrTriggerHoldStatus'])
{
......@@ -4199,20 +3676,16 @@ function validatePostData()
function processFormSubmit()
{
if(Auth::guest())return "Error-401";
$wakka=$this->gthis;
$tasknotification='';
$resultstr="";
$result=false;
$varid=$this->varid;
$message=$this->validatePostData();
if($message==""||$wakka->IsAdmin())
{
if($message!="")$tasknotification.="Please Check: $message<br>";
$this->updateArrayWithPostData();
//$res=$wakka->setPerson($varid,$this->recruitdata);
if($res<0)
{
......@@ -4221,20 +3694,14 @@ function validatePostData()
else
{
$result=true;
$wakka->cleanSystemTaskbyID($varid,$this->HRFiledsStr);
$tasksemp=$wakka->LoadAll("select name from hrms_tasks where empid='$varid' and status in ('NEW','WIP')");
foreach($tasksemp as $tline)$tasknotification.=$tline['name']."<br>";
if($tasknotification==''){$resultstr="<div class='alert alert-success'><strong>Record Updated!</strong><p>Record Data Updated Successfully, you may search and edit or continue to edit data.</p><div style='display:none' id='happy'><img src='/assets/images/emot/happy.jpg' height='80' width='80'></div><div style='display:none' id='sad'><img src='/assets/images/emot/sad.png' height='80' width='80'></div></div><script>clearFileVars();</script><script>simpleNotification('success','topRight','Saved Successfully');
</script>";}
else {$resultstr="<div class='alert alert-success'><strong>Data Saved with Task Escalation</strong><p>Tasks Created:- <br>$tasknotification</p></div><script>clearFileVars();</script><script>simpleNotification('success','topRight','Saved Successfully');</script>";
}
$resultstr.= $this->getProcess($this->recruitdata['peopledata'],$wakka);
//sanity check files and task
$recruitdata=$this->recruitdata;
$tmpstr=explode(",",$this->HRFileFieldsStr);
......@@ -4259,18 +3726,14 @@ function validatePostData()
}
$this->recruitdata=$recruitdata;
$res=$wakka->setPerson($varid,$this->recruitdata);
}
}
else
{
$resultstr="<div class='alert alert-danger'><strong>Record Add/Update Error!</strong><p>Please Check : $message</p></div><script>simpleNotification('error','topRight','Error in saving, Check Errors');</script>";
}
return $resultstr;
}
function buildUL($tooltip,$fpath,$text,$tdata="",$onclick="")
{
$data="<ul class='dash dash2' onclick='$onclick return false;'>
......@@ -4285,9 +3748,7 @@ return $data;
}
function getProcess(&$ppldata,&$gthis)
{
}
function getStageStatus(&$gthis,$stagestr,&$ppldata,$imgoverride="")
{
$completed=true;$tdata="";$titleD=array();
......@@ -4304,10 +3765,8 @@ function getStageStatus(&$gthis,$stagestr,&$ppldata,$imgoverride="")
}
}
$title[]="<br>";if(is_array($titleD))$title=array_merge($title,$titleD);
if($completed)$imgoverride="tick_48";
if(!$completed&&$imgoverride=="")$imgoverride="stop_48";
if($imgoverride!="stop_48"&&$tdata!="stop_48,err1")
{
//if last stage is done set system exit status
......@@ -4326,26 +3785,17 @@ function getStageStatus(&$gthis,$stagestr,&$ppldata,$imgoverride="")
if($ppldata["workflowstatus"]!=$wfstrs[1])$gthis->setPersonKey($ppldata["id"],"workflowstatus",$wfstrs[1]);
if($ppldata["workflowstatusS"]!=$imgoverride)$gthis->setPersonKey($ppldata["id"],"workflowstatusS",$imgoverride);
}
$wfstrs[1].="_ToDo";
}
if(!isset($ppldata['generalremarks']))$ppldata['generalremarks']='';
if($completed)return $this->buildUL(implode("<br>",$titleD),$this->themehome."/assets/icons/$imgoverride.png",$wfstrs[1],$tdata,"Rpopupopen(\"$ppldata[id]\",\"$stagestr\",\"$ppldata[generalremarks]\");");
else return $this->buildUL(implode("<br>",$title), $this->themehome."/assets/icons/$imgoverride.png",$wfstrs[1],$tdata,"Rpopupopen(\"$ppldata[id]\",\"$stagestr\",\"$ppldata[generalremarks]\");");
}
function empWorkflowTrigger($varid,$client,$key,$newval,$oldval,&$postvars,&$newdata)
{
}
function empAnalytics($varid,&$ppldata,$key,$newval,$oldval)
{
}
//Log::info($data);
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!