
<?php $__env->startSection('css-content'); ?>
<style>
.deposit-summary{
    margin-bottom:30px;
}

.summary-main-card{
    background:#2f76ea;
    color:#fff;
    padding:25px;
    border-radius:6px;
    box-shadow:0 2px 8px rgba(0,0,0,.12);
}

.summary-title{
    font-size:18px;
    font-weight:600;
}

.summary-amount{
    font-size:38px;
    font-weight:700;
    margin:5px 0;
}

.summary-count{
    font-size:14px;
    opacity:.9;
}

.summary-box{
    background:#fff;
    border-radius:6px;
    padding:20px;
    box-shadow:0 2px 8px rgba(0,0,0,.12);
    height:100%;
}

.summary-box h5{
    margin-bottom:10px;
    font-size:16px;
    font-weight:600;
}

.summary-box h3{
    margin-bottom:10px;
    font-size:30px;
    font-weight:700;
}

.summary-box p{
    margin:0;
    color:#6c757d;
}
</style>
<?php $__env->stopSection(); ?>
 <?php $__env->startSection('content'); ?>
<div class="card mx-auto">
      
        <?php
$date = dateYYYYMMDD(request('date')) ?? '';
?>
        <!-- /.card-header -->
        <div class="card-body">
            
            
                  <?php
                    $totalAmount = $lists->sum('amount');
                    $totalTransactions = $lists->count();
                
                    $manualAmount = $lists->filter(function ($item) {
                        return stripos($item->remark, 'admin') !== false;
                    })->sum('amount');
                
                    $manualCount = $lists->filter(function ($item) {
                        return stripos($item->remark, 'admin') !== false;
                    })->count();
                
                    $autoAmount = $lists->filter(function ($item) {
                        return stripos($item->remark, 'admin') === false;
                    })->sum('amount');
                
                    $autoCount = $lists->filter(function ($item) {
                        return stripos($item->remark, 'admin') === false;
                    })->count();
                ?>
                
                <div class="deposit-summary mb-4">
                
                    <div class="d-flex justify-content-between align-items-center mb-3 mx-5">
                        <h4 class="mb-0">Withdraw Requests</h4>
                    
                    <?php
                        $defaultDateRange =
                            request('date_range') ??
                            now()->startOfMonth()->format('m/d/Y') . ' - ' .
                            now()->endOfMonth()->format('m/d/Y');
                    ?>
                        <form method="GET" id="filterForm">
                             <div class="d-flex gap-2">
                            <input type="text"
                                   name="date_range"
                                   id="date_range"
                                   value="<?php echo e($defaultDateRange); ?>"
                                   class="form-control"
                                   style="width: 250px;">
                                   
                                   <select name="withdraw_status_id" class="form-control" style="width: 200px;" onchange="$('#filterForm').submit();">
                                        <option value="">All</option>
                                        <option value="1" <?php echo e(request('withdraw_status_id') == '1' ? 'selected' : ''); ?>>
                                            Pending
                                        </option>
                                        <option value="2" <?php echo e(request('withdraw_status_id') == '2' ? 'selected' : ''); ?>>
                                            Accepted
                                        </option>
                                        <option value="3" <?php echo e(request('withdraw_status_id') == '3' ? 'selected' : ''); ?>>
                                            Cancelled
                                        </option>
                                    </select>
                                   
                                </div>
                        </form>
                    </div>
                
                    
                
                </div>
            
            <div id="example1_wrapper" class=" dt-bootstrap4">
                <div class="row">
                    <div class="col-sm-12">
                          <div class='tablescroll'>
                            <div class="table-responsive">
                        <table class="table table-bordered text-center">
                <thead>
                    <tr role="row">
                                <th class="sorting_asc" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                                    aria-sort="ascending"
                                    aria-label="Rendering engine: activate to sort column descending"
                                    style="width: 60px;">#
                                </th>
                                <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                                    aria-label="Browser: activate to sort column ascending" style="width: 207px;">
                                    User Name
                                </th>
                                <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                                    aria-label="Browser: activate to sort column ascending" style="width: 207px;">
                                    User Mobile
                                </th>
                                 <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                                    aria-label="Browser: activate to sort column ascending" style="width: 207px;">
                                    BANK Details
                                </th>
                                <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                                    aria-label="Browser: activate to sort column ascending" style="width: 207px;">
                                  Withdraw Request  Amount
                                </th>
                                <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                                    aria-label="Browser: activate to sort column ascending" style="width: 207px;">
                                  Withdraw  Status
                                </th>
                                  <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                                    aria-label="Browser: activate to sort column ascending" style="width: 207px;">
                                 Date
                                </th>
                                 <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                                    aria-label="Browser: activate to sort column ascending" style="width: 207px;">
                                 Time
                                </th>
                                 <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                                    aria-label="Browser: activate to sort column ascending" style="width: 207px;">
                                Reamark
                                </th>
                               
                                <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                                    aria-label="CSS grade: activate to sort column ascending" style="width: 200px;">
                                    Action
                                </th> 

                            </tr>
                </thead>
                <tbody>
                            
                  <?php $__empty_1 = true; $__currentLoopData = $lists; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $list): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                
                        <tr>
                          <td><?php echo e($key+1); ?></td>
                          <td>
                            <?php echo e(isset($list->username) ?$list->username->name : ''); ?>

                           
                          </td>
                          <td>
                            <?php echo e(isset($list->username) ?$list->username->mobile_number : ''); ?>

                           
                          </td>
                           <?php
                                $bank = optional(optional($list->username)->userBank);
                            ?>
                            
                            <td>
                                <div><strong>Holder Name:</strong> <?php echo e($bank->holder_name ?? '-'); ?></div>
                                <div><strong>Account No:</strong> <?php echo e($bank->ac_no ?? '-'); ?></div>
                                <div><strong>IFSC:</strong> <?php echo e($bank->ifsc ?? '-'); ?></div>
                                <div><strong>Mobile:</strong> <?php echo e($bank->mobile_number ?? '-'); ?></div>
                                <div><strong>UPI:</strong> <?php echo e($bank->upi ?? '-'); ?></div>
                                <div><strong>GPay:</strong> <?php echo e($bank->gpay ?? '-'); ?></div>
                                <div><strong>PhonePe:</strong> <?php echo e($bank->phone_pay ?? '-'); ?></div>
                                <div><strong>Paytm:</strong> <?php echo e($bank->paytm ?? '-'); ?></div>
                            </td>

                          
                          <td>
                          <?php echo e($list->amount); ?>


                          </td>
                           <td>
                          <?php if(isset($list->withdrawStatus)): ?>
                                            <p class="badge badge-lg text-white
                                                <?php if($list->withdrawStatus->id == 1): ?> badge-warning
                                                <?php elseif($list->withdrawStatus->id == 2): ?> badge-success
                                                <?php elseif($list->withdrawStatus->id == 3): ?> badge-danger
                                                <?php else: ?> badge-secondary
                                                <?php endif; ?>">
                                                <?php echo e($list->withdrawStatus->name); ?>

                                            </p>
                                        <?php endif; ?>

                          </td>
                            <td>
                          <?php echo e(dateShow($list->created_at)); ?>


                          </td>
                            <td>
                         <?php echo e(timeShow($list->created_at)); ?>


                          </td>
                           <td>
                            <?php echo e($list->remark); ?>


                          </td>
                             <td>
                                  <?php if($list->withdrawStatus->id == 1): ?>
                             <button type="button" class="btn btn-info btn-lg" data-toggle="modal" onclick="openModal(<?php echo e($list->id); ?>)">Change Status</button>
                             <?php endif; ?>

                          </td>
                      
                        </tr>
                         <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                  <tr>
                    <td colspan="7">Record not found </td>
                  </tr>
                  <?php endif; ?>
                            </tbody>
            </table>

                   </div>
                   </div>
                    <div class="row">
              <div class="col-md-6 text-left" style="margin: 20px 0px;">
                Showing  <?php echo e($lists->firstItem()); ?> to <?php echo e($lists->lastItem()); ?> of <?php echo e($lists->total()); ?>

              </div>
              <div class="col-md-6 text-right">
                <?php echo $lists->appends(request()->input())->links(); ?>

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



<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
     <!--  <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Modal Header</h4>
      </div> -->
      <div class="modal-body">
       <div class="container">
        <div class="justify-content-center">
            <div class="">
                <div class="card">
                    <div class="card-header">Withdraw Status <button type="button" class="close" data-dismiss="modal">&times;</button></div>
                    <div class="card-body">
                        <?php if($errors->any()): ?>
                            <div class="alert alert-danger">
                                <ul>
                                    <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <li><?php echo e($error); ?></li>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </ul>
                            </div>
                        <?php endif; ?>
                        <form method="post" action="<?php echo e(url('/admin/withdraw')); ?>" autocomplete="off" enctype="multipart/form-data">
                            <?php echo csrf_field(); ?>
                            <div class="form-group">
                                <label for="title">Select Status <span class="require label-mandatory">*</span></label>
                                <select  class="form-control   input-mandatory" name="withdraw_statis">
                                <option>
                                    Select Status
                                </option>
                                <?php if(!empty($withdraw)): ?>
                                <?php $__currentLoopData = $withdraw; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $userlists): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($userlists->id); ?>">
                                    <?php echo e($userlists->name); ?>  
                                </option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <?php endif; ?>
                                
                            </select>
                            </div>
                            <div class="form-group">
                                <label for="title">Remark </label>
                                <input type="text" class="form-control"
                                       name="remark" id="amount" required placeholder="Enter Remark" required="">
                            </div>

                          
                            <br>
                            <input type="hidden" name="withdraw_id" value=""> 
                            <div class="form-group">
                                <button type="submit"  class="btn btn-primary" >Submit</button>
                            </div>

                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>

  </div>
</div>
 <?php $__env->stopSection(); ?>
<?php $__env->startSection('js-content'); ?>
<script>

$(function () {

    $('#date_range').daterangepicker({
        autoUpdateInput: false,
        locale: {
            cancelLabel: 'Clear',
            format: 'MM/DD/YYYY'
        },
        ranges: {
           'Today': [moment(), moment()],
           'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
           'Last 7 Days': [moment().subtract(6, 'days'), moment()],
           'Last 30 Days': [moment().subtract(29, 'days'), moment()],
           'This Month': [moment().startOf('month'), moment().endOf('month')],
           'Last Month': [
               moment().subtract(1, 'month').startOf('month'),
               moment().subtract(1, 'month').endOf('month')
           ]
        }
    });

    $('#date_range').on('apply.daterangepicker', function(ev, picker) {
        $(this).val(
            picker.startDate.format('MM/DD/YYYY') + ' - ' +
            picker.endDate.format('MM/DD/YYYY')
        );

        $('#filterForm').submit();
    });

    $('#date_range').on('cancel.daterangepicker', function(ev, picker) {
        $(this).val('');
        $('#filterForm').submit();
    });

});


    function openModal(id){
  $('input[name="withdraw_id"]').val(id);
    $('#myModal').modal();
} 
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.main-layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/onebetplays/public_html/admin.onebetplays.com/resources/views/admin/withdraw/index.blade.php ENDPATH**/ ?>