<?php
/**
 * Login Form
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/myaccount/form-login.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see     https://docs.woocommerce.com/document/template-structure/
 * @package WooCommerce/Templates
 * @version 3.6.0
 */

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

?>

<?php wc_print_notices(); ?>

<?php do_action( 'woocommerce_before_customer_login_form' ); 
$login_wrap_class = 'custom-login-wrap';
if ( get_option( 'woocommerce_enable_myaccount_registration' ) === 'yes' ) {
	$login_wrap_class = 'custom-login-wrap has-register-form';
}
?>

<div class="<?php echo esc_attr($login_wrap_class);?>">
	<h2 class="account-title"><?php esc_html_e('Please Sign In','aidoo'); ?></h2>
	<div class="custom-login">
		<div class="login-wrap">
			<h2 class="custom-title"><?php esc_html_e( 'Registered Customers', 'aidoo' ); ?></h2>
			<div class="custom-sub-title"><?php esc_html_e( 'If you have an account, sign in with your email address.', 'aidoo' ); ?></div>
			<form class="woocomerce-form woocommerce-form-login login" method="post">

				<?php do_action( 'woocommerce_login_form_start' ); ?>

				<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
					<input type="text" placeholder="Email..." class="woocommerce-Input woocommerce-Input--text input-text" name="username" id="username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( wp_unslash( $_POST['username'] ) ) : ''; ?>" />
				</p>
				<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
					<input placeholder="Password..." class="woocommerce-Input woocommerce-Input--text input-text" type="password" name="password" id="password" />
				</p>

				<?php do_action( 'woocommerce_login_form' ); ?>

				<p class="form-row">
					<?php wp_nonce_field( 'woocommerce-login', 'woocommerce-login-nonce' ); ?>
					<input type="submit" class="woocommerce-Button button nb-primary-button" name="login" value="<?php esc_attr_e( 'Log in', 'aidoo' ); ?>" />
					<div class="rememberme-wrap">
						<label class="woocommerce-form__label woocommerce-form__label-for-checkbox inline">
							<input class="woocommerce-form__input woocommerce-form__input-checkbox" name="rememberme" type="checkbox" id="rememberme" value="forever" /> <span><?php esc_html_e( 'Remember me', 'aidoo' ); ?></span>
						</label>
					</div>
				</p>
				<p class="woocommerce-LostPassword lost_password">
					<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php esc_html_e( 'Forgot your password?', 'aidoo' ); ?></a>
				</p>

				<?php do_action( 'woocommerce_login_form_end' ); ?>

			</form>
		</div>
	</div>

<?php if ( get_option( 'woocommerce_enable_myaccount_registration' ) === 'yes' ) : ?>
	<div class="custom-text">
		<div class="text-wrap">
			<h2 class="custom-title"><?php esc_html_e( 'New Customers', 'aidoo' ); ?></h2>
			<div class="custom-sub-title"><?php esc_html_e( 'Creating an account has many benefits:', 'aidoo' ); ?></div>
			<ul class="custom-list">
				<li><?php esc_html_e( 'Check out faster', 'aidoo' ); ?></li>
				<li><?php esc_html_e( 'Keep more than one address', 'aidoo' ); ?></li>
				<li><?php esc_html_e( 'Track orders', 'aidoo' ); ?></li>
				<li><?php esc_html_e( 'Track wishlist and more', 'aidoo' ); ?></li>
			</ul>
			<div class="custom-direct-register"><?php esc_html_e( 'Don\'t have an account? ', 'aidoo' ); ?><a href="#"><?php esc_html_e( 'Create one now.', 'aidoo' ); ?></a></div>
		</div>
	</div>

	<div class="custom-register">
		<div class="register-wrap">
			<h2 class="account-title"><?php esc_html_e( 'Create New Customer Account ', 'aidoo' ); ?><i class="icon-cancel"></i></h2>

			<form method="post" class="register">

				<?php do_action( 'woocommerce_register_form_start' ); ?>

				<?php if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) : ?>

					<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
						<label for="reg_username"><?php esc_html_e( 'Name', 'aidoo' ); ?> <span class="required">*</span></label>
						<input type="text" placeholder="Your name" class="woocommerce-Input woocommerce-Input--text input-text" name="username" id="reg_username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( wp_unslash( $_POST['username'] ) ) : ''; ?>" />
					</p>

				<?php endif; ?>

				<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
					<label for="reg_email"><?php esc_html_e( 'Email', 'aidoo' ); ?> <span class="required">*</span></label>
					<input type="email" placeholder="Email" class="woocommerce-Input woocommerce-Input--text input-text" name="email" id="reg_email" value="<?php echo ( ! empty( $_POST['email'] ) ) ? esc_attr( wp_unslash( $_POST['email'] ) ) : ''; ?>" />
				</p>

				<?php if ( 'no' === get_option( 'woocommerce_registration_generate_password' ) ) : ?>

					<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
						<label for="reg_password"><?php esc_html_e( 'Password', 'aidoo' ); ?> <span class="required">*</span></label>
						<input type="password" placeholder="Password" class="woocommerce-Input woocommerce-Input--text input-text" name="password" id="reg_password" />
					</p>

				<?php endif; ?>

				<!-- Spam Trap -->
				<div style="<?php echo ( ( is_rtl() ) ? 'right' : 'left' ); ?>: -999em; position: absolute;"><label for="trap"><?php esc_html_e( 'Anti-spam', 'aidoo' ); ?></label><input type="text" name="email_2" id="trap" tabindex="-1" autocomplete="off" /></div>

				<?php do_action( 'woocommerce_register_form' ); ?>

				<p class="woocomerce-FormRow form-row">
					<?php wp_nonce_field( 'woocommerce-register', 'woocommerce-register-nonce' ); ?>
					<button type="submit" class="woocommerce-Button button nb-primary-button" name="register" value="<?php esc_attr_e( 'Create an Account', 'aidoo' ); ?>"><?php esc_html_e( 'Create an Account', 'aidoo' ); ?></button>
				</p>

				<?php do_action( 'woocommerce_register_form_end' ); ?>

			</form>
		</div>

	</div>

<?php endif; ?>
</div>

<?php do_action( 'woocommerce_after_customer_login_form' ); ?>
