<?php $__env->startSection('title', 'UPI ID Management'); ?>
<?php $__env->startSection('upi-management', 'active'); ?>
<?php echo $__env->make('adminDashboard.layout.header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

<div class="main-content">
    <section class="section">
        <div class="section-body">
            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-header">
                            <h4>Bank Management</h4>
                        </div>
                        <form action="<?php echo e(url('/admin/upis/add')); ?>" method="post" enctype="multipart/form-data">
                            <?php echo csrf_field(); ?>
                            <div class="card-body">
                                <div class="row">
                                    <div class="col-md-4">
                                        <div class="form-group">
                                            <label>Select Type</label>
                                            <select class="form-control" name="type" id="type" required>
                                                <option value="">Select</option>
                                                <option value="upi">UPI</option>
                                                <option value="qr">QR</option>
                                                <option value="bank">Bank</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <!-- UPI ID Field -->
                                <div class="row" id="upi-section" style="display: none;">
                                    <div class="col-md-4">
                                        <div class="form-group">
                                            <label>Insert UPI ID</label>
                                            <input type="text" class="form-control" name="upi_id" id="upi_id">
                                        </div>
                                    </div>
                                </div>

                                <!-- QR Field -->
                                <div class="row" id="qr-section" style="display: none;">
                                    <div class="col-md-4">
                                        <div class="form-group">
                                            <label>Insert QR Code</label>
                                            <input type="file" class="form-control" name="qr" id="qr">
                                        </div>
                                    </div>
                                </div>

                                <!-- Bank Details Fields -->
                                <div class="row" id="bank-section" style="display: none;">
                                    <div class="col-md-4">
                                        <div class="form-group">
                                            <label>Bank Name</label>
                                            <input type="text" class="form-control" name="bank" id="bank">
                                        </div>
                                    </div>
                                    <div class="col-md-4">
                                        <div class="form-group">
                                            <label>Banking Name</label>
                                            <input type="text" class="form-control" name="banking_name"
                                                id="banking_name">
                                        </div>
                                    </div>
                                    <div class="col-md-4">
                                        <div class="form-group">
                                            <label>Account Number</label>
                                            <input type="number" class="form-control" name="account_number"
                                                id="account_number">
                                        </div>
                                    </div>
                                    <div class="col-md-4">
                                        <div class="form-group">
                                            <label>IFSC Code</label>
                                            <input type="text" class="form-control" name="ifsc" id="ifsc">
                                        </div>
                                    </div>
                                </div>

                                <div class="card-footer p-0">
                                    <input type="submit" class="btn btn-primary mr-1" value="Add Now" />
                                </div>
                            </div>
                        </form>

                        <script>
                            document.getElementById('type').addEventListener('change', function() {
                                var type = this.value;
                                document.getElementById('upi-section').style.display = type === 'upi' ? 'block' : 'none';
                                document.getElementById('qr-section').style.display = type === 'qr' ? 'block' : 'none';
                                document.getElementById('bank-section').style.display = type === 'bank' ? 'block' : 'none';
                            });
                        </script>

                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-body p-0">
                            <div class="table-responsive">
                                <table class="table table-striped table-md">
                                    <tr>
                                        <th>ID</th>
                                        <th>Type</th>
                                        <th>UPI ID</th>
                                        <th>QR</th>
                                        <th>BANK</th>
                                        <th>Created At</th>
                                    </tr>
                                    <tbody id="recharge_table">
                                        <?php if(count($upis) > 0): ?>
                                            <?php $__currentLoopData = $upis; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $upi): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <tr>
                                                    <td><?php echo e($upi->id); ?></td>

                                                    <!-- Display based on type -->
                                                    <td><?php echo e($upi->type); ?></td>

                                                    <!-- Conditionally display UPI ID if type is 'upi' -->
                                                    <td>
                                                        <?php if($upi->type === 'upi'): ?>
                                                            <?php echo e($upi->upi_id); ?>

                                                        <?php else: ?>
                                                            N/A
                                                        <?php endif; ?>
                                                    </td>

                                                    <!-- Conditionally display QR as image if type is 'qr' -->
                                                    <td>
                                                        <?php if($upi->type === 'qr'): ?>
                                                            <img src="<?php echo e(asset('assets/img/' . $upi->qr)); ?>"
                                                                alt="QR Code" width="50">
                                                        <?php else: ?>
                                                            N/A
                                                        <?php endif; ?>
                                                    </td>

                                                    <!-- Conditionally display Bank Details if type is 'bank' -->
                                                    <td>
                                                        <?php if($upi->type === 'bank'): ?>
                                                            <div><strong>Bank Name:</strong> <?php echo e($upi->bank); ?>

                                                            </div>
                                                            <div><strong>Banking Name:</strong> <?php echo e($upi->banking_name); ?>

                                                            </div>
                                                            <div><strong>Account No:</strong> <?php echo e($upi->account_number); ?>

                                                            </div>
                                                            <div><strong>IFSC:</strong> <?php echo e($upi->ifsc); ?></div>
                                                        <?php else: ?>
                                                            N/A
                                                        <?php endif; ?>
                                                    </td>

                                                    <!-- Created At -->
                                                    <td><?php echo e($upi->created_at); ?></td>

                                                    <!-- Delete Button -->
                                                    <td>
                                                        <a href="<?php echo e(url('/admin/upis/delete/' . $upi->id)); ?>"
                                                            class="text-decoration-none">
                                                            <div class="badge badge-success">Delete</div>
                                                        </a>
                                                    </td>
                                                </tr>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <?php else: ?>
                                            <tr>
                                                <td colspan="8" class="text-center">No Data Found.</td>
                                            </tr>
                                        <?php endif; ?>
                                    </tbody>

                                </table>
                            </div>
                        </div>
                        <div class="card-footer text-right" id="pagination">
                            <nav class="d-inline-block">
                                <?php echo e($upis->links('adminDashboard.pagination')); ?>

                            </nav>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="formModal1"
        aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="formModal1">Rejection Reason</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form action="<?php echo e(url('/admin/recharge/disapprove')); ?>" method="post">
                        <?php echo csrf_field(); ?>
                        <input type="hidden" name="reject_id" value="">
                        <div class="row">
                            <div class="col-12 flex">
                                <textarea name="reason" class="form-control" id="reason" required rows="10"></textarea>
                            </div>
                            <div class="col-12">
                                <input type="submit" value="Submit" class="btn btn-success mt-2">
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>
</div>

<script>
    function rejectRecharge(id) {
        $("input[name='reject_id']").val(id);
    }
</script>
<?php echo $__env->make('adminDashboard.layout.footer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php /**PATH /home/shyambabamatka/public_html/zupitogames.com/resources/views/adminDashboard/upi-management.blade.php ENDPATH**/ ?>