

<?php
    $request = request();
?> 

<?php $__env->startSection('content'); ?>
<div class="row justify-content-center gy-4">
    <div class="col-12">
        <div class="page-heading mb-4">
            <h3 class="mb-2"><?php echo e(__($pageTitle)); ?></h3>
            <p>
             <?php echo e(__('View all your Financial Records and their statuses.')); ?>

            </p>
        </div>
        <hr>
    </div>


        <div class="col-12 mt-0">
            <div class="filter-area mb-3">
                <form action="" class="form">
                    <div class="d-flex flex-wrap gap-4">
                        <div class="flex-grow-1">
                            <div class="custom-input-box trx-search">
                                <label><?php echo app('translator')->get('Search'); ?></label>
                                <input type="text" name="search" value="<?php echo e($request->search); ?>" placeholder="<?php echo app('translator')->get('Search'); ?>">
                                <button type="submit" class="icon-area">
                                    <i class="las la-search"></i>
                                </button>
                            </div>
                        </div> 
                        <div class="flex-grow-1">
                            <div class="custom-input-box trx-search">
                                <label><?php echo app('translator')->get('Date'); ?></label>
                                <input name="date" type="search" class="datepicker-here date-range" placeholder="<?php echo app('translator')->get('Start Date - End Date'); ?>" autocomplete="off" value="<?php echo e(request()->date); ?>">
                                <button type="submit" class="icon-area">
                                    <i class="las la-search"></i>
                                </button>
                            </div>
                        </div> 
                    <div class="flex-grow-1">
                        <div class="custom-input-box">
                            <label><?php echo app('translator')->get('Status'); ?></label>
                            <select name="status">
                                <option value=""><?php echo app('translator')->get('All'); ?></option> 
                                <option value="PENDING" ><?php echo app('translator')->get('Pending'); ?></option> 
                                <option value="SUCCESS"><?php echo app('translator')->get('Succeed'); ?></option> 
                                <option value="FAILED"><?php echo app('translator')->get('Canceled'); ?></option> 
                            </select>
                        </div>
                    </div>
                </div>
                    </div>
                </form>
            </div>
            <div class="row text-end mb-3">
                <div class="col-lg-12 d-flex flex-wrap justify-content-end">
             
                </div>
            </div>
        </div>

        <div class="col-md-12">
            <div class="card custom--card border-0">
    <div class="card-body p-0">
        <div class="accordion table--acordion" id="transactionAccordion">
            <?php $__empty_1 = true; $__currentLoopData = $withdraws; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $withdraw): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <div class="accordion-item transaction-item 
                <?php if($withdraw->status == 'PENDING'): ?>
                    trx-warning-badge
                <?php elseif($withdraw->status == 'SUCCESS'): ?>
                    trx-success-badge
                <?php elseif($withdraw->status == 'FAILED'): ?>
                    trx-danger-badge
                <?php endif; ?>">
                
                <h2 class="accordion-header" id="h-<?php echo e($loop->iteration); ?>">
                    <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
                        data-bs-target="#c-<?php echo e($loop->iteration); ?>" aria-expanded="false"
                        aria-controls="c-<?php echo e($loop->iteration); ?>">
                        
                        <div class="col-lg-3 col-sm-4 col-6 order-1 icon-wrapper">
                            <div class="left">
                                <div class="icon rotate-none">
                                    <?php if($withdraw->status == 'PENDING'): ?>
                                        <i class="las la-spinner text--warning"></i>
                                    <?php elseif($withdraw->status == 'SUCCESS'): ?>
                                        <i class="las la-check text--success"></i>
                                    <?php elseif($withdraw->status == 'FAILED'): ?>
                                        <i class="las la-times text--danger"></i>
                                    <?php endif; ?>
                                </div>
                                <div class="content">
                                    <h8 class="trans-title"><?php echo e($withdraw->referenceID); ?></h8>
                                    <span class="text-muted font-size--14px mt-2">
                                        <?php echo e(showDateTime(@$withdraw->created_at, 'M d Y @g:i:a')); ?>

                                    </span>
                                </div>
                            </div>
                        </div>
                        
                        <div class="col-lg-6 col-sm-5 col-12 order-sm-2 order-3 content-wrapper mt-sm-0 mt-3">
                            <p class="text-muted font-size--14px">
                                <b>
                                    Amount 
                                    <?php if(@$withdraw->type == 'CR'): ?>
                                        <?php echo app('translator')->get('Credited'); ?> 
                                    <?php else: ?>
                                        <?php echo app('translator')->get('Debited'); ?> 
                                    <?php endif; ?>
                                    
                                </b>
                                <p class="mt-1"><small><?php echo app('translator')->get('Requested by System'); ?></small></p>
                            </p>
                        </div>
                        <div class="col-lg-3 col-sm-3 col-6 order-sm-3 order-2 text-end amount-wrapper">
                            <p><b><?php echo e(showAmount(@$withdraw->amount)); ?></b></p>
                        </div>
                    </button>
                </h2>

                <div id="c-<?php echo e($loop->iteration); ?>" class="accordion-collapse collapse" aria-labelledby="h-<?php echo e($loop->iteration); ?>" data-bs-parent="#transactionAccordion">
                    <div class="accordion-body">
                        <ul class="caption-list">
                            <li>
                                <span class="caption"><?php echo app('translator')->get('Gateway'); ?></span>
                                <span class="value"><?php echo e(__(@$withdraw->txn_mode)); ?></span>
                            </li>  
                            <li>
                                <span class="caption"><?php echo app('translator')->get('Service'); ?></span>
                                <span class="value"><?php echo e(__(@$withdraw->service)); ?></span>
                            </li> 
                            
                            <?php if($withdraw->status == 'COMPLETED'): ?>
                            <li>
                                <span class="caption"><?php echo app('translator')->get('Transaction ID'); ?></span>
                                <span class="value"><?php echo e(__(@$withdraw->txid)); ?></span>
                            </li> 
                            <?php endif; ?>
                            
                            <li>
                                <span class="caption"><?php echo app('translator')->get('Amount'); ?></span>
                                <span class="value"><?php echo e(showAmount($withdraw->amount)); ?></span>
                            </li>
                           
                            <li>
                                <span class="caption"><?php echo app('translator')->get('Status'); ?></span>
                                <span class="value">
                                    <?php if($withdraw->status == 'SUCCESS'): ?>
                                        <span class="badge badge--success">Succeed</span>
                                    <?php elseif($withdraw->status == 'FAILED'): ?>
                                        <span class="badge badge--danger">Rejected</span>
                                    <?php else: ?> 
                                        <span class="badge badge--dark">Pending</span>
                                    <?php endif; ?>
                                </span>
                            </li>
                            
                        </ul>

                    </div>
                </div>
            </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <div class="accordion-body text-center">
                <p class="text-muted"><?php echo app('translator')->get('No data found'); ?></p>
            </div>
            <?php endif; ?>
        </div>
    </div>
</div><!-- custom--card end -->
        <div class="col-12">
        <div class="mt-3">
            <?php if($withdraws->hasPages()): ?>
                <?php echo e(paginatelinks($withdraws)); ?>

            <?php endif; ?>
        </div>
    </div>
        </div>

</div>

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

<?php $__env->startPush('style-lib'); ?>
    <link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/admin/css/daterangepicker.css')); ?>">
<?php $__env->stopPush(); ?>

<?php $__env->startPush('style'); ?>
<style>
    .border-line-area.style-two{
        text-align: center;
        position: relative;
        z-index: 1;
    }
    .border-line-area.style-two .border-line-title {
        display: inline-block;
        margin-bottom: 0 !important;
        background: #fff;
        padding: 10px;
        padding-bottom: 5px;
    }
    .border-line-title-wrapper {
        position: relative;
    }
    .border-line-title-wrapper::before {
        position: absolute;
        content: "";
        width: 100%;
        height: 0.1px;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        background-color: #e5e5e5;
        z-index: -1;
    }

    .withdraw-detail__balance {
        font-size: 36px; 
    }
    .withdraw-detail-border {
        border-right: 1px solid #dee2e6; 
    }
    @media (max-width: 1399px) {
        .withdraw-detail__desc {
            font-weight: 500;
            font-size: 17px
        }
        .text-muted.title {
            font-size: 20px;
        }
        .withdraw-detail__balance {
            font-size: 32px; 
        }
    }
    @media (max-width: 767px) {
        .withdraw-detail-border {
            border-right: 0; 
            border-bottom: 1px solid #dee2e6!important; 
            padding-bottom: 20px;
            margin-bottom: 20px;
        }
        .withdraw-detail__desc {
            font-size: 16px
        }
    }
    .withdraw-method-image img{
        max-width: 80px;
        max-height: 80px;
    }


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

<?php $__env->startPush('script-lib'); ?>
    <script src="<?php echo e(asset('assets/admin/js/moment.min.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/admin/js/daterangepicker.min.js')); ?>"></script>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('script'); ?>
    <script>

        (function ($) {
            "use strict";



            $('.detailBtn').on('click', function () {
                var modal = $('#detailModal');
                var userData = $(this).data('user_data');
                var html = ``;
                userData.forEach(element => {
                    if(element.type != 'file'){
                        html += `
                        <li class="list-group-item d-flex justify-content-between align-items-center flex-wrap">
                            <span class='fw-bold'>${element.name}</span>
                            <span">${element.value}</span>
                        </li>`;
                    }
                });

                if(!html){
                    html = `<span class='text-center'><?php echo app('translator')->get('No data found'); ?></span>`;
                }

                modal.find('.userData').html(html);

                if($(this).data('admin_feedback') != undefined){
                    var adminFeedback = `
                        <div class="ms-3 border-line-area style-two">
                            <div class="border-line-title-wrapper">
                                <strong class="border-line-title"><?php echo app('translator')->get('Admin Feedback'); ?></strong>
                            </div>
                            <p class="text-start">${$(this).data('admin_feedback')}</p>
                        </div>
                    `;
                }else{
                    var adminFeedback = '';
                }

                modal.find('.feedback').html(adminFeedback);
                modal.modal('show');
            });

            $('[name=method_code], [name=status]').on('change', function(){
                $('.form').submit();
            })

            const datePicker = $('.date-range').daterangepicker({
                autoUpdateInput: false,
                locale: {
                    cancelLabel: 'Clear'
                },
                showDropdowns: true,
                ranges: {
                    'Today': [moment(), moment()],
                    'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
                    'Last 7 Days': [moment().subtract(6, 'days'), moment()],
                    'Last 15 Days': [moment().subtract(14, 'days'), moment()],
                    'Last 30 Days': [moment().subtract(30, 'days'), moment()],
                    'This Month': [moment().startOf('month'), moment().endOf('month')],
                    'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
                    'Last 6 Months': [moment().subtract(6, 'months').startOf('month'), moment().endOf('month')],
                    'This Year': [moment().startOf('year'), moment().endOf('year')],
                },
                maxDate: moment()
            });

            const changeDatePickerText = (event, startDate, endDate) => {
                $(event.target).val(startDate.format('MMMM DD, YYYY') + ' - ' + endDate.format('MMMM DD, YYYY'));
            }

            $('.date-range').on('apply.daterangepicker', (event, picker) => changeDatePickerText(event, picker.startDate, picker.endDate));

            if ($('.date-range').val()) {
                let dateRange = $('.date-range').val().split(' - ');
                $('.date-range').data('daterangepicker').setStartDate(new Date(dateRange[0]));
                $('.date-range').data('daterangepicker').setEndDate(new Date(dateRange[1]));
            }
        })(jQuery);
    </script>
<?php $__env->stopPush(); ?>


<?php echo $__env->make('layouts.main-app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/paysafebd23/ovimanager.store/resources/views/financial-records.blade.php ENDPATH**/ ?>