

<?php
    $request = request();
?> 

<?php $__env->startSection('content'); ?>
<form action="<?php echo e(route('withdraws.withdraws.moneyApply')); ?>" method="post" enctype="multipart/form-data">
    <?php echo csrf_field(); ?>
    <div class="row justify-content-center gy-4">
        <div class="col-12 mt-4">
            <div class="page-heading mb-4">
                <h3 class="mb-2"><?php echo e(__($pageTitle)); ?></h3>
                <p>
                    <?php echo app('translator')->get('Take control of your withdrawals with our easy-to-use withdrawal system.'); ?>
                </p>
            </div>
            <hr>
        </div>

        <div class="col-12 mt-0">
            <div class="card">
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-8 withdraw-detail-border">
                            <div class="withdraw-detail">
                                <h4 class="text-muted title"><?php echo app('translator')->get('Your current balance is'); ?> 
                                    <span class="text--success withdraw-detail__balance">
                                        <?php echo e(showAmount($balance)); ?>

                                    </span>
                                </h4>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-12">
            <div class="card custom--card style--two">
                <div class="card-header card-title mb-0 bg-white">
                    <h5><?php echo app('translator')->get('Withdraw Request'); ?></h5>
                </div>
                <div class="card-body">
                    <div class="row">

                        <div class="col-md-3">
                            <div class="form-group">
                                <label class="form-label"><?php echo app('translator')->get('Method'); ?></label>
                                <input type="text" name="network" value="TRC20" class="form-control form--control" readonly>
                            </div>
                        </div>
                        
                        <div class="col-md-3">
                            <div class="form-group">
                                <label class="form-label"><?php echo app('translator')->get('Reach Amount'); ?></label>
                                <div class="input--group">
                                    <input type="number" step="any" name="amount" id="amount" value="<?php echo e($accounts->reached_amo); ?>" class="form-control form--control" required>
                                    <span class="input-group--text"><?php echo e(strtoupper(auth()->user()->currency)); ?></span>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-3">
                            <div class="form-group">
                                <label class="form-label"><?php echo app('translator')->get('Settle (%)'); ?></label>
                                <input type="number" step="any" name="percentage" id="percentage" value="<?php echo e($accounts->settle_per); ?>" class="form-control form--control" required>
                            </div>
                        </div>
                        
                        <div class="col-md-3">
                            <div class="form-group">
                                <label class="form-label"><?php echo app('translator')->get('Settle Amount'); ?></label>
                                <div class="input--group">
                                    <input type="number" step="any" name="settl_amount" id="settle_amount" value="<?php echo e($accounts->settle_amo); ?>" class="form-control form--control" readonly>
                                    <span class="input-group--text"><?php echo e(strtoupper(auth()->user()->currency)); ?></span>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-12">
                            <div class="form-group">
                                <label><?php echo app('translator')->get('Status'); ?></label>
                                <select class="form-select form--control" name="status" required>
                                    <option value="Y" <?php echo e($accounts->settle_status == 'Y' ? 'selected' : ''); ?>><?php echo app('translator')->get('Enabled'); ?></option>
                                    <option value="N" <?php echo e($accounts->settle_status == 'N' ? 'selected' : ''); ?>><?php echo app('translator')->get('Disabled'); ?></option>
                                </select>
                            </div>
                        </div>

                        <div class="col-md-12">
                            <div class="form-group">
                                <label class="col-form-label"><?php echo app('translator')->get('Google Authenticator Code'); ?></label>
                                <?php if(auth()->user()->ts == 'Y'): ?>
                                    <div class="alert alert-success p-2">
                                        ✅ <?php echo app('translator')->get('Please enter the correct 6-digit code.'); ?>
                                    </div>
                                    <input type="text" class="form--control border-success" name="g2fa_code" required placeholder="Enter 6-digit code">
                                <?php else: ?>
                                    <div class="alert alert-warning p-2">
                                        ⚠️ <?php echo app('translator')->get('2FA is disabled. Please enable it first to make changes.'); ?>
                                    </div>
                                    <input type="text" class="form--control border-warning" name="g2fa_code" disabled placeholder="2FA Required">
                                <?php endif; ?>
                            </div>
                        </div>

                        <div class="col-12">
                            <div class="withdraw_form"></div>
                            <button type="submit" class="btn btn--base w-100 mt-3"><?php echo app('translator')->get('Submit'); ?></button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>    
</form>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('script'); ?>
<script>
    const amountInput = document.getElementById('amount');
    const percentageInput = document.getElementById('percentage');
    const settleAmountInput = document.getElementById('settle_amount');

    function calculateSettleAmount() {
        const amount = parseFloat(amountInput.value) || 0;
        const percentage = parseFloat(percentageInput.value) || 0;
        const settle = (amount * percentage) / 100;
        settleAmountInput.value = settle.toFixed(2);
    }

    amountInput.addEventListener('input', calculateSettleAmount);
    percentageInput.addEventListener('input', calculateSettleAmount);
</script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layouts.main-app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/paysafebd23/ovimanager.store/resources/views/auto_methods.blade.php ENDPATH**/ ?>