Merge pull request #1805 from Azhar-Webkul/gli-3089
Fixed : Enable the currently disabled Latitude and Longitude fields in back-office.
This commit is contained in:
@@ -330,7 +330,6 @@ class ContactControllerCore extends FrontController
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'hotelsInfo' => $hotelsInfo,
|
||||
'viewOnMap' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'),
|
||||
'displayHotels' => Configuration::get('WK_DISPLAY_CONTACT_PAGE_HOTEL_LIST'),
|
||||
'gblHtlPhone' => $gblHtlPhone,
|
||||
'gblHtlEmail' => $gblHtlEmail,
|
||||
|
||||
@@ -128,7 +128,6 @@ class OurPropertiesControllerCore extends FrontController
|
||||
array(
|
||||
'hotelsInfo' => $hotelsInfo,
|
||||
'hotelLocationArray' => $hotelLocationArray,
|
||||
'viewOnMap' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'),
|
||||
'displayHotelMap' => $displayHotelMap,
|
||||
'WK_HTL_SHORT_DESC' => Configuration::get('WK_HTL_SHORT_DESC', $this->context->language->id),
|
||||
'currentIndex' => $this->context->link->getPageLink('our-properties')
|
||||
|
||||
@@ -415,6 +415,18 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
} elseif (!Validate::isCityName($city)) {
|
||||
$this->errors[] = $this->l('Enter a valid city name.');
|
||||
}
|
||||
if (Tools::getValue('loclatitude') !== '' && (!is_numeric(Tools::getValue('loclatitude')) || !Validate::isCoordinate($latitude))) {
|
||||
$this->errors[] = $this->l('Latitude is invalid.');
|
||||
}
|
||||
if (Tools::getValue('loclongitude') !== '' && (!is_numeric(Tools::getValue('loclongitude')) || !Validate::isCoordinate($longitude))) {
|
||||
$this->errors[] = $this->l('Longitude is invalid.');
|
||||
}
|
||||
if ($map_formated_address && !Validate::isCleanHtml(html_entity_decode($map_formated_address))) {
|
||||
$this->errors[] = $this->l('Map formatted address is invalid.');
|
||||
}
|
||||
if ($map_input_text && !Validate::isString($map_input_text)) {
|
||||
$this->errors[] = $this->l('Map location text is invalid.');
|
||||
}
|
||||
|
||||
//Since the address for the hotel is saved in the address table. We are validating the hotel address here manually.
|
||||
$addressValidation = Address::getValidationRules('Address');
|
||||
@@ -613,8 +625,8 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
$objHotelBranch->check_in = $check_in;
|
||||
$objHotelBranch->check_out = $check_out;
|
||||
$objHotelBranch->rating = $rating;
|
||||
$objHotelBranch->latitude = Validate::isCoordinate($latitude) ? Tools::ps_round($latitude, 8) : $latitude;
|
||||
$objHotelBranch->longitude = Validate::isCoordinate($longitude) ? Tools::ps_round($longitude, 8) : $longitude;
|
||||
$objHotelBranch->latitude = $latitude;
|
||||
$objHotelBranch->longitude = $longitude;
|
||||
$objHotelBranch->map_formated_address = $map_formated_address;
|
||||
$objHotelBranch->map_input_text = $map_input_text;
|
||||
$objHotelBranch->save();
|
||||
|
||||
@@ -258,17 +258,34 @@ var GoogleMapsManager = {
|
||||
}
|
||||
},
|
||||
setFormVars: function(params) {
|
||||
$('#loclatitude').val(params.lat);
|
||||
$('#loclongitude').val(params.lng);
|
||||
$('#loclatitude').val(Number(params.lat).toFixed(8));
|
||||
$('#loclongitude').val(Number(params.lng).toFixed(8));
|
||||
$('#locformatedAddr').val(params.formattedAddress);
|
||||
$('#googleInputField').val(params.inputText);
|
||||
},
|
||||
updateMarkerFromInputs: function() {
|
||||
if (!this.map) {
|
||||
return;
|
||||
}
|
||||
var latitude = Number($('#loclatitude').val());
|
||||
var longitude = Number($('#loclongitude').val());
|
||||
if (!latitude || !longitude) {
|
||||
return;
|
||||
}
|
||||
var latLng = {lat: latitude, lng: longitude};
|
||||
this.map.setCenter(latLng);
|
||||
this.addMarker(latLng, null, null, false);
|
||||
},
|
||||
}
|
||||
|
||||
$(document).on('click', 'button.gm-ui-hover-effect', function () {
|
||||
GoogleMapsManager.clearAllMarkers();
|
||||
});
|
||||
|
||||
$(document).on('change', '#loclatitude, #loclongitude', function () {
|
||||
GoogleMapsManager.updateMarkerFromInputs();
|
||||
});
|
||||
|
||||
function initGoogleMaps() {
|
||||
if (typeof enabledDisplayMap != 'undefined'
|
||||
&& $('#googleMapContainer').length
|
||||
|
||||
@@ -287,6 +287,18 @@
|
||||
<input class="form-control" type="" data-validate="" id="hotel_postal_code" name="hotel_postal_code" value="{if isset($smarty.post.hotel_postal_code)}{$smarty.post.hotel_postal_code}{elseif isset($edit)}{$address_info.postcode|escape:'htmlall':'UTF-8'}{/if}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-3" for="loclatitude">{l s='Latitude :' mod='hotelreservationsystem'}</label>
|
||||
<div class="col-sm-6">
|
||||
<input class="form-control" type="text" id="loclatitude" name="loclatitude" value="{if isset($smarty.post.loclatitude)}{$smarty.post.loclatitude|escape:'htmlall':'UTF-8'}{elseif isset($edit) && $hotel_info.latitude != 0}{$hotel_info.latitude|escape:'htmlall':'UTF-8'}{/if}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-3" for="loclongitude">{l s='Longitude :' mod='hotelreservationsystem'}</label>
|
||||
<div class="col-sm-6">
|
||||
<input class="form-control" type="text" id="loclongitude" name="loclongitude" value="{if isset($smarty.post.loclongitude)}{$smarty.post.loclongitude|escape:'htmlall':'UTF-8'}{elseif isset($edit) && $hotel_info.longitude != 0}{$hotel_info.longitude|escape:'htmlall':'UTF-8'}{/if}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">
|
||||
{l s='Hotel Policies :' mod='hotelreservationsystem'}
|
||||
@@ -309,8 +321,6 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{l s='Map:' mod='hotelreservationsystem'}</label>
|
||||
<div class="col-sm-6" id="googleMapContainer">
|
||||
<input type="hidden" id="loclatitude" name="loclatitude" value="{if isset($edit)}{$hotel_info.latitude|escape:'htmlall':'UTF-8'}{/if}" />
|
||||
<input type="hidden" id="loclongitude" name="loclongitude" value="{if isset($edit)}{$hotel_info.longitude|escape:'htmlall':'UTF-8'}{/if}" />
|
||||
<input type="hidden" id="locformatedAddr" name="locformatedAddr" value="{if isset($edit)}{$hotel_info.map_formated_address}{/if}" />
|
||||
<input type="hidden" id="googleInputField" name="googleInputField" value="{if isset($edit)}{$hotel_info.map_input_text}{/if}" />
|
||||
<div id="pac-input" class="controls" type="text"></div>
|
||||
|
||||
@@ -216,7 +216,7 @@
|
||||
<div class="col-xs-8">
|
||||
<p class="hotel-name"><span>{$hotel['hotel_name']}</span></p>
|
||||
<p class="hotel-branch-info-value">{$hotel['address']}, {$hotel['city']}, {if {$hotel['state_name']}}{$hotel['state_name']},{/if} {$hotel['country_name']}, {$hotel['postcode']}</p>
|
||||
{if ($hotel['latitude'] != 0 || $hotel['longitude'] != 0) && $viewOnMap}
|
||||
{if $hotel['latitude'] != 0 || $hotel['longitude'] != 0}
|
||||
<p class="hotel-branch-info-value">
|
||||
<a class="btn htl-map-direction-btn" href="http://maps.google.com/maps?daddr=({$hotel['latitude']},{$hotel['longitude']})" target="_blank">
|
||||
<span class="">{l s='View on map'}</span>
|
||||
|
||||
@@ -69,8 +69,6 @@ function initMap() {
|
||||
map = new google.maps.Map(document.getElementById("map"), PS_MAP_ID ? {mapId: PS_MAP_ID} : {});
|
||||
google.maps.event.trigger(map, 'resize');
|
||||
|
||||
map.setTilt(45);
|
||||
|
||||
// Display multiple markers on a map
|
||||
var infoWindow = new google.maps.InfoWindow();
|
||||
var marker;
|
||||
|
||||
@@ -37,8 +37,6 @@ function initMap() {
|
||||
map = new google.maps.Map(document.getElementById("map"), PS_MAP_ID ? {mapId: PS_MAP_ID} : {});
|
||||
google.maps.event.trigger(map, 'resize');
|
||||
|
||||
map.setTilt(45);
|
||||
|
||||
// Display multiple markers on a map
|
||||
var infoWindow = new google.maps.InfoWindow();
|
||||
var marker;
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
</p>
|
||||
<div class="hotel-branch-info-actions">
|
||||
<a href="{$hotel['view_rooms_link']}" target="_blank" class="btn btn-primary view_rooms_btn col-sm-6 col-xs-12">{l s='View Property'}</a>
|
||||
{if ($hotel['latitude'] != 0 || $hotel['longitude'] != 0) && $viewOnMap}
|
||||
{if $hotel['latitude'] != 0 || $hotel['longitude'] != 0}
|
||||
<a class="btn htl-map-direction-btn col-sm-6 col-xs-12" href="http://maps.google.com/maps?daddr=({$hotel['latitude']},{$hotel['longitude']})" target="_blank">{l s='View on map'}</a>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user