

<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@latest/tabler-icons.min.css">

<?php $__env->startSection('content'); ?>
    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">

    <style>
        .dataTables_info,
        .dataTables_paginate {
            padding: 0 18px 18px !important;
        }
    </style>

    <div class="row align-items-center justify-content-between mb-3 mt-3 m-2">
        <div class="col-auto">
            <h5 class="page-title">
                <i class="ti tabler-wallet text-warning me-2"></i>Product Wallet
            </h5>
        </div>
    </div>

    <div class="card main-card m-2">

        <div class="top-filter p-3">
            <div class="row g-3 align-items-end d-flex justify-content-end">
                <div class="col-auto">
                    <select id="pageLength" class="form-select">
                        <option value="10">10</option>
                        <option value="25">25</option>
                        <option value="50">50</option>
                        <option value="100">100</option>
                        <option value="All">All</option>
                    </select>
                </div>
                <div class="col-lg-2 col-md-6">
                    <label class="form-label">From Date</label>
                    <input type="date" class="form-control">
                </div>

                <div class="col-lg-2 col-md-6">
                    <label class="form-label">To Date</label>
                    <input type="date" class="form-control">
                </div>

                <div class="col-lg-2 col-md-6">
                    <label class="form-label">User Name</label>
                    <input type="text" class="form-control" placeholder="Search user">
                </div>

                <div class="col-lg-1 col-md-6">
                    <button class="btn btn-primary w-100">
                        <i class="ti tabler-search me-1"></i> Search
                    </button>
                </div>
                <div class="col-md-3 ms-auto">
                    <input type="text" id="customSearch" class="form-control" placeholder="Search table...">
                </div>

                <div class="col-lg-1 col-md-6">
                    <button class="btn btn-label-secondary w-100">
                        <i class="ti tabler-download me-1"></i> Export
                    </button>
                </div>

            </div>
        </div>
        <div class="table-responsive table-wrap">
            <table class="table w-100" id="usersTable">
                <thead>
                    <tr>
                        <th>Sno</th>
                        <th> Date</th>
                        <th>User ID</th>
                        <th>User Name</th>
                        <th>Phone&nbsp;Number</th>
                        <th>Credit</th>
                        <th>Debit</th>
                        <th>Available wallet</th>
                        <th>Daily wise</th>
                        <th>View Wallet</th>
                        <th>Action</th>

                    </tr>
                </thead>
                <tbody></tbody>
            </table>
        </div>

    </div>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
    <script>
        $(document).ready(function () {

            const users = [
                {
                    date: '12/10/2025',
                    user_id: 'OM1234',
                    name: 'Ammu',
                    phone: '9876543210',
                    credit: '5000.00',
                    debit: '1200.00',
                    wallet: '3800.00',
                }
            ];

            let table = $('#usersTable').DataTable({
                data: users,
                pageLength: 10,
                ordering: false,
                searching: true,
                info: true,
                lengthChange: false,

                columnDefs: [
                    {
                        targets: '_all',
                        className: 'text-nowrap text-center align-middle'
                    }
                ],

                columns: [

                    /* Sno */
                    {
                        data: null,
                        render: function (data, type, row, meta) {
                            return meta.row + 1;
                        }
                    },

                    /* Date */
                    {
                        data: 'date'
                    },

                    /* User ID */
                    {
                        data: 'user_id'
                    },

                    /* User Name */
                    {
                        data: 'name'
                    },

                    /* Phone Number */
                    {
                        data: 'phone'
                    },

                    /* Credit */
                    {
                        data: 'credit',
                        render: function (data) {
                            return `<span class="badge bg-success">₹ ${data}</span>`;
                        }
                    },

                    /* Debit */
                    {
                        data: 'debit',
                        render: function (data) {
                            return `<span class="badge bg-danger">₹ ${data}</span>`;
                        }
                    },

                    /* Available Wallet */
                    {
                        data: 'wallet',
                        render: function (data) {
                            return `₹ ${data}`;
                        }
                    },

                    {
                        data: null,
                        render: function () {
                            return `
                            <a href="<?php echo e(route('admin.monthly_wallet')); ?>">
                                <i class="ti tabler-eye text-primary menu-icon" style="cursor:pointer;"></i>
                            </a>
                        `;
                        }
                    },

                    /* View Wallet */
                    {
                        data: null,
                        render: function () {
                            return `
                            <a href="<?php echo e(route('admin.product_wallet_history')); ?>">
                                <i class="ti tabler-eye text-primary menu-icon" style="cursor:pointer;"></i>
                            </a>
                        `;
                        }
                    },

                    /* Action */
                    {
                        data: null,
                        render: function () {
                            return `
                                                       <i class="ti tabler-trash text-danger menu-icon" style="cursor:pointer;"></i>

                        `;
                        }
                    }

                ]
            });

            $('#customSearch').keyup(function () {
                table.search($(this).val()).draw();
            });

            $('#pageLength').change(function () {
                let value = $(this).val() === 'All' ? -1 : $(this).val();
                table.page.len(value).draw();
            });

        });
    </script>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('Admin.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/omiga_ipl/resources/views/Admin/product_wallet.blade.php ENDPATH**/ ?>