<?php
include('header.php');
    

if (isset($_GET['id']) && $_GET['id'] != NULL) {
    $id = base64_decode($_GET['id']);
    $res = mysqli_query($conn, "SELECT * FROM `name` WHERE id='$id'");
    $data = mysqli_fetch_assoc($res);
}


if (isset($_POST['ahkweb'])  && $_POST['ahkweb'] == "ahkwebsolutions") {
   $name = mysqli_real_escape_string($conn,$_POST['name']);
$email = mysqli_real_escape_string($conn,$_POST['email']);

	$fname = mysqli_real_escape_string($conn,$_POST['fname']);
	$dob = mysqli_real_escape_string($conn,$_POST['birthdate']);
	$aadhaar_no = mysqli_real_escape_string($conn,$_POST['aadhaar_no']);
	$mobile_no = mysqli_real_escape_string($conn,$_POST['mobile_no']);
	$email = mysqli_real_escape_string($conn,$_POST['email']);
	$father_aadhaar_no = mysqli_real_escape_string($conn,$_POST['father_aadhaar_no']);
	$child_name_hindi = mysqli_real_escape_string($conn,$_POST['child_name_hindi']);
	$gender = mysqli_real_escape_string($conn,$_POST['gender']);
	$village = mysqli_real_escape_string($conn,$_POST['village']);
	$block = mysqli_real_escape_string($conn,$_POST['block']);
	$tehsil = mysqli_real_escape_string($conn,$_POST['tehsil']);
	$district = mysqli_real_escape_string($conn,$_POST['district']);
	$pincode = mysqli_real_escape_string($conn,$_POST['pincode']);
	$state = mysqli_real_escape_string($conn,$_POST['state']);
	$purpose = mysqli_real_escape_string($conn,$_POST['purpose']);

    $username = $_SESSION['phone'];
    $ires = mysqli_query($conn,"UPDATE `usertable` SET `name`='$name', `emailid`='$email', phone='$phone', `walletamount`='$walletamount',`panwallet`='$panwallet',`state`='$state',`city`='$city',`password`='$password',`status`='$status', `usertype`='$usertype' WHERE userid='$id' ");    

    if($ires){
        ?>
        <script>
            $(function(){
                Swal.fire(
                    'Success',
                    'User Updated Successfully',
                    'success'
                )
            });
        </script>
        <?php
    }else{
        ?>
        <script>
            $(function(){
                Swal.fire(
                    'Opps',
                    'Internal Server Error Please try Agin Later',
                    'error'
                )
            });
        </script>
        <?php
    }
}
?>
      <div class="container-fluid">
                <div class="row page-header">
        <div class="col-lg-6 align-self-center ">
           
            <ol class="breadcrumb">
         
            </ol>
        </div>
        
    </div>
<section class="main-content">
        <div class="row">
        
<div class="alert alert-info text-center mb-4">
    <h3 style="margin-bottom:5px;">
        <?php echo strtoupper($data['name']); ?>
    </h3>
    <h5>
        Aadhaar Number :
        <?php echo $data['gender']; ?>
    </h5>
</div>

<div class="form-group">
    <div class="row">

        <div class="col-md-4 mb-3">
            <label><b>OLD NAME</b></label>
            <input type="text" readonly id="fullname" name="fullname"
                class="form-control"
                value="<?php echo $data['name']; ?>">
        </div>

        <div class="col-md-4 mb-3">
            <label><b>NEW NAME IN ENGLISH</b></label>
            <input type="text" readonly name="email"
                class="form-control"
                value="<?php echo $data['email']; ?>">
        </div>

        <div class="col-md-4 mb-3">
            <label><b>NEW NAME IN HINDI</b></label>
            <input type="text" readonly name="father_aadhaar_no"
                class="form-control"
                value="<?php echo $data['father_aadhaar_no']; ?>">
        </div>

        <div class="col-md-4 mb-3">
            <label><b>DOB</b></label>
            <input type="text" readonly id="dob" name="dob"
                class="form-control"
                value="<?php echo $data['dob']; ?>">
        </div>

        <div class="col-md-4 mb-3">
            <label><b>FATHER NAME</b></label>
            <input type="text" readonly name="child_name_hindi"
                class="form-control"
                value="<?php echo $data['child_name_hindi']; ?>">
        </div>

        <div class="col-md-4 mb-3">
            <label><b>AADHAAR NUMBER</b></label>
            <input type="text" readonly name="gender"
                class="form-control"
                value="<?php echo $data['gender']; ?>">
        </div>

        <div class="col-md-4 mb-3">
            <label><b>MOBILE NUMBER</b></label>
            <input type="text" readonly id="mobileno"
                name="mobile"
                class="form-control"
                value="+91 <?php echo $data['mobile_no']; ?>">
        </div>

        <div class="col-md-4 mb-3">
            <label><b>VILLAGE / ग्राम</b></label>
            <input type="text" readonly name="village"
                class="form-control"
                value="<?php echo $data['village']; ?>">
        </div>

        <div class="col-md-4 mb-3">
            <label><b>POST / पोस्ट</b></label>
            <input type="text" readonly name="block"
                class="form-control"
                value="<?php echo $data['block']; ?>">
        </div>

        <div class="col-md-4 mb-3">
            <label><b>LANDMARK</b></label>
            <input type="text" readonly name="tehsil"
                class="form-control"
                value="<?php echo $data['tehsil']; ?>">
        </div>

        <div class="col-md-4 mb-3">
            <label><b>DISTRICT / ज़िला</b></label>
            <input type="text" readonly name="district"
                class="form-control"
                value="<?php echo $data['district']; ?>">
        </div>

        <div class="col-md-4 mb-3">
            <label><b>STATE / राज्य</b></label>
            <input type="text" readonly name="state"
                class="form-control"
                value="<?php echo $data['state']; ?>">
        </div>

        <div class="col-md-4 mb-3">
            <label><b>PIN CODE</b></label>
            <input type="text" readonly name="pincode"
                class="form-control"
                value="<?php echo $data['pincode']; ?>">
        </div>

        <div class="col-md-4 mb-3">
            <label><b>PURPOSE</b></label>
            <input type="text" readonly id="purpose"
                name="purpose"
                class="form-control"
                value="<?php echo $data['purpose']; ?>">
        </div>

                            
                            <!-- <div class="form-group">
									<button type="submit" name="myButton" class="btn btn-success btn-icon"><i class="fa fa-floppy-o"></i>Submit</button>
							</div> -->
                        </form>
                    </div>
                </div>
            </div>
        </div>
        
<footer class="footer">
            
            </footer>      </section>
    <!-- Content Header (Page header) -->
  

    <!-- /.content -->


</div>
<!-- /.content-wrapper -->

<!-- <footer class="main-footer">
    <strong>Copyright &copy; 2014-2021 <a href="https://adminlte.io">AdminLTE.io</a>.</strong>
    All rights reserved.
    <div class="float-right d-none d-sm-inline-block">
      <b>Version</b> 3.1.0
    </div>
  </footer> -->

<!-- Control Sidebar -->
<!-- <aside class="control-sidebar control-sidebar-dark"> -->
<!-- Control sidebar content goes here -->
<!-- </aside> -->
<!-- /.control-sidebar -->

<!-- ./wrapper -->
<div class="modal fade" id="logoutModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
        aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel">Ready to Leave?</h5>
                    <button class="close" type="button" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">×</span>
                    </button>
                </div>
                <div class="modal-body">Select "Logout" below if you are ready to end your current session.</div>
                <div class="modal-footer">
                    <button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
                    <a class="btn btn-primary" href="../logout.php">Logout</a>
                </div>
            </div>
        </div>
    </div>
<!-- jQuery -->
<script src="plugins/jquery/jquery.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="plugins/jquery-ui/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
    $.widget.bridge('uibutton', $.ui.button)
</script>
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>

<!-- Select2 -->
<script src="plugins/select2/js/select2.full.min.js"></script>

<!-- SweetAlert -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/8.11.8/sweetalert2.all.min.js"></script>

<!-- DataTables  & Plugins -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script src="plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>

<script src="plugins/datatables-buttons/js/buttons.html5.min.js"></script>
<script src="plugins/datatables-buttons/js/buttons.print.min.js"></script>
<script src="plugins/datatables-buttons/js/buttons.colVis.min.js"></script>

<!-- ChartJS -->
<script src="plugins/chart.js/Chart.min.js"></script>
<!-- Sparkline -->
<script src="plugins/sparklines/sparkline.js"></script>
<!-- JQVMap -->
<script src="plugins/jqvmap/jquery.vmap.min.js"></script>
<script src="plugins/jqvmap/maps/jquery.vmap.usa.js"></script>
<!-- jQuery Knob Chart -->
<script src="plugins/jquery-knob/jquery.knob.min.js"></script>
<!-- daterangepicker -->
<script src="plugins/moment/moment.min.js"></script>
<script src="plugins/daterangepicker/daterangepicker.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- Summernote -->
<script src="plugins/summernote/summernote-bs4.min.js"></script>
<!-- overlayScrollbars -->
<script src="plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="dist/js/demo.js"></script>
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
<script src="dist/js/pages/dashboard.js"></script>

<script src="https://code.jquery.com/ui/1.13.0/jquery-ui.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.3/jquery.validate.min.js" integrity="sha512-37T7leoNS06R80c8Ulq7cdCDU5MNQBwlYoy1TX/WUsLFC2eYNqtKlV0QjH7r8JpG/S0GUMZwebnVFLPd6SU5yg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-toast-plugin/1.3.2/jquery.toast.min.js" integrity="sha512-zlWWyZq71UMApAjih4WkaRpikgY9Bz1oXIW5G0fED4vk14JjGlQ1UmkGM392jEULP8jbNMiwLWdM8Z87Hu88Fw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

<script>
    function alertMessage(type, message) {
        if (type == 'error') {
            type = 'danger';
        }

        return "<div class='alert alert-" + type + " alert-dismissible'> <a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a> " + message + " </div>";
    }
</script>



</body>

</html>