<?php

require __dir__ . '/init.php';

template::get_header();

?>
    
	<?php template::title("My Loan Status"); ?>

    <div class="null">
        <div class="card">
            <div class="sparkline12-list shadow-reset mg-t-30 card-body">
				
				<div class="box-body table-responsive no-padding">
					<table id="table" class="table table-striped table-bordered table-hover w-100" data-table="simple">
						<thead>
							<tr class="info">
								<th>Account</th>
								<th>Date</th>
								<th>Name</th>
								<th style="display:none;"></th>
								<th>Amount</th>
								<th>Duration</th>
								<th>Reason</th>
								<th>Loan ID</th>
								<th>Status</th>
							</tr>
						</thead>
						<tbody>
						<?php 
						
							$sql= "SELECT * FROM loan WHERE account='{$__user['acctno']}' ORDER BY id DESC LIMIT 800";
							$result = mysqli_query($link,$sql);
							
							if(mysqli_num_rows($result) > 0){
								while($row = mysqli_fetch_assoc($result)){  
					  ?>
						<tr class="primary">
							<td><?php echo $row['account'];?></td>

							<td id="account" class='text-nowrap'>  <?php echo $row['date'];?>
							</td>
							<td id="account"> <?php echo $row['name'];?>
							</td>
							<td style="display:none;"><input type="hidden" name="msgid" value="<?php echo $row['msgid'];?>"> </td>

													
							<td><?php echo '$' . number_format($row['amount'], 2); ?></td>
									  
							<td><?php echo $row['duration'];?></td>


							<td><?php echo $row['reason'];?></td>


							<td><?php echo $row['loanid'];?></td>
							<td class='text-nowrap'><?php echo help::stdCheck($row['status'], "Approved", "Unapproved"); ?></td>
						</tr>
					<?php
								}
							}
					?>
						</tbody>
						
					</table>
				</div>
			
			</div>
		</div>
    </div>


<?php template::get_footer(); ?>  