<?php
session_start();
include 'include/config.php';

if(!isset($_SESSION['id'])){
 echo "<script> window.location.href = 'index.php' </script>";
  }
?>

<?php  include 'include/head.php'; ?>
                    
                      <!-- Start Content-->
                      <div class="container-fluid">
                        
                        <!-- start page title -->
                        <div class="row">
                            <div class="col-12">
                                <div class="page-title-box">
                                    <div class="page-title-right">
                                        <ol class="breadcrumb m-0">
                                            <li class="breadcrumb-item"><a href="dashboard.php">Home</a></li>
                                            <li class="breadcrumb-item active">User Guarantor Details</li>
                                        </ol>
                                    </div>
                                    <h4 class="page-title">User Guarantor Details</h4>
                                </div>
                            </div>
                        </div>
                         <!--end page title -->
                         
                         <div class="row">
        <div class="card">
            <div class="card-body">
                <!-- Form start -->
                <form method="post" action="">
                    <!-- Dropdown and Input field -->
                    <div class="row">
                        <!--<div class="col-lg-4">-->
                        <!--    <div class="form-group">-->
                        <!--        <label for="exampleFormControlSelect1">Select Spa</label>-->
                        <!--        <select name="spa" class="form-control" id="exampleFormControlSelect1">-->
                        <!--            <option>Select..</option>-->
                        <!--            <?php while($data = mysqli_fetch_assoc($select_spa)){?>-->
                        <!--            <option value="<?php echo $data['unique_id'];?>"><?php echo $data['unique_id'] . ' = ' .$data['name'];?></option>-->
                        <!--            <?php }?>-->
                                    
                        <!--        </select>-->
                        <!--    </div>-->
                        <!--</div>-->
                        <div class="col-lg-4">
                           <div class="form-group">
                               <label for="schedule">User ID/Ac No /Phone No</label>
                               <input type="text" name="userid" class="form-control" id="schedule" placeholder="Enter User ID">
                           </div>
                       </div>
                       
                       <!-- <div class="col-lg-4">-->
                       <!--    <div class="form-group">-->
                       <!--        <label for="schedule">Loan User  ID</label>-->
                       <!--        <input type="text" name="l_userid" class="form-control" id="schedule" placeholder="Enter Loan User ID">-->
                       <!--    </div>-->
                       <!--</div>-->
                       
                       <!--<div class="col-lg-4">-->
                       <!--    <div class="form-group">-->
                       <!--        <label for="schedule">From Date</label>-->
                       <!--        <input type="date" name="from_date" class="form-control" id="schedule">-->
                       <!--    </div>-->
                       <!--</div>-->
                        <div class="col-lg-4" style="margin-top:20px;">
                         <button type="submit" name="submittt" class="btn btn-primary">Submit</button>
                         </div>
                    </div>
                    <!-- End of Dropdown and Input field -->
                    <!-- Submit button -->
                   
                </form>
                
                <?php 
                 if(isset($_POST['submittt'])){
                    $userid = $_POST['userid'];
                  
                         $sql = "SELECT * FROM `user` where `id`='$userid' OR `a_c_number`='$userid' OR `phone`='$userid'";
                        // print_r($sql);
                    }
                ?>
                <!-- Form end -->
            </div>
        </div>
</div>
                          <!--<div>-->
                          <!--    <a href="add_cd.php"  class="btn btn-success"> Add CD Amount</a>-->
                          <!--</div>-->

                        <div class="row">
                            <div class="col-12">
                                <div class="card">
                                    <div class="card-body">
                                        
                                      
                                       <div class="table-responsive">
                                            <div class="tab-pane show active" id="basic-datatable-preview">
                                                <table id="datatable" class="table table-striped dt-responsive nowrap w-100">
                                                    <thead>
                                                        <tr>
                                                            <th>Sr. No.</th>
                                                            <th>Guarantor User ID</th>
                                                            <th>Guarantor Name</th>
                                                             <th>GuarantorEmail</th>
                                                             <th>Guarantor Account Number</th>
                                                             <th>Guarantor Phone Number</th>
                                                             <th>Guarantor Address</th>
                                                             <th>Guarantor Password:</th>
                                                             <th>Guarantor Aadhar Number:</th>
                                                             <th>Guarantor Pan Number:</th>
                                                             <th>Guarantor Profile Image:</th>
                                                             <th>Guarantor Aadhar Front Image:</th>
                                                             <th>Guarantor Aadhar Back Image:</th>
                                                             <th>Guarantor Pan Card Image:</th>
                                                             <th>Guarantor Electricity Bill Image:</th>
                                                             <th>Guarantor Signature Image:</th>
                                                             <th>Guarantor Rent Agreement Image:</th>
                                                            
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                    <?php
                                                  //  $sql = "SELECT * FROM `user` ORDER BY id DESC";
                                                    $res = mysqli_query($conn, $sql);
                                                    $i = 1;
                                                    while ($row = mysqli_fetch_assoc($res)) {
                                                     $guranter_id = $row['guarantor_id'];
                                                    ?>
                                                        <tr>
                                                            <td><?= $i; ?></td>
                                                            <?php $selecttttt = mysqli_fetch_assoc(mysqli_query($conn,"select * from `user` where `id`='$guranter_id'"));?>
                                                            <td><?= $selecttttt['id'] ?></td>
                                                            <td><?= $selecttttt['first_name']. ' ' .$row['last_name'] ?></td>
                                                            <td><?= $selecttttt['email'] ?></td>
                                                            <td><?= $selecttttt['a_c_number'] ?></td>
                                                            <td><?= $selecttttt['phone'] ?></td>
                                                            <td><?= $selecttttt['address'] ?></td>
                                                            <td><?= $selecttttt['password'] ?></td>
                                                            <td><?= $selecttttt['adhar_no'] ?></td>
                                                            <td><?= $selecttttt['pan_no'] ?></td>
                                                            <td> <img src="<?= '../img/profile_image/'.$selecttttt['profile'];?>" style="width:100px; height:60px;"></td>
                                                            <td> <img src="<?= '../img/aadhar_image/'.$selecttttt['adhar_front_pic'];?>" style="width:100px; height:60px;"></td>
                                                            <td> <img src="<?= '../img/aadhar_image/'.$selecttttt['adhar_back_pic'];?>" style="width:100px; height:60px;"></td>
                                                            <td> <img src="<?= '../img/pan_image/'.$selecttttt['pan_image'];?>" style="width:100px; height:60px;"></td>
                                                            <td> <img src="<?= '../img/electricity_bill_image/'.$selecttttt['electricity_bill'];?>" style="width:100px; height:60px;"></td>
                                                            <td> <img src="<?= '../img/signature_image/'.$selecttttt['signature_image'];?>" style="width:100px; height:60px;"></td>
                                                            <td> <img src="<?= '../img/rent_agreement/'.$selecttttt['rent agreement_image'];?>" style="width:100px; height:60px;"></td>
                                                           
                                                            <!--<td>-->
                                                            <!--    <a href="useredit.php?id=<?=$row['id']?>" class="action-icon"> <i class="mdi mdi-square-edit-outline"></i></a>-->
                                                            <!--    <a href="user.php?user=<?= $row['id'] ?>" onclick="return confirm('Are You Sure Want To Delete This?');" class="action-icon"> <i class="mdi mdi-delete"></i></a>-->

                                                            <!--</td>-->
                                                         </tr>
                                                        <?php
                                                       $i++;  } 
                                                        ?>
                                                    </tbody>
                                                </table>                                           
                                            </div> <!-- end preview-->
                                        
                                            
                                        </div> <!-- end tab-content-->

                                    </div> <!-- end card body-->
                                </div> <!-- end card -->
                            </div><!-- end col-->
                        </div> <!-- end row-->

                    
                    </div> <!-- container -->


<?php  
include 'include/footer.php'; 
?>