<?php $__env->startSection('content'); ?>
  <div class="content-wrapper">
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6 pb-2 pb-sm-0">
            <h1>Match List</h1>
          </div>
          <div class="col-sm-6 text-sm-right">
            <a href="<?php echo e(url('admin/matches/add')); ?>" class="btn btn-primary">Add New Match</a>
          </div>
        </div>
      </div>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-md-12">
            <div class="card">
              <div class="card-body table-responsive p-3">
                <table id="matchTable" style="width: 100%;" class="table table-striped">
                  <thead>
                    <tr>
                      <th style="width: 80px">S. No.</th>
                      <th>League Name</th>
                      <th>League Type</th>
                      <th>Team One Name</th>
                      <th>Team One Flag</th>
                      <th>Team Two Name</th>
                      <th>Team Two Flag</th>
                      <th>Match Date</th>
                      <th>Match Time</th>
                      <th>Status</th>
                      <th>Action</th>
                    </tr>
                  </thead>
                  <tbody>
                    <!-- Dynamic data will be loaded here by DataTables -->
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
<script>
  // Yajra datatable
  $(document).ready(function() {
    var table = $('#matchTable').DataTable({
      processing: true,
      serverSide: true,
      ajax: {
        url: '<?php echo e(route('admin.matches.index')); ?>',
      },
      columns: [
        {
          data: null, 
          name: 'serial',
          orderable: false,
          searchable: false,
          render: function (data, type, full, meta) {
            return meta.row + 1; 
          }
        },
        { data: 'league_name', name: 'league_name' },
        { 
          data: 'league_type', 
          name: 'league_type',
          render: function (data) {
            return data
              .toLowerCase()
              .replace(/(?:^\w|[A-Z]|\b\w)/g, function(match) {
                return match.toUpperCase();
              })
              .replace(/\s+/g, ''); 
          }
        },
        { data: 'team_one_name', name: 'team_one_name' },
        { 
          data: 'team_one_flag', 
          name: 'team_one_flag',
          render: function(data, type, row, meta) {
            if (data) {
              return '<img src="<?php echo e(asset('')); ?>' + data + '" alt="Flag" style="width: 50px; height: 50px;">';
            }
            return 'N/A';
          }
        },
        { data: 'team_two_name', name: 'team_two_name' },
        { 
          data: 'team_two_flag', 
          name: 'team_two_flag',
          render: function(data, type, row, meta) {
            if (data) {
              return '<img src="<?php echo e(asset('')); ?>' + data + '" alt="Flag" style="width: 50px; height: 50px;">';
            }
            return 'N/A';
          }
        },
        { data: 'match_date', name: 'match_date' },
        { data: 'match_time', name: 'match_time' },
        { data: 'status', name: 'status' },
        { data: 'actions', name: 'actions', orderable: false, searchable: false },
      ],
      responsive: true 
    });

  });
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('backend.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\miniOTTCodeCanyon2\resources\views/backend/admin/matches/index.blade.php ENDPATH**/ ?>