<style>
#infowindow-content .title {
  font-weight: bold;
}

#infowindow-content {
  display: none;
}

#map #infowindow-content {
  display: inline;
}

.pac-card {
  background-color: #fff;
  border: 0;
  border-radius: 2px;
  box-shadow: 0 1px 4px -1px rgba(0, 0, 0, 0.3);
  margin: 10px;
  padding: 0 0.5em;
  font: 400 18px Roboto, Arial, sans-serif;
  overflow: hidden;
  font-family: Roboto;
  padding: 0;
}

#pac-container {
  padding-bottom: 12px;
  margin-right: 12px;
}

.pac-controls {
  display: inline-block;
  padding: 5px 11px;
}

.pac-controls label {
  font-family: Roboto;
  font-size: 13px;
  font-weight: 300;
}

#pac-input {
  background-color: #fff;
  font-family: Roboto;
  font-size: 15px;
  font-weight: 300;
/*  margin-left: 12px;*/
  padding: 0 11px 0 13px;
  text-overflow: ellipsis;
/*  width: 400px;*/
}

#pac-input:focus {
  border-color: #4d90fe;
}

#title {
  color: #fff;
  background-color: #4d90fe;
  font-size: 25px;
  font-weight: 500;
  padding: 6px 12px;
}

    
</style>
<div id="home" class="tab-pane fade in tab_editprofile tab_editprofile1 active" >    
    <div class="change_password tab_editprofile">
        <div class="tab-content" id="myTabContent">
            <div class="col-sm-col-sm-offset-1 margin-10auto0 paddingRL10px">
                <div class="row">
                    <div class="col-sm-12" >
                        <fieldset class=""><legend><?php echo $this->translate('General Configuration'); ?></legend><span class="top-go clearfix"><a href="#topGo" title="Click To Go Top" class="btn btn-blue btn-xs pull-right"><i class="fa fa-chevron-up"></i></a></span>

                            <div class="form-group clearfix margintopbottom20">                                

                                <label class="col-sm-2 col-xs-12 control-label" for="hotel_name"> 
                                    <?php echo $this->translate($this->formLabel($form->get('name'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">                                    
                                    <?php echo $this->FormElement($form->get('name')); ?>
                                    <?php echo $this->formElementErrors($form->get('name'), ['class' => 'error']); ?>
                                </div>
                            </div>
                            
                            <div class="form-group clearfix margintopbottom20">
                                <label class="col-sm-2 col-xs-12 control-label" for="property_type">
                                    <?php echo $this->translate($this->formLabel($form->get('property_type'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('property_type')); ?>
                                    <?php echo $this->formElementErrors($form->get('property_type'), ['class' => 'error']); ?>
                                </div>

                                <label class="col-sm-2 col-xs-12 control-label" for="hotel_category">
                                    <?php echo $this->translate($this->formLabel($form->get('hotel_category'))); ?>    
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('hotel_category')); ?>
                                    <?php echo $this->formElementErrors($form->get('hotel_category'), ['class' => 'error']); ?>
                                </div>
                            </div>
                            
                            <div class="form-group clearfix margintopbottom20">
                                <label class="col-sm-2 col-xs-12 control-label" for="hotel_city">
                                    <?php echo $this->translate($this->formLabel($form->get('hotel_city'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('hotel_city')); ?>
                                    <?php echo $this->formElementErrors($form->get('hotel_city'), ['class' => 'error']); ?>
                                    <?php echo $this->FormElement($form->get('destination_city_id')); ?>
                                </div>

                                <label class="col-sm-2 col-xs-12 control-label" for="location">
                                    <?php echo $this->translate($this->formLabel($form->get('location'))); ?>    
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('location')); ?>
                                    <?php echo $this->formElementErrors($form->get('location'), ['class' => 'error']); ?>
                                </div>
                            </div>
                            
                            
                            
                               <div class="form-group clearfix margintopbottom20">
                                <label class="col-sm-2 col-xs-12 control-label" for="hotel_telephone">
                                    <?php echo $this->translate($this->formLabel($form->get('telephone'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('telephone')); ?>
                                    <?php echo $this->formElementErrors($form->get('telephone'), ['class' => 'error']); ?>
                                </div>

                                <label class="col-sm-2 col-xs-12 control-label" for="hotel_fax"> 
                                    <?php echo $this->translate($this->formLabel($form->get('fax'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">                                    
                                    <?php echo $this->FormElement($form->get('fax')); ?>
                                    <?php echo $this->formElementErrors($form->get('fax'), ['class' => 'error']); ?>
                                </div>
                            </div>

                            <div class="form-group clearfix margintopbottom20">
                                <label class="col-sm-2 col-xs-12 control-label" for="hotel_email">
                                    <?php echo $this->translate($this->formLabel($form->get('email'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('email')); ?>
                                    <?php echo $this->formElementErrors($form->get('email'), ['class' => 'error']); ?>
                                </div>
                                
                                <label class="col-sm-2 col-xs-12 control-label" for="hotel_building_no">
                                    <?php echo $this->translate($this->formLabel($form->get('building_number'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('building_number')); ?>
                                    <?php echo $this->formElementErrors($form->get('building_number'), ['class' => 'error']); ?>
                                </div>

                                
                            </div>

                            <div class="form-group clearfix margintopbottom20">
                                
                                <label class="col-sm-2 col-xs-12 control-label" for="hotel_building_name"> 
                                    <?php echo $this->translate($this->formLabel($form->get('building_name'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">                                    
                                    <?php echo $this->FormElement($form->get('building_name')); ?>
                                    <?php echo $this->formElementErrors($form->get('building_name'), ['class' => 'error']); ?>
                                </div>
                                
                                <label class="col-sm-2 col-xs-12 control-label" for="postal_code">
                                    <?php echo $this->translate($this->formLabel($form->get('postal_code'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('postal_code')); ?>
                                    <?php echo $this->formElementErrors($form->get('postal_code'), ['class' => 'error']); ?>
                                </div>
                            </div>

            <div class="form-group clearfix margintopbottom20">
                <label class="col-sm-2 col-xs-12 control-label" for="address">
                    <?php echo $this->translate($this->formLabel($form->get('address'))); ?>
                </label>
                <div class="col-sm-10 col-xs-10">
                    <?php echo $this->FormElement($form->get('address')); ?>
                    <?php echo $this->formElementErrors($form->get('address'), ['class' => 'error']); ?>
                </div>
            </div>
                            

                            <div class="form-group clearfix margintopbottom20">

                                <label class="col-sm-2 col-xs-12 control-label" for="latitude">
                                    <?php echo $this->translate($this->formLabel($form->get('latitude'))); ?>    
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('latitude')); ?>
                                    <?php echo $this->formElementErrors($form->get('latitude'), ['class' => 'error']); ?>
                                </div>

                                <div class="pac-card" id="pac-card">
                            <div style="display:none;">
                    <div id="title">Autocomplete Search</div>
                    <div id="type-selector" class="pac-controls">
             <input type="radio" name="type" id="changetype-all" checked="checked" />
                    <label for="changetype-all">All</label>

                    <input type="radio" name="type" id="changetype-establishment" />
                    <label for="changetype-establishment">establishment</label>

                    <input type="radio" name="type" id="changetype-address" />
                    <label for="changetype-address">address</label>

                    <input type="radio" name="type" id="changetype-geocode" />
                    <label for="changetype-geocode">geocode</label>

                    <input type="radio" name="type" id="changetype-cities" />
                    <label for="changetype-cities">(cities)</label>

                    <input type="radio" name="type" id="changetype-regions" />
                    <label for="changetype-regions">(regions)</label>
                    </div>
                    <br />
                    <div id="strict-bounds-selector" class="pac-controls">
                    <input type="checkbox" id="use-location-bias" value="" checked />
                    <label for="use-location-bias">Bias to map viewport</label>

                    <input type="checkbox" id="use-strict-bounds" value="" />
                    <label for="use-strict-bounds">Strict bounds</label>
                    </div>
                    </div>
                            <div id="pac-container" style="display:none">
                    <input id="pac-input" type="text" placeholder="Enter a location" />
                    </div>
                    </div>
                    <div id="map"></div>
                    <div id="infowindow-content">
                    <span id="place-name" class="title"></span><br />
                    <span id="place-address"></span>
                    </div>
                    
                    
                                
                            </div>  
                            
                            <div class="form-group clearfix margintopbottom20" style="margin-top:-266px;">
                                <label class="col-sm-2 col-xs-12 control-label" for="longitude">
                                    <?php echo $this->translate($this->formLabel($form->get('longitude'))); ?>    
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('longitude')); ?>
                                    <?php echo $this->formElementErrors($form->get('longitude'), ['class' => 'error']); ?>
                                    
                                </div>
                                
                            </div>
                                              
                            <div class="form-group clearfix margintopbottom20">
                                
                                <label class="col-sm-2 col-xs-12 control-label" for="hotel_url">
                                    <?php echo $this->translate($this->formLabel($form->get('url'))); ?>    
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('url')); ?>
                                    <?php echo $this->formElementErrors($form->get('url'), ['class' => 'error']); ?>
                                </div>
                                



                            </div>
                            
                            <div class="form-group clearfix margintopbottom20">
                                
                                <div class="col-sm-3">
<label class="booking-check"><?php echo $this->translate($this->formLabel($form->get('featured'))); ?>
 <?php echo $this->FormElement($form->get('featured')); ?>
       <span class="checkmark"></span>
</label>


</div>

<div class="col-sm-3">
<label class="booking-check"><?php echo $this->translate($this->formLabel($form->get('preferred'))); ?>
 <?php echo $this->FormElement($form->get('preferred')); ?>
       <span class="checkmark"></span>
</label>
</div>
                                
                            </div>

                            

                            <div class="form-group clearfix margintopbottom20" style="margin-top:-11px;">
                                <label class="col-sm-2 col-xs-12 control-label" for="total_floor">
                                    <?php echo $this->translate($this->formLabel($form->get('total_floor'))); ?>
                                </label>

                                <div class="col-sm-4 col-xs-10"><?php echo $this->FormElement($form->get('total_floor')); ?>
                                    <?php echo $this->formElementErrors($form->get('total_floor'), ['class' => 'error']); ?>                                </div>

                                
                            </div>
                            
                            <div class="form-group clearfix margintopbottom20">
                                
                                <label class="col-sm-2 col-xs-12 control-label" for="total_rooms_single">
                                    <?php echo $this->translate($this->formLabel($form->get('total_rooms_single'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('total_rooms_single')); ?>
                                    <?php echo $this->formElementErrors($form->get('total_rooms_single'), ['class' => 'error']); ?>

                                </div>
                                
                            </div>
                            <div class="form-group clearfix margintopbottom20">
                                <label class="col-sm-2 col-xs-12 control-label" for="total_rooms_double">
                                    <?php echo $this->translate($this->formLabel($form->get('total_rooms_double'))); ?>
                                </label>

                                <div class="col-sm-4 col-xs-10"><?php echo $this->FormElement($form->get('total_rooms_double')); ?>
                                    <?php echo $this->formElementErrors($form->get('total_rooms_double'), ['class' => 'error']); ?>                                </div>

                                
                            </div>
                            
                            <div class="form-group clearfix margintopbottom20">
                                
                                <label class="col-sm-2 col-xs-12 control-label" for="total_rooms_twin">
                                    <?php echo $this->translate($this->formLabel($form->get('total_rooms_twin'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('total_rooms_twin')); ?>
                                    <?php echo $this->formElementErrors($form->get('total_rooms_twin'), ['class' => 'error']); ?>

                                </div>
                                
                                 <label class="col-sm-2 col-xs-12 control-label" for="total_rooms_disabled">
                                    <?php echo $this->translate($this->formLabel($form->get('total_rooms_disabled'))); ?>
                                </label>

                                <div class="col-sm-4 col-xs-10"><?php echo $this->FormElement($form->get('total_rooms_disabled')); ?>
                                    <?php echo $this->formElementErrors($form->get('total_rooms_disabled'), ['class' => 'error']); ?>                                </div>
                                
                                
                            </div>

                            <div class="form-group clearfix margintopbottom20">

                               
                                
                                <label class="col-sm-2 col-xs-12 control-label" for="interconnected_total_rooms">
                                    <?php echo $this->translate($this->formLabel($form->get('interconnected_total_rooms'))); ?>
                                </label>

                                <div class="col-sm-4 col-xs-10"><?php echo $this->FormElement($form->get('interconnected_total_rooms')); ?>
                                    <?php echo $this->formElementErrors($form->get('interconnected_total_rooms'), ['class' => 'error']); ?>                                </div>

                                
                                <label class="col-sm-2 col-xs-12 control-label" for="total_conference_halls">
                                    <?php echo $this->translate($this->formLabel($form->get('total_conference_halls'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('total_conference_halls')); ?>
                                    <?php echo $this->formElementErrors($form->get('total_conference_halls'), ['class' => 'error']); ?>

                                </div>
                               

                            </div>

                            <div class="form-group clearfix margintopbottom20">
                                <label class="col-sm-2 col-xs-12 control-label" for="total_board_rooms">
                                    <?php echo $this->translate($this->formLabel($form->get('total_board_rooms'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('total_board_rooms')); ?>
                                   <?php echo $this->formElementErrors($form->get('total_board_rooms'), ['class' => 'error']); ?>

                                </div>
                                <label class="col-sm-2 col-xs-12 control-label" for="total_party_lawns">
                                    <?php echo $this->translate($this->formLabel($form->get('total_party_lawns'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('total_party_lawns')); ?>
                                    <?php echo $this->formElementErrors($form->get('total_party_lawns'), ['class' => 'error']); ?>

                                </div>

                            </div>
                          

                            <div class="form-group clearfix margintopbottom20">
                                <label class="col-sm-2 col-xs-12 control-label" for="check_in_time">
                                    <?php echo $this->translate($this->formLabel($form->get('check_in_time'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('check_in_time')); ?>
                                    <?php echo $this->formElementErrors($form->get('check_in_time'), ['class' => 'error']); ?>

                                </div>
                                <label class="col-sm-2 col-xs-12 control-label" for="check_out_time">
                                    <?php echo $this->translate($this->formLabel($form->get('check_out_time'))); ?>
                                </label>
                                <div class="col-sm-4 col-xs-10">
                                    <?php echo $this->FormElement($form->get('check_out_time')); ?>
                                    <?php echo $this->formElementErrors($form->get('check_out_time'), ['class' => 'error']); ?>

                                </div>

                            </div>

                            <div class="form-group clearfix margintopbottom20">
                                <label class="col-sm-2 col-xs-12 control-label" for="description">
                                    <?php echo $this->translate($this->formLabel($form->get('description'))); ?>
                                </label>
                                <div class="col-sm-10 col-xs-10">
                                    <?php echo $this->FormElement($form->get('description')); ?>
                                    <?php echo $this->formElementErrors($form->get('description'), ['class' => 'error']); ?>
                                </div>
                            </div>
                    </div>
                </div>
            </div>

        </div>

    </div>
    <?php echo $this->inlineScript()->appendFile($this->basePath('/js/tinymce/tinymce.min.js')); ?>

    
    <script src="<?php echo $google_map_url; ?>?key=<?php echo $google_map_key; ?>&callback=initMap&libraries=places&v=weekly" async defer></script>
    
    <script type="text/javascript">

function initMap() {
//    var latitude = parseFloat(document.getElementById("latitude").value);
//    alert(latitude);
//    if(latitude=='NaN'){
//        alert(1);
//        latitude = 40.749933;
//    }
//    var longitude = parseFloat(document.getElementById("longitude").value);
//    if(longitude==""){
//        longitude = -73.98633;
//    }
//    alert(latitude);
  const map = new google.maps.Map(document.getElementById("map"), {
    center: { lat: 40.749933, lng: -73.98633 },
    //center: { lat: latitude, lng: longitude },
    zoom: 13,
    mapTypeControl: false,
  });
  const card = document.getElementById("pac-card");
  const input = document.getElementById("pac-input");
  const biasInputElement = document.getElementById("use-location-bias");
  const strictBoundsInputElement = document.getElementById("use-strict-bounds");
  const options = {
    fields: ["formatted_address", "geometry", "name"],
    strictBounds: false,
    types: ["establishment"],
  };

  map.controls[google.maps.ControlPosition.TOP_LEFT].push(card);

  const autocomplete = new google.maps.places.Autocomplete(input, options);

  // Bind the map's bounds (viewport) property to the autocomplete object,
  // so that the autocomplete requests use the current map bounds for the
  // bounds option in the request.
  autocomplete.bindTo("bounds", map);

  const infowindow = new google.maps.InfoWindow();
  const infowindowContent = document.getElementById("infowindow-content");

  infowindow.setContent(infowindowContent);

  const marker = new google.maps.Marker({
    map,
    anchorPoint: new google.maps.Point(0, -29),
  });

  autocomplete.addListener("place_changed", () => {
    infowindow.close();
    marker.setVisible(false);

    const place = autocomplete.getPlace();

    if (!place.geometry || !place.geometry.location) {
      // User entered the name of a Place that was not suggested and
      // pressed the Enter key, or the Place Details request failed.
      window.alert("No details available for input: '" + place.name + "'");
      return;
    }

    // If the place has a geometry, then present it on a map.
    if (place.geometry.viewport) {
      map.fitBounds(place.geometry.viewport);
    } else {
      map.setCenter(place.geometry.location);
      map.setZoom(17);
    }

    marker.setPosition(place.geometry.location);
    marker.setVisible(true);
    infowindowContent.children["place-name"].textContent = place.name;
    infowindowContent.children["place-address"].textContent =
      place.formatted_address;
    infowindow.open(map, marker);
    
  });

  // Sets a listener on a radio button to change the filter type on Places
  // Autocomplete.
  function setupClickListener(id, types) {
    const radioButton = document.getElementById(id);

    radioButton.addEventListener("click", () => {
      autocomplete.setTypes(types);
      input.value = "";
    });
  }

  setupClickListener("changetype-all", []);
  setupClickListener("changetype-address", ["address"]);
  setupClickListener("changetype-establishment", ["establishment"]);
  setupClickListener("changetype-geocode", ["geocode"]);
  setupClickListener("changetype-cities", ["(cities)"]);
  setupClickListener("changetype-regions", ["(regions)"]);
  biasInputElement.addEventListener("change", () => {
    if (biasInputElement.checked) {
      autocomplete.bindTo("bounds", map);
    } else {
      // User wants to turn off location bias, so three things need to happen:
      // 1. Unbind from map
      // 2. Reset the bounds to whole world
      // 3. Uncheck the strict bounds checkbox UI (which also disables strict bounds)
      autocomplete.unbind("bounds");
      autocomplete.setBounds({ east: 180, west: -180, north: 90, south: -90 });
      strictBoundsInputElement.checked = biasInputElement.checked;
    }

    input.value = "";
  });
  strictBoundsInputElement.addEventListener("change", () => {
    autocomplete.setOptions({
      strictBounds: strictBoundsInputElement.checked,
    });
    if (strictBoundsInputElement.checked) {
      biasInputElement.checked = strictBoundsInputElement.checked;
      autocomplete.bindTo("bounds", map);
    }

    input.value = "";
    
  });
  
  google.maps.event.addListener(map, 'click', function(event) {
    document.getElementById('latitude').value = event.latLng.lat();
    document.getElementById('longitude').value =  event.latLng.lng();    
  });
}

window.initMap = initMap;
    
    </script>
