
<?php $__env->startSection('content'); ?>
    <div class="page-container">

        <div class="page-title-head d-flex align-items-sm-center flex-sm-row flex-column gap-2">
            <div class="flex-grow-1">
                <h4 class="fs-18 fw-semibold mb-0"><?php echo e($title); ?></h4>
            </div>

            <div class="text-end">
                <?php echo $__env->make('dashboard.user.layouts.components.breadcrumbs', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

            </div>
        </div>

        <div class="row">
            <?php echo $__env->make('dashboard.user.components.menu', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

            <div class="col-lg-12">
                <div class="card">
                    <div class="card-body">
                        <?php $__currentLoopData = $transferCodes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transferCode): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php if($transferCode->reference_id == $referenceId && $transferCode->order_no == request()->segment(6)): ?>
                                <div class="col-sm-12 col-md-12">
                                    <h4>Transfer in progress.....</h4>
                                    <div class="d-flex justify-content-center">
                                        <div class="progress" role="progressbar" aria-label="Success example"
                                            aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"
                                            style="height: 20px; width: 100%;">
                                            <div class="progress-bar bg-success" id="myProgressBar">
                                            </div>
                                        </div>

                                    </div>
                                    <div id="code_area" class="d-none text-center">
                                        <form
                                            action="<?php echo e(route('user.local_transfer.verify_code', [$transfer->reference_id, $orderNo])); ?>"
                                            class="code_form" method="POST">
                                            <?php echo csrf_field(); ?>
                                            <div id="message-area">
                                                <h5 class="text-center mt-2 mb-2">Transfer State:
                                                    <?php echo e(env('APP_NAME')); ?>

                                                    <?php echo e($transferCode->name); ?> CODE</h5>
                                                <h4 class="text-center mt-2 mb-2">Kindly insert your
                                                    <?php echo e($transferCode->name); ?> Code to facilitate the
                                                    transfer
                                                    of
                                                    your
                                                    funds to <span
                                                        class="text-uppercase text-success"><?php echo e($transfer->account_name); ?></span>
                                                    or contact <?php echo e(env('APP_EMAIL')); ?></h4>
                                            </div>

                                            <div class="form-group mt-2 col-sm-12 col-md-12 col-lg-6 offset-lg-3">
                                                <input type="hidden" name="verification_code_id"
                                                    value="<?php echo e($transferCode->verification_code_id); ?>">
                                                <input type="hidden" name="code_name" value="<?php echo e($transferCode->name); ?>">

                                                <div class="mb-3">
                                                    <label for="<?php echo e($transferCode->name); ?>"
                                                        class="d-none"><?php echo e($transferCode->name); ?>(<?php echo e($transferCode->description); ?>)</label>

                                                    <input type="text" id="<?php echo e($transferCode->name); ?>" name="code"
                                                        placeholder="Enter <?php echo e(ucwords($transferCode->name)); ?> Code"
                                                        class="form-control <?php $__errorArgs = ['code'];
$__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); ?>">
                                                    <?php $__errorArgs = ['code'];
$__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"><?php echo e($message); ?></span>
                                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <button class="btn btn-success" type="submit">VALIDATE</button>
                                            </div>

                                        </form>

                                    </div>
                                    <h6 class="mt-4 mb-4">Reference ID:
                                        <code><?php echo e($transferCode->reference_id); ?></code>
                                    </h6>
                                </div>
                            <?php endif; ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div><!-- end card-body -->
                </div><!-- end card -->
            </div>

        </div>

    </div>
    <script>
        let transferCodeCount = <?php echo e(count($transferCodes)); ?>;
        let transferSegment = <?php echo e((int) request()->segment(6)); ?>;
        console.log(transferSegment)
        var i = 0;

        function move(width, widthLimit) {
            if (i == 0) {
                i = 1;
                var elem = document.getElementById("myProgressBar");
                elem.style.width = width + "%";
                elem.innerText = width + "%";

                var id = setInterval(frame, 500);

                function frame() {
                    if (width >= widthLimit) {
                        clearInterval(id);
                        i = 0;
                        $("#code_area").removeClass('d-none')
                    } else {
                        width++;
                        elem.style.width = width + "%";
                        elem.innerHTML = width + "%";
                    }
                }
            }
        }
        if (transferCodeCount == 1) {
            if (transferSegment == 1) {
                move(1, 99);
            }
        }
        if (transferCodeCount == 2) {
            if (transferSegment == 1) {
                move(1, 40);
            }

            if (transferSegment == 2) {
                move(40, 75);
            }
        }
        if (transferCodeCount == 3) {
            if (transferSegment == 1) {
                move(1, 50);
            }

            if (transferSegment == 2) {
                move(50, 75);
            }
            if (transferSegment == 3) {
                move(75, 99);
            }
        }
        if (transferCodeCount == 4) {
            if (transferSegment == 1) {
                move(1, 25);
            }

            if (transferSegment == 2) {
                move(25, 50);
            }
            if (transferSegment == 3) {
                move(50, 75);
            }
            if (transferSegment == 4) {
                move(75, 99);
            }
        }
        if (transferCodeCount == 5) {
            if (transferSegment == 1) {
                move(1, 25);
            }

            if (transferSegment == 2) {
                move(25, 50);
            }
            if (transferSegment == 3) {
                move(50, 75);
            }
            if (transferSegment == 4) {
                move(75, 85);
            }
            if (transferSegment == 5) {
                move(85, 99);
            }
        }
        if (transferCodeCount == 6) {
            if (transferSegment == 1) {
                move(1, 25);
            }

            if (transferSegment == 2) {
                move(25, 45);
            }
            if (transferSegment == 3) {
                move(45, 65);
            }
            if (transferSegment == 4) {
                move(65, 75);
            }
            if (transferSegment == 5) {
                move(75, 85);
            }
            if (transferSegment == 6) {
                move(85, 99);
            }
        }

        setTimeout(() => {
            $("#myProgressBar").css('opacity', '1');
            move();
        }, 3000);
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('dashboard.user.layouts.master', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\projects\online-banking-v6.0\resources\views/dashboard/user/local_transfer/verify.blade.php ENDPATH**/ ?>