<?php
/**
 * Location tab
 *
 * @since  1.0.0
 *
 * @category  WordPress_Plugin
 * @package   QrCdr
 * @author    Nicola Franchini
 * @link      http://veno.es
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
?>
<div data-qrcdr-section="location" class="qrcdr-location tab-pane fade<?php echo esc_attr( $qrcdr_activesection ); ?>" id="qrcdr-location-<?php echo esc_attr( $form_id ); ?>" aria-labelledby="qrcdr-tab-location-<?php echo esc_attr( $form_id ); ?>">
	<h2 class="qrcdr-tab-title"><?php echo isset( $current_tab['label'] ) ? esc_html( $current_tab['label'] ) : ''; ?></h2>
	<?php
	$qrcdr_lat = qrcdr_settings()->get_option( 'lat', '40.7127837' );
	$qrcdr_lng = qrcdr_settings()->get_option( 'lng', '-74.00594130000002' );
	?>
	<p class="small"><?php esc_html_e( 'Search an address or drag the marker to adjust the position and get the coordinates', 'qrcdr' ); ?></p>
	<div class="row">
		<div class="col-md-6 form-group">
			<div class="input-group">
				<input type="text" class="form-control qrcdr-set-address nopreview" placeholder="<?php esc_html_e( 'Search', 'qrcdr' ); ?>">
				<button class="btn btn-outline-primary qrcdr-get-coordinates" type="button"><?php qrcdr_icons()->the_icon( 'ui', 'search' ); ?></button>
			</div>
		</div>
		<div class="col-md-3 form-group">
			<?php qrcdr_renderer()->the_input( $current_tab['inputs']['lat'] ); ?>
		</div>
		<div class="col-md-3 form-group">
			<?php qrcdr_renderer()->the_input( $current_tab['inputs']['lng'] ); ?>
		</div>
	</div>
	<div class="form-group">
		<div class="qrcdr-map" id="qrcdr-map-<?php echo esc_attr( $form_id ); ?>" data-lat="<?php echo esc_attr( $qrcdr_lat ); ?>" data-lng="<?php echo esc_attr( $qrcdr_lng ); ?>"></div>
	</div>
</div>