
<style>
    .dt-search,
    .dt-length {
        display: none !important;
    }
</style>
<?php $__env->startSection('content'); ?>

<h5><button type="button" class="btn btn-icon bg-white me-2 waves-effect waves-light"
        style="box-shadow: 0px 9px 12px -2px #66328E1F;">
        <a href="<?php echo e(route('admin.gold_generate')); ?>">
            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000"
                stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler">
                <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
                <path d="M15 6l-6 6l6 6"></path>
            </svg>
        </a>
    </button>Profit Report</h5>

<div class="row mt-5">
    <div class="col-lg-12">
        <div class="card">

            <div class="card-body">
                <div class="row g-3 align-items-center justify-content-between">

                    <!-- LEFT -->
                    <div class="col-12 col-lg-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-12 col-lg-auto">

                        <div class="d-flex flex-column flex-sm-row align-items-stretch align-items-sm-center gap-2">


                            <input type="text" id="customSearch" class="form-control" placeholder="Search table...">

                            <button class="btn btn-label-secondary">
                                Export
                            </button>
                        </div>

                    </div>

                </div>

                <div class="table-responsive">
                    <table id="usersTable" class="table table-striped table-bordered align-middle nowrap w-100">
                        <thead>
                            <tr>
                                <th class="text-nowrap">#</th>
                                <th class="text-nowrap">Entry Date</th>
                                <th class="text-nowrap">Generated Date</th>
                                <th class="text-nowrap">Entries</th>
                                <th class="text-nowrap">Gen Type</th>
                                <th class="text-nowrap">Action</th>

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

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

<div class="modal fade" id="deleteConfirmModal" tabindex="-1" data-bs-backdrop="static" data-bs-keyboard="false">
    <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content rounded-4 text-center p-4 py-5">
            <h5 class="fw-bold mb-2">Are you sure!!</h5>
            <p class="text-muted "> Are you sure you want to delete this Gold ROI record?</p>
            <form action="<?php echo e(route('admin.delete_gold_roi')); ?>" id="deleteForm" method="post" style="display:inline;">
                <?php echo csrf_field(); ?>
                <input type="hidden" name="id" id="gold_id">

                <div class="mb-3 text-start">
                    <label class="form-label fw-semibold">Reason</label>
                    <textarea name="dlt_reason" class="form-control" rows="3" placeholder="Enter reason for deletion"><?php echo e(old('reason')); ?></textarea>
                    <?php $__errorArgs = ['dlt_reason'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                    <small class="text-danger"><?php echo e($message); ?></small>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>

                </div>

                <div class="d-flex justify-content-center align-items-center gap-3 mt-4">
                    <button type="button" class="btn btn-outline-primary p-3 fw-semibold" data-bs-dismiss="modal">
                        Cancel
                    </button>
                    <button type="submit" id="submit_btn" class="btn btn-primary p-3 ms-2 fw-semibold">
                        Yes, Sure
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdn.datatables.net/1.13.8/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.8/js/dataTables.bootstrap5.min.js"></script>

<script>
    document.addEventListener("DOMContentLoaded", function() {
        <?php if($errors -> any()): ?>
        var modalEl = document.getElementById('deleteConfirmModal');
        if (modalEl) {
            var myModal = new bootstrap.Modal(modalEl);
            myModal.show();
        }
        <?php endif; ?>
    });
</script>

<script>
    function setDeleteId(button) {
        document.getElementById('gold_id').value = button.getAttribute('data-id');
    }

    document.getElementById('deleteForm').addEventListener('submit', function() {
        const btn = document.getElementById('submit_btn');
        btn.disabled = true;
        btn.innerText = 'Deleting...';
    });
</script>

<script>
    $(document).ready(function() {

       

        let table = $('#usersTable').DataTable({
            processing  : true,
            serverSide  : true,
            ajax        : "<?php echo e(route('admin.profit_report_gold_data')); ?>",
            pageLength  : 10,
            ordering    : false,
            searching   : true,
            info        : true,
            lengthChange: false,

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

            columns: [
        {
            data: 'DT_RowIndex',
            name: 'DT_RowIndex',
            orderable: false,
            searchable: false
        },

        {
            data: 'entry_date',
            name: 'entry_date'
        },

        {
            data: 'generate_date',
            name: 'generate_date'
        },

        {
            data: 'count',
            name: 'count'
        },

        {
            data: 'generated_in',
            name: 'generated_in'
        },

        {
            data: 'action',
            name: 'action',
            orderable: false,
            searchable: false
        }
    ]

     

        });

        // Custom Search
        $('#customSearch').on('keyup', function() {
            table.search($(this).val()).draw();
        });

        // Custom Page Length
        $('#pageLength').on('change', function() {

            let value = $(this).val() === 'All' ?
                -1 :
                parseInt($(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/profit_report_gold.blade.php ENDPATH**/ ?>