<?php
/**
 * @var $data array
 */

use auctionforge\inc\helpers\SettingsHelper;

$id = uniqid();
$idForm = (!empty($data['name'])) ? $data['name'] : "loginSection";
$pageRegistrationId = SettingsHelper::getOption('registration', 0);
$pageAuthorizationId = SettingsHelper::getOption('authorization', 0);
$pageRegistration = "";
if ($pageRegistrationId) {
    $pageRegistration = get_permalink($pageRegistrationId);
}

$hiddenClass = apply_filters('bp_hidden_class', 'hidden');
if (is_page($pageAuthorizationId)) {
    $hiddenClass = "";
}
?>
<form id="<?= $idForm ?>" name="<?= $idForm ?>" action="#" class="bp-from bp-login-api">
    <div class="errors-group bp-text-red hidden"></div>
    <div class="hidden">
        <input type="hidden" name="overrideOthers" value="true">
        <input type="hidden" name="fromPortal" value="true">
    </div>
    <div class="bp-form-group">
        <div class="bp-form-group__inner">
            <input type="text" required placeholder="<?= __('Email', 'auctionforge') ?>" class="bp-form-control" name="email" id="loginEmail">
            <span class="bp-form-error hidden"></span>
        </div>
    </div>
    <div class="bp-form-group bp-form-group_svg bp_show_password-action">
        <div class="bp-form-group__inner">
            <div class="bp-form-group__inner">
                <input type="password" placeholder="<?= __('Password', 'auctionforge') ?>" class="bp-form-control bp-form-control_eye" name="password" id="loginPassword">
                <i class="bp_show_password svg-icon svg-eye"></i>
            </div>
            <span class="bp-form-error hidden"></span>
        </div>
    </div>
    <div class="bp-form-group bp-form-check">
        <input class="bp-form-check-input" name="remember" id="remember_<?= $id ?>" type="checkbox">
        <label class="bp-form-check-label" for="remember_<?= $id ?>"><?= __('Remember me', 'auctionforge') ?></label>
    </div>
    <div class="bp-form-group">
        <button id="sendLogin" type="submit" class="bp-btn bp-btn-black"><?= __('Login', 'auctionforge') ?></button>
    </div>
    <div class="bp-form-group bp-d-flex bp-f-center bp-f-wrap">
        <a class="bp-form-group__link doForgotten" href="#"><?= __('Forgot your password?', 'auctionforge') ?></a>
    </div>
    <?php if ($pageRegistration != "") { ?>
        <div class="bp-form-group separate-page-group bp-d-flex bp-f-center bp-f-wrap <?= $hiddenClass ?>">
            <a class="" href="<?= $pageRegistration ?>"><?= __('Not registered? Click here', 'auctionforge') ?></a>
        </div>
    <?php } ?>
</form>