<?php echo $__env->make('admin/header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

            <!-- Page Container START -->

            <div class="page-container">

                <!-- Content Wrapper START -->

                <div class="main-content">    
                <div class="row">
                    <div class="col-lg-12">
                        <div class="horizontal-form">
                            <form action="<?php echo e(url('/admin/payout-report-export')); ?>" method="POST" enctype="multipart/form-data">
                                <?php echo csrf_field(); ?>
                                <div class="form-group row">
                                    <div class="col-md-6 mb-6">
                                        <input id="date" type="date" class="form-control" name="txndate" value="">
                                    </div>

                                    <div class="col-md-2  mb-2">
                                        <div class="form-group text-left">
                                            <button type="submit" class="btn btn-md btn-primary">Export</button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>                

                    <div class="row">

                        <div class="col-md-12 col-lg-12">

                            <div class="card">

                                <div class="card-body">

                                    <div class="d-flex justify-content-between align-items-center">

                                        <h5>Payout Transactions</h5>                                        

                                    </div>

                                    <div class="m-t-30">

                                        <div class="table-responsive-md table-responsive-sm table-responsive">

                                            <table class="table table-hover table-bordered" id="datatable"> 

                                                <thead>

                                                    <tr>

                                                        <th>OrderId</th>

                                                        <th>User</th>

                                                        <th>Transaction Id</th>

                                                        <th>UTR</th>

                                                        <th>Name</th>

                                                        <th>A/C No</th>  

                                                        <th>Ifsc</th> 

                                                        <th>Amount</th>                                                        

                                                        <th>Charge</th>

                                                        <th>Gst</th>

                                                        <th>Net Amount</th>

                                                        <th>Status</th>

                                                        <th>Date</th>

                                                    </tr>

                                                </thead>

                                                <tbody>

                                                    

                                                </tbody>

                                            </table>

                                            

                                        </div>

                                        

                                    </div>

                                </div>

                            </div>

                        </div>

                       

                    </div>

                </div>

                <!-- Content Wrapper END -->

                <!-- model -->          

                

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>

<link href="https://cdn.datatables.net/v/dt/dt-1.13.5/datatables.min.css" rel="stylesheet">

<script src="https://cdn.datatables.net/v/dt/dt-1.13.5/datatables.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>

<script type="text/javascript">

    $(document).ready(function () {



        var url = "<?php echo e(route('/admin/payout-report-data')); ?>";

        let dataTable = new DataTable('#datatable', {



            ajax: {
                url: url,
                type: 'POST',
                data:{"type":"payout",_token: '<?php echo e(csrf_token()); ?>'},

            },

            processing: true,

            serverSide: true,

            ordering: false,

           

            columns : [

                { "data": "orderId"},

                { "data": "name"},

                { "data": "txnId" },

                { "data": "utr" },

                { "data": "beneName" },

                { "data": "beneAccount" },

                { "data": "beneIfsc" },                 

                { "data": "amount" },

                { "data": "charge" },

                { "data": "gst" },

                { "data": "totalAmount" },

                { 

                    data: 'status',

                    render: function(data, type, row) {

                        if (data === 'SUCCESS') {

                            return ' <button class="btn btn-sm btn-success">'+data+'</button>';

                        } else if (data === 'FAILED') {

                            return ' <button class="btn btn-sm btn-danger">'+data+'</i></button>';

                        } else {

                            return '<button class="btn btn-sm btn-danger">'+data+'</i></button>';

                        }

                    }

                },

                { "data": "created_at" },

            ],



            columnDefs: [

            {

                targets: 12, // Index of the column you want to modify

                render: function(data, type, row) {

                    if (type === 'display' || type === 'filter') {

                        const dateutc = data.replace('Z', '');
                        //  console.log(dateutc);
                        const dt = new Date(`${dateutc}Z`);
                        const finaldate = moment(dt).format('L, h:mm ss a');

                        return finaldate ;

                    }

                    

                }

            }

        ]    

        });



        $('#datepicker').on('change', function () {

            var newdate = $("#datepicker").val();

            $("#datepicker").val(newdate)

            //dataTable.draw(); // Redraw the table, which triggers a new AJAX request

            dataTable.ajax.reload();

        });    



    });



</script>



<?php echo $__env->make('admin/footer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/resources/views/admin/payoutreport.blade.php ENDPATH**/ ?>