<?php
use Carbon\Carbon;
?>


<?php $__env->startSection('title', 'All Transactions'); ?>

<?php $__env->startPush('css'); ?>
    <!-- data tables -->
    <link href="<?php echo e(asset('admin/assets/plugins/datatables/plugins/bootstrap/dataTables.bootstrap4.min.css')); ?> " rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />

<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
    <div class="row">
        <div class="col-md-12">
            <div class="card card-topline-red">
                <div class="card-head" style="text-align: center;">
                    <header>
                        All - Transactions
                    </header>
                </div>
                <div class="card-body ">
                    <div class="row p-b-20">
                        <div class="col-xl-3 col-md-6 col-12">
                            <div class="info-box bg-success">
                                <span class="info-box-icon push-bottom"><i class="material-icons">monetization_on</i></span>
                                <div class="info-box-content">
                                    <span class="info-box-text">Total Opening Balance</span>
                                    <span class="info-box-number"> <b><?php echo e(number_format( $total_opening_balance,2,'.',',' )); ?> Tk</b></span>
                                </div>
                                <!-- /.info-box-content -->
                            </div>
                            <!-- /.info-box -->
                        </div>

                        <div class="col-xl-3 col-md-6 col-12">
                            <div class="info-box bg-purple">
                                <span class="info-box-icon push-bottom"><i class="material-icons">monetization_on</i></span>
                                <div class="info-box-content">
                                    <span class="info-box-text">Total Debited Amount</span>
                                    <span class="info-box-number"> <b> <?php echo e(number_format($total_debited_amount,2,'.',',')); ?> Tk</b></span>
                                </div>
                                <!-- /.info-box-content -->
                            </div>
                            <!-- /.info-box -->
                        </div>

                        <div class="col-xl-3 col-md-6 col-12">
                            <div class="info-box bg-warinng">
                                <span class="info-box-icon push-bottom"><i class="material-icons">monetization_on</i></span>
                                <div class="info-box-content">
                                    <span class="info-box-text">Total Credited Amount</span>
                                    <span class="info-box-number"> <b><?php echo e(number_format($total_credited_amount,2,'.',',')); ?> Tk</b></span>
                                </div>
                                <!-- /.info-box-content -->
                            </div>
                            <!-- /.info-box -->
                        </div>

                        <div class="col-xl-3 col-md-6 col-12">
                            <div class="info-box bg-success">
                                <span class="info-box-icon push-bottom"><i class="material-icons">monetization_on</i></span>
                                <div class="info-box-content">
                                    <span class="info-box-text">Current Balance</span>
                                    <span class="info-box-number"> <b><?php echo e(number_format($current_balance,2,'.',',')); ?> Tk</b></span>
                                </div>
                                <!-- /.info-box-content -->
                            </div>
                            <!-- /.info-box -->
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-6 my-4 d-flex align-items-center">
                            <span class="mx-2">Select Range</span>
                            <input type="text" class="form-control" style="width: 300px;" name="datetimes" />
                        </div>
                        <div class="col-6 my-4 d-flex align-items-center justify-content-end">
                            <select class="form-select form-control" id="tnx-status" style="width: 100px;">
                                <option <?php echo e(request('status') == 'debit'  ? 'selected' : ''); ?> value="debit">Debit</option>
                                <option <?php echo e(request('status') == 'credit' ? 'selected' : ''); ?> value="credit">Credit</option>
                            </select> 
                            <span class="mx-2">Transactions</span>
                        </div>
                        <?php echo $dataTable->table(); ?>

                    </div>

                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>
    <!-- data tables -->
    <script src="<?php echo e(asset('admin/assets/plugins/datatables/jquery.dataTables.min.js')); ?>" ></script>
    <script src="<?php echo e(asset('admin/assets/plugins/datatables/plugins/bootstrap/dataTables.bootstrap4.min.js')); ?>" ></script>
    <script src="<?php echo e(asset('admin/assets/js/buttons/dataTables.buttons.min.js')); ?>"></script>
    <script src="<?php echo e(asset('/vendor/datatables/buttons.server-side.js')); ?>"></script>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
    <?php echo $dataTable->scripts(); ?>

    <!-- sweet aleart -->
    <script src="<?php echo e(asset('admin/assets/js/sweetalert.min.js')); ?>"></script>
    <script>
        jQuery(function($) {
            let url = new URL('<?php echo request()->fullUrl(); ?>')
            $('input[name="datetimes"]').daterangepicker({
                timePicker: false,
                startDate: moment().startOf('hour'),
                endDate: moment().startOf('hour').add(32, 'hour'),
                locale: {
                    format: 'DD MMMM YYYY'
                }
            });
            $('input[name="datetimes"]').on('apply.daterangepicker', function(ev, picker) {
                let start = picker.startDate.format('YYYY-MM-DD');
                let end   = picker.endDate.format('YYYY-MM-DD');
                url.searchParams.set('from', start);
                url.searchParams.set('to', end);
                window.location.href = `${url.href}`;
            });

            $('#tnx-status').change(function(){
                url.searchParams.set('status', $(this).val());
                window.location.href = `${url.href}`;
            });
        });
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('template.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/forazitradersbd/public_html/resources/views/admin/payment-gateways/transactions.blade.php ENDPATH**/ ?>