<?php echo $__env->make('layout.header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<style>
    .table>:not(caption)>*>* {
        padding: 0px !important;
    }
</style>
<div class="recharge transaction">
    <!-- HEADER -->
    <nav class="top_nav">
        <div class="left">
            <a href="<?php echo e(url('/user/dashboard')); ?>"><img src="<?php echo e(asset('assets/img/back_arrow.png')); ?>" alt="" />
            </a>
            <span>Recharge Record</span>
        </div>
    </nav>
    <!-- HEADER -->

    <!-- TABLE -->
    <div class="recharge_box">
        <div id="all" class="tabcontent" style="display: block;">
            <div class="d-none form-group">
                <select class="form-control" name="state" id="maxRows">
                    <option value="5000">Show ALL Rows</option>
                    <option value="5">5</option>
                    <option value="10" selected>10</option>
                    <option value="15">15</option>
                    <option value="20">20</option>
                    <option value="50">50</option>
                    <option value="70">70</option>
                    <option value="100">100</option>
                </select>
            </div>
            <table class="table table-borderless" id="table-id">
                <thead>
                    <tr></tr>
                </thead>
                <tbody>
                    <?php if(count($wallet_summery) > 0): ?>
                        <?php $__currentLoopData = $wallet_summery; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $summery): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr style="border-bottom: 1px solid #e8e8e8;">
                                <td>
                                    <div class="listItem">
                                        <div class="text">
                                            <div>
                                                <p class="p-0 m-0">Recharge Amount</p>
                                                <p class="p-0 m-0">Status</p>
                                                <?php if($summery->status == 2): ?>
                                                <p class="p-0 m-0">Rejection Reason</p>
                                                <?php endif; ?>
                                                <p class="p-0 m-0">Date</p>
                                            </div>
                                        </div>
                                    </div>
                                </td>
                                <td style="text-align:right;">
                                    <p class="m-0"><?php echo e($summery->amount); ?></p>
                                    <?php if($summery->status == null || $summery->status == '0'): ?>
                                        <p class="orange p-0 m-0">Pending</p>
                                    <?php elseif($summery->status == '1'): ?>
                                        <p class="success p-0 m-0">Success</p>
                                    <?php elseif($summery->status == '2'): ?>
                                        <p class="error p-0 m-0">Failed</p>
                                    <?php endif; ?>
                                    <?php if($summery->status == 2): ?>
                                    <p class="p-0 m-0"><?php echo e($summery->rejection_reason); ?></p>
                                    <?php endif; ?>
                                    <p><?php echo e($summery->created_at); ?></p>

                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <?php else: ?>
                        <tr class="text-center">
                            <td>No data to show.</td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>

            <?php if(count($wallet_summery) > 10): ?>
                <div class="pagination-container d-flex justify-content-center mb-4">
                    <nav class="d-flex justify-content-center gap-3">
                        <ul class="pagination d-flex justify-content-center align-items-center gap-3">
                            <li data-page="prev" class="pointer">
                                <span>
                                    < <span class="sr-only">
                                </span></span>
                            </li>
                            <!--	Here the JS Function Will Add the Rows -->
                            <li data-page="next" id="prev" class="pointer">
                                <span> > <span class="sr-only"></span></span>
                            </li>
                        </ul>
                    </nav>
                </div>
            <?php endif; ?>
        </div>
    </div>

</div>
</div>


<script>
    getPagination("#table-id", 'pagination');

    function getPagination(table, pagination_class) {
        var lastPage = 1;

        $("#maxRows")
            .on("change", function(evt) {
                //$('.paginationprev').html('');						// reset pagination

                lastPage = 1;
                $("." + pagination_class).find("li").slice(1, -1).remove();
                var trnum = 0; // reset tr counter
                var maxRows = 10; // get Max Rows from select option

                if (maxRows == 5000) {
                    $("." + pagination_class + "").hide();
                } else {
                    $("." + pagination_class + "").show();
                }

                var totalRows = $(table + " tbody tr").length; // numbers of rows

                $(table + " tr:gt(0)").each(function() {
                    // each TR in  table and not the header
                    trnum++; // Start Counter
                    if (trnum > maxRows) {

                        $(this).hide(); // fade it out
                    }
                    if (trnum <= maxRows) {
                        $(this).show();
                    } // else fade in Important in case if it ..
                }); //  was fade out to fade it in
                if (totalRows > maxRows) {
                    var pagenum = Math.ceil(totalRows / maxRows);
                    for (var i = 1; i <= pagenum;) {
                        $("." + pagination_class + " #prev")
                            .before(
                                '<li class="pointer" data-page="' +
                                i +
                                '">\
                                <span>' +
                                i++ +
                                '<span class="sr-only"></span></span>\
                              </li>'
                            )
                            .show();
                    }
                }
                $('.' + pagination_class + ' [data-page="1"]').addClass(
                "active"); // add active class to the first li
                $("." + pagination_class + " li").on("click", function(evt) {
                    evt.stopImmediatePropagation();
                    evt.preventDefault();
                    var pageNum = $(this).attr("data-page");
                    var maxRows = 10;
                    if (pageNum == "prev") {
                        if (lastPage == 1) {
                            return;
                        }
                        pageNum = --lastPage;
                    }
                    if (pageNum == "next") {
                        if (lastPage == $(".pagination li").length - 2) {
                            return;
                        }
                        pageNum = ++lastPage;
                    }
                    lastPage = pageNum;
                    var trIndex = 0;
                    $("." + pagination_class + " li").removeClass("active");
                    $('.' + pagination_class + ' [data-page="' + lastPage + '"]').addClass(
                        "active"
                    );
                    // $(this).addClass('active');					// add active class to the clicked
                    limitPagging(pagination_class);
                    $(table + " tr:gt(0)").each(function() {
                        // each tr in table not the header
                        trIndex++; // tr index counter
                        // if tr index gt maxRows*pageNum or lt maxRows*pageNum-maxRows fade if out
                        if (
                            trIndex > maxRows * pageNum ||
                            trIndex <= maxRows * pageNum - maxRows
                        ) {
                            $(this).hide();
                        } else {
                            $(this).show();
                        } //else fade in
                    }); // end of for each tr in table
                });
                limitPagging(pagination_class);
            })
            .val(5)
            .change();
    }

    function limitPagging(pagination_class) {
        if ($("." + pagination_class + " li").length > 7) {
            if ($("." + pagination_class + " li.active").attr("data-page") <= 3) {
                $("." + pagination_class + " li:gt(5)").hide();
                $("." + pagination_class + " li:lt(5)").show();
                $('.' + pagination_class + ' [data-page="next"]').show();
            }
            if ($("." + pagination_class + " li.active").attr("data-page") > 3) {
                $("." + pagination_class + " li:gt(0)").hide();
                $('.' + pagination_class + ' [data-page="next"]').show();
                for (
                    let i =
                        parseInt($("." + pagination_class + " li.active").attr("data-page")) - 2; i <= parseInt($(
                        "." + pagination_class + " li.active").attr("data-page")) + 2; i++
                ) {
                    $('.' + pagination_class + ' [data-page="' + i + '"]').show();
                }
            }
        }
    }
</script>

<?php echo $__env->make('layout.footer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php /**PATH /home/shyambabamatka/public_html/zupitogames.com/resources/views/userDashboard/recharge-record.blade.php ENDPATH**/ ?>