

<?php $__env->startSection('css-content'); ?>
<style>
    .text-success{color:#28a745;font-weight:600;}
    .text-danger{color:#dc3545;font-weight:600;}
    .text-muted{color:#6c757d;}

    .card{
        border-radius:12px;
        overflow:hidden;
    }

    .card-header{
        padding:12px 15px;
    }

    .card-title{
        margin:0;
        font-size:20px;
        font-weight:700;
    }

    .card-body{
        padding:15px;
    }

    /* Scroll table */
    .tablescroll{
        width:100%;
        overflow-x:auto;
        -webkit-overflow-scrolling:touch;
    }

    table{
        width:100%;
        /*min-width:650px;*/
        font-size:13px;
    }

    th,td{
        white-space:nowrap;
        padding:8px !important;
        vertical-align:middle !important;
        
    }

    th{
        font-weight:700;
    }

    td {
        font-size:15px;
    }
    .filter-box{
        background:#f8f9fa;
        padding:15px;
        border-radius:10px;
    }

    .summary-box{
        text-align:center;
        padding:20px;
        background:#f8f9fa;
        border-radius:12px;
        box-shadow:0 2px 8px rgba(0,0,0,.08);
        margin:15px;
    }

    .summary-title{
        font-size:24px;
        font-weight:700;
        margin-bottom:8px;
    }

    .summary-text{
        font-size:18px;
        font-weight:600;
        margin-bottom:8px;
    }

    .summary-result{
        font-size:20px;
        font-weight:700;
    }

    .btn{
        min-width:100px;
    }

    /* MOBILE */
    @media  (min-width:0px) and  (max-width:768px){

        .card-header{
            padding:10px;
        }

        .card-title{
            font-size:17px;
            text-align:center;
        }

        .card-body{
            padding:10px;
        }

        .filter-box{
            padding:10px;
        }

        .row > div{
            margin-bottom:10px;
        }

        .d-flex{
            flex-direction:column;
        }

        .d-flex .btn{
            width:100%;
            margin-right:0 !important;
            margin-bottom:8px;
        }

        table{
            /*min-width:520px;*/
            font-size:11px;
        }

        th,td{
            padding:6px !important;
        }

        .summary-box{
            padding:15px 10px;
            margin:10px;
        }

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

        .summary-text{
            font-size:14px;
            line-height:22px;
        }

        .summary-result{
            font-size:16px;
        }
        
        
        .select2-dropdown{
            max-width:300px !important;
            width:100%;
        }
        .select2-container{
            width:100% !important;
        }
    }


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

<?php $__env->startSection('content'); ?>
<div class="card">
  <div class="card-header">
    <h3 class="card-title">Market Win/Bid</h3>
  </div>

  <div class="card-body">
      
      <form method="GET" action="">
      <div class="filter-box">
        <div class="row">

          
          <div class="col-md-3 mb-2">
            <label>Store</label>
            <br>
            <select name="stores_id" class="form-control select2">
              <option value="">Select Store</option>
              <?php $__currentLoopData = $stores; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $store): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option value="<?php echo e($store->id); ?>"
                  <?php echo e(request('stores_id') == $store->id ? 'selected' : ''); ?>>
                  <?php echo e($store->name); ?>

                </option>
              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
          </div>

          
          <div class="col-md-3 mb-2">
            <label>Type</label>
            <select name="type" class="form-control">
              <option value="">Both</option>
              <option value="open" <?php echo e(request('type')=='open' ? 'selected' : ''); ?>>Open</option>
              <option value="close" <?php echo e(request('type')=='close' ? 'selected' : ''); ?>>Close</option>
            </select>
          </div>

          
          <div class="col-md-3 mb-2">
            <label>Date</label>
            <input type="date" name="date" value="<?php echo e(request('date')); ?>" class="form-control">
          </div>

          
          <div class="col-md-3 mb-2">
            <label>&nbsp;</label>
            <div class="d-flex">

              <button type="submit" class="btn btn-primary mr-2">
                Search
              </button>

              <a href="<?php echo e(url()->current()); ?>" class="btn btn-danger">
                Reset
              </a>

            </div>
          </div>

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

    <hr/>



    <div class="tablescroll">
      <table class="table table-bordered table-striped">
        <thead>
          <tr>
            <th>Market</th>
            <th>Bid Amount</th>
            <th>Win Amount</th>
            <th>Profit / Loss</th>
          </tr>
        </thead>

        <tbody>
          <?php $__empty_1 = true; $__currentLoopData = $lists; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $list): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>

          <?php
            $profit = ($list->win_amount ?? 0) - ($list->bid_amount ?? 0);
          ?>

          <tr style="background-color: <?php echo e($profit > 0 ? 'red' : 'green'); ?>; color:#fff;">
            <td><?php echo e($list->name); ?></td>
            <td><?php echo e($list->bid_amount ?? 0); ?></td>
            <td><?php echo e($list->win_amount ?? 0); ?></td>

            <td>
              <b><?php echo e($profit); ?></b>
            </td>
          </tr>

          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
          <tr>
            <td colspan="4">Record not found</td>
          </tr>
          <?php endif; ?>
          <tr>
            <td colspan="9"></td>
          </tr>
        </tbody>
        <tfoot style="background:#f8f9fa; font-weight:700;font-size:14px">
            <tr style="background-color: <?php echo e($total_profit_amount > 0 ? 'red' : 'green'); ?>; color:#fff;">
                <th>Total</th>
                <th><?php echo e($total_bid_amount); ?></th>
                <th><?php echo e($total_win_amount); ?></th>
                <th >
                    
                        <span>
                            <?php echo e(abs($total_profit_amount)); ?>

                        </span>
                   
                </th>
            </tr>
        </tfoot>
      </table>
    </div>
  </div>
  
  
  <?php if(isset($store_detail) && isset($result)): ?>
  <div class="card-body" style="text-align:center; padding:25px; background:#f8f9fa; border-radius:10px; box-shadow:0 2px 8px rgba(0,0,0,0.08);">

        <hr>
        <p style="font-size:24px; font-weight:700; margin-bottom:10px;">
            <?php echo e($store_detail->name); ?>

        </p>
    
        <p style="font-size:18px; font-weight:600; margin-bottom:10px;">
            Play: <?php echo e($lists[0]->bid_amount ?? 0); ?> &nbsp; | &nbsp;
            Win: <?php echo e($lists[0]->win_amount ?? 0); ?>

        </p>
    
        <p style="font-size:20px; font-weight:700;  margin-bottom:0;">
            Result : <?php echo e($result); ?>

        </p>
        
        <hr>
        
    <!--    <div class="tablescroll">-->
    <!--  <table class="table table-bordered table-striped">-->
    <!--    <thead>-->
    <!--      <tr>-->
    <!--        <th>Type</th>-->
    <!--        <th>Total Play</th>-->
    <!--        <th>Total Win</th>-->
    <!--        <th></th>-->
    <!--      </tr>-->
    <!--    </thead>-->

    <!--    <tbody>-->
    <!--      <?php $__empty_1 = true; $__currentLoopData = $game_lists; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $list): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>-->


    <!--      <tr>-->
    <!--        <td><?php echo e($list['name']); ?></td>-->
    <!--        <td><?php echo e($list['bid_amount'] ?? 0); ?></td>-->
    <!--        <td><?php echo e($list['win_amount'] ?? 0); ?></td>-->

    <!--        <td>-->
    <!--            <a href="<?php echo e(url('/admin/user-winner?search_date='.request('date').'&store_id='.$store_detail->id.'&game_id='.$list['id'].'&type='.request('type'))); ?>"><i class="fa fa-eye"></i></a>-->
    <!--        </td>-->
    <!--      </tr>-->

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

<?php $__env->startSection('js-content'); ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.main-layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/profcymadev/public_html/onebet.profcymadev.in/resources/views/admin/profit-loss/index.blade.php ENDPATH**/ ?>