<?php
/**
 * Contact info 
 */
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

global $fbbttm_cartobj,$cartsummary,$fbbttm_helperobj; 
global $fbbttm_allowed_html;
$userid = $fbbttm_helperobj->fbbttm_check_user_loginornot();

$userdata = array();

$email = '';	
$readonly =$hide='';

if(!empty($userid))
{
	$hide = 'hide';
	$userdata = $fbbttm_helperobj->fbbttm_get_user_info($userid);

	if(!empty($userdata))
	  {
	 		$email = $userdata->user_email;
	  }

	if(!empty($email))
	  {
	 		$readonly = 'readonly';
 	  }

}


?> 

<div class="fbbttm-cehckout-logininfo <?php echo esc_html($hide);?>">

	<h4 class="fbbttm-h4-title"><?php echo esc_html__('Contact information','foodboxbooker');?></h4>

	<div class="fbbttm-contact-info <?php echo esc_html($hide);?>">

		<div class="">
			<label><?php echo esc_html__('We`ll use this email to send you details and updates about your order.','foodboxbooker');?></label>
			<input type="text" name="fbbttm-email" value="<?php echo esc_html($email);?>" id="fbbttm-email" <?php echo esc_html($readonly);?>>
			<div class="fbbttm-error fbbttm-email"> </div>
		</div>
		<div class="fbbttm-email-class-exist"></div>
	</div>

	<div class="fbbttm-login-content" style="display: none;">
		<form name="fbbttm-loginform" id="fbbttm-loginform" method="post">
			<?php
			// Noncename needed to verify where the data originated
			   wp_nonce_field( 'fbbttm_meta_box_nonce', 'fbbttm_meta_box_noncename' );
			?>
				<div class="">
					<label for="<?php echo esc_html__('User Name / email ','foodboxbooker');?>">
						<?php echo esc_html__('User Name','foodboxbooker');?><span class="required"> <?php echo esc_html__('*','foodboxbooker');?></span>
					</label>
					<input type="text" name="fbbttm-username" id="fbbttm-username">
					<div class="fbbttm-error fbbttm-username"></div>
				</div>
				<div class="">
					<label for="<?php echo esc_html__('Password','foodboxbooker');?>">
						<?php echo esc_html__('Password','foodboxbooker');?><span class="required"> <?php echo esc_html__('*','foodboxbooker');?></span>
					</label>
					<input type="password" name="fbbttm-password" id="fbbttm-password">
					<div class="fbbttm-error fbbttm-password"></div>
				</div>
				<div class="">
					<input type="submit" name="fbbttm-submitlogin" id="fbbttm-submitlogin" value="Submit">
				</div>
				<div class="fbbttm-lostpassword-chk">
					<label><?php echo esc_html__('Lost Password','foodboxbooker');?></label>
				</div>
				

				<div class="fbbttm-loginform-message">
				</div>

				<div class="fbbttm-loader hide"></div> 
			</form>
			<div class="hide fbbttm-lostpasswordform">
					<?php
					$passwordpath = FBBTTM_DIR . 'templates/lost-password.php';

					$fbbttm_lostpassword  =  $fbbttm_helperobj->fbbttm_get_filecontent( $passwordpath);

					echo wp_kses($fbbttm_lostpassword,$fbbttm_allowed_html);
					?>
				</div>
		</div>

</div>