<?php 
include('header.php');
if(isset($_GET['id']) && $_GET['id'] != NULL){
    $id = base64_decode($_GET['id']);
    mysqli_set_charset($conn,"utf8");
    $res = mysqli_query($conn,"SELECT * FROM `birthmanual` WHERE id='$id'");
    $data = mysqli_fetch_assoc($res);
}

if(isset($_POST['ahkweb'])  && $_POST['ahkweb'] == "ahkwebsolutions"){
    $name = mysqli_real_escape_string($conn,$_POST['name']);
    $dob = mysqli_real_escape_string($conn,$_POST['dob']);
    $birth_place = mysqli_real_escape_string($conn,$_POST['birth_place']);
    $aadhar = mysqli_real_escape_string($conn,$_POST['aadhar']);
    $regno = mysqli_real_escape_string($conn,$_POST['regno']);
    $fname = mysqli_real_escape_string($conn,$_POST['fname']);
    $faadhar = mysqli_real_escape_string($conn,$_POST['faadhar']);
    $mname = mysqli_real_escape_string($conn,$_POST['mname']);
    $maadhar = mysqli_real_escape_string($conn,$_POST['maadhar']);
    $permanent_address = mysqli_real_escape_string($conn,$_POST['permanent_address']);
    $birth_address = mysqli_real_escape_string($conn,$_POST['birth_address']);
    $username = $_SESSION['phone'];
    mysqli_set_charset($conn,"utf8");
    $ires = mysqli_query($conn,"UPDATE `birthmanual` SET `name`='$name',`dob`='$dob', `placeofbirth`='$birth_place',`aadharno`='$aadhar',`regno`='$regno',`mname`='$mname',`maadhar`='$maadhar',`fname`='$fname',`faadhar`='$faadhar',`birthaddress`='$birth_address',`permanentaddress`='$permanent_address' WHERE username='$username' AND id='$id'");
    if($ires){
        ?>
        <script>
            $(function(){
                Swal.fire(
                    'Success',
                    'Data Updated Successfully',
                    'success'
                )
            });
        </script>
        <?php
    }else{
        ?>
        <script>
            $(function(){
                Swal.fire(
                    'Opps',
                    'Internal Server Error Please try Agin Later',
                    'error'
                )
            });
        </script>
        <?php
    }
}

?>
<style>
        .payment-form {
            max-width: 1000px;
            margin: auto;
            background: #fff;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 4px 10px rgb(0 0 0 / 80%);
        }

        .payment-form input {
            width: calc(100% - 20px);
            padding: 10px;
            margin: 10px 0;
            border: 1px solid #ccc;
            border-radius: 5px;
        }

        .payment-form button {
            width: 100%;
            padding: 10px;
            background: #28a745;
            color: #fff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }

        .payment-form button:hover {
            background: #218838;
        }

        .qr-popup {
            display: none;
            position: fixed;
            top: 70px;
            left: 50%;
            transform: translateX(-50%);
            width: 300px;
            background: rgb(255, 255, 255);
            justify-content: center;
            padding: 20px;
            border-radius: 10px;
            text-align: center;
            color: #181818;
            border: 5px solid #28a745;
            /* Add a 5px border with green color */
            box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
            /* Optional: Add a shadow for better styling */
        }

        .qr-popup img {
            max-width: 200px;
            margin: 10px auto;
        }

        .qr-popup button {
            margin-top: 10px;
            padding: 10px;
            background: #dc3545;
            color: #fff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
    </style>
		 <div  class="payment-form">
				  <!-- form start -->
				  <form method="post" action="" autocomplete="off" enctype="multipart/form-data">
				  	<input type="hidden" name="_token" value="tXGiuK1UHn9f0bBcdxlFcpI5vWHkwOxHEXkGv43r">	
                    <input type="hidden" name="_method" value="PUT">				    
                    <div class="card-body row">
                            <input type="hidden" name="ahkweb" value="ahkwebsolutions" >
						
                            <div class="form-group col-md-6">
								<label for="aadhar">नाम / Name</label>
								<input type="text" class="form-control" id="name" name="name" placeholder="Name" value="<?php echo $data['name'] ?>">
							</div>
                            <div class="form-group col-md-6">
								<label for="aadhar">जन्मतिथि / Date of birth</label>
								<input type="text" class="form-control" id="dob" name="dob" placeholder="Dob" value="<?php echo $data['dob'] ?>">
							</div>

							<div class="form-group col-md-6">
								<label for="aadhar">आधार नंबर / Aadhar Number</label>
								<input type="text" class="form-control" id="aadhar" name="aadhar" placeholder="AADHAR NUMBER" value="<?php echo $data['aadharno'] ?>">
							</div>

                            <div class="form-group col-md-6">
								<label for="aadhar">Birth Place / जन्म स्थान</label>
								<input type="text" class="form-control" id="birth_place" name="birth_place" placeholder="Birth Place" value="<?php echo $data['placeofbirth'] ?>">
							</div>

						

							<div class="form-group col-md-6">
								<label for="father_name">पिता का नाम / Father Name <span class="text-danger">*</span></label>
								<input type="text" class="form-control" id="father_name" name="fname" placeholder="FATHER NAME" value="<?php echo $data['fname'] ?>" required="">
							</div>

							<div class="form-group col-md-6">
								<label for="father_aadhar">पिता का आधार / Father Aadhar</label>
								<input type="text" class="form-control" id="father_aadhar" name="faadhar" placeholder="FATHER AADHAR" value="<?php echo $data['faadhar'] ?>">
							</div>

							<div class="form-group col-md-6">
								<label for="mother_name">माता का नाम / Mother Name <span class="text-danger">*</span></label>
								<input type="text" class="form-control" id="mother_name" name="mname" placeholder="MOTHER NAME" value="<?php echo $data['mname'] ?>" required="">
							</div>

							<div class="form-group col-md-6">
								<label for="mother_aadhar">माता का आधार / Mother Aadhar</label>
								<input type="text" class="form-control" id="mother_aadhar" name="maadhar" placeholder="MOTHER AADHAR" value="<?php echo $data['maadhar'] ?>">
							</div>

							<div class="form-group col-md-6">
								<label for="permanent_address">स्थायी पता / Permanent Address <span class="text-danger">*</span></label>
								<input type="text" class="form-control" id="permanent_address" name="permanent_address" placeholder="PERMANENT ADDRESS" value="<?php echo $data['permanentaddress'] ?>" required="">
							</div>

							<div class="form-group col-md-6">
								<label for="birth_address">जन्म के समय पता / Address at time of birth <span class="text-danger">*</span></label>
								<input type="text" class="form-control" id="birth_address" name="birth_address" placeholder="ADDRESS OF BIRTH" value="<?php echo $data['birthaddress'] ?>" required="">
							</div>
	                        <div class="form-group col-md-12">
								<label for="date_of_birth">पंजीकरण संख्या / REGISTRATION NUMBER<span class="text-danger">*</span></label>
								<input type="text" class="form-control" id="date_of_birth" name="regno" placeholder="PLACE OF BIRTH" value="<?php echo $data['regno'] ?>" required="">
							</div>
                             
                            
                          
				    </div>
				    <!-- /.card-body -->

				    <div class="card-footer text-right pt-3 pb-3 mt-2">
				      <button type="submit" class="btn btn-primary btn-lg">Update</button>
				    </div>
				  </form>
				</div>
				<!-- /.card -->
			</div>
    	</div>
	</div><!-- /.container-fluid -->
</section>
<!-- /.content -->


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

<!-- 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>