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

if (isset($_GET['id']) && $_GET['id'] != NULL) {
    $id = base64_decode($_GET['id']);
    $res = mysqli_query($conn, "SELECT * FROM `mobile` 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>

<head>
    <title>ERROLLMENT SLIP</title>
    <meta charset="UTF-8">
    <!--<meta name="viewport" content="width=device-width, initial-scale=1">-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <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=Eczar&family=IBM+Plex+Sans+Devanagari&family=Martel&family=Noto+Serif+Devanagari:wght@400;500;600&family=Roboto&family=Tiro+Devanagari+Hindi&display=swap"
        rel="stylesheet">
    <style>
    
       /* Ensure consistent color adjustment during printing */
* {
    -webkit-print-color-adjust: exact !important;   /* Chrome, Safari 6–15.3, Edge */
    color-adjust: exact !important;                 /* Firefox 48–96 */
    print-color-adjust: exact !important;           /* Firefox 97+, Safari 15.4+ */
}

/* Reset margin and padding for the body and standardize its styles */
body {
    margin: 0;
    padding: 0;
    font-family: Georgia, serif; /* Simplified to a commonly supported serif font */
    font-size: 35px;             /* Restored font size */
}

.a4-div {
    width: 1630px;
    height: 1000px;
    margin: auto ; /* Center the div itself */
    position: relative;
    border: 0px solid #000000;
    display: flex; /* Enable flexbox */
    flex-direction: column; /* Stack children vertically */
    justify-content: center; /* Center vertically */
    align-items: center; /* Center horizontally */
    page-break-before: always; /* Ensure new page in print */
}



/* The image background styling */
.a4-div::before {
    content: "";
    background: scr="ack1.png"
    background-size: 70%; /* Stretch background to fit width */
    background-repeat: no-repeat;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 1; /* Ensure the image is fully visible */
    width: 100%; /* Full width of the div */
    height: 100%; /* Match the height of the div */
    z-index: -1; /* Place the background behind content */
}

/* Styling for the random center code */
.random-center-code {
    font-family: 'Arial Black', sans-serif;
    font-size: 20px;
    font-weight: normal; /* Ensure the font weight is not overwritten */
    padding: 20px;
    background-color: ; /* Example background color */
    color: black;
    border-radius: 10px;
    position: absolute;
    top: 50%; /* Adjust the vertical position */
    left: 50%; /* Adjust the horizontal position */
    transform: translate(-50%, -50%); /* Center it perfectly */
}

/* Custom positioning classes */
.top-left {
    top: 200px;
    left: 20px;
}

.top-right {
    top: 515px;
    right: 75px;
}



    </style>
</head>

<body>
    <div class="a4-div">
        <span style="  display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 0px;">



        








<span style="position: absolute; top: 0px; left: 0px;">
    <img src="ack1.png" alt="ack1 Image" class="ack1-image"></span>

<!-- CSS for signature image -->
<style>
.ack1-image {
    width: 1150px;  /* Set the desired width for ack1 */
    height: 1200px;  /* Set the desired height for ack1 */
    object-fit: contain; /* Ensure the image fits inside the box */
    border: 0px solid; /* Optional: Border around the ack1 image */
    border-radius: 0px; /* Optional: Rounded corners */
}
</style>

              </div>
            </a>

<!------------<span style="position: absolute; top: 640px; left: 250px;">
    <img src="<?php echo $data['pob'] ?>" alt="photo of Interest Image" class="passport-image opacity-50 style-1"></span>---------------->

<!---------------<span style="position: absolute; top: 560px; left: 900px;">
    <img src="<?php echo $data['pob'] ?>" alt="photo of Interest Image" class="passport-image opacity-70 style-1"></span>---------------->

<!-- CSS for passport-size image with opacity and different styles -->
<style>
.passport-image {
    object-fit: contain; /* Ensure the image maintains its aspect ratio */
    background-color: transparent; /* Ensure the background is transparent */
    display: block; /* Prevent images from having inline styles like extra spaces */
}

/* Specific styles for the first image */
.style-1 {
    width: 125px; /* Set the desired width for the first image */
    height: 97px; /* Set the desired height for the first image */
    border: 0px solid red; /* Red border for the first image */
    border-radius: 0px; /* Rounded corners for the first image */
}

/* Specific styles for the second image with Ink Pot color effect */
.style-2 {
    width: 150px; /* Set the desired width for the second image */
    height: 249px; /* Set the desired height for the second image */
    border: 0px solid #3A4C68; /* Ink pot color border for the second image */
    border-radius: 0px; /* No rounded corners for the second image */
    filter: sepia(1) saturate(5) hue-rotate(180deg); /* Applying an "ink pot" color effect */
}

/* 50% opacity for the first image */
.opacity-50 {
    opacity: 0.6; /* 50% opacity */
}

/* 60% opacity for the second image */
.opacity-60 {
    opacity: 0.2; /* 60% opacity */
}
</style>

















<!------------------<span style="position: absolute; top: 586px; left: 565px;">
    <img src="<?php echo $data['poi'] ?>" alt="Signature Image" class="signature-image"></span>--------------->

<!-- CSS for signature image -->
<style>
.signature-image {
    width: 175px;  /* Set the desired width for signature */
    height: 80px;  /* Set the desired height for signature */
    object-fit: contain; /* Ensure the image fits inside the box */
    border: 0px solid; /* Optional: Border around the signature image */
    border-radius: 0px; /* Optional: Rounded corners */
}
</style>


 
 
<!-----------<div style='font-family: Arial; color: #000000; font-size: 15px; font-weight: bold; position: absolute; top: 624px; left: 1238px; text-transform: uppercase;'><?php echo $data['registration_no2'] ?>5</div><div style='font-family: Arial; color: #000000; font-size: 15px; font-weight: bold; position: absolute; top: 627px; left: 652px; text-transform: uppercase;'><?php echo $data['registration_no2'] ?>5</div>

<div style='font-family: Arial; color: #000000; font-size: 15px; font-weight: normal; position: absolute; top: 652px; left: 920px; text-transform: uppercase;'><?php echo $data['dob'] ?></div><div style='font-family: Arial; color: #000000; font-size: 15px; font-weight: normal; position: absolute; top: 688px; left: 920px; text-transform: uppercase;'><?php echo $data['mobile_no'] ?></div><div style='font-family: Arial; color: #000000; font-size: 15px; font-weight: normal; position: absolute; top: 723px; left: 920px; text-transform: uppercase;'><?php echo $data['father_aadhaar_no'] ?></div> 
<div style='font-family: Arial; color: #000000; font-size: 15px; font-weight: lighter; position: absolute; top: 771px; left: 418px; text-transform: uppercase;'><?php echo $data['village'] ?></div>   
 


<div style='font-family: Arial; color: #000000; font-size: 15px; font-weight: lighter; position: absolute; top: 753px; left: 920px; text-transform: uppercase; letter-spacing: 2px; line-height: 2;'><?php echo $data['child_name_hindi'] ?>,   <br> <?php echo $data['tehsil'] ?> <br>PIN: <?php echo $data['pincode'] ?>, <?php echo $data['state'] ?>, INDIA</div>

<div style='font-family: Arial; color: #000000; font-size: 15px; font-weight: lighter; position: absolute; top: 913px; left: 910px; text-transform: uppercase; letter-spacing: 2px;'><?php echo $data['registration_no3'] ?></div>----------------->




<!--------<div class="u-text u-text-6">0000/<?php
echo(rand(123245,100));
?>/<?php
echo(rand(123245,100));
?></div>---------->

















 
<div style='font-family: Arial; color: #000000; font-size: 16px;  font-weight: normal; position: absolute; top: 305px; left: 350px; text-transform: uppercase;'><strong><?php echo $data[''] ?></strong>  <strong>0514/<?php
echo(rand(75464,99999));
?>/<?php
echo(rand(123245,100));
?></strong></div>

 
 
 <div style='font-family: Arial; color: #000000; font-size: 16px; font-weight: normal; position: absolute; top: 383px; left: 55px; text-transform: uppercase;'><strong><?php echo $data['name'] ?></strong></div> 
 
 
<div style='font-family: Arial; color: #000000; font-size: 16px; font-weight: normal; position: absolute; top: 355px; left: 250px; text-transform: uppercase;'><strong><?php echo $data['aadhaar_no'] ?></strong>  </div> 
 
 
 
<div style='font-family: Arial; color: #000000; font-size: 16px; font-weight: normal; position: absolute; top: 586px; left: 598px; text-transform: uppercase;'>+91&nbsp;<strong><?php echo $data['mobile_no'] ?></strong></div>

 <div style='font-family: Arial; color: #000000; font-size: 16px; font-weight: normal; position: absolute; top: 305px; left: 900px; text-transform: uppercase;'><strong><?php echo $data['date'] ?></strong>
 </div>
 
 

 
 
 
 
 

 

 
 


 
<style>
    /* Using Google Fonts for a stylish signature font */
    @import url('https://fonts.googleapis.com/css2?family=Great+Vibes&display=swap');

    /* Styling the signature text */
    .stylish-signature {
        font-family: 'Great Vibes', cursive;
        color: black;
        font-size: 15px;
        font-weight: normal;
        position: absolute;
        top: 790px;
        left: 262px;
        text-transform: uppercase;
        /* Apply irregular, tilted effect */
        transform: rotate(-5deg) skewX(-5deg);
        /* Optional: Add more transform to create variation */
    }
</style>





<!--------------<div style='font-family: Arial; color: #000000; font-size: 15px; font-weight: lighter; position: absolute; top: 885px; left: 252px; text-transform: uppercase; letter-spacing: 1px;'>P< IND<?php echo $data['fname'] ?><< <?php echo $data['name'] ?><  <<<<<<<<<<<<<<<<<<<<  <br><?php echo $data['registration_no2'] ?>5 < <?php echo $data['registration_no'] ?><84<br></div>------------>



















<style>
    /* Screen Styles */
    .a4-div {
        font-family: Arial, sans-serif;
        font-size: 29px; /* Default font size for screen */
        font-weight: bold;
        color: rgb(0, 0, 0);
        position: absolute;
        top: 10px;
        left: 60px;
    }

    .btns {
        display: flex;
        justify-content: center;
        margin-top: 20px;
    }

    .btn {
        margin: 10px;
        padding: 12px 25px;
        font-size: 18px;
        font-weight: bold;
        text-transform: uppercase;
        cursor: photonter;
        border: none;
        border-radius: 50px;
        outline: none;
        transition: all 0.3s ease;
        display: inline-block;
    }

    .advanced-btn {
        background: linear-gradient(135deg, #ff0000, #ff0000);
        color: white;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }

    .advanced-btn:hover {
        background: linear-gradient(135deg, #2575fc, #6a11cb);
        transform: translateY(-3px);
        box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
    }

    /* Print Styles */
    @media print {
        /* Hide Buttons */
        .btns {
            display: none !important;
        }

       /* Ensure consistent text size for printing */
.a4-div {
    font-size: 29px !important; /* Ensure text size is consistent in print */
    font-weight: bold !important;
    color: rgb(0, 0, 0) !important;
    position: absolute !important;
    top: 0px !important;
    left: 0px !important;
  
}


        
        @page {
    size: auto landscape; /* Specify A4 size in landscape orientation */
            margin: 25; /* Standard margin for printing */
        }

        /* Prevent scaling issues */
        html, body {
            width: 100px;
            height: 100%;
            overflow: visible;
        }
    }
</style>


 <br>
  <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
 <br>
<br>

 



<div class="btns">
    <button id="printBtn" class="btn advanced-btn" onclick="printFn()">Print</button>
</div>

<script>
    // Function to handle printing
    function printFn() {
        window.print();
    }
</script>
