<?php
/**
 * GFB Customer Appointment View Front-end
 *
 * @package GFB.
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}
?>

<div class="apbgf-custom-top-nav-wrapper">
	<?php
	$export_pro_modal_id = 'apbgf-service-pro-modal';
	if ( 'apbgf-appointment' === $post_type ) {
		$export_pro_modal_id = 'apbgf-appointment-pro-modal';
	} elseif ( 'apbgf-customer' === $post_type ) {
		$export_pro_modal_id = 'apbgf-customer-pro-modal';
	}

	if ( 'apbgf-appointment' === $post_type ) {
		?>
		<div class="apbgf-appointment-filter-container">
			<div id="reportrange">
				<i class="fa fa-calendar"></i>&nbsp;
				<span></span> <i class="fa fa-caret-down"></i>
				<input type="hidden" name="date_from" readonly />
				<input type="hidden" name="date_to" readonly />
				<?php 
				$nonce = wp_create_nonce('apbgf-appointment-filter-nonce-action');
				echo '<input type="hidden" name="apbgf-appointment-filter-nonce" value="' . esc_attr( $nonce ) . '" />';
				?>
			</div>
		</div>
		<?php
	}
	?>

	<span class="apbgf-export-pro-trigger apbgf-export-pro-trigger--select apbgf-pro-trigger" data-apbgf-pro-modal="<?php echo esc_attr( $export_pro_modal_id ); ?>">
		<select name="apbgf_export_type" id="apbgf-export-type" class="disabled-block" disabled>
			<option value=""><?php echo esc_html__('Select Export Format', 'appointment-and-booking-for-gravity-forms'); ?></option>
			<option value="csv"><?php echo esc_html__('CSV', 'appointment-and-booking-for-gravity-forms'); ?></option>
		</select>
		<button type="button" class="apbgf-export-pro-overlay" aria-label="<?php esc_attr_e( 'Upgrade to Pro', 'appointment-and-booking-for-gravity-forms' ); ?>"></button>
	</span>

	<span class="apbgf-export-pro-trigger apbgf-export-pro-trigger--button apbgf-pro-trigger" data-apbgf-pro-modal="<?php echo esc_attr( $export_pro_modal_id ); ?>">
		<input type="submit" class="disabled-block" id="apbgf-export" name="apbgf-export-submit" disabled value="<?php echo esc_html__('Export', 'appointment-and-booking-for-gravity-forms'); ?>" />
		<button type="button" class="apbgf-export-pro-overlay" aria-label="<?php esc_attr_e( 'Upgrade to Pro', 'appointment-and-booking-for-gravity-forms' ); ?>"></button>
	</span>
	<?php
		$nonce = wp_create_nonce('apbgf_export_nonce_action');
		echo '<input type="hidden" name="apbgf_export_nonce" value="' . esc_attr($nonce) . '"/>';
	?>
	<?php
	if ( 'apbgf-customer' === $post_type ) {
		?>
		<a class="apbgf-add-button" data-id="apbgf-import-modal" href="#"><?php echo esc_html__('Import', 'appointment-and-booking-for-gravity-forms'); ?></a>
		<?php
	}
	?>
</div>

