403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2bzend/application/views/scripts/customer/query-old.phtml
<?php
$LeadListArr = $this->paginator;
$customHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom');
$travelPlanStatusName = $customHelper->GetTravelPlanStatusArray(1, '');
$travelPlanStatusNameForLead = $customHelper->GetTravelPlanStatusArray('3', '');
//$AlltravelPlanStatusName = array_merge($travelPlanStatusName, $travelPlanStatusNameForLead);

$LEAD = "";
$QUERY = "";
if ((isset($this->searchData['leadType_LEAD']) && $this->searchData['leadType_LEAD'] == 'LEAD')) {
    $LEAD = "checked";
} else if ((isset($this->searchData['leadType_LEAD']) && $this->searchData['leadType_LEAD'] == 'QUERY')) {
    $QUERY = "checked";
} else {
    $QUERY = "checked";
}
$TabTypeActive = isset($this->searchData['TabTypeActive'])?$this->searchData['TabTypeActive']:'0';
$date = strtotime(date("Y-m-d", strtotime("-1 month")));
$befor30days = date('d-m-Y',$date);

$customhelper = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom');
$AllLeadStatus=$customhelper->GetTravelPlanStatus(1,'');
$AllLeadQualityStatus=array(array('Id'=>1,'Title'=>'Hot'),array('Id'=>2,'Title'=>'Warm'),array('Id'=>3,'Title'=>'Cold'));
$AllLeadQualityStatusName=array(1=>'hot',2=>'warm',3=>'cold');
//print_r($this->searchData);die;
?>
<!--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">Lead Listing</h3>
                    <!--Top header end -->

                    <!--Top breadcrumb start -->
                    <ol class="breadcrumb">
                        <li><a href="#"><i class="fa fa-home"></i></a></li>
                        <li class="active">CRM</li><li class="active">
                        <?php if ((isset($this->searchData['leadType_LEAD']) && $this->searchData['leadType_LEAD'] == 'LEAD')){ echo "Lead"; } else { echo "Query"; } ?> Listing</li>
                    </ol>
                    <!--Top breadcrumb start -->
                </div>
            </div>
            <!-- Main Content Element  Start-->
            <div class="row"><?php 
						$display=1;
						if(isset($this->searchData['lead_stage']) && $this->searchData['lead_stage'] == 'UnAssigned') {
                                                    $display=0;
                                                } else {
						if(@$this->searchData['lead_stage']!=''){
							$lead_stage=@explode(",",$this->searchData['lead_stage']);
							if(count($lead_stage)>1){
								$display=0;
							}
						}
                                                }
						//echo $display;
						?>
                <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">
                                <li><a class="minus <?php if (count($this->filterFormDisplay) == 0 || $display==0): ?>active <?php endif; ?>" href="javascript:void(0)"><i class="fa <?php if (!empty($this->filterFormDisplay) ): ?>fa-angle-up large <?php else: ?> fa-angle-down large<?php endif; ?>"></i></a></li>
                            </ul>
                        </div>
                        
                        <div class="panel-body" style="display:<?php if (count($this->filterFormDisplay) == 0 || $display==0): ?>none <?php else: echo "block";endif; ?>;">
                            <form class="ls_form" role="form" action="" method="post" autocomplete="off" id="leadQueryFilterForm" name="leadQueryFilterForm1">

								<div class="col-md-3">
                                    <div class="form-group">
                                        <label>Type</label>
                                        <select id="lead_type" name="lead_type" class="demo-default select-country" placeholder="lead type">
                                            <option value="">Select Lead Stage</option>	
                                            
                                                <option value="0" <?php if (isset($this->searchData['lead_type']) && $this->searchData['lead_type'] == '0') { echo "selected"; } ?>>B2C</option>
                                                <option value="1" <?php if (isset($this->searchData['lead_type']) && $this->searchData['lead_type'] == '1') { echo "selected"; } ?>>B2B</option>
											
                                        </select>
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label>Lead Stage</label>
                                        <?php if ((isset($this->searchData['leadType_LEAD']) && $this->searchData['leadType_LEAD'] == 'LEAD')){ 
											$seperatedLead=array(47,50);
											?>
                                        <select id="lead_stage" name="lead_stage" class="demo-default select-country" placeholder="lead Stage">
                                            <option value="">Select Lead Stage</option>	
                                            <?php foreach ($travelPlanStatusNameForLead as $key => $value) { 
												if(!in_array($value['TPStatusSysId'],$seperatedLead)){ ?>
                                                <option value="<?php echo trim($value['TPStatusSysId']); ?>" <?php if (isset($this->searchData['lead_stage']) && $this->searchData['lead_stage'] == trim($value['TPStatusSysId'])) {
                                                echo "selected";
                                            } ?>><?php echo stripslashes(trim($value['TPStatus'])); ?></option>
												<?php 
												}
												} ?>
                                        </select>
                                        <?php } else{ ?>
                                        <select id="lead_stage" name="lead_stage" class="demo-default select-country" placeholder="lead Stage">
                                            <option value="">Select Lead Stage</option>	
                                            <?php foreach ($travelPlanStatusName as $key => $value) { ?>
                                                <option value="<?php echo trim($value['TPStatusSysId']); ?>" <?php if (isset($this->searchData['lead_stage']) && $this->searchData['lead_stage'] == trim($value['TPStatusSysId'])) {
                                                echo "selected";
                                            } ?>><?php echo stripslashes(trim($value['TPStatus'])); ?></option>
											<?php } ?>
                                        </select>
                                        <?php } ?>
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label>Customer Name</label>
                                        <input class="form-control whbg" type="text" id="customername2" name="customername" value="<?php echo isset($this->searchData['customername']) ? $this->searchData['customername'] : ''; ?>"/>
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group dropdown">
                                        <label>Company Name</label>
                                          <input type="text" class="form-control whbg filterdata" name="agencyName" value="<?php echo @$this->searchData['agencyName']; ?>">                                      
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label>Customer Mobile</label>
                                        <input class="form-control whbg" type="text" id="customermobile" name="customermobile" value="<?php echo isset($this->searchData['customermobile']) ? $this->searchData['customermobile'] : ''; ?>"/>
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label>Customer Email</label>
                                        <input class="form-control whbg" type="text" id="customeremail" name="customeremail" value="<?php echo isset($this->searchData['customeremail']) ? $this->searchData['customeremail'] : ''; ?>"/>
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label>Source/Destination</label>
<?php echo $this->partial('customer/typeaheadcitysearchdetail.phtml', array('cityDisable' => false, 'countryFieldName' => '', 'validationCityFiledName' => 'Destination', 'textFieldName' => 'CityName', 'textFieldSelectedValue' => @$this->searchData['CityName'], 'cityId' => @$this->searchData['Destination'])); ?> 

                                    </div>
                                </div>
                                <?php //if($this->getRoleDetail['IsAdmin']==true){ ?>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label style="display:none;"><input onclick="$('#assignFilterDisplay').show();" type="radio" name="assigUnassignFilter" id="assignedFilter" value="1" <?php if (@$this->searchData['assigUnassignFilter'] == 1) {
    echo "checked";
} ?> /> Assigned
                                        </label>
                                        <label>Assigned to </label>
                                        <div id="assignFilterDisplay">
                                            <select id="agencyUserFilter" name="agencyUserFilter" class="demo-default select-country" placeholder="Select" onchange='$("#assignedFilter").trigger("click");'>
                                                <option value="">Select Owner</option>
                                                <?php
                                                if (!empty($this->agencyUser) ) {
                                                    foreach ($this->agencyUser as $u => $l) {
                                                        ?>
                                                        <option value="<?php echo trim($l['UserSysId']); ?>" <?php if ($l['UserSysId'] == @$this->searchData['agencyUserFilter']) {
                                                            echo "selected";
                                                        } ?>><?php echo (isset($l['FullName']) && !empty($l['FullName'])) ? stripslashes($l['FullName']) : $l['EmailId']; ?></option>
    <?php }
}
?>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <?php //} ?>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label>Query Id</label>
                                        <input class="form-control whbg" type="text" id="customerQueryId" name="customerQueryId" value="<?php echo $this->searchData['customerQueryId']; ?>"/>
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label><strong>From</strong></label>
                                        <div class="input-group ls-group-input">
                                            <input name="dateFrom" class="form-control datePickerOnly valid" id="LeadQueryFrom" placeholder="yyyy-mm-dd" value="<?php echo isset($this->searchData['dateFrom']) ? $this->searchData['dateFrom'] : ''; ?>" type="text"/>
                                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label><strong>To</strong></label>
                                        <div class="input-group ls-group-input">
                                            <input name="dateTo" class="form-control datePickerOnly valid" id="LeadQueryTo" placeholder="yyyy-mm-dd" value="<?php echo isset($this->searchData['dateTo']) ? $this->searchData['dateTo'] : ''; ?>" type="text"/>
                                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-3" style="display:none;">
                                    <div class="form-group">
                                        <label>&nbsp;</label>
                                        <div class="form">
                                            <label><input type="checkbox" name="assigUnassignFilter" id="unassignedFilter" value="2" <?php if (@$this->searchData['assigUnassignFilter'] == 2) {
    echo "checked";
} ?> /> Un-Assigned
                                            </label>
                                        </div>
                                    </div>
                                </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/query'); ?>'" class="btn btn-primarygray btn-sm" type="button">Reset</button>
                                        <button class="btn btn-primary  btn-sm" type="submit" id="filterbutton"><i class="fa fa-search"></i> Filter</button>
                                        <input type="hidden" name="page" id="page" value="1" />
                                        <input type="hidden" id="order_details" name="order" value="<?php echo $this->getData['order']; ?>" />
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>



                <div class="col-md-12"> 
                   
                    <div class="col-md-4">  
                     <?php if(($this->getRoleDetail['IsAdmin']==true) || $this->getRoleDetail['IsAbleToManageMember']==true){ ?>     
                        <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);
										//$res = $customHelper->GetAgencyQueryAssignedToAgent($l['AgencySysId'],$l['UserSysId']);
                                        //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']; ?></option>
    <?php }
}
?>
                            </select>      
                        </div>
                        <button class="btn btn-primarygray btn-sm" style="margin-bottom:4px;" onclick="return assignUsers();"> <i class="fa fa-list" aria-hidden="true"></i> Assign</button>
                         <?php } ?>
                        <span class="btn-group assignMsg" style="text-align:right;color:#449D44;margin-right:3px;"></span>
                        <?php if($this->getRoleDetail['IsAdmin']==true){ ?>
                        <button class="btn btn-danger btn-sm pleaseWaitArchieve" style="margin-bottom:4px;" onclick="return archieveLeads();"> <i class="fa fa-file-archive-o" aria-hidden="true"></i> Archive</button>
                        <?php } ?>
                    </div>
                   
                    
                    <div class="col-md-8">
                        <div class="pull-right">
                            <a class="btn btn-primarygray btn-sm" href="<?php echo $this->baseUrl('/customer/query'); ?>">Refresh</a>
                            <a class="btn btn-danger btn-sm" data-target="#myModa1addcustomer" onclick="$('#clickedFromNewQuery').val(1);" data-toggle="modal"><i class="fa fa-braille" aria-hidden="true"></i>Add B2C Customer</a>
                            <a class="btn btn-danger btn-sm" data-target="#myModa1addB2bAgent" data-toggle="modal"><i class="fa fa-braille" aria-hidden="true"></i>Add B2B Customer</a>
                            
                            <!--<a href="<?php echo $this->baseUrl('/customer/export-excel-leag-query/dateFrom/'); ?><?php echo isset($this->searchData['dateFrom']) ? $this->searchData['dateFrom'] : $befor30days; ?>/dateTo/<?php echo isset($this->searchData['dateTo']) ? $this->searchData['dateTo'] : date("d-m-Y", strtotime("+1 day")); ?><?=isset($this->searchData['leadType_LEAD'])?'/type/'.$this->searchData['leadType_LEAD']:''?><?=isset($this->searchData['customername'])?'/customername/'.$this->searchData['customername']:''?><?=isset($this->searchData['customermobile'])?'/customermobile/'.$this->searchData['customermobile']:''?>" title="Export To Excel"><img style="width:28px;" src="<?php echo $this->baseUrl('public/images/excel.png'); ?>"></a>-->
                            <a href="javascript:void(0);" onclick="ExportExcelForm();" title="Export To Excel"><img style="width:28px;" src="<?php echo $this->baseUrl('public/images/excel.png'); ?>"></a>
                       		 <form target="_blank" class="ls_form ExportExcelForm" role="form" action="<?php echo $this->baseUrl('/customer/export-excel-leag-query'); ?>" method="get" autocomplete="off">
                                <input type="hidden" name="dateFrom" value="<?php echo isset($this->searchData['dateFrom']) ? $this->searchData['dateFrom'] : $befor30days; ?>">
                                <input type="hidden" name="dateTo" value="<?php echo isset($this->searchData['dateTo']) ? $this->searchData['dateTo'] : date("d-m-Y", strtotime("+1 day")); ?>">
                                <input type="hidden" name="type" value="<?=isset($this->searchData['leadType_LEAD'])?$this->searchData['leadType_LEAD']:''?>">
                                <input type="hidden" name="customername" value="<?=isset($this->searchData['customername'])?$this->searchData['customername']:''?>">
                                <input type="hidden" name="customermobile" value="<?=isset($this->searchData['customermobile'])?$this->searchData['customermobile']:''?>">
                                <input type="hidden" name="customeremail" value="<?=isset($this->searchData['customeremail'])?$this->searchData['customeremail']:''?>">
                                <input type="hidden" name="Destination" value="<?=isset($this->searchData['Destination'])?$this->searchData['Destination']:''?>">
                                <input type="hidden" name="lead_stage" value="<?=isset($this->searchData['lead_stage'])?$this->searchData['lead_stage']:''?>">
                            </form>
                            </div>
                    </div>
                    <div class="clear"></div>
                    <div class="col-md-6" style="margin-bottom:5px;">
                        <div class="">                            
                            <form class="ls_form FormSubmit" role="form" action="<?php echo $this->baseUrl('/customer/query'); ?>" method="post" autocomplete="off" id="leadQueryFilterForm" name="leadQueryFilterForm2">
                            <input type="hidden" disabled="disabled" name="lead_stage" class="Progress" value="1,2,58,36,20"> <!--In Progress-->
                            <input type="hidden" disabled="disabled" name="lead_stage" class="Booked" value="29,21,22,23,3,24,38,37,34,35"> <!--Booked-->
                            <input type="hidden" disabled="disabled" name="lead_stage" class="Rejected" value="25,28,30,31,32,33"> <!--Rejected-->
                             
                            <input type="hidden" disabled="disabled" name="lead_stage" class="UnAssigned" value="UnAssigned"> <!--Rejected-->
                          
                            <input type="hidden" name="TabTypeActive" class="TabTypeActive" value="0">
                            <a href="<?php echo $this->baseUrl('/customer/query'); ?>" class="btn <?php if($this->getData['lead_stage_name']==''){ echo "btn-warning"; } else{ echo "btn-danger"; } ?> btn-sm">Overall Queries</a>
                            <a class="btn <?php if($this->getData['lead_stage_name']=='inprogress'){ echo "btn-warning"; } else{ echo "btn-danger"; } ?> btn-sm" href="<?php echo $this->baseUrl('/customer/query/filter/inprogress'); ?>"> <i class="fa fa-search"></i> In Progress</a>
                            <a class="btn <?php if($this->getData['lead_stage_name']=='confirmed'){ echo "btn-warning"; } else{ echo "btn-danger"; } ?> btn-sm" href="<?php echo $this->baseUrl('/customer/query/filter/confirmed'); ?>"> <i class="fa fa-search"></i> Confirmed Proposals</a>
                            <a class="btn <?php if($this->getData['lead_stage_name']=='rejected'){ echo "btn-warning"; } else{ echo "btn-danger"; } ?> btn-sm" href="<?php echo $this->baseUrl('/customer/query/filter/rejected'); ?>"> <i class="fa fa-search"></i> Rejected</a>
                            <?php if(@$_SESSION['sessionLogin_user']['UserRoleTitle'] == ROLE_DESC_OWNER){ ?>
                            <a class="btn <?php if($this->getData['lead_stage_name']=='unassigned'){ echo "btn-warning"; } else{ echo "btn-danger"; } ?> btn-sm" href="<?php echo $this->baseUrl('/customer/query/filter/unassigned'); ?>"> Un Assigned</a>
                               <?php } ?>
                            </form>
                        </div>
                    </div>
                    <div class="col-md-6" style="margin-bottom:5px;">
                        <?php 
                        
                        if($TabTypeActive == '1'){
                            echo '<span>Showing In Progress Leads</span>';
                        }elseif($TabTypeActive == '2'){
                            echo '<span>Showing Booked Leads</span>';
                        }elseif($TabTypeActive == '3'){
                            echo '<span>Showing Rejected Leads</span>';
                        }else{ }
						
						$filterLink='';
						if($this->getData['lead_stage_name']!=''){
							$filterLink='/filter/'.$this->getData['lead_stage_name'];
						}
                        ?>
                        
                    </div>
                    

                    <div class="clear"></div>
                </div>
                <div class="col-md-12">
                    <div class="panel-body table-responsivenew leadeBorder" >
                        <div class="table-responsive">
                            <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;">
                                            <?php if (isset($this->getData['order']) && !empty($this->getData['order']) && $this->getData['order'] == 'queryDate_1') { ?>
                                                <a onclick="return sortByOrder('queryDate_0');" style="cursor:pointer;">Query Date/Age<i class="fa fa-arrow-up"></i></a>
                                            <?php } else { ?>
                                                <a onclick="return sortByOrder('queryDate_1');" style="cursor:pointer;">Query Date/Age<i class="fa fa-arrow-down"></i></a>
                                            <?php } ?>
                                        </th>
                                        <th class="small" style="vertical-align:top;white-space:nowrap;">Name/Mobile</th>
                                        <th class="small" style="vertical-align:top;white-space:nowrap;">Type</th>
                                        <th class="small" style="vertical-align:top;display:none;">Query ID</th>
                                        <th class="small" style="vertical-align:top;display:none;">Query Source</th>
                                        <th class="small" style="vertical-align:top;">Description</th>
                                        <th class="small" style="vertical-align:top;">
                                            <?php if (isset($this->getData['order']) && !empty($this->getData['order']) && $this->getData['order'] == 'travelDate_1') { ?>
                                                <a onclick="return sortByOrder('travelDate_0');" style="cursor:pointer;">Travel Date<i class="fa fa-arrow-up"></i></a>
											<?php } else { ?>
                                                <a onclick="return sortByOrder('travelDate_1');" style="cursor:pointer;">Travel Date<i class="fa fa-arrow-down"></i></a>
                                            <?php } ?>
                                        </th>
                                        <th class="small" style="vertical-align:top;">No. of Pax</th>
                                        <th class="small" style="vertical-align:top;">
                                            <?php if (isset($this->getData['order']) && !empty($this->getData['order']) && $this->getData['order'] == 'destination_1') { ?>
                                                <a onclick="return sortByOrder('destination_0');"  style="cursor:pointer;">Destinations<i class="fa fa-arrow-up"></i></a>
											<?php } else { ?>
                                                <a onclick="return sortByOrder('destination_1');" style="cursor:pointer;">Destinations<i class="fa fa-arrow-down"></i></a>
											<?php } ?>
                                        </th>
                                        <th class="small" style="vertical-align:top;">Proposal</th>
                                        <?php  ?>
                                        <th class="small" style="vertical-align:top;">Lead Stage</th>
                                        <th class="small" style="vertical-align:top;">
                                    <?php if (isset($this->getData['order']) && !empty($this->getData['order']) && $this->getData['order'] == 'lastUpdate_1') { ?>
                                                <a onclick="return sortByOrder('lastUpdate_0');" style="cursor:pointer;">Last Updated<i class="fa fa-arrow-up"></i></a>
                                    <?php } else { ?>
                                                <a onclick="return sortByOrder('lastUpdate_1');" style="cursor:pointer;">Last Updated<i class="fa fa-arrow-down"></i></a>
                                    <?php } ?>
                                        </th>
                                        <th class="small" style="vertical-align:top;">Owner</th>
                                        <th class="small" style="vertical-align:top;">Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php
//                                    echo '<pre>'; print_r($LeadListArr); die;

                                    if (!empty($LeadListArr) ) {
                                        $objagencyCustomer = new Travel_Model_CRM_AgencyLeadAccount();
                                        $objCustomer = new Travel_Model_CRM_Customer();
                                        $customhelper = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom');
                                        $g = 1;
                                        $checkDuplicatEmail = array();
                                        foreach ($LeadListArr as $leadlist) {
                                          //echo '<pre>'; print_r($leadlist); exit;
											$leadlist['TYPE']='QUERY';
                                            // $chatDetails=$objTravelModel->GetCustomerChatHistoryDetailsById($leadlist['TPSysId']);
                                            $childinPAckage = 0;
                                            $adultinPAckage = 0;
                                            $infantinPAckage = 0;
                                            $returndate = '';
                                            $departuredate = '';
                                            $totalmember = '';
                                            $paxTOtalArr = json_decode($leadlist['RoomInfoJson']);
											//echo "<pre>";print_r($paxTOtalArr);echo "</pre>";
                                            if (!empty($paxTOtalArr) ) {
                                                foreach ($paxTOtalArr as $PaxTotal) {
                                                    $adultinPAckage += @$PaxTotal->Adult;
                                                    $childinPAckage += @$PaxTotal->Child;
                                                    $infantinPAckage += @$PaxTotal->Infant;
                                                    $departuredate = @$PaxTotal->departuredate;
                                                    $returndate = trim(@$PaxTotal->returndate);
                                                    $totalmember = trim(@$PaxTotal->totalmember);
                                                }
                                            }
                                            $differenceIndays = '';
                                            //if(isset($leadlist['TYPE']) && ($leadlist['TYPE']=='LEAD')){
                                            $fromDate = $leadlist['CreateDate']->format('Y-m-d');
                                            //echo $leadlist['CreateDate']->format('Y-m-d')
                                            $fromDateTime = time() - strtotime($leadlist['CreateDate']->format('Y-m-d H:i:s'));
                                            $toDate = date('Y-m-d', time());
                                            if ($fromDateTime / 3600 < 24) {
                                                $fromDateTime = abs($fromDateTime / 60);
                                                $differenceIndays = Zend_Controller_Action_HelperBroker::getStaticHelper('DateFormat')->convertToHoursMins($fromDateTime);
                                            } else {
                                                $differenceIndays = Zend_Controller_Action_HelperBroker::getStaticHelper('DateFormat')->calculateNoOfDays($fromDate, $toDate);
                                                $differenceIndays = $differenceIndays . " Days";
                                            }
                                            //}
                                            $h = 0;
                                            ?>
                                            <tr id="row_<?php echo $leadlist['TPSysId']; ?>">
                                                <td class="small">
                                                    <label class="checkbox inlinebl no-margin">
                                                        <input class="icheck-red" type="checkbox" name="usersDetail[]" pid="<?php echo $leadlist['TPSysId']; ?>_<?php echo $g; ?>" id="checkRed<?php echo $leadlist['TPSysId']; ?>" value="<?php echo base64_encode($leadlist['TPSysId'] . "_" . $leadlist['TYPE'] . "_" . $leadlist['TPSysId']); ?>">
                                                    </label>
                                                </td>
                                                <td class="small"><?php echo!empty($leadlist['CreateDate']) ? $leadlist['CreateDate']->format('d/m/y') : 'NA';
                                            echo $differenceIndays ? "<br/>-<br/> " . $differenceIndays : ''; 
											echo "<br>".$proposalID = ($leadlist['PlanBookingId']) . '/' . $leadlist['TPSysId'];
											?>
                                            </td>
                                                <td class="small" style="white-space:nowrap;">
                                                    <?php
													if ($leadlist['IsB2BAgent'] == 1) { echo ($leadlist['CompanyName']) ? "<span title='Company Name'>C</span>: " . stripslashes(trim($leadlist['CompanyName']))."<br/>" : '';}
													echo (!empty($leadlist['FullName'])) ? "<span title='Customer Name'>N</span>: <a href='" . $this->baseUrl('/customer/customer-profile-desc/id/' . base64_encode($leadlist['CustomerSysId'])) . "' target='_blank'>" . ucfirst($leadlist['FullName']) . "</a>" : 'NA';
                                                    echo ($leadlist['Contacts']) ? "<br/><span title='Mobile'>M</span>: " . ($leadlist['Contacts']) : '';
                                                    echo ($leadlist['EmailId']) ? "<br/><span title='Email'>E</span>: " . stripslashes(trim($leadlist['EmailId'])) : '';
													?>
                                                </td>
                                                <td class="small" style="white-space:nowrap;">
                                                    <?php if ($leadlist['IsB2BAgent'] == 1) {
                                                        echo "B2B";
                                                    } else {
                                                        echo "B2C";
                                                    } 
													
													if($leadlist['PlanType']==5){
														echo ($leadlist['PKqueryType']==1)?"<br/>(Group)":"<br/>(Normal)";
													}
													?>
                                                </td>
                                                <td class="small">
                                                    <?php
                                                    if ($leadlist['PlanType'] != '') {
                                                        echo $customHelper->getPlanTypeName($leadlist['PlanType']);echo '<br>'; echo trim($leadlist['LeadSource']);
                                                    } else {
                                                        echo "Lead";
                                                        ?>
                                                        <br/>
                                                        <?php
                                                        if (trim($leadlist['Remarks']) != '') {
                                                            ?>
                                                            <br /><a style="cursor:pointer" title="<?php echo stripslashes(trim($leadlist['Remarks'])); ?>">Remarks</a>
                                                        <?php
                                                        }
                                                    }
                                                    ?></td>
                                                    <?php
                                                if (!empty($leadlist['TPSysId'])) {
                                                    $proposalcount = $this->proposals(@$leadlist['TPSysId']);
                                                }
                                                $totalproposal = !empty($proposalcount) ? count($proposalcount) : 0;
												$owner=(isset($leadlist['OwnerAgentFirstName']) && !empty($leadlist['OwnerAgentFirstName'])) ? stripslashes(trim($leadlist['OwnerAgentFirstName'])) . "&nbsp;" . stripslashes(trim($leadlist['OwnerAgentLastName'])) : 'NA';
                                                ?>
                                                <?php  ?>    
                                                <td class="small">
												<?php 
                                               	 	echo $departuredate;
                                                	echo trim($returndate) ? " - " . $returndate : '';
                                             	?>
                                             	</td>
                                                <td class="small">
                                                <?php 
                                                if ($leadlist['PlanType'] == 7) {
                                                    echo count($paxTOtalArr) . '&nbsp;Forex Type';
                                                } else if ($leadlist['PlanType'] == 4) {
                                                    echo!empty($totalmember) ? $totalmember . '&nbsp;Member(s)' : '';
                                                } else if($adultinPAckage > 0 || $childinPAckage > 0 || $infantinPAckage > 0) {
                                                        echo $adultinPAckage . '&nbsp;Adult(s)';
                                                        echo!empty($childinPAckage) ? ', ' . $childinPAckage . '&nbsp;Kid ' : '';
                                                        echo!empty($infantinPAckage) ? ', ' . $infantinPAckage . '&nbsp;Infant ' : '';
                                                    } else {
                                                        echo "NA";
                                                }
                                                ?>
                                                </td>

                                                <td class="small">
													<?php
														$destination = (!empty($leadlist['Cities']) && trim($leadlist['Cities']) != '') ? stripslashes($leadlist['Cities']) : '';
														echo str_replace(',', ', ', $destination);
													?>
                                                </td>
                                                <td class="small" style="display:none;">?</td>
                                                <td class="small" style="display:none;"><span class="fa fa-rupee"></span><?php echo $leadlist['NetPrice'] ? $leadlist['NetPrice'] : 0; ?></td>
                                                <td class="small">
													<?php if ($leadlist['TPSysId'] != '') { ?>
                                                        <a target="_blank" href="<?php echo $this->baseUrl('/leaddetail/proposal/id/' . base64_encode($leadlist['TPSysId']) . '/cid/' . base64_encode($leadlist['CustomerSysId'])); ?>"><?php echo $totalproposal; ?></a>
													<?php
                                                    } else {
                                                        echo "NA";
                                                    }
                                                    ?>
                                                </td>

                                                 <?php  ?>
                                               <td class="small">
                                               		<span class="queryStatus_<?php echo $leadlist['TPSysId']; ?>">
                                                    <?php 
                                                        echo (isset($leadlist['StatusType']) && !empty($leadlist['StatusType']) && isset($travelPlanStatusName[$leadlist['StatusType']]['TPStatus'])) ? $travelPlanStatusName[$leadlist['StatusType']]['TPStatus'] : 'NA';
													?>
                                                    </span>
                                                    <?php
                                                        $proposalID = ($leadlist['PlanBookingId']) . '/' . $leadlist['TPSysId'] . "/V" . $leadlist['VersionId']; // proposal id for open follow up add form
                                                        $plantype_forlink = strtolower($customHelper->getPlanTypeName($leadlist['PlanType']));

                                                        $openAddModalToDo = "actionChangeProposalStatusAddIteration('" . base64_encode($leadlist['TPSysId']) . "',$h,'{$plantype_forlink}_" . $leadlist['TPSysId'] . "'," . (($leadlist['MasterTPSysId']) ? $leadlist['MasterTPSysId'] : $leadlist['TPSysId']) . "," . $leadlist['CustomerSysId'] . ",'" . base64_encode(27) . "','$proposalID', '" . trim($leadlist['CustomerSysId']) . "','" . trim($owner) . "','" . $leadlist['AgentSysId'] . "',this,'QUERY','".$leadlist['StatusType']."')";

                                                        if (!empty($leadlist['hasFollowUp'])) {
                                                            ?>    
                                                            <br/><a func="<?php echo $openAddModalToDo ?>" href="javascript:void(0);" onclick="getFollowUp('<?php echo $leadlist['CustomerSysId']; ?>', '<?php echo (($leadlist['MasterTPSysId']) ? $leadlist['MasterTPSysId'] : $leadlist['TPSysId']); ?>', $(this).attr('func'));" title="View follow up list" style="color:#0e931d;">Follow Ups</a>
														<?php } else {
                                                            ?>    
                                                            <br/><a click-src="addtodo" href="javascript:void(0);" title="Add Follow Up" class="" style="color: #F22C0C"
                                                                    onclick="actionChangeProposalStatusAddIteration('<?php echo base64_encode($leadlist['TPSysId']); ?>',<?php echo $h; ?>, '<?php echo $plantype_forlink . '_' . $leadlist['TPSysId']; ?>',<?php echo (($leadlist['MasterTPSysId']) ? $leadlist['MasterTPSysId'] : $leadlist['TPSysId']); ?>,<?php echo $leadlist['CustomerSysId']; ?>, '<?php echo base64_encode(27); ?>',
                                                                                    '<?php echo $proposalID ?>', '<?php echo trim($leadlist['CustomerSysId']); ?>', '<?php echo trim(@$leadlist['Owner']); ?>', '<?php echo $leadlist['AgentSysId']; ?>', this,'QUERY','<?php echo $leadlist['StatusType']; ?>');"> Follow Up
                                                            </a>
																<?php }
                                                            
                                                            ?>
                                                            <br>
                                                            <a click-src="addtodo" href="javascript:void(0);" title="Update Status" class="" style="color: #000"
                                                                    onclick="actionChangeQueryStatus( '<?php echo base64_encode($leadlist['TPSysId']); ?>','<?php echo $leadlist['StatusType']; ?>','<?php echo $leadlist['LeadQuality']; ?>','1');"> Update
                                                            </a>
                                                            <br>
                                                            <a data-target="#myModalViewTouchPoints" title='View Query History' href="<?php echo $this->baseUrl('/leaddetail/view-touch-points/cid/'.base64_encode($leadlist['CustomerSysId']).'/tpid/'.base64_encode($leadlist['TPSysId'])); ?>"  data-toggle="modal">Touch Points</a>
                                                            <span class="leadQualityDetails_<?php echo $leadlist['TPSysId']; ?>">
                                                            <?php if(isset($leadlist['LeadQuality']) && $leadlist['LeadQuality'] == 1){?>
                                                            <span style="background-color:#19ce37; color:#fff;padding: 0px 8px;"><?php echo $AllLeadQualityStatusName[$leadlist['LeadQuality']]; ?></span>
                                                            <?php }elseif(isset($leadlist['LeadQuality']) && $leadlist['LeadQuality'] == 2){ ?>
                                                            <span style="background-color:#efdd0a;color:#000;padding: 0px 8px;"><?php echo $AllLeadQualityStatusName[$leadlist['LeadQuality']]; ?></span>
                                                            <?php }elseif(isset($leadlist['LeadQuality']) && $leadlist['LeadQuality'] == 3){ ?>
                                                            <span style="background-color:#65bcfb;color:#fff;padding: 0px 8px;"><?php echo $AllLeadQualityStatusName[$leadlist['LeadQuality']]; ?></span>
                                                            <?php } ?>
                                                            </span>
                                                </td>
                                                <td class="small">
												<?php echo (isset($leadlist['UpdateDate']) && !empty($leadlist['UpdateDate'])) ? $leadlist['UpdateDate']->format('d/m/Y') : 'NA'; ?>
                                                </td>
                                                <td class="small">
                                                    <div class="form-group">
                                                        <span class="ownersuccess_<?php echo $leadlist['TPSysId']; ?>_<?php echo $g; ?>"><?php if (trim($leadlist['OwnerAgentFirstName']) != '') {
															echo trim(stripslashes($leadlist['OwnerAgentFirstName'])) . "&nbsp;" . trim(stripslashes($leadlist['OwnerAgentLastName']));
														} else {
															echo 'Unassigned';
														} ?>
														</span>
                                                    </div>
                                                </td>
                                                <td class="small" style="white-space:nowrap;">
                                                    <?php if($leadlist['AgentSysId'] == '0'){ ?>
                                                    <a href="javascript://" onclick="alert('This query is not assign to any staff. Please assign.')" target="_blank" title="View" class="tooltipLink fa fa-eye btn btn-success btn-xs"> </a> 
                                                    <a   onclick="alert('This query is not assign to any staff. Please assign.')" class="tooltipLink fa fa-comment-o btn btn-primary btn-xs" title='Send Sms' href="javascript://"  data-toggle="modal"></a>
                                                    <?php } else { ?>
                                                    <a href="<?php echo $this->baseUrl('/leaddetail/lead-detail/id/' . base64_encode($leadlist['TPSysId']) . '/cid/' . base64_encode($leadlist['CustomerSysId'])); ?>" target="_blank" title="View" class="tooltipLink fa fa-eye btn btn-success btn-xs"> </a> 
                                                    <a data-target="#myModalSendSMSToDoCustomer"  class="tooltipLink fa fa-comment-o btn btn-primary btn-xs" title='Send Sms' href="<?php echo $this->baseUrl('/leaddetail/view-sms-template-to-lead/cid/'.base64_encode($leadlist['CustomerSysId']).'/tpid/'.base64_encode($leadlist['TPSysId'])); ?>"  data-toggle="modal"></a>
                                                    <?php } ?>
                                                    <?php if ($totalproposal == 0) { ?>
                                                        <a href="javascript:void(0);" data-placement="top" title="Archive" class="tooltipLink fa fa-archive btn btn-warning btn-xs gtxarchieve_<?php echo trim($leadlist['TPSysId']); ?>" onclick="return archieveQueryLead('<?php echo base64_encode(trim($leadlist['TPSysId'])); ?>', '<?php echo trim($leadlist['TPSysId']); ?>');"></a>
                                                    <?php } ?>
                                                </td>
                                            </tr>
												<?php
                                                $g++;
                                            }
                                        } else {
                                            ?>
                                        <tr class="alert alert-danger"><td colspan="14" style="text-align:center;"><strong>No record found</strong></td></tr>
										<?php } ?>
                                </tbody>
                            </table>
                        </div>
                        <div class="form-group form-group1 no-margin ">
                            <div class="col-md-12 text-right clearfix">
							<?php
                            if (!empty($this->paginator) ) {
                                $IsSubmitForm = (isset($this->searchData) && count($this->searchData) > 0) ? true : false;
                                ?>
                                <?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination-form.phtml', array('IsSubmitForm' => $IsSubmitForm, 'FormName' => 'leadQueryFilterForm')); ?>
                            <?php } ?> 
                            </div>
                            <div class="clear"></div></div>                             
                    </div>
                </div>
            </div>
            <!-- Main Content Element  End-->
        </div>
    </div>
<?php echo $this->render('copyrightfooter.phtml'); ?>
</section>
<!--Page main section end -->
<!-- popup modal for view touch points or history of query -->
	<div class="modal fade in" id="myModalViewTouchPoints" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none;">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
				<div class="center">
                        <img class="loaderimg"  id="loaderimg" src="<?php echo $this->baseUrl('/public/tinymce/skins/lightgray/img/loader.gif'); ?>"/>
                </div>
            </div>
        </div>
    </div>
<!-- end of popup modal for view touch points or history of query -->
<!-- popup modal for send sms to customer -->
	<div class="modal fade in" id="myModalSendSMSToDoCustomer" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none;">
        <div class="modal-dialog">
            <div class="modal-content">
				<div class="center">
                        <img class="loaderimg"  id="loaderimg" src="<?php echo $this->baseUrl('/public/tinymce/skins/lightgray/img/loader.gif'); ?>"/>
                </div>
            </div>
        </div>
    </div>
<!-- end of popup modal for send sms to customer -->

<div class="modal fade" id="viewquotesupplier" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
        </div>
    </div>
</div>
<div class="modal fade" id="myModa1createLead" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <form name = "addcustomerform" id = "addcustomerform" method = "post" action = "">
        <input type = "hidden" name = "editID" id = "editIDLead" value = "">
        <div class="modal-dialog modal-sm">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">Add Lead</h4>
                </div>
                <div class="modal-body">
                    <div class="col-md-12 no-padding">
                        <div class="form-group">
                            <label>Email ID <span class="red">*</span></label>
                            <input type="text" class="form-control whbg" name = "emailID" id = "emailIDLead" value="" onblur = "return ChkDuplicateEmailLead();">                       
                        </div>
                        <span id = "emailexistLead" style="display:none;color:red;">Email id already exists <a href="#" class="emailViewDetailsLead">view</a></span>
                    </div>
                    <div class="col-md-12 no-padding">
                        <div class="form-group no-margin">
                            <label>Mobile Number <span class="red">*</span></label>
                            <div class="txtfieldMain textfieldMain_mobile">
                                <div class="country_details">
                                    <div id="iti-flag_leadq" class="iti-flag in"></div>
                                    <div class="iti-arrow"></div>   
                                </div>
                                <div class="country_dropdown">
                                    <div class="search_country">
                                        <input type="text" name="" class="txtfield form-control" placeholder="Search countries" id="countries_list">
                                        <div class="search_icon"></div>
                                    </div>
                                    <ul class="allcountries"></ul>
                                </div> 
                                <input type="text" class="txtfield country_code" readonly="readonly" id="mobile_code" name="countrycode" value="+91">
                                <input type="text" name="mobilenum" id="mobilenumLead" maxlength="10" value="" onblur = "return ChkDuplicateMobileLead();" class="form-control whbg" style="width: 186px; float: right; border:#ccc 0px solid !important; ">
                            </div>
<?php //echo $this->partial('common-modals/countrycode.phtml');  ?>

   <!--<input type="text" class="form-control whbg" name = "mobilenum" id = "mobilenumLead" value="" maxlength = "10" onblur = "return ChkDuplicateMobileLead();"> -->                      
                        </div>
                        <span id = "mobileexistLead" style = "display:none;color:red;">Mobile number already exist <a href="#" target="_blank" class="mobileViewDetailsLead">view</a></span>	
                    </div>
                    <div class="col-md-12 no-padding">
                        <div class="form-group">
                            <label>First Name <span class="red">*</span></label>
                            <input type="text" class="form-control whbg" name = "customername" id = "customernameLead" value="">                       
                        </div>
                    </div>
                    <div class="col-md-12 no-padding">
                        <div class="form-group">
                            <label>Last Name</label>
                            <input type="text" class="form-control whbg" name = "customerlastname" id = "customerlastnameLead" value="">                       
                        </div>
                    </div>
                    <div class="clear"></div></div>


                <div class="modal-footer">
                    <button type="button" class="btn btn-warning pull-right pleasewaitaddcustomerLead"  data-toggle="modal" onclick = "AddNewCustomerLead();">Submit</button>
                    <input type="hidden" name="iscustomerexistemail" id="iscustomerexistemailLead" class="iscustomerexistemailLead" value="1" />
                    <input type="hidden" name="iscustomerexistmobile" id="iscustomerexistmobileLead" class="iscustomerexistmobileLead" value="1" />
                    <input type="hidden" name="isExistCustomer" id="isExistCustomerLead" value="1" />
                    <input type="hidden" name="clickedFromNewQuery" id="clickedFromNewQueryLead" value="0" />
                    <input type="hidden" name="IsCreateNewGtxQuery" id="IsCreateNewGtxQueryLead" value="0" />
                    <button type="button" class="btn btn-primarygray pull-left" data-dismiss="modal">Cancel</button>
                </div>

            </div>
        </div>
    </form>
</div>

<!-- start : added by Ranvir Singh on 27 09 2017 for itinerary -->
<div class="modal fade in" id="myModalAddToDoCustomer" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">Add To Do/Follow Up </h4>
            </div>
            <div class="alert alert-success" id="succmsg" style="display:none;">
                <strong>Success!</strong>Customer has been Added.
            </div>
            <div class="modal-body">
                <div class="col-md-12">
                    <div class="form-group" style="min-height:inherit; margin-bottom:0;">
                        <label><input type="radio" name="followup" value="1" class="followup" readonly=""/> Follow Up</label> &nbsp;&nbsp;
                        <label><input type="radio" name="followup" value="0" class="followup" readonly="" /> To Do</label> &nbsp;&nbsp;
                        <label><input type="radio" name="followup" value="2" class="followup" checked="checked" /> Iteration Required</label>
                    </div>
                </div>

                <div class="col-md-6">
                    <div class="form-group" style="min-height:inherit; ">
                        <label>Title<span class="red">*</span></label>
                        <input class="form-control whbg" name="subject" id="subject" type="text">                       
                    </div>
                </div>

                <div class="col-md-6">
                    <div class="form-group" style="min-height:inherit; ">
                        <label>Due Date<span class="red">*</span></label>
                        <input class="form-control whbg leadtodostartdate" name="todostartdate" id="todostartdate" type="text">                       
                    </div>
                </div>

                <div class="col-md-6" style="display:none;">
                    <div class="form-group" style="min-height:inherit; ">
                        <label>End Date</label>
                        <input class="form-control whbg leadtodoenddate" name="todoenddate" id="todoenddate" type="text">                       
                    </div>
                </div>

                <div class="col-md-6" style="display:none;">
                    <div class="form-group" style="min-height:inherit; ">
                        <label>Select Customer</label>
                        <input class="form-control ui-autocomplete-input" autocomplete="off" name="contact" id="contact">       
                        <input type="hidden" name="custsysID" id="custsysID" value="" />
                    </div>
                </div>

                <div class="col-md-6">
                    <div class="form-group" style="min-height:inherit; ">
                        <label>Assigned To</label>
                        <input class="form-control whbg" name="assignedto" id="assignedto" value="" type="text" />   
                        <input type="hidden" name="assignedtoId" id="assignedtoId" value="" />                    
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group" style="min-height:inherit; ">
                        <label>To Do Reminder</label>
                        <input class="form-control whbg number" name="todoreminder" id="todoreminder" type="text" onkeyup="return kp_numeric(event);"> 
                        <span style="font-size:12px"><h7>In Minutes</h7></span>  
                    </div>
                </div>
                
                
                <div class="col-md-12">
                    <div class="form-group cityDiv" style="min-height:inherit;">
                        <label>Details <span class="red">*</span></label>
                        <textarea class="form-control whbg" name="details" id="details"  type="text" rows="3" cols="7"> </textarea>                   
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group cityDiv" style="min-height:inherit; margin-bottom:0;">
                        <label><input type="checkbox" name="markasdone" value="0" id="markasdone" />      
                            Mark as done</label>

                    </div>
                </div>
<!--                <div class="col-md-6"> 
                    <div class="form-group" style="min-height:inherit; ">
                        <label class="stststsst"></label>
                        <select id="QueryStatus" name="QueryStatus" class="form-control QueryStatus" placeholder="Select" >
                            
                        </select>  
                    </div>
                </div>-->

                <input id="_proposal_id_hidden" type="hidden" value="" />
                <input id="_to_pop_type_id_hidden" type="hidden" value="addtodo" />
                <input id="_to_loopid_hidden" type="hidden" value="" />
                <input id="_to_leadtypeid_hidden" type="hidden" value="" />
                <input id="_to_MasterTPSysId_hidden" type="hidden" value="" />
                <input id="_to_CustomerSysId_hidden" type="hidden" value="" />
                <input id="_to_ProposalStatusId_hidden" type="hidden" value="" />
                <input id="_to_proposalIDTitle_hidden" type="hidden" value="" />
                <input id="_to_CustomerSysId_hidden" type="hidden" value="" />
                <input id="_to_ownerName_hidden" type="hidden" value="" />
                <input id="_to_AgentSysId_hidden" type="hidden" value="" />
                <input id="selectedLeadType" name="selectedLeadType" type="hidden" value="" />

                <div class="clear"></div>

            </div>

            <div class="modal-footer">
                <a href="javascript:void(0);"><button type="button" class="btn btn-warning pull-right submittodo" id="SubmitToDoItinerary" >Submit</button></a>
                <button type="button" class="btn btn-primarygray pull-left" data-dismiss="modal">Cancel</button>
            </div>

        </div>
    </div>
</div>


<div class="modal fade in" id="myModalAddQueryStatusPop" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none;">
    <div class="modal-dialog">
        <form class="ls_form" role="form" action="/leaddetail/saveupdatequerystatusquality" method="post" autocomplete="off" id="saveupdatequerystatusquality" name="">
        <input type="hidden" name="pages" id="pages" value="/customer/query">
            <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">Update Query Status and Lead Quality </h4>
            </div>
            <div class="alert alert-success" id="succmsg" style="display:none;">
                <strong>Success!</strong>Customer has been Added.
            </div>
            <div class="modal-body">
                <div class="col-md-6"> 
                    <div class="form-group" style="min-height:inherit; ">
                        <!--<label class="stststsst"></label>-->
                        <select id="QueryStatus" name="sid" class="form-control QueryStatus" placeholder="Select" onchange="showHideRemarkForQueryConversion('leadRemarkDiv');">
                            
                        </select>  
                    </div>
                </div>
                <div class="col-md-6"> 
                    <div class="form-group" style="min-height:inherit; ">
                        <select id="LeadQuality" name="LeadQuality" class="form-control LeadQuality" placeholder="Select" >
                       
                        </select>
                    </div>
                </div>
				 <div class="col-md-12 leadRemarkDiv" style="display:none;"> 
                 	<div class="form-group">
                    	<textarea name="leadRemarkData" id="leadRemarkData" class="form-control" placeholder="Remarks"></textarea>
                    </div>
                 </div>
                <input id="proposalId" type="hidden" name="TPSysId" value="" />
                
                <input id="QueryStatus_temp" name="sidss" type="hidden" value="" />

                <div class="clear"></div>

            </div>

            <div class="modal-footer">
                <a href="javascript:void(0);"><button type="submit" class="btn btn-warning pull-right saveaction" >Submit</button></a>
                <button type="button" class="btn btn-primarygray pull-left" data-dismiss="modal">Cancel</button>
            </div>

        </div>
            </form>
    </div>
</div>
<!-- start : added by Ranvir Singh on 27 09 2017 for itinerary -->

<?php echo $this->render('common-modals/customer.phtml'); ?> 
<?php echo $this->render("customer/customer-todo-partial.phtml"); ?>
<?php echo $this->render('common-modals/b2bcustomer.phtml'); ?> 
<?php
//echo $this->render('modals.phtml');
echo $this->render('newfooter.phtml');
?>
<!--<script src="<?php echo $this->baseUrl('public/js/customer/customer.js'); ?>"></script>
--><script src="<?php echo $this->baseUrl('public/js/jquery.validate.min.js'); ?>"></script>
<script src="<?php echo $this->baseUrl('public/assets/js/customer.js'); ?>"></script>
<script src="<?php echo $this->baseUrl('public/assets/js/bootstrap3-typeahead.js'); ?>"></script> 
<script src="<?php echo $this->baseUrl('public/countrycode/script.js?rv=1144'); ?>"></script>
<script type="text/javascript">
$('#myModalViewTouchPoints').on('hidden.bs.modal', function () {
        $(this).removeData('bs.modal');
});
function sortByOrder(orderInfo){
	$("#order_details").val(orderInfo);
	$("#filterbutton").trigger('click');
	//$(".ls_form").submit();
}
function getFollowUp(CustomerSysId,MasterTPSysId , func) { // this function copied from commented js in this file public/js/customer/customer.js
    $("#Follow-up-history").modal();
    $.ajax({
         url: '/customer/proposal-follow-up-history',
         data: {CustomerSysId:CustomerSysId,MasterTPSysId:MasterTPSysId},
         dataType: 'html',
         type: 'POST',
         beforeSend: function(){
             $("#history_response").html('Please Wait...');
         },
         success: function (response) {
            $("#history_response").html(response);
            $("#Follow-up-history").find('.addnewbtn').attr({'onclick' : func , 'click-src': 'todo' }); // create onclick function here for add form modal
         }
     });
}
    function submitDetailsForm(x) {
        $('.TabTypeActive').val(x);
        if(x === '1'){
            $('.Progress').removeAttr("disabled",true);
        }else if(x === '2'){
            $('.Booked').removeAttr("disabled",true);
        }else if(x === '3'){
            $('.Rejected').removeAttr("disabled",true);
        }else if(x === '4'){
            $('.UnAssigned').removeAttr("disabled",true);
        }
       $(".FormSubmit").submit();
    }
    
    function ExportExcelForm() {
       $(".ExportExcelForm").submit();
    }

                            function validateFilter() {
                                var customername = $.trim($("#customername").val());
                                var customeremail = $.trim($("#customeremail").val());
                                var customermobile = $.trim($("#customermobile").val());
                                var leadType = $.trim($("#leadType").val());
                                var lead_stage = $.trim($("#lead_stage").val());
                                var hidden_typeahead_cityid = $.trim($(".hidden_typeahead_cityid").val());
                                if (customername == '' && customeremail == '' && customermobile == '' && leadType == '' && lead_stage == '' && hidden_typeahead_cityid == '') {
                                    alert('Please fill at least one field');
                                    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/update-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 () {
												//alert(userhtmlname+'/'+$(this).attr('pid'));
                                                $(".ownersuccess_" + $(this).attr('pid')).html(userhtmlname);
                                                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 ChkDuplicateMobileLead() {
                                var mobilenum = $.trim($("#mobilenumLead").val());
                                var CRMCustSysId = $.trim($("#CRMCustSysIdLead").val());
                                if (mobilenum != '') {
                                    jQuery.ajax({
                                        url: '/customer/get-customer-detail',
                                        type: 'POST',
                                        dataType: 'json',
                                        data: {mobilenum: mobilenum, CRMCustSysId: CRMCustSysId},
                                        beforeSend: function () {
                                            //$().attr('disabled',true);
                                        },
                                        success: function (result) {
                                            if (result.status == 'success') {
                                                if (result.CustomerSysId != '') {
                                                    $("#mobileexistLead").show();
                                                    $(".mobileViewDetailsLead").attr('href', reqUrl + '/customer/customer-todo/id/' + result.CustomerSysId);
                                                    $("#iscustomerexistmobileLead").val(1);
                                                    $("#isExistCustomerLead").val(1);
                                                } else {
                                                    $("#mobileexistLead").hide();
                                                    $("#isExistCustomerLead").val(0);
                                                    $("#iscustomerexistmobileLead").val(0);
                                                }

                                                $("#CustomerSysIdLead").val(result.CustomerSysId);
                                                return false;
                                            } else {
                                                //alert($("#CRMCustSysId").val());
                                                $("#mobileexistLead").hide();
                                                $("#isExistCustomerLead").val(0);
                                                $("#iscustomerexistmobileLead").val(0);

                                                $("#CustomerSysIdLead").val('');
                                            }
                                        }
                                    });
                                }
                            }


                            function ChkDuplicateEmailLead() {
                                var emailID = $.trim($("#emailIDLead").val());
                                jQuery.ajax({
                                    url: '/customer/get-customer-detail',
                                    type: 'POST',
                                    dataType: 'json',
                                    data: {emailID: emailID},
                                    success: function (result) {
                                        //alert(result);
                                        if (result.status == 'success') {
                                            if (result.CustomerSysId != '') {
                                                $("#emailexistLead").show();
                                                $(".emailViewDetailsLead").attr('href', reqUrl + '/customer/customer-todo/id/' + result.CustomerSysId);
                                                $("#isExistCustomerLead").val(1);
                                                $("#iscustomerexistemailLead").val(1);
                                            } else {
                                                $("#emailexistLead").hide();
                                                $("#isExistCustomerLead").val(0);
                                                $("#iscustomerexistemailLead").val(0);
                                            }
                                            $("#CRMCustSysIdLead").val(result.CRMCustSysId);
                                            $("#CustomerSysIdLead").val(result.CustomerSysId);
                                            //$("#emailID").focus();
                                            return false;
                                        } else {
                                            $("#emailexistLead").hide();
                                            $("#isExistCustomerLead").val(0);
                                            $("#iscustomerexistemailLead").val(0);
                                            $("#CRMCustSysIdLead").val('');
                                            $("#CustomerSysIdLead").val('');
                                        }

                                    }
                                });
                            }
                            function AddNewCustomerLead() {
                                var countrycode = $("input[name='countrycode']").val();
                                var mobilenum = $("#mobilenumLead").val();
                                var customername = $.trim($("#customernameLead").val());
                                var customerlname = $.trim($("#customerlnameLead").val());
                                var customerlastname = $.trim($("#customerlastnameLead").val());
                                var emailID = $("#emailIDLead").val();
                                var isExistCustomer = $.trim($("#isExistCustomerLead").val());
                                var iscustomerexistmobile = $.trim($("#iscustomerexistmobileLead").val());
                                var iscustomerexistemail = $.trim($("#iscustomerexistemailLead").val());
                                var clickedFromNewQuery = $.trim($('#clickedFromNewQueryLead').val());
                                var IsCreateNewGtxQuery = $.trim($('#IsCreateNewGtxQueryLead').val());
                                var phoneReg = /^\d+$/;
                                if (emailID == '') {
                                    alert('Email id Can not be empty');
                                    $("#emailIDLead").focus();
                                    return false;
                                }
                                if (customername == '') {
                                    alert('First Name Can not be empty');
                                    $("#customernameLead").focus();
                                    return false;
                                }
                                if (customerlname == '') {
                                    var customerlname = customerlastname;
                                }
                                if (mobilenum == '') {
                                    alert('Mobile Number Can not be empty');
                                    $("#mobilenumLead").focus();
                                    return false;
                                }
                                var emailReg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
                                if (!emailReg.test(emailID))
                                {
                                    alert("Please enter valid email address");
                                    $("#emailIDLead").focus();
                                    return false;
                                }
                                if (!phoneReg.test(mobilenum))
                                {
                                    alert("phone number should only in digit");
                                    $("#mobilenumLead").focus();
                                    return false;
                                }
                                if (mobilenum.length < 8 || mobilenum.length > 15)
                                {
                                    alert("phone number should be in correct format");
                                    $("#mobilenumLead").focus();
                                    return false;
                                }
                                if (iscustomerexistmobile == 1 || iscustomerexistemail == 1) {
                                    alert('Email or mobile already exist');
                                    return false;
                                }
                                if (iscustomerexistmobile != 0 && iscustomerexistemail != 0) {
                                    return false;
                                }

                                var source = "";
                                jQuery.ajax({
                                    url: '/customer/addgtxcustomerdata',
                                    type: 'POST',
                                    dataType: 'json',
                                    data: {mobilenumber: mobilenum, countrycode: countrycode, fname: customername, lname: customerlname, customerEmail: emailID, source: source, IsCreateNewGtxQuery: IsCreateNewGtxQuery},
                                    beforeSend: function () {
                                        $(".pleasewaitaddcustomerLead").attr('disabled', true);
                                        $(".pleasewaitaddcustomerLead").html('Please wait...');
                                    },
                                    success: function (result) {
                                        if (clickedFromNewQuery == 1) {
                                            window.location.href = '/customer/query/type/LEAD';
                                        }
                                        $(".pleasewaitaddcustomerLead").removeAttr('disabled');
                                        $(".pleasewaitaddcustomerLead").html('Send');
                                        $("#mobilenumberLead").val(result.mobilenumber);
                                        $("#fnameLead").val(result.fname);
                                        $("#lnameLead").val(result.lname);
                                        $("#customerEmailLead").val(result.customerEmail);
                                        $("#editIDLead").val(result.CustomerSysId);
                                        //$("#myModa1addcustomer").modal('hide');
                                        //$("#myModalEditCustomer").modal('show');
                                        $("#contactLead").val(result.fname + '(' + result.customerEmail + ')');
                                        $("#custsysIDLead").val(result.CustomerSysIdNew);
                                    }
                                });
                                //$("#myModaladdCustomer").modal();
                            }
                            $('#viewquotesupplier').on('hidden.bs.modal', function () {
                                $(this).removeData('bs.modal');
                            });
                            function redirectGtxCustomer(id, url) {
                                //$("#row_" + id).fadeOut(3000); //remove if want to hide row where click on convert
                                window.open(url, '_blank');
                            }
                            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 archieveQueryLead(id, decodeid) {
                                if (confirm('Are your sure, you want to delete this query?')) {
                                    $.ajax({
                                        url: "/leaddetail/query-archieve",
                                        type: "POST",
                                        dataType: 'json',
                                        data: {'TPSysId': 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 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;
                                }
                            }
                            $(".changeOwnerName").typeahead({
                                //items: 'all',

                                source: function (query, process) {

                                    return $.ajax({
                                        url: '/customer/get-agency-user-list',
                                        type: 'post',
                                        //async: true,
                                        data: {query: query},
                                        dataType: 'json',
                                        success: function (result) {

                                            var resultList = result.map(function (item) {
                                                var aItem = {UserSysId: item.UserSysId, EmailId: item.EmailId, FullName: item.FullName};
                                                return JSON.stringify(aItem);
                                            });
                                            return process(resultList);
                                        }
                                    });
                                },
                                sorter: function (items) {
                                    var beginswith = [], caseSensitive = [], caseInsensitive = [], item;
                                    while (aItem = items.shift()) {
                                        var item = JSON.parse(aItem);
                                        if (!item.EmailId.toLowerCase().indexOf(this.query.toLowerCase()))
                                            beginswith.push(JSON.stringify(item));
                                        else if (~item.EmailId.indexOf(this.query))
                                            caseSensitive.push(JSON.stringify(item));
                                        else
                                            caseInsensitive.push(JSON.stringify(item));
                                    }
                                    return beginswith.concat(caseSensitive, caseInsensitive)

                                },
                                highlighter: function (obj) {
                                    var item = JSON.parse(obj);
                                    var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&');
                                    return item.EmailId.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
                                        return '<strong>' + match + '</strong>'
                                    })
                                },
                                updater: function (item) {
                                    var item = JSON.parse(item);
                                    //$('#assignedtoId').val(item.UserSysId);
                                    //return item.EmailId;
                                    var currentId = $(this.$element.attr('id')).selector;
                                    var currentId = currentId.split('_');
                                    var AgencyCRMLeadSysId = currentId[2];
                                    var TPSysId = currentId[1];
                                    jQuery.ajax({
                                        url: '/customer/update-customer-owner',
                                        type: 'POST',
                                        dataType: 'json',
                                        data: {UserSysId: item.UserSysId, ACLid: AgencyCRMLeadSysId},
                                        success: function (result) {
                                            //alert(result);
                                            if (result.status == 'success') {
                                                $(".ownersuccess_" + TPSysId).html("(" + result.msg + ")").show();
                                                $(".ownerNameText_" + TPSysId).html(item.FullName);
                                                showHide('ownerNameText_' + TPSysId, 'changeOwnerName_' + TPSysId);
                                                return false;
                                            } else {
                                                alert('Some thing went wrong.Please try after some time');
                                                showHide('ownerNameText_' + TPSysId, 'changeOwnerName_' + TPSysId);
                                            }

                                        }
                                    });
                                },
                                minLength: 2
                                        // displayField: 'label',
                            });

                            function showHide(showclass, hideclass) {
                                $("." + showclass).show();
                                $("." + hideclass).hide();
                            }
                            $(".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 updateLeadStage(customerId, encodecustomerId, encodestageId) {
                                if (encodestageId == 52) {
                                    $(".callbackTitle_" + customerId).show();
									$("#followupcust_" + customerId).hide();
									
                                    return false;
                                } else {
                                    $(".callbackTitle_" + customerId).hide();
									$("#followupcust_" + customerId).show();
                                }

                                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;
                                            }
                                            if (encodestageId == 47) {
                                                $("#row_" + customerId).fadeOut(3000);
                                            }

                                            //$("#leadtitle_"+customerId).html(data.title);

                                        } else {
                                            $("#stagesuccess_" + customerId).html('Some error occured');
                                        }
                                    },
                                    error: function () {
                                        $("#stagesuccess_" + customerId).html('Some error occured');
                                    }
                                });
                            }

                            function updateQueryOwner(customerId, encodecustomerId, TPSysId, AgencyUserId) {
                                $(".ownersuccess_" + TPSysId).html('Please wait...').show();
                                var myArray = [];
                                myArray.push(encodecustomerId);
                                //console.log(myArray);
                                //alert(AgencyUserId);
                                //return false;
                                $.ajax({
                                    url: "/customer/update-assign-agency-user",
                                    type: "POST",
                                    dataType: 'json',
                                    data: {'data': myArray, 'aid': AgencyUserId},
                                    beforeSend: function () {
                                        $(".ownersuccess_" + TPSysId).html('Please wait...');
                                    },
                                    success: function (data) {
                                        if (data.status == 'success') {
                                            $(".ownersuccess_" + TPSysId).html('Record updated');
                                        } else {
                                            $(".ownersuccess_" + TPSysId).html('Some error occured');
                                        }
                                    },
                                    error: function () {
                                        $(".ownersuccess_" + customerId).html('Some error occured');
                                    }
                                });
                            }
                            function updateLeadOwner(customerId, encodecustomerId, AgencyUserId) {
                                $("#ownersuccess_" + customerId).html('Please wait...');
                                var myArray = [];
                                myArray.push(encodecustomerId);
                                //console.log(myArray);
                                //alert(AgencyUserId);
                                //return false;
                                $.ajax({
                                    url: "/customer/assign-agency-user",
                                    type: "POST",
                                    dataType: 'json',
                                    data: {'data': myArray, 'aid': AgencyUserId},
                                    beforeSend: function () {
                                        $("#ownersuccess_" + customerId).html('Please wait...');
                                    },
                                    success: function (data) {
                                        if (data.status == 'success') {
                                            $("#ownersuccess_" + customerId).html('Record updated');
                                        } else {
                                            $("#ownersuccess_" + customerId).html('Some error occured');
                                        }
                                    },
                                    error: function () {
                                        $("#ownersuccess_" + customerId).html('Some error occured');
                                    }
                                });
                            }
                            function updateCallBackLeadStage(customerId, encodecustomerId) {
                                var callbackFrom = $.trim($("#callbackFrom_" + customerId).val());
                                var callbackreminder = $.trim($("#callbackreminder_" + customerId).val());
								var callbackreminderremarks = $.trim($("#callbackreminderremarks_" + 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,'callbackreminderremarks':callbackreminderremarks},
                                    beforeSend: function () {
                                        $(".calbackButton_"+customerId).attr('disabled', true);
                                        $("#stagesuccess_" + customerId).html('Please wait...');
                                    },
                                    success: function (data) {
                                        if (data.status == 'success') {
                                           // $(".calbackButton").removeAttr('disabled');
                                            $("#stagesuccess_" + customerId).html('Record updated').fadeOut(5000);
                                            //$("#leadtitle_"+customerId).html(data.title);

                                        } else {
                                            $("#stagesuccess_" + customerId).html('Some error occured').fadeOut(5000);
                                        }
                                    },
                                    error: function () {
                                        $("#stagesuccess_" + customerId).html('Some error occured').fadeOut(5000);
                                    }
                                });
                            }
                            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',
                            });
                            function archieveLeads(e) {
                                var atLeastOneIsChecked = $('input[name="usersDetail[]"]:checked').length;
                                var userDetail = $.trim($("#agencyUser").val());
                               if (atLeastOneIsChecked == 0) {
                                    alert('Please select at least one Lead to archieve.');
                                    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(",");
								//alert(myArray);
								//return false;
                                $.ajax({
                                    url: "/customer/update-archieve-agency-lead",
                                    type: "POST",
                                    dataType: 'json',
                                    data: {'data': myArray, 'aid': userDetail},
                                    beforeSend: function () {
                                        $(".assignMsg").html('Please wait...');
										$(".pleaseWaitArchieve").attr('disabled',true);
                                    },
                                    success: function (data) {
                                        if (data.status == 'success') {
											$(".assignMsg").html('Record Updated');
                                            $(".assignMsg").fadeOut(4000);
											$(".pleaseWaitArchieve").removeAttr('disabled',true);
                                            var y = 0;
                                            $('input[name="usersDetail[]"]:checked').each(function () {
												var pid=$(this).attr('pid').split('_');
												var pid=pid[0];
												$("#row_"+pid).fadeOut(4000);
                                                y++;
                                            });
                                        }
										if (data.status == 'failed') {
											alert("Some error occured.Please try after some time.");
											$(".assignMsg").fadeOut(4000);
										}
                                        return false;
                                    },
                                    error: function () {
                                        $(".assignMsg").html("Some error occured.Please try after some time.");
                                        $(".assignMsg").fadeOut(4000);
                                    }
                                });

                            }
</script>
<style>
    label.success {
        position: relative;
        top: -25px;
        right: 10px;
        float: right;
        width: 16px;
        height: 16px;
        display: inline-block;
        color:#449D44;
    }
</style>

Youez - 2016 - github.com/yon3zu
LinuXploit