    <div class="content-header">
        <div class="container-fluid">
            <div class="row mb-3 mt-3">
                <div class="col-sm-6">
                    <h1 class="m-0 text-dark"><?=$sportsinfo['title']?>, Teams ,Player</h1>
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.container-fluid -->
    </div>
    <!-- Main content -->

        <?php if($sportsinfo['teams']==true){?>
            <br><br>
       <button type="button" style="
    float: right;
" class="btn btn-primary" data-toggle="modal" data-target="#myModal1">
  Add Team
</button>
<br><br>
        <?php 
    } 
        ?>
  <?php if($sportsinfo['teams']==true){?>
    <section class="content mt-5">
        <div class="container-fluid">
            <form method="post" id="add_driver" class="card" action="<?php echo base_url();?>dashboard/addsports">
                <div class="card-body">
                    <h5 class="mb-3">TailGate Teams</h5>

            </form>
            <table class="table table-bordered" cellspacing="0">
                <thead class="thead-dark">
                    <tr>
                        <th>No.</th>
                        <th>Team Name</th>
                        <th>Action</th>

                    </tr>
                </thead>
                <tbody>
                    <?php
                    $count = 1;
                        foreach ($teamdetail as $key=>$tailGateTeam) {
                    ?>
                    <tr>
                        <td style="width: 10%"><?=$count?></td>
                        <td style="width: 90%"><?=$tailGateTeam['title']?></td>
                        <td><a 
                                class="btn btn-danger"
                            href="<?php echo base_url().'dashboard/deleteteam/'.$id.'/'.$key ?>">
                                Delete
                                </a>
                        </td>
                    </tr>
                    <?php $count++; } ?>
                </tbody>
            </table>
        </div>
    </section>
<?php } ?>
        <?php if($sportsinfo['player']==true){?>
 <br><br>
       <button type="button" style="
    float: right;
" class="btn btn-primary" data-toggle="modal" data-target="#myModal">
  Add Player
</button>
<br><br>
        <?php 
    } 
        ?>


    <section class="content mt-5">
        <div class="container-fluid">
            <form method="post" id="add_driver" class="card" action="<?php echo base_url();?>dashboard/addsports">
                <div class="card-body">

            </form>
            <table class="table table-bordered" cellspacing="0">
                <thead class="thead-dark">
                    <tr>
                        <th>Player</th>
  <?php if($sportsinfo['teams']==true){?>
                        <th>Team</th>
                    <?php } ?>

                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                        <?php
        foreach($playerdetail as $key =>$leagueTeam) {
    ?>
                    <tr>
                        <td style="width: 50%"><?=$leagueTeam['title']?></td>
                          <?php if($sportsinfo['teams']==true){?>
                        <td style="width: 30%">

                      <?php
                   foreach ($teamdetail as $key1=>$tailGateTeam) {
                    if($key1==$leagueTeam['teamId']){
                        echo $tailGateTeam['title'];
                    }
                    ?>

                    <?php } ?>          

                            </td>
                        <?php }?>

                        <td style="width: 20%">
                            <a 
                                class="btn btn-danger"
                            href="<?php echo base_url().'dashboard/deletemyplayer/'.$id.'/'.$key ?>">
                                Delete
                                </a>

                        </td>
                    </tr>
                    <?php } ?>
                </tbody>
            </table>
        </div>
    </section>
    



    <!-- /.content -->

  <!-- The Modal -->
  <div class="modal fade" id="myModal">
    <div class="modal-dialog">
      <div class="modal-content">
      
        <!-- Modal Header -->
        <div class="modal-header">
          <h4 class="modal-title">Player Add</h4>
          <button type="button" class="close" data-dismiss="modal">&times;</button>
        </div>
        
        <!-- Modal body -->
   <form method="post" enctype="multipart/form-data"  action="<?php echo  base_url('dashboard/insertplayer/'.$id)  ?>">
        <div class="modal-body">
                <div class="row">

                      <div class="col-sm-6 col-md-6">
                            <label class="form-label">Player Name<span class="form-required">*</span></label>
                            <div class="form-group">
                                <input type="text" name="title" id="title" class="form-control" placeholder="Title"  required="">
                            </div>
                        </div>
  <?php if($sportsinfo['teams']==true){?>
                       <div class="col-sm-6 col-md-6">
                            <label class="form-label">Team<span class="form-required">*</span></label>
              <input type="hidden" name="sportid" value="<?php echo $id; ?>">
                            <div class="form-group">
                                <select class="form-control" name="teamId"  required="">
                      <?php
                        foreach ($teamdetail as $key=>$tailGateTeam) {?>


                                    <option value="<?php echo $key; ?>"><?=$tailGateTeam['title']?></option>
                                <?php } ?>
                                </select>
                            </div>
                        </div>  

                   <?php } ?>

                </div>



            


        </div>
        
        <!-- Modal footer -->
        <div class="modal-footer">
                    <button type="submit" class="btn btn-primary"> <?php echo 'Add Player'; ?></button>
          <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
    
        </div>
        </form>
        
      </div>
    </div>
  </div>

    <!-- The Modal -->
  <div class="modal fade" id="myModal1">
    <div class="modal-dialog">
      <div class="modal-content">
      
        <!-- Modal Header -->
        <div class="modal-header">
          <h4 class="modal-title">Team Add</h4>
          <button type="button" class="close" data-dismiss="modal">&times;</button>
        </div>
        
        <!-- Modal body -->
   <form method="post" enctype="multipart/form-data"  action="<?php echo  base_url('dashboard/insertteam/'.$id)  ?>">
        <div class="modal-body">
                


                <div class="row">


                      <div class="col-sm-6 col-md-6">
                            <label class="form-label">Team Name<span class="form-required">*</span></label>
                            <div class="form-group">
                                <input type="text" name="title" id="title" class="form-control" placeholder="Title"  required="">
                                <input type="hidden" name="sportid" value="<?php echo $id; ?>">
                            </div>
                        </div>

                   

                </div>



            


        </div>
        
        <!-- Modal footer -->
        <div class="modal-footer">
                    <button type="submit" class="btn btn-primary"> <?php echo 'Add Team'; ?></button>
          <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
    
        </div>
        </form>
        
      </div>
    </div>
  </div>
