<?php if (isset($component)) { $__componentOriginal8e2ce59650f81721f93fef32250174d77c3531da = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\AppLayout::class, []); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
    <div class="">
        <div class="w-content">
            <div class="row page-stats-area">
                <div class="col item">
                    <div class="content-box">
                        <p class="title">Available Energy</p>
                        <p class="amount"><?php echo e(Auth::user()->energy); ?> <span>Energy</span></p>
                    </div>
                    <div class="icon-area green">
                        <i class="fas fa-coins icon"></i>
                    </div>
                </div>
            </div>
        </div>
        <div class="banner d-block d-md-none text-center m-auto" style="margin-top: 30px;">
            <div class="d-inline-block text-center m-auto"></div>
        </div>
        <div class="banner d-none d-md-block d-lg-none text-center m-auto" style="margin-top: 30px;">
            <div class="d-inline-block text-center m-auto">
                <!--banner-->
            </div>
        </div>
        <div class="banner d-none d-lg-block text-center" style="margin-top: 30px;">
            <div class="d-inline-block text-center m-auto">
                <!--banner-->
            </div>
        </div>
        <div class="m-area">
            <p class="title">Auto Claim</p>
            <a href="<?php echo e(route('autoclaim.history')); ?>">
                <div class="button-box">
                    <p class="view"><i class="fas fa-history" style="margin-right: 5px;"></i> History</p>
                </div>
            </a>
            <div class="clearfix"></div>
            <form name="form-auto" id="form-auto" action="<?php echo e(route('autoclaim.store')); ?>" method="post">
            <?php echo csrf_field(); ?>
                <div class="form">
                    <div class="mid-600">
                        <p class="title-s text-center mt-40"><i class="fas fa-arrow-right icon"></i>Choose the
                            currencies for starting the Auto Claim</p>
                        <div class="clearfix"></div>
                        <p class="desc-s">All the currencies that you select will be claimed in the same tab!</p>
                        <div class="clearfix"></div>
                        <div class="row mt-40">
                            <?php $__currentLoopData = $coins; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$coin): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="col">
                                <label class="cwrapper text-uppercase" onclick="myFunction()">
                                    <?php echo e($coin->short_name); ?>

                                    <input type="checkbox" class="currencies" name="currencies[]"
                                        value="<?php echo e($coin->short_name); ?>">
                                    <span class="checkmark"></span>
                                </label>
                                <input type="hidden" name="reward_<?php echo e($coin->short_name); ?>" value="<?php echo e($coin->reward_amount); ?>" />
                                <input type="hidden" name="energy_<?php echo e($coin->short_name); ?>" value="<?php echo e($coin->consume_energy); ?>" />
                            </div>
                            <?php if(++$key % 4 == 0): ?>
                            <div class="w-100"></div>
                            <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                        </div>
                        <hr>
                        <p class="title-s text-center mt-40"><i class="fas fa-arrow-right icon"></i>Choose the frequency
                        </p>
                        <div class="clearfix"></div>
                        <p class="desc-s">There are several options for the frequency!</p>
                        <div class="clearfix"></div>
                        <fieldset id="frequency">
                            <div class="row mt-25">
                                <div class="col">
                                    <label class="rwrapper">2 minutes
                                        <input type="radio" name="frequency" onclick="myFunction()"
                                            id="auto-frequency-radio" value="1">
                                        <span class="checkmark"></span>
                                    </label>
                                </div>
                                <div class="col">
                                    <label class="rwrapper">5 minutes
                                        <input type="radio" name="frequency" onclick="myFunction()"
                                            id="auto-frequency-radio" value="2">
                                        <span class="checkmark"></span>
                                    </label>
                                    <div class="info-s">(1% bonus)</div>
                                </div>
                                <div class="col">
                                    <label class="rwrapper">10 minutes
                                        <input type="radio" name="frequency" onclick="myFunction()"
                                            id="auto-frequency-radio" value="3">
                                        <span class="checkmark"></span>
                                    </label>
                                    <div class="info-s">(2% bonus)</div>
                                </div>
                            </div>
                        </fieldset>
                        <hr>
                        <p class="title-s text-center mt-40"><i class="fas fa-arrow-right icon"></i>Payment Boost</p>
                        <div class="clearfix"></div>
                        <p class="desc-s">You can boost the payment by choosing one of them. As
                            much as it is boosted,
                            the FCT Token cost will be increased!</p>
                        <div class="clearfix"></div>
                        <fieldset id="boost">
                            <div class="row mt-25">
                                <div class="col">
                                    <label class="rwrapper">1x
                                        <input type="radio" name="boost" onclick="myFunction()" id="auto-boost-radio"
                                            value="1">
                                        <span class="checkmark"></span>
                                    </label>
                                </div>
                                <div class="col">
                                    <label class="rwrapper">2x
                                        <input type="radio" name="boost" onclick="myFunction()" id="auto-boost-radio"
                                            value="2">
                                        <span class="checkmark"></span>
                                    </label>
                                </div>
                                <div class="col">
                                    <label class="rwrapper">3x
                                        <input type="radio" name="boost" onclick="myFunction()" id="auto-boost-radio"
                                            value="3">
                                        <span class="checkmark"></span>
                                    </label>
                                </div>
                                <div class="col">
                                    <label class="rwrapper">4x
                                        <input type="radio" name="boost" onclick="myFunction()" id="auto-boost-radio"
                                            value="4">
                                        <span class="checkmark"></span>
                                    </label>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                    <div class="mid-600 auto-prev">
                        <hr>
                        <p class="title-s text-center mt-40"><i class="fas fa-arrow-right icon"></i>Estimated Rates</p>
                        <div class="clearfix"></div>
                        <div id="rates" class="rates"></div>
                    </div>
                    <div class="mid-300">
                        <button type="submit" class="btn btn-primary">Claim</button>
                    </div>
                </div>
                <div class="clearfix"></div>
            </form>
        </div>
        <div class="banner d-block d-md-none text-center m-auto" style="margin-top: 30px;">
            <div class="d-inline-block text-center m-auto">
                <!--banner-->
            </div>
        </div>
        <div class="banner d-none d-md-block d-lg-none text-center m-auto" style="margin-top: 30px;">
            <div class="d-inline-block text-center m-auto"></div>
        </div>
        <div class="banner d-none d-lg-block text-center" style="margin-top: 30px;">
            <div class="d-inline-block text-center m-auto"></div>
        </div>
        <?php if (isset($component)) { $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4 = $component; } ?>
<?php $component = $__env->getContainer()->make(Illuminate\View\AnonymousComponent::class, ['view' => 'components.footer','data' => []]); ?>
<?php $component->withName('footer'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?> <?php if (isset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4)): ?>
<?php $component = $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4; ?>
<?php unset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4); ?>
<?php endif; ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
    </div>
    <script>
    function myFunction() {
        var currencies = []
        var checkboxes = document.querySelectorAll('input[class=currencies]:checked')
        for (var i = 0; i < checkboxes.length; i++) {
            //console.log($(`input:hidden[name=reward_${checkboxes[i].value}]`).val())
            currencies.push(checkboxes[i].value)
        }
        //console.log(currencies)

        var frequency = []
        checkboxes = document.querySelectorAll('input[name=frequency]:checked')
        for (var i = 0; i < checkboxes.length; i++) {
            frequency.push(checkboxes[i].value)
        }
        //console.log(frequency[0])

        var boost = []
        checkboxes = document.querySelectorAll('input[name=boost]:checked')
        for (var i = 0; i < checkboxes.length; i++) {
            boost.push(checkboxes[i].value)
        }
        //console.log(boost[0])

        if (currencies.length > 0 && frequency.length > 0 && boost.length > 0) {
            $(".auto-prev").show()
            $(".rates").html('');
            $.each(currencies, function(ind, elem) {
                //$("#values").last().html('you will be earn' + elem);
                let reward = $(`input:hidden[name=reward_${elem}]`).val();
                let energy = $(`input:hidden[name=energy_${elem}]`).val();
                
                let bonusPrint = '';
                let minutes = 2;
                if(frequency[0] > 1){
                    let bonus = 0;
                    if(frequency[0] == 2){
                        bonus = (reward/100)*1;
                        minutes = 5;
                    }else if(frequency[0] == 3){
                        bonus = (reward/100)*2;
                        minutes = 10;
                    }else{
                        minutes = 2;
                    }
                    bonusPrint = `+ <span>${parseFloat(bonus).toFixed(8)}</span> <span class="text-uppercase">${elem}</span> bonus`;
                }

                reward = reward * boost[0];
                energy = energy * boost[0];

                $(".rates").append(`
                <div class="item">
                            <p><span>${parseFloat(reward).toFixed(8)}</span> <span class="text-uppercase">${elem}</span> ${bonusPrint}
                                will be sent every ${minutes} minutes for <span>${energy}</span> <span>Energy!</span></p>
                        </div>
                `);
            });
        }

    }
    </script>
 <?php if (isset($__componentOriginal8e2ce59650f81721f93fef32250174d77c3531da)): ?>
<?php $component = $__componentOriginal8e2ce59650f81721f93fef32250174d77c3531da; ?>
<?php unset($__componentOriginal8e2ce59650f81721f93fef32250174d77c3531da); ?>
<?php endif; ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?><?php /**PATH /home/jorgeserranodev/Escritorio/Projects/timebitco.in/autoclaim/resources/views/autoclaim/index.blade.php ENDPATH**/ ?>