<?php
   require_once("header.php");
   require_once("menu.php");
   $databaseService = new DatabaseService();
   $con = $databaseService->getConnection();
?>
<style>
   th {
   width: 20%;
   }
</style>
<div id="layoutSidenav_content">
<main class="mt-4">
   <div class="container-fluid">
      <div class="card mb-4">
         <div class="card-header">
            <i class="fas fa-border-style"></i>  &nbsp;Email Configuration

              <?php 
             $query= $obj-> view_email_setting($row['e_id']);
             $qu= mysqli_num_rows($query);

                      if($qu==0)
              {
              ?>
              <a href="add_email_setting.php" class="btn btn-primary btn-sm float-right add_right">Add</a>
              <?php
               }
              else
              {
                while($row=mysqli_fetch_array($query))
                {
                 ?>
                  <a  href="add_email_setting.php?edit=<?php echo base64_encode($row['e_id']);?>" class="btn btn-primary btn-sm float-right add_right">EDIT INFORMATION</a>
                 
             <?php
               }
               }
               ?>
            
         </div>
         <div class="card-body">
            <div class="table-responsive">
               <?php
                  $ex = $obj->view_email_setting();
                  while($row=mysqli_fetch_array($ex))
                  {
                  ?>
               <table class="table table-bordered" width="100%" cellspacing="0">
                
                  <tr>
                     <th>Name</th>
                     <td><?php echo $row['e_name'];?></td>
                  </tr>
                    <tr>
                     <th>Email Id</th>
                     <td><?php echo $row['e_email'];?></td>
                  </tr>
            <tr>
                     <th>Password</th>
                     <td><?php echo $row['e_password'];?></td>
                  </tr>
                   <tr>
                     <th>Incoming Host Name</th>
                     <td><?php echo $row['e_income_host'];?></td>
                  </tr>
                   <tr>
                     <th>Incoming Port</th>
                     <td><?php echo $row['e_income_port'];?></td>
                  </tr>
                   
                   <tr>
                     <th>IMAP/POP3</th>
                     <td><?php echo $row['e_income_protocol'];?></td>
                  </tr>
                  <tr>
                     <th>Outgoing Host Name</th>
                     <td><?php echo $row['e_smtp_host'];?></td>
                  </tr>
                   <tr>
                     <th>Outgoing Port</th>
                     <td><?php echo $row['e_smtp_port'];?></td>
                  </tr>
                  <tr>
                     <th>SSL/TLS</th>
                     <td><?php echo $row['e_smtp'];?></td>
                  </tr>
                  <tr>
                     <th>Remark</th>
                     <td><?php echo $row['e_remark'];?></td>
                  </tr>
                  <?php } ?>
               </table>
            </div>

         </div>
      </div>
   </div>
</main>
<?php require_once("footer.php");?>