<!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>
                  </div>
                  <div class="card-body">
                      
                    <div class="table-responsive">
                      <table class="table table-striped table-hover" id="contacts" style="width:100%;">
                        <thead>
                          <tr>
                            <th>#</th>
                            <th>Name</th>
                            <th>Email</th>
                            <th>Phone</th>
                            <th>Message</th>
                            <th>Date</th>
                            <th>Options</th>
                          </tr>
                        </thead>
                      </table>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </section>
      </div>
         <!---delete modal--->
          <?php 
          $datas = $this->db->get_where('contact_us')->result();
          foreach($datas as $data) {
          ?>
          <div class="modal fade" id="delete_modal<?=$data->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_message/<?=$data->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_contacts') ?>";
    		$('#contacts').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": "name" },
					{ "data": "email" },
					{ "data": "phone" },
					{ "data": "message" },
					{ "data": "date" },
					{ "data": "options" },
				],
				"drawCallback": function( settings ) {
			        $('.add-tooltip').tooltip();
			    },
		    });
    	
    });
    </script>
</html>