| 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 : |
<?php
$packageThemeList = $this->packageThemeList;
$foodPreferenceList = $this->foodPreferenceList;
$packageTypeList = $this->packageTypeList;
$arrStatus = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom')->GetTravelPlanStatusName(1,'');
$priceRangeArr = Zend_Controller_Action_HelperBroker::getStaticHelper('PackageSearch')->getPriceRange();
?>
<script src="<?php echo $this->baseUrl('public/js/jquery.validate.min.js'); ?>"></script>
<section id="main-container">
<!--Left navigation section end-->
<!--Page main section start-->
<section id="min-wrapper" class="active">
<div id="main-content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<!--Top header start-->
<h3 class="ls-top-header">CRM</h3>
<!--Top header end -->
<!--Top breadcrumb start -->
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-home"></i></a></li>
<li class="active">Customers</li><li class="active"><a href="<?php echo $this->baseUrl('/customer/customer-profiling'); ?>">Customers Profiling</a></li>
</ol>
<!--Top breadcrumb start -->
</div>
</div>
<!-- Main Content Element Start-->
<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading minus">
<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->searchData) == 0): ?>active <?php endif; ?>" href="javascript:void(0)"><i class="fa <?php if(!empty($this->searchData) ): ?>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(!empty($this->searchData) ): ?>block <?php else: echo "none"; endif; ?>;">
<form class="ls_form" role="form" method="post" name="customerFilterForm" id="customerFilterForm" autocomplete="off">
<input type="hidden" class="filterdata" name="atleastone" id="atleastone" value="<?php echo $this->searchData['atleastone']; ?>" />
<div class="row">
<div class="col-md-3">
<div class="form-group dropdown">
<label>Phone No</label>
<input type="text" class="form-control whbg atleastone" onkeyup="return kp_numeric(event);" name="phonenumber" maxlength="10" value="<?php echo $this->searchData['phonenumber']; ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group dropdown">
<label>Customer Name</label>
<input type="text" class="form-control whbg atleastone" name="customername" value="<?php echo $this->searchData['customername']; ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group dropdown">
<label>Email ID</label>
<input type="text" class="form-control whbg atleastone" name="emailid" value="<?php echo $this->searchData['emailid']; ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group dropdown">
<label>Lead Source</label>
<select id="leadsource" name="lead_source" class="form-control whbg atleastone" placeholder="Lead Source..." >
<option value="">Lead Source...</option>
<?php
$objCrmCust = new Travel_Model_CRM_Customer();
$arrLeadSourse = $objCrmCust->getLeadSource($this->AgencySysId);
if(!empty($arrLeadSourse) ){
foreach($arrLeadSourse as $result){
$intLeadSourceSysId = trim($result['LeadSourceSysId']);
$strTitle = trim($result['Title']);
if($this->searchData['lead_source'] == $intLeadSourceSysId){
$selected = "selected";
}else{
$selected = "";
}
?>
<option value="<?php echo $intLeadSourceSysId; ?>" <?php echo $selected; ?>><?php echo $strTitle; ?></option>
<?php } } ?>
</select>
</div>
</div>
<div class="col-md-12" id="advance_search" <?php if(count($this->searchData) == 0){ ?>style="display:none;" <?php } ?>>
<div class="col-md-12">
<div style="margin-bottom: -25px; min-height: 67px; position: relative;">
<strong>Advance Search :</strong>
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Origin City</label>
<input type="text" class="form-control whbg atleastone city_auto_suggest" seq="search_going_from" id="origin_city" name="origin_city" value="<?php echo $this->searchData['origin_city']; ?>">
<input type="hidden" id="search_going_from" name="search_going_from" value="<?php echo $this->searchData['search_going_from']; ?>"/>
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Destination City</label>
<input type="text" class="form-control whbg atleastone city_auto_suggest" seq="search_going_to" id="destination_city" name="destination_city" value="<?php echo $this->searchData['destination_city']; ?>">
<input type="hidden" id="search_going_to" name="search_going_to" value="<?php echo $this->searchData['search_going_to']; ?>"/>
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Travel Period</label>
<input type="text" class="form-control whbg atleastone" id="travel_month" name="travel_month" value="<?php echo !empty($this->searchData['travel_month'])?$this->searchData['travel_month']:'' ?>">
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Query Period</label>
<input type="text" class="form-control whbg atleastone" id="query_month" name="query_month" value="<?php echo !empty($this->searchData['query_month'])?$this->searchData['query_month']:'' ?>">
</div>
</div>
<!-- <div class="col-md-3">
<div class="form-group dropdown">
<label>Traveller Type</label>
<select id="traveller_type" name="traveller_type" class="demo-default select-country" placeholder="Select Traveller Type">
<option value="">Select Traveller Type</option>
<option value="1" <?php //echo (isset($this->searchData['traveller_type']) && ($this->searchData['traveller_type'] == 1))?'selected':''; ?>>Solo</option>
<option value="2" <?php //echo (isset($this->searchData['traveller_type']) && ($this->searchData['traveller_type'] == 2))?'selected':''; ?>>Couple</option>
<option value="3" <?php //echo (isset($this->searchData['traveller_type']) && ($this->searchData['traveller_type'] == 3))?'selected':''; ?>>Family & Friends</option>
</select>
</div>
</div>-->
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Destination Type</label>
<select id="destination_type" name="destination_type" class="demo-default select-country atleastone" placeholder="Select Destination Type">
<option value="">Destination Type</option>
<?php for($i=0;$i<count($packageTypeList);$i++) {
if($this->searchData['destination_type'] == $packageTypeList[$i]['PackRangeType']){
$selected = "selected";
}else{
$selected = "";
}
?>
<option value="<?php echo $packageTypeList[$i]['PackRangeType']?>" <?php echo $selected; ?>><?php echo @$packageTypeList[$i]['Title']?></option>
<?php } ?>
</select>
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Meal preference</label>
<select id="search_food" name="search_food" class="demo-default select-country atleastone">
<option value="">Meal preference</option>
<?php
if (!empty($foodPreferenceList) ) {
$i = 0;
foreach ($foodPreferenceList as $foodPreference) {
if($this->searchData['search_food'] == $i){
$selected = "";
}else{
$selected = "";
}
echo "<option value='" . $i . "' $selected>" . $foodPreference['Title'] . "</option>";
$i++;
}
}
?>
</select>
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Customer City</label>
<input type="text" class="form-control whbg city_auto_suggest atleastone" seq="cust_city_id" id="cust_city" name="cust_city" value="<?php echo $this->searchData['cust_city']; ?>">
<input type="hidden" id="cust_city_id" name="cust_city_id" value="<?php echo $this->searchData['cust_city_id']; ?>"/>
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Theme</label>
<select id="theme" name="theme" class="demo-default select-country atleastone" placeholder="Select theme">
<option value="">Theme</option>
<?php for ($i = 0; $i < count($packageThemeList); $i++) {
if($this->searchData['theme'] == $packageThemeList[$i]['PackType']){
$selected = "selected";
}else{
$selected = "";
}
?>
<option value="<?php echo $packageThemeList[$i]['PackType'] ?>" <?php echo $selected ?> ><?php echo $packageThemeList[$i]['Title'] ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Budget</label>
<select id="search_price_range" name="search_price_range" class="demo-default select-country atleastone" placeholder="Select">
<?php
foreach ($priceRangeArr as $key => $value) {
if($this->searchData['search_price_range'] == $value['key']){
$selected = "selected";
}else{
$selected = "";
}
echo "<option value='$value[key]' $selected>$value[value]</option>";
}
?>
</select>
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Birth Anniversary</label>
<select id="dob" name="dob" class="demo-default select-country atleastone" placeholder="Select Month">
<option value="">Select Month</option>
<?php if(!empty(unserialize(SEASON_MONTH_FULL)) ){
foreach(unserialize(SEASON_MONTH_FULL) as $key=>$val){
if($this->searchData['dob'] == $key){
$selected = "selected";
}else{
$selected = "";
}
?>
<option value="<?php echo $key;?>" <?php echo $selected; ?>><?php echo stripslashes($val);?></option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Age Group</label>
<select id="age_group" name="age_group" class="demo-default select-country atleastone" placeholder="Select Month">
<option value="">Age Group</option>
<option value="0_30" <?php echo (isset($this->searchData['age_group']) && ($this->searchData['age_group'] == "0_30"))?'selected':''; ?>>Up to 30</option>
<option value="30_40" <?php echo (isset($this->searchData['age_group']) && ($this->searchData['age_group'] == "30_40"))?'selected':''; ?>>30 to 40</option>
<option value="40_50" <?php echo (isset($this->searchData['age_group']) && ($this->searchData['age_group'] == "40_50"))?'selected':''; ?>>40 to 50</option>
<option value="50_60" <?php echo (isset($this->searchData['age_group']) && ($this->searchData['age_group'] == "50_60"))?'selected':''; ?>>50 to 60</option>
<option value="60_100" <?php echo (isset($this->searchData['age_group']) && ($this->searchData['age_group'] == "60_100"))?'selected':''; ?>>60 And Above</option>
</select>
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Marriage Anniversary </label>
<select id="anniversary" name="anniversary" class="demo-default select-country atleastone" placeholder="Select Month">
<option value="">Select Month</option>
<?php if(!empty(unserialize(SEASON_MONTH_FULL)) ){
foreach(unserialize(SEASON_MONTH_FULL) as $key=>$val){
if($this->searchData['anniversary'] == $key){
$selected = "selected";
}else{
$selected = "";
}
?>
<option value="<?php echo $key;?>" <?php echo $selected; ?>><?php echo stripslashes($val);?></option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Passport Expiring In </label>
<input type="text" class="form-control whbg atleastone" id="passportexpiry" name="passportexpiry" value="<?php echo !empty($this->searchData['passportexpiry'])?$this->searchData['passportexpiry']:'' ?>">
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Last Status</label>
<select id="last_status" name="last_status" class="demo-default select-country atleastone" placeholder="Select theme">
<option value="">Status</option>
<?php if(!empty($arrStatus) ){
foreach($arrStatus as $key=>$val){
if($this->searchData['last_status'] == $val['TPStatusSysId']){
$selected = "selected";
}else{
$selected = "";
}
?>
<option value="<?php echo stripslashes($val['TPStatusSysId']);?>" <?php echo $selected; ?>><?php echo stripslashes($val['TPStatus']);?></option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<!-- <div class="form-group dropdown">
<label>Kids</label><br/><br/>
<label>
<input class="icheck-red atleastone" <?php echo (isset($this->searchData['kids']) && ($this->searchData['kids'] == 1))?'checked':''; ?> type="radio" name="kids" id="kids" value="1"> <strong>Yes</strong>
</label>
<label>
<input class="icheck-red atleastone" <?php echo (isset($this->searchData['kids']) && ($this->searchData['kids'] == 0))?'checked':''; ?> type="radio" name="kids" id="kids" value="0"> <strong>No</strong>
</label>
</div> -->
<label>Kids </label>
<input class="atleastone" <?php echo (isset($this->searchData['kids']) && ($this->searchData['kids'] == 1))?'checked':''; ?> type="radio" name="kids" id="kids1" value="1">
<label for="kids1">Yes </label>
<input class="atleastone" <?php echo (isset($this->searchData['kids']) && ($this->searchData['kids'] == 0))?'checked':''; ?> type="radio" name="kids" id="kids0" value="0">
<label for="kids0">No </label>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Travelled With Us</label><br/><br/>
<label>
<input class="icheck-red atleastone" <?php echo (isset($this->searchData['travel_with']) && ($this->searchData['travel_with'] == 1))?'checked':''; ?> type="radio" name="travel_with" id="travel_with" value="1"> <strong>Yes</strong>
</label>
<label>
<input class="icheck-red atleastone" <?php echo (isset($this->searchData['travel_with']) && ($this->searchData['travel_with'] == 0))?'checked':''; ?> type="radio" name="travel_with" id="travel_with" value="0"> <strong>No</strong>
</label>
</div>
<!-- <label>Type : </label>
<input type="radio" name="b2btype" id="b2bagencytype" value="1" checked="checked">
<label for="b2bagencytype">Agency </label>
<input type="radio" name="b2btype" id="b2bcorporatetype" value="2">
<label for="b2bcorporatetype">Corporate </label> -->
</div>
<div class="col-md-3 col-lg-3 col-sm-3 col-xs-12">
<div class="form-group dropdown">
<label>Hotel Preference</label>
<label>
1 <input type="checkbox" class="icheck-black atleastone" name="hotelpreference[]" <?php echo (isset($this->searchData['hotelpreference']) && in_array(1,$this->searchData['hotelpreference']))?'checked':''; ?> value="1" />
2 <input type="checkbox" class="icheck-black atleastone" name="hotelpreference[]" <?php echo (isset($this->searchData['hotelpreference']) && in_array(2,$this->searchData['hotelpreference']))?'checked':''; ?> value="2" />
3 <input type="checkbox" class="icheck-black atleastone" name="hotelpreference[]" <?php echo (isset($this->searchData['hotelpreference']) && in_array(3,$this->searchData['hotelpreference']))?'checked':''; ?> value="3" />
4 <input type="checkbox" class="icheck-black atleastone" name="hotelpreference[]" <?php echo (isset($this->searchData['hotelpreference']) && in_array(4,$this->searchData['hotelpreference']))?'checked':''; ?> value="4" />
5 <input type="checkbox" class="icheck-black atleastone" name="hotelpreference[]" <?php echo (isset($this->searchData['hotelpreference']) && in_array(5,$this->searchData['hotelpreference']))?'checked':''; ?> value="5" />
</label>
</div>
</div>
</div>
<div class="col-md-12 pull-right">
<div class="col-md-8"><span class="errorTxt"></span></div>
<div class="col-md-4 pull-right">
<div class="form-group form-group1 flexipadding text-right">
<a href="javascript:void(0);" onclick="advanceSearchFields();">Advance Search</a>
<?php if(!empty($this->searchData) ){ ?>
<a href="/customer/export-to-excel">Export To Excel</a>
<?php } ?>
<button onclick="window.location.href='<?php echo $this->baseUrl('/customer/customer-profiling'); ?>'" class="btn btn-primarygray" type="button">Reset</button>
<button class="btn btn-primary" id="filter-btn" type="submit"><i class="fa fa-search"></i> Filter</button>
<input type="hidden" name="page" id="page" value="1" />
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel-body leadeBorder">
<div class="col-md-12 no-padding">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr class="alert alert-graylight">
<!-- <th style="vertical-align:top; width:50px;"><strong>#</strong></th>-->
<th class="small" style="vertical-align:top;"><strong>Customer Name</strong></th>
<th class="small" style="vertical-align:top;"><strong>Email</strong></th>
<th class="small" style="vertical-align:top;"><strong>Mobile</strong></th>
<th class="small" style="vertical-align:top;"><strong>Lead Source</strong></th>
<th class="small" style="vertical-align:top;"><strong>Owner</strong></th>
<th class="small" style="vertical-align:top;"><strong>Last Updated</strong></th>
<th class="small" style="vertical-align:top;"><strong>Status</strong></th>
<!-- <th class="small" style="vertical-align:top; width:85px;"><strong>Action</strong></th>-->
</tr>
</thead>
<tbody>
<?php if (!empty($this->paginator1) ):
$s=1;
foreach ($this->paginator1 as $customerDetail){ //echo '<pre>'; print_r($roles); die;
?>
<tr>
<!-- <td class="small">
<label class="checkbox inlinebl no-margin">
<input class="icheck-red" type="checkbox" name="usersDetail[]" pid="<?php echo $customerDetail['CustomerSysId']; ?>" id="checkRed<?php echo $customerDetail['CustomerSysId']; ?>" value="<?php echo base64_encode($customerDetail['AgencyCRMLeadSysId']); ?>">
</label>
</td>-->
<td class="small"><?php echo $customerDetail['FirstName']?ucfirst($customerDetail['FirstName'])." ".$customerDetail['LastName']:'NA';?></td>
<td class="small"><?php echo trim($customerDetail['EmailId'])?$customerDetail['EmailId']:'NA';?></td>
<td class="small"><?php echo trim($customerDetail['Contacts'])?$customerDetail['Contacts']:'NA';?></td>
<td class="small"><?php echo $customerDetail['LeadSource']?$customerDetail['LeadSource']:'NA';?></td>
<td class="small" id="leadowner_<?php echo $customerDetail['CustomerSysId']; ?>"><?php echo (isset($customerDetail['AgencyUserFirstName']) && !empty($customerDetail['AgencyUserFirstName']))?stripslashes($customerDetail['AgencyUserFirstName'])." ".stripslashes($customerDetail['AgencyUserLastName']):'Admin';?></td>
<td class="small"><?php echo $customerDetail['UpdateDate']->format('d/m/Y');?></td>
<td class="small status_<?php echo $s; ?>"><?php if($customerDetail['IsActive']==1){ $alertStatus='Deactive'; echo "Active"; } else{ $alertStatus='Active'; echo "Deactive";} ?></td>
</tr>
<?php $s++; }
else:?>
<tr>
<td class="small" align="center" colspan="9"><strong class="text-danger">No record found</strong></td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<div class="col-md-12 text-right no-padding">
<?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'=>'customerFilterForm')); ?>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
<!-- Main Content Element End-->
</div>
</div>
<?php echo $this->render('copyrightfooter.phtml'); ?><!--Page main section end -->
<!--Right hidden section start-->
<?php echo $this->render('common-modals/customer.phtml'); ?>
<?php echo $this->render('newfooter.phtml'); ?>
<script src="<?php echo $this->baseUrl('public/js/customer/customer.js'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl('public/assets/js/moment.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl('public/assets/js/jquery.daterangepicker.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl('public/js/jquery-ui-1.11.0.js'); ?>"></script>
<link rel="stylesheet" href="<?php echo $this->baseUrl('public/assets/css/daterangepicker.min.css'); ?>">
<script type = "text/javascript">
$('#anniversary').dateRangePicker({});
$('#passportexpiry').dateRangePicker({});
$('#travel_month').dateRangePicker({});
$('#query_month').dateRangePicker({});
function advanceSearchFields(){
$("#advance_search").toggle('slow');
}
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 selcetedData=selectedIdsArray.join(",");
$.ajax({
url: "/customer/assign-agency-user",
type: "POST",
dataType: 'json',
data: {'data':myArray,'aid':userDetail},
beforeSend:function(){
$(".assignMsg").html('Please wait...');
},
success: function(data){
if(data.status=='success'){
var $select = $("#agencyUser").selectize();
var selectize = $select[0].selectize;
var selectedUser = selectize.getValue();
var userhtmlname=selectize.getItem(selectize.getValue())[0].innerHTML;
$(selcetedData).html(userhtmlname);
$(".assignMsg").html('Record Updated');
$(".assignMsg").fadeOut(4000);
}
return false;
},
error:function(){
$(".assignMsg").html("Some error occured.Please try after some time.");
$(".assignMsg").fadeOut(4000);
}
});
}
function enableCityInput(className,idName){
$("."+className).removeAttr('disabled');
$("."+className).val('');
$("#"+idName).val();
}
$.validator.addMethod("mobileNoLength", function (value, element) {
return this.optional(element) || (value.length == 10);
}, "Please enter a valid number.");
$.validator.addMethod("noStartEndWhiteSpaces", function (value, element) {
return this.optional(element) || /^[a-zA-Z0-9](?:[a-zA-Z0-9 ]*[a-zA-Z0-9])?$/.test(value);
}, "Spaces are not allowed.");
$.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.text('OK!').addClass('valid')
//element.addClass('success').html('<i class="fa fa-check"></i>')
element.addClass('success').closest('.control-group').removeClass('error').addClass('success');
},
rules: {
"phonenumber": {
required: false,
mobileNoLength: true,
number: true,
noStartEndWhiteSpaces: true,
maxlength: 10
},
"emailid": {
email:true,
},
"atleastone": {
require_from_group: [1, ".filterdata"]
}
},
messages: {
"phonenumber":'',
"emailid": {
email: 'Please enter a valid email id.'
}
},
errorLabelContainer: '.errorTxt',
});
</script>
<script src="<?php echo $this->baseUrl('public/assets/js/bootstrap3-typeahead.js'); ?>"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.atleastone').on('blur change',function(){
var atleastVal = $(this).val();
//alert(atleastVal)
if(atleastVal!=""){
$("#atleastone").val(1);
}else{
$("#atleastone").val('');
}
});
$('#filter-btn').on('click',function(){
var passportexpiry = $('#passportexpiry').val();
var query_month = $('#query_month').val();
if(passportexpiry!="" || query_month!=""){
$("#atleastone").val(1);
}else{
//$("#atleastone").val('');
}
});
$('.atleastone').on('ifChecked', function (event) {
$("#atleastone").val(1);
});
$('.atleastone').on('ifUnchecked', function (event) {
$("#atleastone").val('');
});
$('.city_auto_suggest').typeahead({
items: 'all',
source: function(query, process) {
//$('.passenger_city').val('');
return $.ajax({
url: '/package-booking/autosuggest',
type: 'post',
data: {query: query},
dataType: 'json',
success: function (result) {
var resultList = result.map(function (item) {
var aItem = { TBBCityId: item.TBBCityId,CityId: item.CityId, label: item.label, countryCode: item.countryCode,ContId:item.ContId };
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.label.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(JSON.stringify(item));
else if (~item.label.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.label.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
return '<strong>' + match + '</strong>'
})
},
updater: function(item) {
var item = JSON.parse(item);
var idIndex = this.$element.attr('seq');
$('#'+idIndex).val(item.CityId);
return item.label;
},
minLength:2
// displayField: 'label',
});
});
function kp_numeric(e){
if(window.event) {
// for IE, e.keyCode or window.event.keyCode can be used
keynum = e.keyCode;
}
else if(e.which) {
// netscape
keynum = e.which;
}
else {
// no event, so pass through
return true;
}
if ((keynum != 46) && (keynum != 8) && (keynum < 48 || keynum > 57))
return false;
}
</script>
<style>
label.success {
position: relative;
top: -25px;
right: 10px;
float: right;
width: 16px;
height: 16px;
display: inline-block;
color:#449D44;
}
.error { bottom:-15px; }
</style>