<?php
session_start();
include_once ('conn/session.php');
require_once 'conn/controller.php';
if(!isset($_SESSION['acc_no'])){
	
header("Location: auth_login.php");
exit(); 
}
$user_home = new USER();

if(isset($_GET['subject'])){
	
$subject=$_GET['subject'];
}


if(isset($_GET['id'])){
	
$id=$_GET['id'];
}



$reg_user = new USER();

$stmt = $reg_user->runQuery("SELECT * FROM account WHERE acc_no=:acc_no");
$stmt->execute(array(":acc_no"=>$_SESSION['acc_no']));
$row = $stmt->fetch(PDO::FETCH_ASSOC);


 



?>
 

 <?php include 'auth_header.php'; ?>
 
 <!---begin of Mobile View Here   only from Digital Forest Team-->
 
     
   
   
  				
  <script>
    $(document).ready(function() {
      $('#mybutton').hide().delay(5000).fadeIn(2200);
});
    </script> 

 <style>
input[type=text2] {
  width: 60%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  margin-top: 6px;
  margin-bottom: 16px;
  resize: vertical;
} 

input[type=text], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  margin-top: 6px;
  margin-bottom: 16px;
  resize: vertical;
}

input[type=number], date{
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  margin-top: 6px;
  margin-bottom: 16px;
  resize: vertical;
}


input[type=submit] {
  padding: 12px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

input[type=submit]:hover {
  background-color: #45a049;
}

.container {
  border-radius: 5px;
  background-color: ;
  padding: 20px;
}
</style>
						
				
				
				
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.min.js"></script>  
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.6/jspdf.plugin.autotable.min.js"></script> 
  
				
                                    
           
  
 
 
 <br><br>
 
 
 <div class="container-fluid py-4">
 
  <div class="row">
        <div class="col-12">
          <div class="card my-4">
            <div class="card-header p-0 position-relative mt-n4 mx-3 z-index-2">
              <div class="bg-gradient-primary shadow-primary border-radius-lg pt-4 pb-3">
                <h4 class="text-white text-capitalize ps-3"><img src="icon/support.png" height="30" width="30" > INBOX MESSAGES</h4>
               &nbsp; &nbsp;&nbsp;<input type="button" onclick="generate()" class="btn bg-gradient-dark mb-0"  value="Export To PDF" />
              </div>
            </div>
                <p style="color:darkgreen;">Dont miss any message from us, it could be a security alert</p>
            <div class="card-body px-0 pb-2">
              <div class="table-responsive p-0">
                <table class="table align-items-center mb-0" id="dataexample">
                  <thead>
                    <tr>
                         
                      <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Sender Name</th>
                      <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7 ps-2">Subject</th>
                      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Date</th> 
                      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">MSG ID</th> 
                      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">ACTION</th>
                    </tr>
                  </thead>
                  <tbody>
                    <?php 
								$reci_name = $row['uname'];
								$msg = $user_home->runQuery("SELECT * FROM message INNER JOIN account ON message.reci_name= account.uname  WHERE account.uname = '$reci_name'");
								$msg->execute(array(":reci_name"=>$_SESSION['uname']));
								while($show = $msg->fetch(PDO::FETCH_ASSOC)){?>
								
			 	     <tr>
                       
						<td scope="row"> <?php echo $show['sender_name']; ?> (<?php echo $row['lname']; ?>)</td>
						<td><?php echo $show['subject']; ?></td>
						<td><?php echo $show['date']; ?> </td> 
						<td><?php echo $show['msg_no']; ?>  </td> 
						<td> <a href="read_message.php?msg_no=<?php echo $show['msg_no']; ?>" >READ ME</a></td>
                      </tr>
               
            		   
			 <?php } ?>
                   
              
                      
                    
                    
          
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
      </div>
 
 
 
 </div>
 
 
 
  
  
 
	
	 <script type="text/javascript"> 
 
 
function generate() {  
    var doc = new jsPDF('p', 'pt', 'letter');  
    var htmlstring = '';  
    var tempVarToCheckPageHeight = 0;  
    var pageHeight = 0;  
    pageHeight = doc.internal.pageSize.height;  
    specialElementHandlers = {  
        // element with id of "bypass" - jQuery style selector  
        '#bypassme': function(element, renderer) {  
            // true = "handled elsewhere, bypass text extraction"  
            return true  
        }  
    };  
    margins = {  
        top: 150,  
        bottom: 60,  
        left: 40,  
        right: 40,  
        width: 600  
    };  
    var y = 20;  
    doc.setLineWidth(2);  
   
    
     doc.text(200, y = y + 30,"MY BANK MESSAGES"); 
 
    doc.autoTable({  
        html: '#dataexample',  
        startY: 70,  
        theme: 'striped',  
        columnStyles: {  
            0: {  
                cellWidth: 30,  
            },  
            1: {  
                cellWidth: 120,  
            },  
            2: {  
                cellWidth: 70,  
            },
            3: {  
                cellWidth: 80,  
            },
            4: {  
                cellWidth: 80,  
            },
            5: {  
                cellWidth: 80,  
            },
            6: {  
                cellWidth: 80,  
            }
       
        },  
        styles: {  
            minCellHeight: 20  
        }  
    })  
    doc.save('bank_messages.pdf');  
}  
</script> 
 























 
			  
 
	
       

 <?php include 'auth_footer.php'; ?>		
	 
    
								
						
 
 
         
         
         
         
         
         
         
         
         