<?php
include('../includes/config.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']);

	$fname = mysqli_real_escape_string($conn,$_POST['fname']);
	$dob = mysqli_real_escape_string($conn,$_POST['dob']);
	$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']);
	$status = "pending";
	// fingers 
	$photo1 = mysqli_real_escape_string($conn,$_POST['photo1']);
	$photo2 = mysqli_real_escape_string($conn,$_POST['photo2']);
	$photo3 = mysqli_real_escape_string($conn,$_POST['photo3']);
	$photo4 = mysqli_real_escape_string($conn,$_POST['photo4']);
	$photo5 = mysqli_real_escape_string($conn,$_POST['photo5']);

    $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
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<!-- The rest of your HTML code goes here -->

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Mobile Update Slip</title>
  <link rel="stylesheet" href="index.css">
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Lexend+Peta:wght@300&display=swap" rel="stylesheet">
  <script src="https://cdn.tailwindcss.com"></script>

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">



</head>

<body class="flex justify-center">
  <div class="certificate bg-white border">
    <div class="container p-4">
      <div class="border border-black ">
        <div>
          <div class="flex justify-center py-1">
            <img width="30px" src="data:image/png;base64,[encoded data, 12452 characters]" alt="">
            
            

          </div>
          

          <div class="flex justify-between">
            <div></div>
            <div class="flex flex-col items-center justify-center">
              <p class="text-[10px] "><span class="font-bold">Unique Identification Authority of India, Government of
                  Indian </span>/ भारतीय विशिष्ट पहचान प्राधिकरण, भारत सरकार </p>
                 <p class="text-[10px]"><span class="font-bold">Acknowledgement/Consent for update</span> / पावती / नवीनीकरण
                   सहमति</p>
            </div>
            <div class="">
              <img width="70" src="data:image/png;base64,[encoded data, 8448 characters]" alt="">
            </div>
          </div>


          <div class="flex justify-center">
            <div class="border-b border-dotted border-gray-400 px-2 pt-1 w-[98%]"></div>
          </div>

          <div class="flex justify-between px-4 py-[4px]">
            <p class="text-[10px]"><span class="font-bold">Update Request No.</span>/ अपडेट अनुरोध संख्या: </p>
            <p id="randomNumber" class="text-[10px] font-bold"></p>

    <script>
        // Function to generate a random number in the specified range
        function getRandomNumber(min, max) {
            return Math.floor(Math.random() * (max - min + 1)) + min;
        }

        // Function to generate the random number string
        function generateRandomNumberString() {
            const part1 = getRandomNumber(1000, 9999);
            const part2 = getRandomNumber(10000, 99999);
            const part3 = getRandomNumber(10000, 99999);
            
            return `${part1}/${part2}/${part3}`;
        }

        // Display the random number on page load
        document.getElementById('randomNumber').textContent = generateRandomNumberString();

        // Update the random number on page refresh
        window.addEventListener('load', function() {
            document.getElementById('randomNumber').textContent = generateRandomNumberString();
        });
    </script>

            <p class="text-[10px] font-semibold">***This is not the Aadhaar Number*** Date/ तिथि : </p>
            <p class="text-[10px] font-bold" id="dateTime"></p>

    <script>
        // Get the element by its ID
        var dateTimeElement = document.getElementById("dateTime");
// Set the content of the element to the current date and time in IST
        var currentDateTimeIST = new Date().toLocaleString('en-US', {timeZone: 'Asia/Kolkata'});
        dateTimeElement.innerText = currentDateTimeIST;
        // Get the content of the element
        var dateTimeString = dateTimeElement.innerText;

        // Parse the date string
        var parsedDate = new Date(dateTimeString);
        
        // Log the current date and time
        console.log(currentDateTime);

        // Display the parsed date in a human-readable format (only date)
        var formattedDate = parsedDate.toLocaleDateString();
        console.log(formattedDate);

        // If you want to set the displayed date in the HTML element
        dateTimeElement.innerText = formattedDate;
    </script>

          </div>

          <div class="flex justify-center">
            <div class="border-b border-dotted border-gray-400 px-2 w-[98%]"></div>
          </div>

          <div class="flex justify-center pt-1">
            <p class="text-[10px]"><span class="font-bold">Appointment No </span> / नियुक्ति संख्या: <B> -NA-</B></p>
          </div>

          <div class="px-2">
            <div class="w-full mx-auto border border-dotted border-gray-400">

              <div class="flex items-center w-[78%] border-r border-dotted border-black py-1">
                <p class="text-[10px] px-1 font-semibold"><B>AADHAAR No</B> / आधार संख्या<?php
$aadhaar_number = $data['aadhaar_no'];
$masked_aadhaar = substr_replace(str_repeat('x', 8), ' ', 4, 0) . ' ' . substr($aadhaar_number, -4);
echo $masked_aadhaar;
?>
</p>
              </div>

              <div class="flex">
                <div class="border-b border-dotted border-gray-400 w-[78%]"></div>
              </div>

              <div class="flex">

                <div class="flex flex-col w-[39%] border-r border-b border-dotted border-black py-1 h-[120px]">
                  <p class="text-[10px] px-1 font-semibold"><?php echo $data['name'] ?></p>
                  <p class="text-[10px] px-1 font-semibold"><B>Update(s) made as per request:</B></p>
                  <p class="text-[10px] px-1 font-semibold"><B>Demographics update-</B></p>
                </div>

<div class="flex w-[39%] border-r border-b border-dotted border-black py-1 h-[120px]">
                  <p class="text-[10px] px-1 font-semibold"> 
                  <?php echo $data['name'] ?>                  </p>
                </div>



                <div class="flex w-[22%] border-b border-dotted border-black py-1 h-[110px]">

                </div>



              </div>

              <div>

                <div class="flex">
                  <div class="flex w-[39%] border-r border-b border-dotted border-black py-1 h-[30px]">
                    <p class="text-[10px] px-1 font-semibold"></p>
                  </div>

                  <div class="flex w-[39%] border-r border-b border-dotted border-black py-1 h-[30px]">
                    <span class="text-[10px] px-1 "><span class="font-bold">Mobile</span>/ मोबाइल </span><span
                      class="text-[10px] pl-3 font-semibold">+91 <?php echo $data['mobile_no'] ?></span>
                  </div>

                </div>



                <div class="flex flex-col w-[78%]  border-r border-b border-dotted border-black py-1">
                  <p class="text-[10px] px-1 font-semibold pb-1">References:   <?php echo $data['purpose'] ?> </p>
                  <p class="text-[10px] px-1 font-semibold pb-3">Documents- NO DOCUMENT</p>
                </div>



                <div class="flex w-[78%] items-center border-r border-b border-dotted border-black py-[1px] h-[30px]">
                  <p class="text-[10px] px-1 font-bold">Biometrics Update- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; No </p>
                </div>


                <div class="flex">
                  <div class="flex w-[78%] items-center border-r border-b border-dotted border-black py-1 h-[40px]">
                    <p class="text-[10px] px-1"><span class="font-bold">Information Sharing Disclosure</span> / जानकारी
                      साझा करने के प्रकटीकरण: Yes / हाँ</p>
                  </div>
                  <div
                    class="flex flex-col w-[22%] border-t border-r border-b border-dotted border-black py-1 h-[40px]">
                    <p class="text-[10px] px-1 font-semibold"><B>Biometric Captured:</B></p>
                    <p class="text-[10px] px-1">NA</p>
                  </div>

                </div>



              </div>

              <div class="flex justify-between">
                <p class="text-[10px] px-1 font-semibold"><span class="font-bold">Registrar:</span> CSC e-Gov.</p>
                <p class="text-[10px] px-1 font-semibold"><span class="font-bold">Enrolment Agency:</span> CSC Bank BC
                </p>
                <p class="text-[10px] px-1 font-semibold"><span class="font-bold">Location Id:</span> Client Location N
                </p>
              </div>

              <div class="flex justify-between pt-3">
                <p class="text-[10px] px-1 font-bold tracking-wider">Disclosure under section 3(2) of THE AADHAAR
                  (TARGETED DELIVERY OF FINANCIAL AND OTHER SUBSIDIES, BENEFITS AND SERVICES) ACT, 2016</p>
              </div>

              <div class="flex flex-col justify-between">
                <p class="text-[8px] px-1 tracking-wider font-semibold">I confirm that I have been residing in India for
                  at least 182 days in the preceding 12 months & informistion (including biometrics) provided by me to
                  the UIDAI is my own and is true, correct and accurate.I am aware that my information including
                  biometrics will be used for updation of Andhaar and authentication. I understand that my identity
                  information (except core biometric) may be provided to an agency only with my consent during
                  authentication or as per the provisions of the Andhaar Act.I have a right to access my identity
                  information (except core biometrics) following the procedure laid down by UIDAI</p>
                <p class="text-[8px] px-1 tracking-wider font-bold">Keep your Aadhaar always updated for Enhanced "Ease
                  of Living". If your Aadhaar was issued more than 10 years back and has not since been updated.</p>
              </div>
              <div class="pb-8">
                <img src="https://cscucladhar.online/user/mobile_update_list/slip/assets/barcod.png" alt="barcode" style="height:20px;width:50%;">
              </div>



              <div class="ml-[75%]">
<p class="text-[8px] px-1 tracking-wider ml-24 py-2"><span class="font-bold"><?php echo $data['name'] ?></span></p>
                <p class="text-[8px] px-1 tracking-wider"><span
                    class="font-bold">Signature/Thumbprint</span>(हस्ताक्षर/अंगूठा)</p>
              </div>


              <div class="flex w-[100%] border-b border-dotted border-black">

              </div>

              <div class="flex justify-between w-[100%] border-b border-dotted border-black py-[2px] px-8">

                <div class="">
                  <table class="table-auto border-collapse w-[360px]">
                    <thead>
                      <tr>
                        <th class="border border-black flex leading-[9px] justify-center w-[360px] px-4 font-semibold text-[10px]"
                          colspan="3">CASH RECEIPT</th>
                      </tr>

                      <tr>
                        <th class="border leading-[9px] border-black w-[360px] flex just-left font-semibold text-[10px]" colspan="3">
                         <p class="text-[8px] px-1 tracking-wider ml-24 py-2"><span class="font-bold"><?php echo $data['name'] ?></span></p>
</th>
                      </tr>
             <tr>
    <th class="border leading-[9px] border-black flex w-[360px] font-semibold text-[10px]" colspan="3">Date of Receipt Printing : <span id="delhiTime"></span></th>
</tr>

<script>
    // Function to get the current time in Delhi
    function getDelhiTime() {
        const dateTimeElement = document.getElementById('delhiTime');

        // Set the content of the element to the current date and time in IST
        var currentDateTimeIST = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata' });

        // Parse the date string
        var parsedDate = new Date(currentDateTimeIST);

        // Format the date as DD MM YYYY
        var formattedDate = parsedDate.toLocaleDateString('en-GB', {
            day: 'numeric',
            month: 'numeric',
            year: 'numeric'
        });

        // Set the displayed date in the HTML element
        dateTimeElement.innerText = formattedDate;
    }

    // Call the function to update the Delhi time
    getDelhiTime();
</script>

                      <tr>
                        <th class="border leading-[9px] border-black flex w-[360px] font-semibold text-[10px]" colspan="3">Receipt
                          Number :</th>
                      </tr>

                      <tr class="flex">
                        <th class="border leading-[9px] border-black flex w-[160px] font-semibold text-[8px]" colspan="3">Registrar
                          Name: CSC e-GOV</th>
                        <th class="border leading-[9px] border-black flex w-[200px] font-semibold text-[8px]" colspan="3">Enrolment
                          Agency Details : CSC Bank BC</th>
                      </tr>

                      <tr class="flex">
                        <th class="border leading-[9px] border-black flex w-[140px] font-semibold text-[8px]" colspan="3">Services
                        </th>
                        <th class="border leading-[9px] border-black flex w-[20px] font-semibold text-[8px]" colspan="3"></th>
                        <th class="border leading-[9px] border-black flex w-[85px] font-semibold text-[8px]" colspan="3">Amount
                          Chargeg</th>
                        <th class="border leading-[9px] border-black flex w-[25px] font-semibold text-[8px]" colspan="3">GST</th>
                        <th class="border leading-[9px] border-black flex w-[90px] font-semibold text-[8px]" colspan="3">Total Amount
                          Chargeg</th>
                      </tr>

                      <tr class="flex font-bold">
                        <th class="border leading-[9px] border-black flex w-[140px] font-semibold text-[8px]" colspan="3">New
                          Enrolment</th>
                        <th class="border leading-[9px] border-black flex w-[20px] font-semibold text-[8px]" colspan="3">No</th>
                        <th class="border leading-[9px] border-black flex w-[85px] font-semibold text-[8px]" colspan="3">RS 0</th>
                        <th class="border leading-[9px] border-black flex w-[25px] font-semibold text-[8px]" colspan="3">18.0%</th>
                        <th class="border leading-[9px] border-black flex w-[90px] font-semibold text-[8px]" colspan="3">Rs</th>
                      </tr>



                      <tr class="flex font-bold">
                        <th class="border leading-[9px] border-black flex w-[30px] font-semibold text-[8px] py-4" colspan="3">Update
                        </th>
                        <th class="border leading-[9px] flex flex-col border-black w-[110px] font-semibold text-[8px]" colspan="3">
                          <p class="border-b border-black ml-[-1px] w-[110px] ">Mandatory Biometric Update</p>
                          <p class="border-b border-black ml-[-1px] w-[110px]">Demographic Update</p>
                          <p class="border-b border-black ml-[-1px] w-[110px] ">Biometric Update</p>
                          <p class="w-[110px] ">Document Update</p>
                        </th>
                        <th class="border leading-[9px] border-black flex flex-col w-[20px] font-semibold text-[8px]" colspan="3">
                          <p class="border-b border-r border-black w-[20px] ml-[-1px]">No</p>
                          <p class="border-b border-r border-black w-[20px] ml-[-1px]">Yes</p>
                          <p class="border-b border-r border-black w-[20px] ml-[-1px]">No</p>
                          <p class="w-[20px] border-r border-black ml-[-1px]">No</p>
                        </th>
                        <th
                          class="border leading-[9px] border-black flex items-center justify-between w-[85px] font-semibold text-[8px]"
                          colspan="3">18.0%</th>
                        <th class="border leading-[9px] border-black flex items-center w-[25px] font-semibold text-[8px]" colspan="3">
                          18.0%</th>
                        <th class="border leading-[9px] border-black flex items-center w-[90px] font-semibold text-[8px]" colspan="3">
                          Rs 50</th>
                      </tr>




                    </thead>
                    <tbody>





                    </tbody>
                  </table>
                </div>

                <div class=" mt-[14%]">
                  <p class="text-[8px] px-1 tracking-wider"><span class="font-bold">UIDAI OPERATOR (Signature)</span></p>
                  <p class="text-[8px] px-1 tracking-wider"><span class="font-bold">Enrolment Operator</span></p>
                </div>

              </div>


              <div class="flex w-[100%] border-b border-dotted border-black justify-between px-12 py-[2px]">
                <div class="flex items-center">
                  <i class="fa-brands fa-google-plus fa-2x"></i> / +UIDAI
                </div>
                <div class="flex items-center">
                  <i class="fa-brands fa-facebook fa-2x"></i> / Aadhaar Official
                </div>
                <div class="flex items-center">
                  <i class="fa-brands fa-youtube fa-2x"></i> / Aadhaar UID
                </div>
                <div class="flex items-center">
                  <i class="fa-brands fa-twitter fa-2x"></i> / UIDAI
                </div>
              </div>


              <div class="flex -[100%] border-b border-dotted border-black justify-between">
                <p class="text-[8px] px-1"><span class="font-bold">For enquiry, please contact </span>/ किसी तरह की
                  पूछताछ के लिए कृपया संपर्क करें</p>
                <!-- <i class="fa-thin fa-envelopes"></i>
                         <i class="fa-brands fa-internet-explorer"></i>
                         <i class="fa-sharp fa-light fa-tty"></i> -->
              </div>

              <div class="w-[100%] border-b border-dotted border-black justify-between">
                <p class="text-[8px] px-1 tracking-wider font-bold pt-2">It may take up to 20 days for your information
                  to be reflected in online status check & may take up to 90 days for Aadhaar generation /Update. </p>
              </div>



              <div class="w-[100%] justify-between py-2">
                <p class="text-[8px] px-1 tracking-wider font-bold">Keep your Aadhaar always updated for Enhanced "Ease
                  of Living. If your Aadhaar was issued more than 10 years back and has not since been updated. It is
                  highly recommended that the supporting documents (POI/POA) are updated for continued accuracy of
                  demographic information.</p>
              </div>




            </div>
          </div>

        </div>
      </div>
    </div>
  </div>
</body>

</html>