<?php echo $__env->make('layouts.auth-layout.auth-header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>


<style>
    .otp-input {
        text-align: center; /* Centrer le texte */
    }
     #resend {
        cursor: pointer;
    }
</style>

<?php if(session('status')): ?>
    <div class="toastrDefaultSuccess" role="alert" style="display: none;">
        <?php echo e(session('status')); ?>

    </div>
<?php endif; ?>


<div class="container-xxl mt-lg-5">
    <div class="authentication-wrapper authentication-basic container-p-y">
        <div class="authentication-inner py-4">
            <!-- Forgot Password -->
            <div class="card">
                <div class="card-body">
                    <!-- Logo -->
                    <div class="d-flex justify-content-center mb-3">
                        <span class="app-brand-logo text-success fw-bolder fs-3">Vérification de l'E-mail</span>
                    </div>
                    <!-- /Logo -->
                    <div class="d-flex justify-content-center mt-3">
                        <p class="text-center">Entrer le code OTP de validation</p>
                    </div>
                    <form id="formAuthentication" class="m-4" method="POST" action="<?php echo e(route('verification.verify')); ?>" enctype="multipart/form-data">
                        <?php echo csrf_field(); ?>
                        <!-- Champ input caché pour stocker l'e-mail de l'utilisateur -->
                        <input type="hidden" name="email" value="<?php echo e(auth()->user()->email); ?>">
                        <div class="form-group row justify-content-center">
                            <div class="row">
                                <div class="col-md-3 col-3">
                                    <!-- Champ input 1 -->
                                    <input id="otp1" type="text" maxlength="1" class="form-control otp-input <?php $__errorArgs = ['otp1'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" name="otp1" required autocomplete="off" pattern="\d*">
                                    <?php $__errorArgs = ['otp1'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <span class="invalid-feedback" role="alert">
                                        <strong><?php echo e($message); ?></strong>
                                    </span>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                                <div class="col-md-3 col-3">
                                    <!-- Champ input 2 -->
                                    <input id="otp2" type="text" maxlength="1" class="form-control otp-input <?php $__errorArgs = ['otp2'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" name="otp2" required autocomplete="off" pattern="\d*">
                                    <?php $__errorArgs = ['otp2'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <span class="invalid-feedback" role="alert">
                                        <strong><?php echo e($message); ?></strong>
                                    </span>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                                <div class="col-md-3 col-3">
                                    <!-- Champ input 3 -->
                                    <input id="otp3" type="text" maxlength="1" class="form-control otp-input <?php $__errorArgs = ['otp3'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" name="otp3" required autocomplete="off" pattern="\d*">
                                    <?php $__errorArgs = ['otp3'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <span class="invalid-feedback" role="alert">
                                        <strong><?php echo e($message); ?></strong>
                                    </span>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                                <div class="col-md-3 col-3">
                                    <!-- Champ input 4 -->
                                    <input id="otp4" type="text" maxlength="1" class="form-control otp-input <?php $__errorArgs = ['otp4'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" name="otp4" required autocomplete="off" pattern="\d*">
                                    <?php $__errorArgs = ['otp4'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <span class="invalid-feedback" role="alert">
                                        <strong><?php echo e($message); ?></strong>
                                    </span>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row mb-0">
                            <div class="col-md-12 text-center">
                                <button type="submit" class="btn btn-success w-md-50 w-100 mt-3">Vérifier</button>
                            </div>
                        </div>
                    </form>

                    <div class="text-center mt-5">
                        <form id="resendOpt" class="mb-3" method="POST" action="<?php echo e(route('resendOTP')); ?>">
                            <?php echo csrf_field(); ?>
                            <input type="hidden" name="email" value="<?php echo e(auth()->user()->email); ?>">
                            <div class="text-success" id="resend">Renvoyer le code OTP</div>
                        </form>
                    </div>
                </div>
            </div>
            <!-- /Forgot Password -->
        </div>
    </div>
</div>




  <!-- /.modal -->
<!-- / Content -->

<?php echo $__env->make('layouts.auth-layout.auth-footer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

<script>
    $(function() {
        $('.toastrDefaultSuccess').each(function() {
            toastr.success($(this).text());
        });
    });
</script>


<script>
    window.addEventListener('online', function() {
        toastr.success('Internet connection restored.');
    });

    window.addEventListener('offline', function() {
        toastr.error('Internet connection lost.');
    });
</script>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        var inputs = document.querySelectorAll('.otp-input');
        for (var i = 0; i < inputs.length; i++) {
            inputs[i].addEventListener('input', function(event) {
                // Vérifier si la saisie est un chiffre
                if (/^\d$/.test(this.value)) {
                    // Déplacer le focus vers le champ suivant
                    var maxLength = parseInt(this.getAttribute('maxlength'));
                    var currentLength = this.value.length;
                    if (currentLength >= maxLength) {
                        var index = Array.prototype.indexOf.call(inputs, this);
                        if (index < inputs.length - 1) {
                            inputs[index + 1].focus();
                        }
                    }
                } else {
                    // Supprimer les caractères non numériques
                    this.value = this.value.replace(/\D/g, '');
                }
            });
        }
    });
</script>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        // Sélectionner l'élément avec l'ID resend
        var resendButton = document.getElementById('resend');

        // Ajouter un écouteur d'événement de clic
        resendButton.addEventListener('click', function() {
            // Soumettre le formulaire resendOpt
            document.getElementById('resendOpt').submit();
        });
    });
</script>

<?php /**PATH C:\Users\damal\Desktop\Expertik\GreatimesVersion2.0\resources\views/auth/verification.blade.php ENDPATH**/ ?>