| 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/leaddetail/ |
Upload File : |
<?php
$packageThemeList = $this->packageThemeList;
$packageFoodPreferenceList=$this->packageFoodPreferenceList;
$packageInclusionList = $this->packageInclList;
$cityListArray = $this->cityListArray;
$sessionPackageSearchData = new Zend_Session_Namespace('sessionPackageSearchData');
$searchResult = $sessionPackageSearchData->searchData;
$leadDetail = $this->leadDetail;
$roominfojson = json_decode($leadDetail['RoomInfoJson'],true);
//echo $roominfojson;
$adultPax =0;
$childPax =0;
$infantPax =0;
//echo "<pre>";print_r($roominfojson);echo "</pre>";die;
if(!empty($roominfojson) ){
foreach($roominfojson as $res){
$adultPax += $res['Adult'];
$childPax += $res['Child'];
$infantPax += @$res['Infant'];
}
}
$travellers=$adultPax+$childPax+$infantPax;
$PackTypeMaskArr = str_split(@$leadDetail['PackTypeMask']);
$FoodTypeMaskArr = str_split(@$leadDetail['CuisineMask']);
$priceRangeArr = Zend_Controller_Action_HelperBroker::getStaticHelper('PackageSearch')->getPriceRange();
//print_r($PackTypeMaskArr);
$InclMaskArr = str_split(@$leadDetail['InclMask']);
$DestinationPlaces = explode(',',$leadDetail['DestinationPlacesSysId']);
$DestinationPlacesSysId = explode(',',$leadDetail['DestinationPlaces']);
for($j=0;$j<count($DestinationPlacesSysId);$j++){
$going_to_destination[] = trim($DestinationPlaces[$j]).'__'.trim($DestinationPlacesSysId[$j]);
}
if(!empty($cityListArray) ){
foreach ($cityListArray as $cityData) {
$cityData['CityId'].'__'.$cityData['Title'];
if(in_array($cityData['CityId'].'__'.$cityData['Title'] , $going_to_destination)){
$selected = 'selected';
}
}
}
$customerId = $this->customerId;
$getpricerange = $leadDetail['MinPrice'].'__'.$leadDetail['MaxPrice'];
?>
<div class="col-md-12 no-padding leadeBorder" style="padding-top:20px !important;" id="modpackagedetail">
<!--<form name="PackageSearchForm" id="PackageSearchForm" method="POST" action="/packagesearch/search-result">-->
<div class="col-md-12">
<div class="alert alert-danger" style="display: none;">
<span id="errorMessage">Package is not available for search criteria, please try another combination</span>
</div>
</div>
<input type="hidden" name="modify_goingfrom" value="<?php echo trim($leadDetail['SourcePlaces']); ?>" id="modify_goingfrom" />
<input type="hidden" name="modify_goingto" value="<?php echo trim($leadDetail['DestinationPlaces']); ?>" id="modify_goingto" />
<input type="hidden" name="modify_specificdate" value="<?php echo (isset($leadDetail['StartDate']) && ($leadDetail['StartDate']->format('d-M-y')!='01/01/1900'))?$leadDetail['StartDate']->format('d-M-y'):''; ?>" id="modify_specificdate" />
<input type="hidden" name="modify_pricerange" value="<?php echo @$getpricerange; ?>" id="modify_pricerange" />
<input type="hidden" name="modify_inclusions" value="<?php echo $leadDetail['InclMask']; ?>" id="modify_inclusions" />
<input type="hidden" name="modify_theme" value="<?php echo $leadDetail['PackTypeMask']; ?>" id="modify_theme" />
<input type="hidden" name="modify_multipledestination" value="<?php echo $leadDetail['Cities']; ?>" id="modify_theme" />
<input type="hidden" name="modify_totaltravelers" value="<?php echo $travellers; ?>" id="modify_totaltravelers" />
<form name="PackageSearchForm" id="PackageSearchForm" method="POST">
<input type="hidden" name="isFromSearchResult" id="isFromSearchResult" value="0">
<input type="hidden" name="MinPax" id="MinPax" value="0">
<input type="hidden" name="itenaryID" id="itenaryID" value="<?php echo $leadDetail['itenaryID'];?>">
<input type="hidden" name="TPSysId" id="TPSysId" value="<?php echo $leadDetail['TPSysId'];?>">
<input type="hidden" name="is_source" id="is_source" value="CRM">
<input type="hidden" name="customerID" id="customerID" value="<?php echo $customerId;?>">
<div class="col-md-4">
<div class="form-group">
<label><strong>Going From</strong></label>
<span class="red">*</span>
<input name="search_going_f" id="search_going_f" class="form-control" type="text" placeholder="City Name" value="<?php echo trim($leadDetail['SourcePlaces']); ?>" onkeyup="get_city_autosuggest('search_going_f','search_going_from','');" >
<input type="hidden" id="search_going_from" name="search_going_from" value="<?php echo trim($leadDetail['SourcePlaceSysId']).'__'.trim($leadDetail['SourcePlaces']); ?>"/>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label><strong>Going to</strong></label>
<span class="red">*</span>
<input name="search_going" id="search_going" class="form-control" type="text" placeholder="City Name" value="<?php echo trim($leadDetail['DestinationPlaces']); ?>" onkeyup="get_city_autosuggest('search_going','search_going_to','');">
<input type="hidden" id="search_going_to" name="search_going_to" value="<?php echo trim($leadDetail['DestinationPlacesSysId']).'__'.trim($leadDetail['DestinationPlaces']); ?>"/>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label><strong>Specific Date</strong></label>
<div class="input-group ls-group-input">
<input class="form-control datePickerOnly" placeholder="dd/mm/yy" type="text" name="search_specific_date" value="<?php echo (isset($leadDetail['StartDate']) && ($leadDetail['StartDate']->format('d-M-y')!='01/01/1900'))?$leadDetail['StartDate']->format('d-M-y'):''; ?>" id="search_specific_date"/>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
<div class="clear"></div></div>
</div>
<div class="col-md-4">
<div class="form-group">
<label><strong>Travelers</strong></label>
<input type="hidden" name="roominfojson" id="roominfojson" value="">
<div class="travelerboxMain">
<div class="travelerbox" id="travelers"><?php echo @$travellers ? @$travellers : 2;?></div>
<div class="roomBoxMain">
<div class="roomBoxMainIn" id="roomloopres">
<?php for ($roomCounter = 1; $roomCounter <= CONST_PACKAGE_TRAVELER_MAX_ROOM; $roomCounter++) { ?>
<?php $displayROomCOnd = count($roominfojson) ? count($roominfojson) : 1; ?>
<div class="roomLoop" id="rmres_<?php echo @$roomCounter ?>" <?php if ($roomCounter > $displayROomCOnd){ ?> style="display:none;" <?php } ?>>
<!--<h1>Room <?php // echo @$roomCounter ?></h1>-->
<h1>Room <?php echo @$roomCounter ?><?php if ($roomCounter > 1) { ?><a class="disproom disproom_<?php echo @$roomCounter ?>" style="cursor:pointer; <?php if ($roomCounter == $displayROomCOnd) { echo "display:inline-block;"; } else { echo 'display:none;'; } ?>" onclick="delroom(<?php echo @$roomCounter ?>)">(x)</a><?php } ?></h1>
<div class="travelerIn"><div class="travelerLft">ADULTS (+12 YRS)</div>
<div class="travelerrght">
<select id="adult_<?php echo @$roomCounter; ?>" name="adult_<?php echo @$roomCounter; ?>" class="demo-default select-country counttraveler" placeholder="Select">
<?php
$adultDefaultSelected=($roominfojson[$roomCounter]['Adult'] > 0)?$roominfojson[$roomCounter]['Adult']:2;
for ($i = 1; $i <= CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM; $i++) {
$selected = ($adultDefaultSelected == $i) ? 'selected' : '';
echo "<option value='$i' $selected>$i</option>";
}
?>
</select>
</div>
<div class="clear"></div></div>
<div class="travelerIn"><div class="travelerLft">CHILDREN(2 - 11YRS)</div>
<div class="travelerrght">
<select onChange="showchildagebox('<?php echo @$roomCounter; ?>')" id="child_<?php echo @$roomCounter; ?>" name="child_<?php echo @$roomCounter; ?>" class="demo-default select-country counttravelerchild" placeholder="Select">
<?php
for ($i = 0; $i <= CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM; $i++) {
$selected = ($roominfojson[$roomCounter]['Child'] == $i) ? 'selected' : '';
echo "<option value='$i' $selected>$i</option>";
}
?>
</select>
</div>
<div class="clear"></div></div>
<div class="travelerIn"><div class="travelerLft">INFANT(0 - 2YRS)</div>
<div class="travelerrght">
<select id="infant_<?php echo @$roomCounter; ?>" name="infant_<?php echo @$roomCounter; ?>" class="demo-default select-country counttravelerinfant" placeholder="Select">
<?php
for ($i = 0; $i <= CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM; $i++) {
$selected = ($roominfojson[$roomCounter]['Infant'] == $i) ? 'selected' : '';
echo "<option value='$i' $selected>$i</option>";
}
?>
</select>
</div>
<div class="clear"></div></div>
<div class="travelerIn extrabedcl">
<?php
$searchexbed = 'extrabed_'.@$roomCounter;
$childAges=array();
if(isset($roominfojson[$roomCounter]['Child'])){
if($roominfojson[$roomCounter]['Child'] > 0){
for($g=1;$g<=$roominfojson[$roomCounter]['Child'];$g++){
$childAges[$g]=@$roominfojson[$roomCounter]['ChildAge_'.$g];
}
}
} //echo count($childAges);
?>
<?php $bedType = @$roominfojson[$roomCounter]['bedtype']; ?>
<input type="radio" name="extrabed_<?php echo @$roomCounter; ?>" id="extrabed_<?php echo @$roomCounter; ?>" value="extrabed" <?php echo ($bedType == 'extrabed') ? 'checked' : ''; ?> > Extra Bed
<input type="radio" name="extrabed_<?php echo @$roomCounter; ?>" id="extrabed_<?php echo @$roomCounter; ?>" value="withoutbed" <?php echo ($bedType == 'withoutbed') ? 'checked' : ''; ?> > Without Bed
<input type="radio" name="extrabed_<?php echo @$roomCounter?>" id="extrabed_<?php echo @$roomCounter?>" value="none" <?php if($bedType == 'none') { echo 'checked'; } else { if($bedType == ''){ echo "checked"; } } ?>> None
<div class="clear"></div>
</div>
<div class="travelerInChild childcl_<?php echo @$roomCounter; ?>" <?php if(isset($roominfojson[$roomCounter]['Child']) && $roominfojson[$roomCounter]['Child'] > 0) {?>style="display:block;" <?php } else { ?>style="display:none;"<?php } ?> >
<div class="travelerInChildTop">AGE OF CHILDREN</div>
<div class="travelerInChildBottom">
<?php
for ($ageChildCounter = 1; $ageChildCounter <= CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM; $ageChildCounter++) { ?>
<div class="col-md-3 childage_<?php echo @$roomCounter ?>" style="padding:0 4px; display:<?php if($ageChildCounter <= @$roominfojson[$roomCounter]['Child']){ echo "block"; } else { echo "none"; } ?>" id="child_<?php echo @$roomCounter; ?>_<?php echo @$ageChildCounter; ?>">
<select class="form-control input-sm whbg" name="child_<?php echo @$roomCounter; ?>_<?php echo @$ageChildCounter; ?>" style="padding:5px;">
<!--<option value="">Select</option>-->
<?php
$childAge = unserialize(CONST_PACKAGE_TRAVELER_CHILD_AGE);
foreach ($childAge as $age) {
$selected = ($roominfojson[$roomCounter]['ChildAge_'.$ageChildCounter]==$age) ? 'selected' : '';
echo "<option value='$age' $selected>$age yrs</option>";
}
?>
</select>
</div>
<?php } ?>
</div>
<div class="clear"></div></div>
<div class="clear"></div>
</div>
<?php } ?>
<input type="hidden" name="roomlp" id="roomlp" value="<?php echo count($roominfojson) > 0 ? count($roominfojson) : 1;?>">
<input type="hidden" name="totadlt" id="totadlt" value="<?php echo $adultPax > 0 ? $adultPax : 1;?>">
<input type="hidden" name="totchld" id="totchld" value="<?php echo $childPax > 0 ? $childPax : 0;?>">
<input type="hidden" name="totinfnt" id="totinfnt" value="<?php echo $infantPax > 0 ? $infantPax : 0;?>">
<input type="hidden" name="travelers" id="totaltravelers" value="<?php echo $travellers > 0 ? $travellers : 1;?>" >
<a class="btn btn-primary" style="width:100%;" onClick="return addroom();">Add another room</a>
<div class="clear" style="padding-bottom:10px"></div>
<!--<button class="btn btn-success" data-dismiss="modal" style="width:100%;">Done</button>-->
<a class="btn btn-success" data-dismiss="modal" style="width:100%;" onClick="tottraveller()">Done</a>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label><strong>Price Range</strong></label>
<select id="search_price_range" name="search_price_range" class="demo-default select-country" placeholder="Select">
<?php
foreach ($priceRangeArr as $key => $value) {
$selected = ($value[key] == $getpricerange) ? 'selected' : '';
echo "<option value='$value[key]' $selected>$value[value]</option>";
}
?>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label><strong>Inclusions</strong></label>
<select id="search_inclusions" name="search_inclusions[]" multiple class="demo-default select-theme">
<?php echo '<option value="">Select Inclusions</option>'; for($i=0;$i<count($packageInclusionList);$i++) { ?>
<option value="<?php echo $i?>" <?php if(@$InclMaskArr[$i+1]==1) { ?> selected="selected" <?php } else { }?>><?php echo $packageInclusionList[$i]['Title']?></option>
<?php } ?>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label><strong>Theme</strong></label>
<select id="search_theme" name="search_theme[]" multiple class="demo-default select-theme">
<?php echo '<option value="">Select Theme</option>'; for($i=0;$i<count($packageThemeList);$i++) { ?>
<option value="<?php echo $i;?>" <?php if(@$PackTypeMaskArr[$i+1]==1) { ?> selected="selected" <?php } else { }?>><?php echo $packageThemeList[$i]['Title']?></option>
<?php } ?>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label><strong>Add Remark</strong></label>
<input name="leadRemark" id="leadRemark" class="form-control" type="text" placeholder="Add Remark" value="<?php echo $leadDetail['leadRemark']; ?>">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label><strong>Multiple Destination</strong></label>
<span class="red">*</span>
<input name="multicities" id="multicities" class="form-control" type="text" readonly="readonly" placeholder="City Name" value="<?php echo $leadDetail['Cities']; ?>" >
</div>
</div>
<div class="col-md-4">
<div class="col-md-6">
<div class="form-group">
<label><strong>No Of Days</strong></label>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<input name="noofdaysfrom" maxlength="2" id="noofdaysfrom" class="form-control" onkeyup="return kp_numeric(event);" type="text" placeholder="From" value="<?php echo $leadDetail['DaysCountFrom']>0?$leadDetail['DaysCountFrom']:''; ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<input name="noofdaysto" maxlength="2" id="noofdaysto" class="form-control" onkeyup="return kp_numeric(event);" type="text" placeholder="To" value="<?php echo $leadDetail['DaysCountTo']>0?$leadDetail['DaysCountTo']:''; ?>">
</div>
</div>
</div>
<div class="col-md-4">
<div class="col-md-12 pull-left">
<div class="form-group">
<?php
$hotelpreferenceExplode=array();
$hotelpreference=$leadDetail['HotelPreference'];
if(isset($hotelpreference) && !empty($hotelpreference)){
$hotelpreferenceExplode=explode(',',$hotelpreference);
}
?>
<label><strong>Hotel Preference : </strong></label>
<label>1 <input type="checkbox" class="icheck-black" name="hotelpreference[]" value="1" <?php if(in_array(1,$hotelpreferenceExplode)){ echo "checked"; }?> /></label>:
<label>2 <input type="checkbox" class="icheck-black" name="hotelpreference[]" value="2" <?php if(in_array(2,$hotelpreferenceExplode)){ echo "checked"; }?>/></label>:
<label>3 <input type="checkbox" class="icheck-black" name="hotelpreference[]" value="3" <?php if(in_array(3,$hotelpreferenceExplode)){ echo "checked"; }?>/></label>:
<label>4 <input type="checkbox" class="icheck-black" name="hotelpreference[]" value="4" <?php if(in_array(4,$hotelpreferenceExplode)){ echo "checked"; }?>/></label>:
<label>5 <input type="checkbox" class="icheck-black" name="hotelpreference[]" value="5" <?php if(in_array(5,$hotelpreferenceExplode)){ echo "checked"; }?>/></label>
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label><strong>Food Preference</strong></label>
<select id="search_food" name="search_food[]" multiple class="demo-default select-theme">
<?php echo '<option value="">Select Food Preference</option>'; for($i=0;$i<count($packageFoodPreferenceList);$i++) { ?>
<option value="<?php echo $i;?>" <?php if(@$FoodTypeMaskArr[$i+1]==1) { ?> selected="selected" <?php } else { }?>><?php echo $packageFoodPreferenceList[$i]['Title']?></option>
<?php } ?>
</select>
</div>
</div>
<div class="col-md-12" align="right">
<a onclick="formSubmit();" class="btn btn-sm btn-danger btn-lg">Modify Query</a>
<?php if($this->proposalCount == 0 || ($this->proposalCount > 0 && $leadDetail['Readymade'] == 0)){ ?>
<a onclick="BulidPkg();" class="btn btn btn-success btn-sm ladda-button buildYourOwnButton">Build Your Own</a>
<?php } if($this->proposalCount == 0 || ($this->proposalCount > 0 && $leadDetail['Readymade'] > 0)){?>
<a onclick="modifyQuery();" class="btn btn-sm btn-warning btn-lg ">Search Package</a>
<?php } ?>
<img class="loaderimg" style="display: none;" id="loaderimg" src="<?php echo $this->baseUrl('public/assets/images/loader.gif'); ?>"/>
</div>
<div class="clear"></div>
<div class="col-md-12" style="text-align:center">
<span id="searchMessage" class="red"></span>
<a style="display: none;" id="jsId" href="#" class="btn btn btn-success btn-lg ladda-button">Build your own</a>
</div>
<div class="clear"></div>
</form>
</div>
<script type="text/javascript" src="<?php echo $this->baseUrl('public/js/packagetravelerformfunctions.js'); ?>"></script>
<script type="text/javascript">
var somethingChanged = false;
$(document).ready(function() {
$("#search_specific_date").datetimepicker({
format:'d/m/Y',
timepicker: false,
minDate: 0
});
});
function formSubmit() {
var modify_goingfrom=$.trim($("#modify_goingfrom").val());
var modify_goingto=$.trim($("#modify_goingto").val());
var modify_pricerange=$.trim($("#modify_pricerange").val());
var modify_inclusions=$.trim($("#modify_inclusions").val());
var modify_theme=$.trim($("#modify_theme").val());
var modify_specificdate=$.trim($("#modify_specificdate").val());
var modify_totaltravelers=$.trim($("#modify_totaltravelers").val());
var original_goingfrom=$.trim($("#search_going_f").val());
var original_goingto=$.trim($("#search_going").val());
var original_pricerange=$.trim($("#search_price_range").val());
var original_inclusions=$.trim($("#search_inclusions").val());
var original_theme=$.trim($("#search_theme").val());
var original_specificdate=$.trim($("#search_specific_date").val());
var original_totaltravelers=$.trim($("#totaltravelers").val());
var original_specificdate_split=original_specificdate.split('/');
var fit_start_time=original_specificdate_split[2]+-+original_specificdate_split[1]+-+original_specificdate_split[0];
var fit_end_time=getCurrentDate();
if(compareDate(fit_start_time,fit_end_time)==false){
alert('Query date is expired, please select date to create new query!');
$("#search_specific_date").focus();
return false;
}
//alert(modify_totaltravelers+"/"+original_totaltravelers);
if((modify_goingfrom != original_goingfrom) || (modify_goingto != original_goingto) || (modify_pricerange != original_pricerange) || (modify_specificdate != original_specificdate) || (modify_totaltravelers != original_totaltravelers)){
if(confirm('New query shall be created for the customer as you have changed the search/query criteria!')){
$("#isFromSearchResult").val(1);
$("#TPSysId").val('');
}
//$("#modify_TPSysId").val('');
//$("#sendpropform_isFromSearchResult").val(1);
} else{
alert('Query is already saved!');
return false;
}
var PackageSearchFormData = $('#PackageSearchForm').serialize();
$.ajax({
url: '/customer/savepackagequery',
data: PackageSearchFormData,
method: 'POST',
dataType: 'json',
error: function (err) {
// alert(err);
},
beforeSend: function () {
$('#loaderimg').css('display', 'inline-block');
},
success: function (response) {
//return false;
if (!response.success) {
//alert(response.msg);
$(".alert-danger").css("display", "block");
$("#errorMessage").html(response.msg);
}
else{
$.ajax({
url: '/packagesearch/packagesearch-result',
data: PackageSearchFormData,
method: 'POST',
dataType: 'json',
error: function (err) {
// alert(err);
},
beforeSend: function () {
$('#loaderimg').css('display', 'inline-block');
},
success: function (response) {
console.log(response);
if (response.status === 1) {
$('#searchMessage').html('');
$('#jsId').css('display', 'none');
window.location = '/packagesearch/search-result';
} else {
$(".alert-danger").css("display", "block");
$("#errorMessage").html('');
$("#errorMessage2").show();
}
$('#loaderimg').css('display', 'none');
//console.log(location.href+'/id/'+response.id);
// var newURL = location.href + '/id/' + response.id;
// window.history.pushState("object or string", "Title", newURL);
// alert(response);
}
});
}
}
});
}
function modifyQuery() {
var modify_goingfrom=$.trim($("#modify_goingfrom").val());
var modify_goingto=$.trim($("#modify_goingto").val());
var modify_pricerange=$.trim($("#modify_pricerange").val());
var modify_inclusions=$.trim($("#modify_inclusions").val());
var modify_theme=$.trim($("#modify_theme").val());
var modify_specificdate=$.trim($("#modify_specificdate").val());
var modify_totaltravelers=$.trim($("#modify_totaltravelers").val());
var original_goingfrom=$.trim($("#search_going_f").val());
var original_goingto=$.trim($("#search_going").val());
var original_pricerange=$.trim($("#search_price_range").val());
var original_inclusions=$.trim($("#search_inclusions").val());
var original_theme=$.trim($("#search_theme").val());
var original_specificdate=$.trim($("#search_specific_date").val());
var original_totaltravelers=$.trim($("#totaltravelers").val());
//alert(modify_specificdate+"/"+original_specificdate);
isFormDataChanged=false;
var original_specificdate_split=original_specificdate.split('/');
var fit_start_time=original_specificdate_split[2]+-+original_specificdate_split[1]+-+original_specificdate_split[0];
var fit_end_time=getCurrentDate();
if(compareDate(fit_start_time,fit_end_time)==false){
alert('Query date is expired, please click on Modify Query button to create new query!');
$("#search_specific_date").focus();
return false;
}
if((modify_goingfrom != original_goingfrom) || (modify_goingto != original_goingto) || (modify_pricerange != original_pricerange) || (modify_specificdate != original_specificdate) || (modify_totaltravelers != original_totaltravelers)){
if(confirm('New query shall be created for the customer as you have changed the search/query criteria!')){
$("#isFromSearchResult").val(1);
$("#TPSysId").val('');
}
//$("#modify_TPSysId").val('');
//$("#sendpropform_isFromSearchResult").val(1);
isFormDataChanged=true;
}
//return false;
var PackageSearchFormData = $('#PackageSearchForm').serialize();
$.ajax({
url: '/customer/modifypackagequery',
data: PackageSearchFormData,
method: 'POST',
dataType: 'json',
error: function (err) {
// alert(err);
},
beforeSend: function () {
$('#loaderimg').css('display', 'inline-block');
},
success: function (response) {
if (!response.success) {
//alert(response.msg);
$(".alert-danger").css("display", "block");
$("#errorMessage").html(response.msg);
}
else{
$("#TPSysId").val(response.TPSysId);
var PackageSearchFormData = $('#PackageSearchForm').serialize();
$.ajax({
url: '/packagesearch/packagesearch-result',
data: PackageSearchFormData,
method: 'POST',
dataType: 'json',
error: function (err) {
// alert(err);
},
beforeSend: function () {
$('#loaderimg').css('display', 'inline-block');
},
success: function (response) {
console.log(response);
if (response.status === 1) {
$('#searchMessage').html('');
$('#jsId').css('display', 'none');
window.location = '/packagesearch/search-result';
} else {
$(".alert-danger").css("display", "block");
$("#errorMessage").html(response.msg);
}
$('#loaderimg').css('display', 'none');
//console.log(location.href+'/id/'+response.id);
// var newURL = location.href + '/id/' + response.id;
// window.history.pushState("object or string", "Title", newURL);
// alert(response);
}
});
}
}
});
}
function BulidPkg(){
var modify_goingfrom=$.trim($("#modify_goingfrom").val());
var modify_goingto=$.trim($("#modify_goingto").val());
var modify_pricerange=$.trim($("#modify_pricerange").val());
var modify_inclusions=$.trim($("#modify_inclusions").val());
var modify_theme=$.trim($("#modify_theme").val());
var modify_totaltravelers=$.trim($("#modify_totaltravelers").val());
var modify_specificdate=$.trim($("#modify_specificdate").val());
var original_goingfrom=$.trim($("#search_going_f").val());
var original_goingto=$.trim($("#search_going").val());
var original_pricerange=$.trim($("#search_price_range").val());
var original_inclusions=$.trim($("#search_inclusions").val());
var original_theme=$.trim($("#search_theme").val());
var original_specificdate=$.trim($("#search_specific_date").val());
var original_totaltravelers=$.trim($("#totaltravelers").val());
//alert(modify_specificdate+"/"+original_specificdate);
isFormDataChanged=false;
if((modify_goingfrom != original_goingfrom) || (modify_goingto != original_goingto) || (modify_pricerange != original_pricerange) || (modify_specificdate != original_specificdate) || (modify_totaltravelers != original_totaltravelers)){
if(confirm('New query shall be created for the customer as you have changed the search/query criteria!')){
$("#isFromSearchResult").val(1);
$("#TPSysId").val('');
}
//$("#modify_TPSysId").val('');
//$("#sendpropform_isFromSearchResult").val(1);
isFormDataChanged=true;
}
//return false;
var PackageSearchFormData = $('#PackageSearchForm').serialize();
var is_currentowner = $("#currentOwner").prop("checked");
var currentOwnerSysId = $.trim($("#currentOwner").val());
if(is_currentowner == true){
var currentOwnerSysId='';
}
$.ajax({
url: '/customer/savepackagequerybyo',
data: PackageSearchFormData+'¤tOwnerSysId='+currentOwnerSysId,
method: 'POST',
dataType: 'json',
error: function (err) {
// alert(err);
},
beforeSend: function () {
$('#loaderimg').css('display', 'inline-block');
},
success: function (response) {
if (!response.success) {
//alert(response.msg);
$(".alert-danger").css("display", "block");
$("#errorMessage").html(response.msg);
}
else{
// alert(response.lastID);
$.ajax({
url: '/package/add-customer-package/id/'+response.lastID,
data: PackageSearchFormData+'¤tOwnerSysId='+currentOwnerSysId,
method: 'POST',
dataType: 'json',
error: function (err) {
// alert(err);
},
beforeSend: function () {
$('#loaderimg').css('display', 'inline-block');
},
});
window.location = '/package/add-customer-package/id/'+response.lastID;
}
}
});
}
// function addroom(){
// var roomlp = $("#roomlp").val();
// var showroom = parseInt(roomlp) + 1;
// $("#roomlp").val(showroom);
// $("#rmres_" + showroom).show();
// }
// function delroom(id) {
// var showroom = parseInt(id)-1;
// $("#roomlp").val(showroom);
// $("#rmres_" + id).hide();
// }
// function showchildagebox(id) {
// $('.extrabedcl').show();
// var childrencount = $("#child_" + id).val();
// var j;
// for (j = 1; j <= childrencount; j++) {
// $("#child_" + id + "_" + j).show();
// $("#childclage"+ id ).show();
// }
// if(childrencount == 0){
// $('.extrabedcl').hide();
// $('.childclage').hide();
// }
// }
function tottraveller() {
var totaladult = '0';
var totalchild = '0';
var totalinfant = '0';
var roomlp = $("#roomlp").val();
var childrenbed = [];
for (j = 1; j <= roomlp; j++) {
totaladult = parseFloat(totaladult) + parseFloat($("#adult_" + j).val());
totalchild = parseFloat(totalchild) + parseFloat($("#child_" + j).val());
totalinfant = parseFloat(totalinfant) + parseFloat($("#infant_" + j).val());
var extraBed = $('#extrabed_'+j+':checked').val();
childrenbed.push(extraBed);
}
var totaltraveller = parseInt(totaladult) + parseInt(totalchild) + parseInt(totalinfant);
$("#totadlt").val(totaladult);
$("#totchld").val(totalchild);
$("#totinfnt").val(totalinfant);
$("#travelers").html(totaltraveller);
$("#totaltravelers").val(totaltraveller);
$(".roomBoxMain").hide();
var roominfojson = '[{"totalRoom" : '+roomlp+'},{"totalTraveler" : '+totaltraveller+'},{"totaladult" : '+totaladult+'},{"totalchild" : '+totalchild+'},{"totalinfant" : '+totalinfant+'}]'
$("#roominfojson").val(roominfojson);
$(".roomBoxMain").hide();
}
function getCityfrom(){
$('#search_going_from').val('');
$("input[name=search_going_f]").autocomplete({
source: "/register/autosuggest-city",
minLength: 3,
focus: function (event, ui) {
event.preventDefault();
$("#tags").val(ui.item.label);
},
select: function (event, ui) {
event.preventDefault();
$("input[name=search_going_f]").val(ui.item.label);
$("#search_going_from").val(ui.item.value + '__' + ui.item.label).trigger('change');
$("#dispErrMessage").html('');
$(".alert-danger").css("display", "none");
}
});
}
// start : Code is added by Er Amit kumar Dubey on 10 April 2017 at 4:25 PM copied from ranvir singh's code for city
function get_city_autosuggest(inputId , hiddenInputId, countryInputId) {
$('#'+inputId).typeahead({
items: 'all',
source: function(query, process) {
$('#'+hiddenInputId).val('');
var countryId = (countryInputId) ? $("#"+countryInputId).val() : '';
return $.ajax({
url: '/buyhotel/autosuggest',
type: 'post',
async: true,
data: {query: query, countryId : countryId},
dataType: 'json',
success: function (result) {
var resultList = result.map(function (item) {
var aItem = { CityId: item.CityId, label: item.label, CityName: item.CityName};
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);
$('#'+hiddenInputId).val(item.CityId + '__' + item.CityName);
return item.label;
},
minLength:2,
// displayField: 'Title',
});
}
// end : Code is added by Er Amit Kumar Dubey on 10 April 2017
function getCityListF() {
$('#search_going_to').val('');
$("input[name=search_going]").autocomplete({
source: "/register/autosuggest-city",
minLength: 3,
focus: function (event, ui) {
event.preventDefault();
$("#tags").val(ui.item.label);
},
select: function (event, ui) {
event.preventDefault();
$("input[name=search_going]").val(ui.item.label);
$("#search_going_to").val(ui.item.value + '__' + ui.item.label).trigger('change');
$("#dispErrMessage").html('');
$(".alert-danger").css("display", "none");
}
});
}
</script>