<!DOCTYPE html>
<html lang="en">
<?php include('fixed/top.php');  ?>
<body>
  <div class="loader"></div>
  <div id="app">
    <div class="main-wrapper main-wrapper-1">
      <div class="navbar-bg"></div>

       <?php include('fixed/navigation.php');  ?>
      <!-- Main Content -->
      <div class="main-content">
        <section class="section">
          <div class="section-body">
            <div class="row">
              <div class="col-12">
                   <?php echo $this->session->flashdata('msg'); ?>
                <div class="card">
                  <div class="card-header">
                    <h4><?=$title?></h4>
                      <a href="<?php echo base_url(); ?>admin/add_courses"><button data-target="#add_client" data-toggle="modal" class="btn btn-outline-primary" style="float:right;">Add Courses</button></a>
                  </div>
                  <div class="card-body">
                      
                    <div class="table-responsive">
                      <table class="table table-striped table-hover" id="banner" style="width:100%;">
                        <thead>
                          <tr>
                            <th>#</th>
                            <th>Photo</th>
                            <th>Title</th>
                            <th>Content</th>
                            <th>Options</th>
                          </tr>
                        </thead>
                      </table>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </section>
      </div>
         <!---delete modal--->
          <?php 
          $courses = $this->db->get_where('courses')->result();
          foreach($courses as $course) {
          ?>
          <div class="modal fade" id="delete_modal<?=$course->id?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
          aria-hidden="false">
          <div class="modal-dialog" role="document">
         <form id="" method="post" action="<?php echo base_url(); ?>admin/delete_course/<?=$course->id?>" enctype="multipart/form-data">
            <div class="modal-content">
              <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel" style="color:red;">Delete Data</h5>
              </div>
              <div class="modal-body">
                <div class="row clearfix">
                     <div class="col-md-12 col-sm-12 col-xs-12">
                               <div class="form-group">
                               <p>Are you sure you want to delete this record ?</p>
                                   </div>
                      </div>   

                            </div>   
              </div>
               
              <div class="modal-footer bg-whitesmoke br">
                <button type="submit" class="btn btn-primary" id="send">Continue</button>
                <!--button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button-->
              </div>
            </div>
              </form>
          </div>
        </div>
          <?php } ?>
        
        
      <?php include('fixed/footer.php');  ?>
    </div>
  </div>
   <?php include('fixed/bottom.php');  ?>
</body>
<script>
    $(document).ready(function () {
    	var url = "";
    	
    		url = "<?php echo base_url('admin/list_courses') ?>";
    		$('#banner').DataTable({
	            "processing": true,
	            "serverSide": true,
	            "ajax":{
					"url": url,
					"dataType": "json",
					"type": "POST",
					"data":{  '<?php echo $this->security->get_csrf_token_name(); ?>' : '<?php echo $this->security->get_csrf_hash(); ?>' }
				},
		    	"columns": [
					{ "data": "#" },
					{ "data": "photo" },
					{ "data": "title" },
					{ "data": "content" },
					{ "data": "options" },
				],
				"drawCallback": function( settings ) {
			        $('.add-tooltip').tooltip();
			    },
		    });
    	
    });
    </script>
<style>
    #truncate {
display: block;
display: -webkit-box;
max-height: 100px;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis; 
} 
.dataTable th, .dataTable td {
max-width: 20px;
min-width: 15px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}</style>
</html>