
<?php $__env->startSection('content'); ?>
<div class="card">
  <div class="card-header">
    <h3 class="card-title">You Played Game</h3>
  </div>

  <div align="left">
    <!--<a href="<?php echo e(url('admin/stores-newgame-schedule/create')); ?>" class="btn btn-info">Add New</a>-->
  </div>

  <div class="card-body">
    <?php if(session()->has('message')): ?>
    <div class="alert alert-success">
      <?php echo e(session()->get('message')); ?>

    </div>
    <?php endif; ?>
    <div id="example1_wrapper" class="dt-bootstrap4">
      <div class="row">
        <div class="col-sm-12">
          <div class='tablescroll'>
            <div class="table-responsive">
              <table id="example1" class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info">
                <thead>
                  <tr role="row">
                    <th>Sr No.</th>
                    <th>Game Name</th>
                    <th>Day</th>
                    <th>Open Time</th>
                    <th>Close Time</th>
                    <th>View</th>
                  </tr>
                </thead>
                <tbody>
                  <?php
                  $page = 1;
                  if(Request::input('page'))
                  $page = Request::input('page');
                  $sort = $lists->perPage();
                  ?>

                  <?php
                  $currentDayId = null;
                  $rowSpanCount = 0;
                  ?>

                  <?php $__empty_1 = true; $__currentLoopData = $lists; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $list): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                  <?php
                  $storesGroupedByDay = $list->storesDay->groupBy('stores_day_id')->sortBy(function ($group, $key) {
                  return $key; // Assuming the key represents the day
                  });
                  $gameNameDisplayed = false;
                  $serialNumberDisplayed = false;
                  $actionDisplayed = false;
                  ?>

                  <?php $__currentLoopData = $storesGroupedByDay; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dayId => $stores): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <?php
                  $rowSpanCount = $stores->count();
                  ?>

                  <?php $__currentLoopData = $stores; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $store): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <tr>
                    <?php if($index === 0): ?>
                    <?php if(!$serialNumberDisplayed): ?>
                    <td rowspan="<?php echo e($storesGroupedByDay->flatten()->count()); ?>"><?php echo e($sort * ($page - 1) + ($key + 1)); ?></td>
                    <?php $serialNumberDisplayed = true; ?>
                    <?php endif; ?>
                    <?php if(!$gameNameDisplayed): ?>
                    <td rowspan="<?php echo e($storesGroupedByDay->flatten()->count()); ?>"><?php echo e($list->name); ?></td>
                    <?php $gameNameDisplayed = true; ?>
                    <?php endif; ?>
                    <td rowspan="<?php echo e($rowSpanCount); ?>"><?php echo e(isset($store->storesDayName)? $store->storesDayName[0]->name:''); ?></td>
                    <?php endif; ?>
                    <td><?php echo e(timeShow($store->opent_time)); ?></td>
                    <td><?php echo e(timeShow($store->close_time)); ?></td>
                    <td>
                    
                      <a href="<?php echo e(url('admin/your-store-palyed-open/'.$store->id .'?store_id='.$store->stores_id )); ?>" class="btn btn-primary">View Open</a>
                     <?php if($store->stores_id != 9): ?>
                      <a href="<?php echo e(url('admin/your-store-palyed-close/'.$store->id.'?store_id='.$store->stores_id)); ?>" class="btn btn-primary">View Close</a>
                      <?php endif; ?>
                    </td>
                    
                    <?php $actionDisplayed = true; ?>

                  </tr>
                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                  <tr>
                    <td colspan="6">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>
<?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/a1gamess/public_html/admin.a1gamess.com/resources/views/admin/your-played-game/index.blade.php ENDPATH**/ ?>