<?php defined('ABSPATH') or die("No script kiddies please!");
global $post;
$post_id = $post->ID;
$egpr_meta_option = get_post_meta($post_id, 'egpr_meta_option', true);
$location_name = (isset($egpr_meta_option['location_name']) && $egpr_meta_option['location_name'] != '')?$egpr_meta_option['location_name']:'';
$place_id = (isset($egpr_meta_option['place_id']) && $egpr_meta_option['place_id'] != '')?$egpr_meta_option['place_id']:'';
$phone_number = (isset($egpr_meta_option['phone_number']) && $egpr_meta_option['phone_number'] != '')?$egpr_meta_option['phone_number']:'';
$formated_address = (isset($egpr_meta_option['formated_address']) && $egpr_meta_option['formated_address'] != '')?$egpr_meta_option['formated_address']:'';
?>
<div class="egpr_gmap_section-wrapper egpr-rwrapper">
    <div class="egpr_field_type">
        <p class="description"><?php _e('Search google places from below google map, then location and its place id will be automatically listed on location name and place id field options.',EGPR_TD);?></p>
         <p class="description"><?php _e('Important Note: If you are having difficulty to find your google location through below map then you can search location through link - ',EGPR_TD);?>
           <a href="https://google-developers.appspot.com/my-business/content/tools/placeid-lookup" target="_blank">Get Place ID</a>
           <?php _e(' search google location from search field and copy place id and paste it to below field "Place ID" and copy location name and paste it to below field "Location Name"
           and simply save the data. Your location will be automatically displayed with place id in Google Map below.',EGPR_TD);?>
         </p>
         <input id="egpr-pac-input" class="controls" value="<?php echo esc_attr($location_name);?>" type="text" placeholder="Enter a location">
            <div id="map" style="width:100%;height:300px;"></div>
            <div id="infowindow-content">
              <span id="place-name" class="title"></span><br>
              Place ID 
              <span id="place-id"></span><br>
              
              <span id="place-address"></span>
            </div>
    </div>
    <div class="egpr-type-field">
          <label><h4>Location Name:</h4></label>
          <label class="egpr-noswitch">
             <input type="text" name="egpr_meta_option[location_name]" id="egpr_meta_location_name" value="<?php echo esc_attr($location_name);?>"/>
          </label>
    </div>
       <div class="egpr-type-field">
         <label><h4>Place ID:</h4></label>
         <label class="egpr-noswitch">
             <input type="text" name="egpr_meta_option[place_id]" id="egpr_meta_place_id" value="<?php echo esc_attr($place_id);?>"/>
         </label>
    </div>
     <input type="hidden" name="egpr_meta_option[phone_number]" id="egpr_meta_phone_no" value="<?php echo esc_attr($phone_number);?>"/>
     <input type="hidden" name="egpr_meta_option[formated_address]" id="egpr_meta_formated_address" value="<?php echo esc_attr($formated_address);?>"/>
</div>