<?php $__env->startSection('styles'); ?>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('title'); ?>
    FMI Checker
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <!-- Begin Page Content -->
    <div class="container">

        <!-- Page Heading -->
        
    <div id="preloader" class="preloader"></div>
        <div class="d-flex align-items-center p-3 my-3 text-white bg-primary rounded shadow-sm">
            <svg class="bd-placeholder-img flex-shrink-0 me-2 rounded" width="32" height="32"
                xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 32x32"
                preserveAspectRatio="xMidYMid slice" focusable="false">
                <title>Placeholder</title>
                <rect width="100%" height="100%" fill="var(--white)"></rect><text x="50%" y="50%"
                    fill="var(--white)" dy=".3em">32x32</text>
            </svg>

            <div class="ml-2">
                <h1 class="h6 mb-0 text-white lh-1">FMI Checker</h1>
                <small><a class="text-white" href="<?php echo e(url('admin/dashboard')); ?>">dashboard</a> > fmi-checker</small>
            </div>
        </div>
        <!-- Content Row -->
        <div class="row">
            <div class="col-sm-12">
                <div class="card mb-4 shadow">
                    <div class="card-body">
                        <form action="<?php echo e(url($prefix . 'check')); ?>" method="post">
                            <?php echo csrf_field(); ?>
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="form-group">
                                        <label class="small">IMEI Bulck Or Single <span class="text-danger">*</span></label>
                                        <textarea name="imei" id="imei" cols="30" rows="10" class="form-control" required placeholder="IMEI LIST" ></textarea>
                                        <?php $__errorArgs = ['template'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                            <span class="text-danger small"><?php echo e($message); ?></span>
                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="text-right mt-4">
                                        <a class="btn btn-secondary text-uppercase font-weight-bold rounded pl-4 pr-4"
                                            href="<?php echo e(url()->previous()); ?>">Cancel</a>
                                        <button class="btn btn-primary text-uppercase font-weight-bold rounded pl-4 pr-4 submit"
                                            type="submit" >Submit</button>
                                    </div>
                                </div>
                            </div>
                            <div class="row flex-row mt-1">
                                <?php if(isset($data)): ?>
                                <?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="col-sm-4 mt-2">
                                    <div class="card shadow h-100">
                                        <div class="card-body">
                                            <?php echo $d; ?>

                                            <?php if(strpos($d, '</font>')): ?> </div>  <?php endif; ?>
                                        </div>
                                    </div>
                                </div>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <?php endif; ?>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <small class="d-block text-end mt-3">

        </small>
    </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
    <script>
        window.onload = function(){
            var el = document.getElementById('preloader');
            el.style.display = 'none';
        };
        $(".submit").on("click", function(){
            var val = $("#imei").val()
            if(val != ''){
                var el = document.getElementById('preloader');
            el.style.display = 'block';
            }
        })
        $("#imei").on("keydown",function(e) {
        var isChrome = window.chrome;
        var valueText = $(this).val();
        var lengthValue = $(this).val().replace(/(\r\n|\n|\r)/g,"");
        let len =  lengthValue.length
            if(len > 0 && len % 15 == 0 && e.keyCode !== 46 && e.keyCode !== 8){
            $("#imei").val(valueText + "\n")
        }
        
        
    })
    $("#imei").on("paste",function(e) {
        e.preventDefault()
        var paste, valueText, count
        paste = (event.clipboardData || window.clipboardData).getData('text');
        paste = paste.replaceAll(/(\r\n|\n|\r)/g,"")
        valueText = this.value
        count =0 
        for (let index = 0; index < paste.length; index++) {
            if(index % 15 == 0 && index !== 0){
                valueText += paste.slice(count * 15, index)+"\n" 
                count += 1
                console.log(valueText)
            }
        }
        
        $(this).val(valueText+paste.slice(count * 15))
    })
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('components.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Users/tharukadananjaya/Documents/long-term-projects/iServer_v6/resources/views/admin/fmi-checker/index.blade.php ENDPATH**/ ?>