| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/b2bzend/application/views/scripts/customer/ |
Upload File : |
<script src="<?php echo $this->baseUrl('public/js/jquery.validate.min.js'); ?>"></script>
<?php $customHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom'); ?>
<section id="main-container">
<!--Left navigation section end-->
<!--Page main section start-->
<section id="min-wrapper" class="active">
<div id="main-content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<!--Top header start-->
<h3 class="ls-top-header">CRM</h3>
<!--Top header end -->
<!--Top breadcrumb start -->
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-home"></i></a></li>
<li class="active">Leads</li><li class="active"><a href="<?php echo $this->baseUrl('/customer/listgtxcustomer'); ?>">My Leads</a></li>
</ol>
<!--Top breadcrumb start -->
</div>
</div>
<!-- Main Content Element Start-->
<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title" onclick="$('.minus').trigger('click')"><i class="fa fa-filter"></i> Filter By</h3>
<ul class="panel-control">
<?php $filterDisplay="none";
if(!empty($this->searchData['lead_source']) or !empty($this->searchData['lead_stage']) or !empty($this->searchData['customername'])){
$filterDisplay="block";
?>
<li><a class="minus" href="javascript:void(0)"><i class="fa fa-angle-up large"></i></a></li>
<?php } else { ?>
<li><a class="minus active" href="javascript:void(0)"><i class="fa fa-angle-down large"></i></a></li>
<?php } ?>
</ul>
</div>
<div class="panel-body" style="display:<?php echo $filterDisplay; ?>;">
<form method="post" class="ls_form" role="form" id="customerFilterForm">
<div class="col-md-4">
<div class="form-group">
<label>Source </label>
<select id="leadsource" name="lead_source" class="form-control whbg filterdata" placeholder="Select">
<option value="">Select Source</option>
<?php
if(!empty($this->leadSourceList) ){
foreach($this->leadSourceList as $result){
?>
<option value="<?php echo trim($result['LeadSourceSysId']); ?>" <?php if($this->searchData['lead_source'] == $result['LeadSourceSysId']){ echo "selected"; } ?>><?php echo trim(stripslashes($result['Title'])); ?></option>
<?php } } ?>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Stage</label>
<select id="leadstage" name="lead_stage" class="form-control whbg filterdata" placeholder="Select">
<option value="">Select Stage</option>
<?php if(!empty($this->leadStageList) ){
foreach($this->leadStageList as $key=>$val){
?>
<option value="<?php echo stripslashes($val['TPStatusSysId']);?>" <?php if($this->searchData['lead_stage'] == $val['TPStatusSysId']){ echo "selected"; } ?>><?php echo stripslashes($val['TPStatus']);?></option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Customer Name/Mobile</label>
<input class="form-control whbg filterdata" type="text" name="customername" value="<?php echo $this->searchData['customername']; ?>"/>
</div>
</div>
<div class="col-md-12"><span class="errorTxt"></span></div>
<div class="col-md-12" align="right">
<div class="form-group form-group1 flexipadding">
<button onclick="window.location.href='<?php echo $this->baseUrl('/customer/listgtxcustomer'); ?>'" class="btn btn-danger" type="button">Reset</button>
<button class="btn btn-primary" type="submit"><i class="fa fa-search"></i> Filter</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<div class="btn-group" style="margin-right:10px;">
<select id="agencyUser" name="agencyUser" class="demo-default select-country" placeholder="Select" style="width:150px;">
<option value="">Select Users</option>
<?php if(!empty($this->agencyUser) ){
foreach($this->agencyUser as $u=>$l){
/*if($this->getRoleDetail['IsAdmin']==true && $this->getRoleDetail['AgencySysId']==$l['AgencySysId'] && $this->getRoleDetail['RoleSysId']==$l['UserRole']){
$getData['AgencySysId']=$l['AgencySysId'];
} else{*/
$getData['UserSysId']=$l['UserSysId'];
//}
$res=$customHelper->GetAgencyLeadUnAssignedToAgent($getData);
//echo "<pre>";print_r($res);die;
?>
<option value="<?php echo base64_encode($l['UserSysId']);?>"><?php echo (isset($l['FullName']) && !empty($l['FullName']))?stripslashes($l['FullName']):$l['EmailId']; ?>(<?php echo count($res); ?>)</option>
<?php }
} ?>
</select>
</div>
<button class="btn btn-warning btn-group-xs" onclick="return assignUsers();"><i class="fa fa-fw fa-arrows"></i> Assign</button>
<span class="btn-group assignMsg" style="text-align:right;color:#449D44;margin-right:3px;"></span>
</div>
<div class="col-md-4">
<span>Total UnAssigned Leads : <span class="badge badge-red recordCountDisplay"><?php echo (!empty($this->paginator) )?$this->paginator->getTotalItemCount():0; ?></span><input type="hidden" name="totalRecords" id="totalRecords" value="<?php echo (!empty($this->paginator) )?$this->paginator->getTotalItemCount():0; ?>" /></span>
</div>
<div class="col-md-4">
<div class="pull-right">
<?php if($this->getRoleDetail['IsAdmin']==true){ ?>
<button class="btn btn-danger btn-sm" onclick="window.location.href='<?php echo $this->baseUrl('/customer/listgtxassignedcustomer'); ?>'">Go To Assigned Leads</button>
<?php } ?>
<button class="btn btn-warning btn-sm" data-target="#myModa1addcustomer" data-toggle="modal" onclick="$('#clickedFromNewQuery').val(1);$('#IsCreateNewGtxQuery').val(1);"><i class="fa fa-fw fa-arrows"></i> Create New Lead</button>
</div>
</div>
<div class="clear"></div>
</div>
<div class="col-md-12">
<div class="panel-body no-padding">
<div class="table-responsivenew">
<table class="table table-bordered no-margin">
<thead>
<tr class="alert alert-graylight">
<th class="small" style="vertical-align:top;">#</th>
<th class="small" style="vertical-align:top;">Name </th>
<th class="small" style="vertical-align:top;">Email </th>
<th class="small" style="vertical-align:top;">Mobile </th>
<th class="small" style="vertical-align:top;">Date/Age of Lead</th>
<th class="small" style="vertical-align:top;">Source</th>
<th class="small" style="vertical-align:top;">Owner</th>
<th class="small" style="vertical-align:top;">Stage </th>
<th class="small" style="vertical-align:top;">Action</th>
</tr>
</thead>
<tbody>
<?php if (!empty($this->paginator) ):
$s=1;
$objagencyCustomer = new Travel_Model_CRM_AgencyLeadAccount();
//echo "<pre>";print_r($this->leadStageList);
foreach ($this->paginator as $customerDetail){ //echo '<pre>'; print_r($roles); die;
$agencyCustomerexist = $objagencyCustomer->GetAgencyCustomerByLeadId($customerDetail['AgencyCRMLeadSysId']);
$fromDate=$customerDetail['ActiveDate']->format('Y-m-d');
$toDate=date('Y-m-d',time());
$differenceIndays=Zend_Controller_Action_HelperBroker::getStaticHelper('DateFormat')->calculateNoOfDays($fromDate, $toDate);
$ownerName=(isset($customerDetail['AgencyUserFirstName']) && !empty($customerDetail['AgencyUserFirstName']))?stripslashes($customerDetail['AgencyUserFirstName'])." ".stripslashes($customerDetail['AgencyUserLastName']):'Admin';
?>
<tr id="row_<?php echo $customerDetail['AgencyCRMLeadSysId']; ?>">
<td class="small">
<label class="checkbox inlinebl no-margin">
<input class="icheck-red" type="checkbox" name="usersDetail[]" pid="<?php echo $customerDetail['AgencyCRMLeadSysId']; ?>" id="checkRed<?php echo $customerDetail['AgencyCRMLeadSysId']; ?>" value="<?php echo base64_encode($customerDetail['AgencyCRMLeadSysId']); ?>">
</label>
</td>
<td class="small"><?php echo (isset($customerDetail['FullName']) && !empty(trim($customerDetail['FullName'])))?ucfirst($customerDetail['FullName']):'NA';?><br/>(<?php if(!empty($agencyCustomerexist) ){ echo "Existing"."(".$ownerName.")"; } else { echo "New Lead"; } ?>)</td>
<td class="small"><?php echo (isset($customerDetail['EmailId']) && !empty(trim($customerDetail['EmailId'])))?$customerDetail['EmailId']:'NA';?></td>
<td class="small"><?php echo (isset($customerDetail['PrimaryContactNumber']) && !empty(trim($customerDetail['PrimaryContactNumber'])))?$customerDetail['PrimaryContactNumber']:'NA';?></td>
<td class="small"><?php echo $customerDetail['ActiveDate']?$customerDetail['ActiveDate']->format('d/m/Y')." - ".$differenceIndays." Days":'NA';?></td>
<td class="small" id="leadtitle_<?php echo $customerDetail['AgencyCRMLeadSysId']; ?>"><?php echo (isset($customerDetail['LeadSource']) && !empty($customerDetail['LeadSource']))?$customerDetail['LeadSource']:'NA';?></td>
<td class="small" id="leadowner_<?php echo $customerDetail['AgencyCRMLeadSysId']; ?>"><?php echo $ownerName;?></td>
<td class="small">
<div class="form-group" style="width:250px;">
<select id="select-country" class="demo-default select-country" placeholder="Select" onchange="updateLeadStage(<?php echo $customerDetail['AgencyCRMLeadSysId']; ?>,'<?php echo base64_encode($customerDetail['AgencyCRMLeadSysId']); ?>',this.value);">
<option value="">Select Stage</option>
<?php if(!empty($this->leadStageList) ){
foreach($this->leadStageList as $key=>$val){
?>
<option value="<?php echo stripslashes($val['TPStatusSysId']);?>" <?php if($val['TPStatusSysId']==$customerDetail['LeadStageSysId']){ echo "selected='true'"; } ?>><?php echo stripslashes($val['TPStatus']);?></option>
<?php
}
}
?>
</select>
<span class="archieveLink_<?php echo $customerDetail['AgencyCRMLeadSysId']; ?>" style="display:none"><a class="text-danger" style="cursor:pointer;" onclick="return archieveLead('<?php echo base64_encode($customerDetail['AgencyCRMLeadSysId']); ?>','<?php echo base64_encode(trim($customerDetail['EmailId'])); ?>','<?php echo trim($customerDetail['AgencyCRMLeadSysId']); ?>');">Archieve</a></span>
<span class="col-md-12 callbackTitle_<?php echo $customerDetail['AgencyCRMLeadSysId']; ?>" style="display:none">
<span class="col-md-12">
<input type="text" name="callbackFrom" id="callbackFrom_<?php echo $customerDetail['AgencyCRMLeadSysId']; ?>" class="form-control callbackFrom" placeholder="From" />
</span>
<span class="col-md-12">
<input onkeyup="return kp_numeric(event);" type="text" name="callbackreminder" id="callbackreminder_<?php echo $customerDetail['AgencyCRMLeadSysId']; ?>" class="form-control callbackreminder" placeholder="Reminder(In Minutes)" />
</span>
<span class="col-md-12">
<button type="button" class="btn btn-sm btn-warning calbackButton" onclick="updateCallBackLeadStage(<?php echo $customerDetail['AgencyCRMLeadSysId']; ?>,'<?php echo base64_encode($customerDetail['AgencyCRMLeadSysId']); ?>');" placeholder="To">Save</button>
</span>
</span>
<span style="color:#3071A9;" id="stagesuccess_<?php echo $customerDetail['AgencyCRMLeadSysId']; ?>"></span>
</div>
</td>
<td class="small" style="white-space:nowrap;">
<a href="javascript:void(0)" onclick="redirectGtxCustomer(<?php echo $customerDetail['AgencyCRMLeadSysId']; ?>,'<?php echo $this->baseUrl('/customer/gtxcustomer-update/id/'.base64_encode($customerDetail['AgencyCRMLeadSysId'])); ?>')" data-placement="top" title="Convert" class="tooltipLink fa fa-check-square-o btn btn-success btn-xs"> </a> <a href="javascript:void(0);" data-placement="top" title="Archive" class="tooltipLink fa fa-trash-o btn btn-primary btn-xs gtxarchieve_<?php echo trim($customerDetail['AgencyCRMLeadSysId']); ?>" onclick="return archieveLead('<?php echo base64_encode($customerDetail['AgencyCRMLeadSysId']); ?>','<?php echo base64_encode(trim($customerDetail['EmailId'])); ?>','<?php echo trim($customerDetail['AgencyCRMLeadSysId']); ?>');"></a>
<?php if((isset($customerDetail['EmailId']) && !empty(trim($customerDetail['EmailId'])))){ ?>
<a href="javascript:void(0);" onclick="return sendLeadEmail('<?php echo base64_encode($customerDetail['AgencyCRMLeadSysId']); ?>','<?php echo base64_encode(trim($customerDetail['EmailId'])); ?>','<?php echo trim($customerDetail['AgencyCRMLeadSysId']); ?>');" data-placement="top" title="Send Email" class="tooltipLink fa fa-envelope btn btn-danger btn-xs gtxsendemail"><span class="gtxsendemailtxt_<?php echo trim($customerDetail['AgencyCRMLeadSysId']); ?>"></span></a>
<?php } ?>
<!--<a href="javascript:void(0);" data-placement="top" title="Allocate" class="tooltipLink fa fa-archive btn btn-danger btn-xs"></a>-->
</td>
</tr>
<?php $s++; }
else:?>
<tr>
<td class="small" align="center" colspan="9"><strong>No record found</strong></td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<div class="panel-box clearfix">
<?php if (!empty($this->paginator) ) { ?>
<?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- Main Content Element End-->
</div>
</div>
<?php echo $this->render('copyrightfooter.phtml');
echo $this->render('newfooter.phtml');
echo $this->render("customer/customer-gtx-partial.phtml"); ?>
<style>
label.success {
position: relative;
top: -25px;
right: 10px;
float: right;
width: 16px;
height: 16px;
display: inline-block;
color:#449D44;
}
.error { bottom:-15px; }
</style>
<script>
$('#myModa1addcustomer').on('hidden.bs.modal', function () {
location.reload();
})
$(".callbackFrom").datetimepicker({
format:'d/m/Y H:i:00',
/*timepicker: false,
onShow:function(ct){
this.setOptions({
minDate:($('.callbackTo').val()!='')?$('.callbackTo').val():false,
});
}*/
});
$(".callbackTo").datetimepicker({
// minDate:'0d'
format:'d/m/Y',
formatDate:'d/m/Y',
timepicker: false,
onShow:function(ct){
this.setOptions({
minDate:($('.callbackFrom').val()!='')?$('.callbackFrom').val():false,
});
}
});
function sendLeadEmail(id,emailid,decodeid){
if(confirm('Are your sure, you want to send welcome emailer to customer?')){
$.ajax({
url: "/customer/send-email-gtx-user",
type: "POST",
dataType: 'json',
data: {'cid':id,'emailid':emailid},
beforeSend:function(){
$(".gtxsendemailtxt_"+decodeid).html('Please wait...');
},
success: function(data){
if(data.status=='success'){
$(".gtxsendemailtxt_"+decodeid).html('Mail Sent');
$(".gtxsendemailtxt_"+decodeid).fadeOut(4000,function(){
$(".gtxsendemailtxt_"+decodeid).html('');
});
}
return false;
},
error:function(){
$(".gtxsendemailtxt_"+decodeid).html("Some error.");
$(".gtxsendemailtxt_"+decodeid).fadeOut(4000,function(){
$(".gtxsendemailtxt_"+decodeid).data('');
});
}
});
} else {
return false;
}
}
function archieveLead(id,emailid,decodeid){
if(confirm('Are your sure, you want to delete this lead?')){
$.ajax({
url: "/customer/gtxcustomer-archieve",
type: "POST",
dataType: 'json',
data: {'cid':id},
beforeSend:function(){
$(".gtxarchieve_"+decodeid).attr('disabled',true);
$(".gtxarchieve_"+decodeid).html('Please wait...');
},
success: function(data){
if(data.status=='success'){
$("#row_"+decodeid).fadeOut(1000);
}
return false;
},
error:function(){
$(".gtxarchieve_"+decodeid).html("Some error.");
$(".gtxarchieve_"+decodeid).fadeOut(4000,function(){
$(".gtxarchieve_"+decodeid).data('');
});
}
});
} else {
return false;
}
}
function assignUsers(e){
var atLeastOneIsChecked = $('input[name="usersDetail[]"]:checked').length;
var userDetail=$.trim($("#agencyUser").val());
if(userDetail==''){
alert('Please select at least one User to assign.');
return false;
}
if(atLeastOneIsChecked==0){
alert('Please select at least one Lead to assign.');
return false;
}
var myArray = [];
var selectedIdsArray=[];
$('input[name="usersDetail[]"]:checked').each(function() {
myArray.push(this.value);
selectedIdsArray.push("#leadowner_"+$(this).attr('pid'));
});
var totalRecord=$("#totalRecords").val();
var selcetedData=selectedIdsArray.join(",");
$.ajax({
url: "/customer/assign-agency-user",
type: "POST",
dataType: 'json',
data: {'data':myArray,'aid':userDetail},
beforeSend:function(){
$(".assignMsg").html('Please wait...');
},
success: function(data){
if(data.status=='success'){
var $select = $("#agencyUser").selectize();
var selectize = $select[0].selectize;
var selectedUser = selectize.getValue();
var userhtmlname=selectize.getItem(selectize.getValue())[0].innerHTML;
$(selcetedData).html(userhtmlname);
$(".assignMsg").html('Record Updated');
$(".assignMsg").fadeOut(4000);
var y=0;
$('input[name="usersDetail[]"]:checked').each(function() {
$("#row_"+$(this).attr('pid')).hide();
y++;
});
$("#totalRecords").val(parseInt(totalRecord)-parseInt(y));
$(".recordCountDisplay").html(parseInt(totalRecord)-parseInt(y));
}
return false;
},
error:function(){
$(".assignMsg").html("Some error occured.Please try after some time.");
$(".assignMsg").fadeOut(4000);
}
});
}
function redirectGtxCustomer(id,url){
$("#row_"+id).fadeOut(3000);
window.open(url,'_blank');
}
function updateCallBackLeadStage(customerId,encodecustomerId){
var callbackFrom=$.trim($("#callbackFrom_"+customerId).val());
var callbackreminder=$.trim($("#callbackreminder_"+customerId).val());
if(callbackFrom == ''){
alert('Please select from date.');
$("#callbackFrom_"+customerId).focus();
return false;
}
$.ajax({
url: "/customer/gtxcustomer-stage-update-callback",
type: "POST",
dataType: 'json',
data: {'cid':encodecustomerId,'sid':52,'callbackFrom':callbackFrom,'callbackreminder':callbackreminder},
beforeSend:function(){
$(".calbackButton").attr('disabled',true);
$("#stagesuccess_"+customerId).html('Please wait...');
},
success: function(data){
if(data.status=='success'){
$(".calbackButton").removeAttr('disabled');
$("#stagesuccess_"+customerId).html('Record updated');
//$("#leadtitle_"+customerId).html(data.title);
}else{
$("#stagesuccess_"+customerId).html('Some error occured');
}
},
error:function(){
$("#stagesuccess_"+customerId).html('Some error occured');
}
});
}
function updateLeadStage(customerId,encodecustomerId,encodestageId){
if(encodestageId==52){
$(".callbackTitle_"+customerId).show();
return false;
}
if(encodestageId==50){
redirectGtxCustomer(customerId,'/customer/gtxcustomer-update/id/'+encodecustomerId);
return false;
}
$("#stagesuccess_"+customerId).html('Please wait...');
$.ajax({
url: "/customer/gtxcustomer-stage-update",
type: "POST",
dataType: 'json',
data: {'cid':encodecustomerId,'sid':encodestageId},
beforeSend:function(){
$("#stagesuccess_"+customerId).html('Please wait...');
},
success: function(data){
if(data.status=='success'){
$("#stagesuccess_"+customerId).html('Record updated');
if(encodestageId==48){
$(".archieveLink_"+customerId).show();
return false;
}
//$("#leadtitle_"+customerId).html(data.title);
}else{
$("#stagesuccess_"+customerId).html('Some error occured');
}
},
error:function(){
$("#stagesuccess_"+customerId).html('Some error occured');
}
});
}
//added validation for filter
jQuery.validator.addMethod("require_from_group", function(value, element, options) {
var numberRequired = options[0];
var selector = options[1];
//Look for our selector within the parent form
var validOrNot = $(selector, element.form).filter(function() {
// Each field is kept if it has a value
return $(this).val();
// Set to true if there are enough, else to false
}).length >= numberRequired;
if(!$(element).data('being_validated')) {
var fields = $(selector, element.form);
fields.data('being_validated', true);
// .valid() means "validate using all applicable rules" (which
// includes this one)
fields.valid();
fields.data('being_validated', false);
}
return validOrNot;
// {0} below is the 0th item in the options field
}, jQuery.format("Please fill out at least {0} of these fields."));
$("#customerFilterForm").validate({
highlight: function (error, element) {
var name = $(element).attr("name");
},
success: function (element) {
element.addClass('success').closest('.control-group').removeClass('error').addClass('success');
},
rules: {
"lead_source": {
require_from_group: [1, ".filterdata"]
},
"lead_stage": {
require_from_group: [1, ".filterdata"]
},
"customername": {
require_from_group: [1, ".filterdata"]
}
},
messages: {
"lead_stage":'',
"customername":'Please fill out at least 1 of these fields.',
"lead_source":'',
},
errorLabelContainer: '.errorTxt',
});
</script>
<style>
label.success {
position: relative;
top: -25px;
right: 10px;
float: right;
width: 16px;
height: 16px;
display: inline-block;
color:#449D44;
}
</style>