<?php $__env->startSection('content'); ?>
    <div class="row">
        <div class="col-sm-4">
            <div class="card">
                <div class="card-body">
                    <form action="<?php echo e(route('rechargeUpdate')); ?>" method="POST">
                        <?php echo csrf_field(); ?>


                        <p class="p-2">Manager Name: <?php echo e($reseller->name); ?></p>
                        <p class="p-2">Current Balance: <?php echo e($reseller->balance[0]['amount'] ?? 0); ?></p>
                        <p class="p-2 font-weight-bold text-danger">Maximum amount can recharge :
                            <?php echo e(999999.99 - ($reseller->balance[0]['amount'] ?? 0)); ?></p>


                        <div class="form-group">
                            <label for="amount">Amount</label>

                            <input type="number" name="amount" placeholder="0" class="form-control" required>
                            <?php $__errorArgs = ['amount'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="text-red-500 mt-2 text-sm"><?php echo e($message); ?></div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="form-group d-none">
                            <label for="amount">Recharge Type</label>

                            <select name="recharge_type" class="form-control" required>
                                <option value="cash" selected>Cash</option>
                            </select>
                            <?php $__errorArgs = ['recharge_type'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="text-red-500 mt-2 text-sm"><?php echo e($message); ?></div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <?php if(checkSettings('reseller-recharge-paid-option') == 'enable'): ?>
                            <div class="form-group">
                                <label for="amount">Paid Amount</label>

                                <input type="number" name="paid_amount" placeholder="0" class="form-control" required>
                                <?php $__errorArgs = ['paid_amount'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-red-500 mt-2 text-sm"><?php echo e($message); ?></div>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>

                            </div>
                        <?php endif; ?>






                        <div class="form-group">

                            <label for="remark">Remark</label>
                            <input type="text" name="remark" class="form-control" required>
                            <?php $__errorArgs = ['remark'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="text-red-500 mt-2 text-sm"><?php echo e($message); ?></div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>

                        </div>




                        <input type="hidden" value="<?php echo e($reseller->id); ?>" name="type_id">
                        <input type="hidden" value="reseller" name="type">
                        <div class="from-group">
                            <a href="<?php echo e(route('resellers.index')); ?>" class="btn btn-default float-lef"><i
                                    class="fa fa-arrow-left"></i> Back</a>
                            <button class="btn btn-primary float-right " type="submit">Recharge</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class="col-sm-8">
            <div class="card">
                <div class="card-body">
                    <p class="p-2">Manager Recharge History </p>

                    <div class="form-group">
                        <div class="table-responsive">
                            <table class="table table-borderd table-striped">
                                <thead class="bg-blue-50">
                                    <tr>

                                        <th>
                                            Date
                                        </th>

                                        <th class="text-right">
                                            Recharge Amount
                                        </th>

                                        <th class="text-right">
                                            After Recharge Balance
                                        </th>
                                        <?php if(checkSettings('reseller-recharge-paid-option') == 'enable'): ?>
                                            <th class="text-right">Paid Amount</th>
                                        <?php endif; ?>

                                        <th>
                                            Remarks
                                        </th>
                                        <th>
                                            Recharge By
                                        </th>
                                        <th>

                                        </th>
                                    </tr>
                                </thead>
                                <tbody class="
                                        bg-white divide-y divide-gray-200">
                                    <?php $__currentLoopData = $rechargeList; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $r): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>

                                            <td>
                                                <?php echo e(date('d-M-Y h:i:sa', strtotime($r->created_at))); ?>

                                            </td>



                                            <td class="text-right">
                                                <?php echo e($r->amount); ?>

                                            </td>


                                            <td class="text-right">
                                                <?php echo e($r->after_recharge_balance); ?>

                                            </td>
                                            <?php if(checkSettings('reseller-recharge-paid-option') == 'enable'): ?>
                                                <td class="text-right"><?php echo e($r->paid_amount); ?></td>
                                            <?php endif; ?>

                                            <td>
                                                <?php echo e($r->remarks); ?>

                                            </td>
                                            <td>
                                                <?php echo e($r->user->name ?? ''); ?>

                                            </td>


                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                    <tr class="bg-info">
                                        <td class="text-right">Total Recharge: </td>
                                        <td class="text-right"><?php echo e($rechargeList->sum('amount')); ?></td>
                                        <?php if(checkSettings('reseller-recharge-paid-option') == 'enable'): ?>
                                            <td class="text-right">Total Paid: </td>
                                            <td class="text-right"><?php echo e($rechargeList->sum('paid_amount')); ?></td>
                                        <?php endif; ?>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>





                    </div>
                </div>
            </div>
        </div>

    </div>


<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>
<script>
    $(function() {
        $('.recharge').on('click', function() {
            if (confirm('Are you sure to recharge?')) {
                return true;
            }
        });
    });
</script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layout.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/mondol/radius-circle/resources/views/reseller/resellerRecharge.blade.php ENDPATH**/ ?>