<div class="main-content">



<div class="page-content">

  <div class="container-fluid">



    <div class="row">



      <div class="col-lg-12">

       <div class="card">

        <div class="card-body">    

         <h4 class="mt-0 header-title m-b-30 mb-2">Admin Messages</h4>

         <a href="<?= base_url();?>admin/create_support" class="btn btn-primary mb-3">Send Message </a>

         <?php  if($this->session->flashdata()) {

          echo Helpers::showFlash($this->session->flashdata("response"));

        } ?>



        <table id="example" class="table table-striped table-bordered dt-responsive nowrap">

          <thead>

           <tr>

               <th>Sr No.</th>

             <th>ID</th>

             <th>Email</th>

             <th>Subject</th>

             <th>Message</th>

             <!-- <th>Status</th> -->

             <th>Date</th>

           </tr>

         </thead>

         <tbody>

           <?php if(!empty($data)) { ?>

             <?php foreach ($data as $key => $complaint) { 

               $user = Helpers::getUserObj($complaint["user_id"]); ?>

               <tr>

                   <td><?= $key+1; ?></td>

                 <td><a href="<?= Helpers::adminLink('single_complaint').'/'.$complaint['ticket_no'].'/admin_message'; ?>">View Chat</td>

                   <td><?= $user["email"]; ?></td>

                   <td><?= $complaint["subject"]; ?></td>

                   <td><?= word_limiter($complaint["message"], 2); ?></td>

                   <!-- <td><?= ($complaint["status"] == 0) ? "Not resolved" : "Resolved"; ?></td> -->

                   <td><?= $complaint["created_at"]; ?></td>

                 </tr>

               <?php } } else {?>

                 <tr><td colspan="6">No new message!</td></tr>

               <?php } ?>

             </tbody>

           </table> 



         </div>

       </div>



     </div>



   </div>

 </div>

</div>



