<?php $__env->startSection('content'); ?>
  <?php
    $totalSpent = $gameplayhistory->sum(fn ($history) => (float) $history->playedamount);
    $latestPlay = $gameplayhistory->max('createtime');
  ?>

  <div class="card-header">
    <h4>Applied Competitions</h4>
  </div>
  <div class="card-body">
    <?php echo $__env->make('admin.partials.flash-messages', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

    <div class="contest-summary-grid">
      <div class="contest-summary-card">
        <span>Student</span>
        <strong><?php echo e($student->name); ?></strong>
      </div>
      <div class="contest-summary-card">
        <span>Total Competitions</span>
        <strong><?php echo e(number_format($gameplayhistory->count())); ?></strong>
      </div>
      <div class="contest-summary-card">
        <span>Total Joined Amount</span>
        <strong>Rs. <?php echo e(number_format($totalSpent, 2)); ?></strong>
      </div>
      <div class="contest-summary-card">
        <span>Latest Activity</span>
        <strong><?php echo e($latestPlay ? $latestPlay->format('d M Y, h:i A') : '-'); ?></strong>
      </div>
    </div>

    <div class="table-responsive">
      <table class="table table-striped table-hover" id="tableExport" style="width:100%;">
        <thead>
          <tr>
            <th>S.No.</th>
            <th>Competition Title</th>
            <th>Join Amount</th>
            <th>Applied Time</th>
            <th>Action</th>
          </tr>
        </thead>
        <tbody>
          <?php $__empty_1 = true; $__currentLoopData = $gameplayhistory; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $history): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <tr>
              <td><?php echo e($loop->iteration); ?></td>
              <td><?php echo e($history->assignment?->competitiontitle ?: ($history->contestname ?: $history->contest?->contesttitile)); ?></td>
              <td>Rs. <?php echo e(number_format((float) $history->playedamount, 2)); ?></td>
              <td><?php echo e($history->createtime?->format('d-m-Y h:i:s A') ?? '-'); ?></td>
              <td>
                <a class="btn btn-info btn-sm" data-toggle="tooltip" data-placement="top" title="Student Exam Result" href="<?php echo e(route('admin.examreaultdetaiils', ['id' => ($history->assignquestionid ?: $history->contestid), 'stid' => $history->userid])); ?>">
                  <i class='fas fa-eye'></i>
                </a>
              </td>
            </tr>
          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <tr>
              <td colspan="5" class="contest-empty-row">This student has not joined any competition yet.</td>
            </tr>
          <?php endif; ?>
        </tbody>
      </table>
    </div>
  </div>

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

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\examproject\examproject_new\resources\views/admin/school/contest/studentscontest.blade.php ENDPATH**/ ?>