<?php
/**
 * Load admin view for WPLoginForm.
 *
 * @package miniorange-sms-order-notification-otp-verification/controllers/forms/
 */

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

if ( ! current_user_can( 'manage_options' ) ) {
	wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'miniorange-sms-order-notification-otp-verification' ) );
}

use WCSMSOTP\Handler\Forms\WPLoginForm;
use WCSMSOTP\Helper\MoUtility;

$mowc_handler                = WPLoginForm::instance();
$mowc_wp_login_enabled       = (bool) $mowc_handler->is_form_enabled() ? 'checked' : '';
$mowc_wp_login_hidden        = 'checked' === $mowc_wp_login_enabled ? '' : 'hidden';
$mowc_wp_login_enabled_type  = (bool) $mowc_handler->savePhoneNumbers() ? 'checked' : '';
$mowc_wp_login_field_key     = $mowc_handler->get_phone_key_details();
$mowc_wp_login_admin         = (bool) $mowc_handler->byPassCheckForAdmins() ? 'checked' : '';
$mowc_wp_login_with_phone    = (bool) $mowc_handler->allowLoginThroughPhone() ? 'checked' : '';
$mowc_wp_handle_duplicates   = (bool) $mowc_handler->restrict_duplicates() ? 'checked' : '';
$mowc_wp_enabled_type        = $mowc_handler->get_otp_type_enabled();
$mowc_wp_phone_type          = $mowc_handler->get_phone_html_tag();
$mowc_wp_email_type          = $mowc_handler->get_email_html_tag();
$mowc_form_name              = $mowc_handler->get_form_name();
$mowc_skip_pass              = $mowc_handler->getSkipPasswordCheck() ? 'checked' : '';
$mowc_skip_pass_fallback_div = $mowc_handler->getSkipPasswordCheck() ? 'block' : 'hidden';
$mowc_skip_pass_fallback     = $mowc_handler->getSkipPasswordCheckFallback() ? 'checked' : '';
$mowc_user_field_text        = $mowc_handler->getUserLabel();

$mowc_login_form_file = MOV_WC_DIR . 'views/forms/mowploginform.php';
if ( ! MoUtility::mo_require_file( $mowc_login_form_file, MOV_WC_DIR ) ) {
	return;
}
require $mowc_login_form_file;
