<?php

include("includes/header.php"); 
include("includes/sidebar.php");

 

$details = $db_handle->runBaseQuery("SELECT * FROM bank_details");

 ?>
 <div class="main-content app-content">
 	<div class="container-fluid">
 	    <button class="mt-3 btn btn-danger text-light"><a href="add-deposits-details.php?page=deposit-details" class="text-light">ADD DEPOSIT DETAIL</a></button>
 	    
 	    

        <?php if (isset($_SESSION['msg-s'])) { ?>
        <div class="alert alert-success alert-dismissible">
                    <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true">×</button>
                    <h4><i class="icon fa fa-check"></i> Success!</h4> <?php echo $_SESSION['msg-s']; ?>
                </div>
<?php unset($_SESSION['msg-s']); } ?>

<?php if (isset($_SESSION['msg-e'])) { ?>
        <div class="alert alert-danger alert-dismissible" role="alert">
                    <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true">×</button>
                    <h4><i class="icon fa fa-check"></i> Error!</h4> <?php echo $_SESSION['msg-e']; ?>
                </div>
<?php unset($_SESSION['msg-e']); } ?>
<div class="row mt-3">
    
            <div class="col-xl-12">
                <div class="card custom-card">
                    <div class="card-header justify-content-between border-bottom-0">
                        <div class="card-title"> Deposit Details </div>
                        
                    </div>
                    <div class="card-body p-0">
                        <div class="table-responsive">
                            <table class="table text-nowrap table-bordered" id="TableTab">
                                <thead>
                                    <tr>
                                        <th scope="col">#</th>
                                       <th scope="col">Bank Name</th>
                                        <th scope="col">Account Name</th>
                                        
                                        
                                        <th scope="col">Account Number</th>
                                        
                                        <th scope="col">Action</th>
                                       
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php
                                    if($details){
                                        $i = 1;
                                    foreach($details as $detail){
                                       
                                   echo "<tr>";
                                    echo '<td class="fw-medium">'.$i.'</td>';
                                    echo '<td class="fw-medium">'.$detail['bank_name'].'</td>';
                                    echo '<td class="fw-medium">'.$detail['acc_name'].'</td>';
                                      echo '<td class="fw-medium">'.$detail['acc_no'].'</td>';
                                      
                                        

                                         echo '<td>
                                            <div class="btn-list"> <a href="edit-deposit-details.php?detailid='.$detail['id'].'"><button class="btn btn-sm btn-icon btn-success-light rounded-circle" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Edit"><i class="ri-pencil-line lh-1 align-middle"></i></button></a> <button class="btn btn-sm btn-icon btn-danger-light rounded-circle" type="submit" onclick="deleteadmin(\'delete.php?deposit-detail='.$detail['id'].'\')"><i class="ri-delete-bin-line lh-1 align-middle"></i></button> </div>
                                        </td>';
                                       
                                    echo '</tr>';

                                    $i++;
                                    
                                    }

                                }

                                ?>
                                    
                                   
                                   
                                </tbody>
                            </table>
                        </div>
                    </div>
                   
                </div>
            </div>
        </div>
    </div>
 </div>
  <?php

include("includes/footer.php"); 
 ?>