<?php
checkSession();
?>
<!--<html lang="en" class="color-sidebar sidebarcolor4 color-header headercolor2 ">---->


<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!--favicon-->
<link rel="shortcut icon" type="image/x-icon" href="<?php echo ahkweb('logo');  ?>">
    <!--plugins-->
    <link href="../template/ahkweb/assets/plugins/vectormap/jquery-jvectormap-2.0.2.css" rel="stylesheet" />
    <link href="../template/ahkweb/assets/plugins/simplebar/css/simplebar.css" rel="stylesheet" />
    <link href="../template/ahkweb/assets/plugins/perfect-scrollbar/css/perfect-scrollbar.css" rel="stylesheet" />
    <link href="../template/ahkweb/assets/plugins/metismenu/css/metisMenu.min.css" rel="stylesheet" />
    <!-- loader-->
    <link href="../template/ahkweb/assets/css/pace.min.css" rel="stylesheet" />
    <script src="../template/ahkweb/assets/js/pace.min.js"></script>
    <!-- Bootstrap CSS -->
    <link href="../template/ahkweb/assets/plugins/datatable/css/dataTables.bootstrap5.min.css" rel="stylesheet" />
    <link href="../template/ahkweb/assets/css/bootstrap.min.css" rel="stylesheet">
    <link href="../template/ahkweb/assets/css/bootstrap-extended.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&amp;display=swap" rel="stylesheet">
    <link href="../template/ahkweb/assets/css/app.css" rel="stylesheet">
    <link href="../template/ahkweb/assets/css/icons.css" rel="stylesheet">
    <!-- Theme Style CSS -->
	<link href="../assets/css/app.css" rel="stylesheet">
    <link rel="stylesheet" href="../template/ahkweb/assets/css/dark-theme.css" />
    <link rel="stylesheet" href="../template/ahkweb/assets/css/semi-dark.css" />
    <link rel="stylesheet" href="../template/ahkweb/assets/css/header-colors.css" />
    <title>Dashboard | <?php echo ahkweb('webname'); ?></title>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
</head>

<body>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.1.62/jquery.inputmask.bundle.js"></script>
    <!--wrapper-->
    <div class="wrapper">
        <!--sidebar wrapper -->
        <div class="sidebar-wrapper" data-simplebar="true">
            <div class="sidebar-header">
                <div>
                    <img src="<?php echo ahkweb('logo'); ?>" class="logo-icon" alt="logo icon">
                </div>
                <div>
                    <h4 class="logo-text">
                        <?php
                        ob_start();
                        ahkweb('webname');
                        $webname = ob_get_clean();

                        $words = explode(' ', trim($webname));
                        echo isset($words[1]) ? $words[0] . ' ' . $words[1] : $words[0];
                        ?>
                    </h4>

                </div>
                <div class="toggle-icon ms-auto"><i class=></i>
                </div>
            </div>
            <!--navigation-->

            <ul class="metismenu" id="menu">
                <li <a href="javascript:;" class="">
                    <a href="index">
                       <div class="parent-icon"> <i class="text-danger fa-sharp fa-solid fa-laptop"></i>
                        </div>
                        <div class="menu-title">Dashboard</div>
                    </a>

                    <!-- <ul>
                        <li> <a href="index"><i class="bx bx-right-arrow-alt"></i>Default</a>
                        </li>
                        <li> <a href="dashboard-eCommerce.html"><i class="bx bx-right-arrow-alt"></i>eCommerce</a>
                        </li>
                        <li> <a href="dashboard-analytics.html"><i class="bx bx-right-arrow-alt"></i>Analytics</a>
                        </li>
                        <li> <a href="dashboard-digital-marketing.html"><i class="bx bx-right-arrow-alt"></i>Digital Marketing</a>
                        </li>
                        <li> <a href="dashboard-human-resources.html"><i class="bx bx-right-arrow-alt"></i>Human Resources</a>
                        </li>
                    </ul> -->
                </li>


                <!-- User management -->

                <?php if (checkAdmin($udata['type']) == true) { ?>
                    <li>
                        <a href="javascript:;" class="has-arrow">
                            <div class="parent-icon"><img
                                    src="../assets/img/care.jpg" width="30ox"
                                    style="border-radius:4px;">
                            </div>
                            <div class="menu-title">User Management </div>
                        </a>
                        <ul>
                            <li> <a href="users"><i class="bx bx-right-arrow-alt"></i>All Users</a>
                            </li>


                            <li> <a href="adduser"><i class="bx bx-right-arrow-alt"></i>Add New</a>
                            <li> <a href="qrpay_pending"><i class="bx bx-right-arrow-alt"></i>QR pending <sup
                                        style="color:red;"></sup></a>
                            <li> <a href="PendingManualUsers"><i class="bx bx-right-arrow-alt"></i>Manual user pending <sup
                                        style="color:red;"></sup></a>
                            <li> <a href="BalanceTransfer"><i class="bx bx-right-arrow-alt"></i>Balance Transfer <sup
                                        style="color:red;"></sup></a>
                            </li>


                        </ul>
                    </li>
                <?php } ?>
                <!-- User Management END -->
                <!-- User management -->
                <?php if ($udata['type'] == "distributor" || $udata['type'] == "super_dist") { ?>
                    <li>
                        <a href="javascript:void(0)" style="; !important;"=""="">
                            <div class="parent-icon"><i class="bx bx-user"></i>
                            </div>
                            <div class="menu-title">User Management</div>
                        </a>
                        <ul>
                            <li> <a href="adduser"><i class="bx bx-right-arrow-alt"></i>Add New</a></li>
                            <li> <a href="myusers"><i class="bx bx-right-arrow-alt"></i>My User List</a></li>
                        </ul>
                    </li>
                <?php } ?>
                
                 <style>
                            .badge-instant {
                                background-color: #28a745;
                                /* Bootstrap success green */
                                color: white;
                                font-size: 10px;
                                padding: 2px 6px;
                                border-radius: 8px;
                                margin-left: 6px;
                                vertical-align: middle;
                                font-weight: bold;
                            }
                        </style>
                <!-- User Management END -->
                <!-- User Management END -->
                <li <a href="javascript:;">
                    <a href="wallet" class="">
                        <div class="parent-icon"><img
                                src="../admin/uploads/Services/wallet.png" width="30ox"
                                style="border-radius:4px;">
                        </div>
                        <div class="menu-title">
                            Add Wallet
                            <span class="badge-instant">Instant</span>
                        </div>

                       
                    </a>
                </li>
                <!-- PAN MANUAL CARD APPLY PDF -->
                <!-- <style>-->
                <!--            .badge-instant2 {-->
                <!--                background-color: #a72828;-->
                              
                <!--                color: white;-->
                <!--                font-size: 10px;-->
                <!--                padding: 2px 6px;-->
                <!--                border-radius: 8px;-->
                <!--                margin-left: 6px;-->
                <!--                vertical-align: middle;-->
                <!--                font-weight: bold;-->
                <!--            }-->
                <!--        </style>-->
                
                <!-- <li <a href="javascript:;">-->
                <!--    <a href="balance" class="">-->
                <!--        <div class="parent-icon"><img-->
                <!--                src="../admin/uploads/Services/wallet2.png" width="30ox"-->
                <!--                style="border-radius:4px;">-->
                <!--        </div>-->
                <!--        <div class="menu-title">-->
                <!--            Add Wallet-->
                <!--            <span class="badge-instant2">Instant</span>-->
                <!--        </div>-->

                       
                <!--    </a>-->
                <!--</li>-->

                <!-- PAN MANUAL CARD APPLY PDF -->
            <li class="menu-label">Services</li>
  <!--           <li>  -->
		<!--	<a href="mobileRecharge">-->
		<!--		<div class="parent-icon">-->
		<!--			<img src="../admin/uploads/Services/recharge2.png" width="30" style="border-radius: 3px;">-->
		<!--		</div>-->
		<!--		<div class="menu-title">Mobile Recharge</div>-->
		<!--		<img class="new_blink d-none" style="position: relative; height: 30px; width: 30px; left: 3px;" src="../images/new.png">-->
		<!--	</a>-->
		<!--</li>-->
		<li> 
		 <li>  
			<a href="Uid_Flx-Services">
				<div class="parent-icon">
					<img src="../images/aadhaar_icon.jpg" width="30" style="border-radius: 3px;">
				</div>
				<div class="menu-title">Aadhaar Services</div>
				<img class="new_blink d-none" style="position: relative; height: 30px; width: 30px; left: 3px;" src="../images/new.png">
			</a>
		</li>
		<li> 
		
		  <li>  
			<a href="pan_card_service">
				<div class="parent-icon">
					<img src="../admin/uploads/Services/panservices.png" width="30" style="border-radius: 3px;">
				</div>
				<div class="menu-title">Pan Card Services</div>
				<img class="new_blink d-none" style="position: relative; height: 30px; width: 30px; left: 3px;" src="../images/new.png">
			</a>
		</li>
		<li> 
		
		



            <li>  
			<a href="vahicle_card_service">
				<div class="parent-icon">
					<img src="../admin/uploads/Services/Yamaha-Bike-PNG.png" width="30" style="border-radius: 3px;">
				</div>
				<div class="menu-title">Vachile Services</div>
				<img class="new_blink d-none" style="position: relative; height: 30px; width: 30px; left: 3px;" src="../images/new.png">
			</a>
		</li>
		<li> 
		
		 <li>  
			<a href="Voter_card_service">
				<div class="parent-icon">
					<img src="../admin/uploads/Services/voter.png" width="30" style="border-radius: 3px;">
				</div>
				<div class="menu-title">Voter Services</div>
				<img class="new_blink d-none" style="position: relative; height: 30px; width: 30px; left: 3px;" src="../images/new.png">
			</a>
		</li>
		<li> 
		
		 <li>  
			<a href="Ration_card_service">
				<div class="parent-icon">
					<img src="../admin/uploads/Services/ration1.png" width="30" style="border-radius: 3px;">
				</div>
				<div class="menu-title">Ration Services</div>
				<img class="new_blink d-none" style="position: relative; height: 30px; width: 30px; left: 3px;" src="../images/new.png">
			</a>
		</li>
		<li> 
		
		 <li>  
			<a href="ElectriBill_card_service">
				<div class="parent-icon">
					<img src="../admin/uploads/Services/electricBill.png" width="30" style="border-radius: 3px;">
				</div>
				<div class="menu-title">ElectriBill Services</div>
				<img class="new_blink d-none" style="position: relative; height: 30px; width: 30px; left: 3px;" src="../images/new.png">
			</a>
		</li>
		<li> 
		
		<!-- <li>  -->
		<!--	<a href="JanAdhaarServices">-->
		<!--		<div class="parent-icon">-->
		<!--			<img src="../admin/uploads/Services/janaadhar.png" width="30" style="border-radius: 3px;">-->
		<!--		</div>-->
		<!--		<div class="menu-title">JanAdhar Services</div>-->
		<!--		<img class="new_blink d-none" style="position: relative; height: 30px; width: 30px; left: 3px;" src="../images/new.png">-->
		<!--	</a>-->
		<!--</li>-->
		<!--<li> -->
		
			 <li>  
			<a href="FarmerStackService">
				<div class="parent-icon">
					<img src="../admin/uploads/Services/farmerLogo0.png" width="30" style="border-radius: 3px;">
				</div>
				<div class="menu-title">Farmer Services</div>
				<img class="new_blink d-none" style="position: relative; height: 30px; width: 30px; left: 3px;" src="../images/new.png">
			</a>
		</li>
		<li> 
		
			 <li>  
			<a href="Passbook_card_service">
				<div class="parent-icon">
					<img src="../admin/uploads/Services/1771198.png" width="30" style="border-radius: 3px;">
				</div>
				<div class="menu-title">Passbook Services</div>
				<img class="new_blink d-none" style="position: relative; height: 30px; width: 30px; left: 3px;" src="../images/new.png">
			</a>
		</li>
		<li> 

 <li>  
			<a href="Other_card_service">
				<div class="parent-icon">
					<img src="../admin/uploads/Services/dlpng.png" width="30" style="border-radius: 3px;">
				</div>
				<div class="menu-title">Other Services</div>
				<img class="new_blink d-none" style="position: relative; height: 30px; width: 30px; left: 3px;" src="../images/new.png">
			</a>
		</li>
		<li> 





        
<li class="menu-label">HELP & STATEMENT </li>

            <!-- Wallet management START -->

            <li <a href="javascript:;">
                <a href="wallet_history" class="">
                    <div class="parent-icon"><i class="text-success fa fa-wallet"></i>
                    </div>
                    <div class="menu-title">
                        Wallet Record

                    </div>


                </a>
            </li>
            
             <li <a href="javascript:;">
                <a href="complaint_request" class="">
                    <div class="parent-icon"><i class="text-success fa fa-exclamation-circle"></i>
                    </div>
                    <div class="menu-title">
                        Complaint Rise

                    </div>


                </a>
            </li>
            
             <li <a href="javascript:;">
                <a href="complaint_request_list" class="">
                    <div class="parent-icon"><i class="fas fa-regular fa-headset"></i>
                    </div>
                    <div class="menu-title">
                        Complaint List

                    </div>


                </a>
            </li>
            
            <li>
			<a href="pricing_list">
				<div class="parent-icon"><i class="fa-solid fa-indian-rupee-sign"></i>
				</div>
				<div class="menu-title">&nbsp Pricing</div>
			</a>
		</li>
               <?php
                    if (checkAdmin($udata['type']) == true) {
                        ?>
            
<li class="menu-label">Admin Control </li>

       
                
            <!--                  <li <a href="javascript:;">-->
            <!--    <a href="puc_admin" class="">-->
            <!--        <div class="parent-icon"><i class="text-success fa fa-globe"></i>-->
            <!--        </div>-->
            <!--        <div class="menu-title">-->
            <!--            Puc Admin List-->

            <!--        </div>-->


            <!--    </a>-->
            <!--</li>-->
            
            
            <!--  <li <a href="javascript:;">-->
            <!--    <a href="tec_exam_req_admin" class="">-->
            <!--        <div class="parent-icon"><i class="text-success fa fa-credit-card"></i>-->
            <!--        </div>-->
            <!--        <div class="menu-title">-->
            <!--            Tec Admin List-->

            <!--        </div>-->


            <!--    </a>-->
            <!--</li>-->
                
            <!--      <li <a href="javascript:;">-->
            <!--    <a href="ll_request_admin" class="">-->
            <!--        <div class="parent-icon"><i class="text-success fa-solid fa-address-card"></i>-->
            <!--        </div>-->
            <!--        <div class="menu-title">-->
            <!--            LL Admin List-->

            <!--        </div>-->


            <!--    </a>-->
            <!--</li>-->
            
              <li <a href="javascript:;">
                <a href="complaint_request_list_admin" class="">
                    <div class="parent-icon"><i class="fas fa-regular fa-headset"></i>
                    </div>
                    <div class="menu-title">
                        Complaint Admin List

                    </div>


                </a>
            </li>
            
                   <li>
                    <a href="javascript:;" class="has-arrow">
                        <div class="parent-icon"><img
                                src="https://img.icons8.com/?size=100&id=h9udvJ8YzhgG&format=png&color=000000" width="30ox"
                                style="border-radius:4px;">
                        </div>
                        <div class="menu-title">Website Setting</div>
                    </a>
                    <ul>
                        <li> <a href="pricing"><i class="bx bx-right-arrow-alt"></i>Pricing</a>
                        </li>
                        <li> <a href="LogoUpdate"><i class="bx bx-right-arrow-alt"></i>Update Logo</a></li>
                        <li> <a href="settings"><i class="bx bx-right-arrow-alt"></i>Website Details</a>
                        </li>







                    </ul>
                </li>



<?php
                    }
                    ?>
          
          
  
            <!-- Settings -->
            <!-- Refer and Earn-->

            <li <a href="javascript:;">
                <a href="referral" class="">
                    <div class="parent-icon"><img
                            src="https://img.icons8.com/?size=100&id=9kseaedOXUkb&format=png&color=000000" width="30ox"
                            style="border-radius:4px;">
                    </div>
                    <div class="menu-title">Refer & Earn</div>
                </a>

            </li>
            <li <a href="javascript:;">
                <a href="../includes/logout.php" class="">
                    <div class="parent-icon"><img
                            src="https://img.icons8.com/?size=100&id=fmOzBzMvUPQR&format=png&color=000000" width="30ox"
                            style="border-radius:4px;">
                    </div>
                    <div class="menu-title">Logout</div>
                </a>
            </li>
            <!-- Refer and Earn -->
            <!-- Content Shifted to sidebarextra -->
        </div>
        <!--end sidebar wrapper -->
        <!--start header -->



        <header>
            <div class="topbar d-flex align-items-center">
                <nav class="navbar navbar-expand">
                    <div class="mobile-toggle-menu"><i class='bx bx-menu'></i>
                    </div>
                    <?php
                    if (isset($_GET['gettoAdmin']) && $_GET['session'] == 'true') {
                        loginAsAdmin();
                    }

                    if (isset($_SESSION['adminasuser']) == true && $_SESSION['adminusername'] != NULL) {
                        ?>
                        <!-- <form action="" method="POST"> -->
                        <div class="search-bar flex-grow-1">
                            <div class="position-relative search-bar-box">
                                <a href="?gettoAdmin=1&session=true" type="submit" class="btn btn-success">Go Back to Admin
                                    Panel</a>
                            </div>
                        </div>
                        <!-- </form> -->


                    <?php
                    } else {
                        ?>
                        <div class="search-bar flex-grow-1">

                            <div class="position-relative search-bar-box">

                                <input type="text" class="form-control search-control" placeholder="Temporary Notepad...">
                                <span class="position-absolute top-50 search-show translate-middle-y"><i
                                        class='bx bx-notepad'></i></span>

                                <span class="position-absolute top-50 search-close translate-middle-y"><i
                                        class='bx bx-x'></i></span>


                            </div>

                        </div>
                        <?php
                    }
                    ?>
                    <div style="margin-right:12px;" class="text-success">
                        <!-- Google Font for digital style -->
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@500&display=swap" rel="stylesheet">

<style>
    #time {
        color: black;
        font-size: 14px; /* Smaller size */
        font-weight: 500;
        font-family: 'Georgia', 'Times New Roman', serif; /* Classic style */
        background: #f1f1f1;
        padding: 3px 6px; /* Compact padding */
        border-radius: 4px;
        display: inline-block;
        letter-spacing: 0.5px; /* Slight spacing */
        box-shadow: 0px 1px 2px rgba(0,0,0,0.1);
    }

    /* Hide time on phone screens */
    @media screen and (max-width: 768px) {
        #time {
            display: none;
        }
    }
</style>



                        <a id="time"></a>
                        <script>
                            var timeDisplay = document.getElementById("time");

                             function refreshTime() {
            let now = new Date();

            // Format date parts
            let day = String(now.getDate()).padStart(2, '0');
            let month = String(now.getMonth() + 1).padStart(2, '0'); // Month is 0-based
            let year = now.getFullYear();

            // Format time parts
            let hours = now.getHours();
            let minutes = String(now.getMinutes()).padStart(2, '0');
            let seconds = String(now.getSeconds()).padStart(2, '0');
            let ampm = hours >= 12 ? 'PM' : 'AM';

            hours = hours % 12;
            hours = hours ? hours : 12; // 12-hour format

            // Final format: dd-MM-YYYY - HH:MM:SS AM/PM
            let formattedString = `${day}-${month}-${year} - ${hours}:${minutes}:${seconds} ${ampm}`;

            timeDisplay.innerHTML = formattedString;
        }

        refreshTime(); // Show immediately
        setInterval(refreshTime, 1000);
                        </script>
                    </div>
                    <a href="wallet" class="btn btn-dark btn-sm mt-1 d-flex align-items-center justify-content-center"
                        style="min-width: 80px; padding: 4px 8px; border-radius: 6px;">
                        <i class="fas fa-wallet" style="font-size: 1.2rem; margin-right: 5px;"></i>
                        <span style="font-size: 1rem; font-weight: 600;">₹<?= round($udata['balance'], 2) ?></span>
                    </a>


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


                    <div class="top-menu ms-auto">
                        <ul class="navbar-nav align-items-center">

                            <li class="nav-item dropdown dropdown-large">
                                <a class="nav-link dropdown-toggle dropdown-toggle-nocaret position-relative" href="#"
                                    role="button" data-bs-toggle="dropdown" aria-expanded="false"> <span
                                        class="alert-count">7</span>
                                    <i class='bx bx-bell'></i>
                                </a>
                                <div class="dropdown-menu dropdown-menu-end">
                                    <a href="javascript:;">
                                        <div class="msg-header">
                                            <p class="msg-header-title">Notifications</p>
                                            <p class="msg-header-clear ms-auto">Marks all as read</p>
                                        </div>
                                    </a>
                                    <div class="header-notifications-list">
                                        <a class="dropdown-item" href="javascript:;">
                                            <div class="d-flex align-items-center">
                                                <div class="notify bg-light-primary text-primary"><i
                                                        class="bx bx-group"></i>
                                                </div>
                                                <div class="flex-grow-1">
                                                    <h6 class="msg-name">New Customers<span
                                                            class="msg-time float-end">14 Sec
                                                            ago</span></h6>
                                                    <p class="msg-info">5 new user registered</p>
                                                </div>
                                            </div>
                                        </a>
                                        <a class="dropdown-item" href="javascript:;">
                                            <div class="d-flex align-items-center">
                                                <div class="notify bg-light-danger text-danger"><i
                                                        class="bx bx-cart-alt"></i>
                                                </div>
                                                <div class="flex-grow-1">
                                                    <h6 class="msg-name">New Orders <span class="msg-time float-end">2
                                                            min
                                                            ago</span></h6>
                                                    <p class="msg-info">You have recived new orders</p>
                                                </div>
                                            </div>
                                        </a>
                                        <a class="dropdown-item" href="javascript:;">
                                            <div class="d-flex align-items-center">
                                                <div class="notify bg-light-success text-success"><i
                                                        class="bx bx-file"></i>
                                                </div>
                                                <div class="flex-grow-1">
                                                    <h6 class="msg-name">24 PDF File<span class="msg-time float-end">19
                                                            min
                                                            ago</span></h6>
                                                    <p class="msg-info">The pdf files generated</p>
                                                </div>
                                            </div>
                                        </a>
                                        <a class="dropdown-item" href="javascript:;">
                                            <div class="d-flex align-items-center">
                                                <div class="notify bg-light-warning text-warning"><i
                                                        class="bx bx-send"></i>
                                                </div>
                                                <div class="flex-grow-1">
                                                    <h6 class="msg-name">Time Response <span
                                                            class="msg-time float-end">28 min
                                                            ago</span></h6>
                                                    <p class="msg-info">5.1 min avarage time response</p>
                                                </div>
                                            </div>
                                        </a>
                                        <a class="dropdown-item" href="javascript:;">
                                            <div class="d-flex align-items-center">
                                                <div class="notify bg-light-info text-info"><i
                                                        class="bx bx-home-circle"></i>
                                                </div>
                                                <div class="flex-grow-1">
                                                    <h6 class="msg-name">New Product Approved <span
                                                            class="msg-time float-end">2 hrs ago</span></h6>
                                                    <p class="msg-info">Your new product has approved</p>
                                                </div>
                                            </div>
                                        </a>
                                        <a class="dropdown-item" href="javascript:;">
                                            <div class="d-flex align-items-center">
                                                <div class="notify bg-light-danger text-danger"><i
                                                        class="bx bx-message-detail"></i>
                                                </div>
                                                <div class="flex-grow-1">
                                                    <h6 class="msg-name">New Comments <span class="msg-time float-end">4
                                                            hrs
                                                            ago</span></h6>
                                                    <p class="msg-info">New customer comments recived</p>
                                                </div>
                                            </div>
                                        </a>
                                        <a class="dropdown-item" href="javascript:;">
                                            <div class="d-flex align-items-center">
                                                <div class="notify bg-light-success text-success"><i
                                                        class='bx bx-check-square'></i>
                                                </div>
                                                <div class="flex-grow-1">
                                                    <h6 class="msg-name">Your item is shipped <span
                                                            class="msg-time float-end">5 hrs
                                                            ago</span></h6>
                                                    <p class="msg-info">Successfully shipped your item</p>
                                                </div>
                                            </div>
                                        </a>
                                        <a class="dropdown-item" href="javascript:;">
                                            <div class="d-flex align-items-center">
                                                <div class="notify bg-light-primary text-primary"><i
                                                        class='bx bx-user-pin'></i>
                                                </div>
                                                <div class="flex-grow-1">
                                                    <h6 class="msg-name">New 24 authors<span
                                                            class="msg-time float-end">1 day
                                                            ago</span></h6>
                                                    <p class="msg-info">24 new authors joined last week</p>
                                                </div>
                                            </div>
                                        </a>
                                        <a class="dropdown-item" href="javascript:;">
                                            <div class="d-flex align-items-center">
                                                <div class="notify bg-light-warning text-warning"><i
                                                        class='bx bx-door-open'></i>
                                                </div>
                                                <div class="flex-grow-1">
                                                    <h6 class="msg-name">Defense Alerts <span
                                                            class="msg-time float-end">2 weeks
                                                            ago</span></h6>
                                                    <p class="msg-info">45% less alerts last 4 weeks</p>
                                                </div>
                                            </div>
                                        </a>
                                    </div>
                                    <a href="javascript:;">
                                        <div class="text-center msg-footer">View All Notifications</div>
                                    </a>
                                </div>
                            </li>

                            <li class="nav-item dropdown dropdown-large">
                                <?php
                                if (checkAdmin($udata['type']) == true) {
                                    ?>
                                    <a class="nav-link dropdown-toggle dropdown-toggle-nocaret position-relative" href="#"
                                        role="button" data-bs-toggle="dropdown" aria-expanded="false"> <span
                                            class="alert-count"><?= $query_noforadmin; ?></span>
                                        <i class='bx bx-comment'></i>
                                    </a>

                                    <?php
                                } else {
                                    ?>
                                    <a class="nav-link dropdown-toggle dropdown-toggle-nocaret position-relative" href="#"
                                        role="button" data-bs-toggle="dropdown" aria-expanded="false"> <span
                                            class="alert-count"><?= $query_foruser; ?></span>
                                        <i class='bx bx-comment'></i>
                                    </a>
                                    <?php
                                }
                                ?>
                                <div class="dropdown-menu dropdown-menu-end">
                                    <a href="javascript:;">
                                        <div class="msg-header">
                                            <p class="msg-header-title">Messages</p>
                                            <p class="msg-header-clear ms-auto">Marks all as read</p>
                                        </div>
                                    </a>
                                    <div class="header-message-list">
                                        <?php
                                        $res = mysqli_query($ahk_conn, "SELECT * FROM contact  WHERE email='" . $udata['email'] . "'");
                                        if (mysqli_num_rows($res) > 0) {
                                            $x = 0;
                                            while ($mdata = mysqli_fetch_assoc($res)) {
                                                $x++;
                                                ?>
                                                <div class="dropdown-item" href="javascript:;">
                                                    <div class="d-flex align-items-center">
                                                        <p class="msg-info"><?= $mdata['reply']; ?></p>
                                                        <div class="flex-grow-1">
                                                            <h6 class="msg-name" <?php $mdata['mess']; ?> <span
                                                                class="msg-time float-end"><?php $mdata['date']; ?> </span></h6>
                                                            <p class="msg-info"><?= $mdata['reply']; ?></p>
                                                        </div>
                                                    </div>
                                                </div>

                                                <?php

                                            }
                                        }
                                        ?>


                                    </div>
                                    <a href="javascript:;">
                                        <div class="text-center msg-footer">View All Messages</div>
                                    </a>
                                </div>
                            </li>
                        </ul>
                    </div>
                    <div class="user-box dropdown">
                        <a class="d-flex align-items-center nav-link dropdown-toggle dropdown-toggle-nocaret" href="#"
                            role="button" data-bs-toggle="dropdown" aria-expanded="false">
                            <img src="../admin/uploads/Profile-Male-PNG.png" class="user-img" alt="user avatar">
                            <div class="user-info ps-3">
                                <p class="user-name mb-0"><?php echo $udata['name']; ?></p>
                                <p class="designattion mb-0"></p>
                            </div>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end">
                            <li><a class="dropdown-item" href="profile"><i
                                        class="bx bx-user"></i><span>Profile</span></a>
                            </li>

                            <li>
                                <div class="dropdown-divider mb-0"></div>
                            </li>
                            <li><a class="dropdown-item" href="../includes/logout.php"><i
                                        class='bx bx-log-out-circle'></i><span>LOGOUT</span></a>
                            </li>
                        </ul>
                    </div>
                </nav>
            </div>
        </header>
        <style>
            html,
            body {
                margin: 0;
                padding: 0;
            }

            #page-loader {
                position: fixed;
                top: 0;
                left: 0;
                width: 100vw;
                height: 100vh;
                background: #ffffff;
                z-index: 99999;
                display: none;
                align-items: center;
                justify-content: center;
            }

            #page-loader .spinner {
                border: 6px solid red;
                /* Red base */
                border-top: 6px solid blue;
                /* Blue rotating part */
                border-radius: 50%;
                width: 50px;
                height: 50px;
                animation: spin 1s linear infinite;
            }

            @keyframes spin {
                0% {
                    transform: rotate(0deg);
                }

                100% {
                    transform: rotate(360deg);
                }
            }
        </style>
        </head>

        <body>
            <div id="page-loader"
                style="position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.5); z-index: 99999; 
         display: flex; flex-direction: column; justify-content: center; align-items: center; color: #fff; font-family: Arial, sans-serif; font-size: 18px;">
                <div class="spinner" style="margin-bottom: 15px;"></div>
                <div id="loading-text">Loading Please Wait</div>
                <button id="cancel-loader-btn"
                    style="display:none; margin-top: 20px; padding: 8px 16px; background-color: red; color: white; border: none; border-radius: 5px; cursor: pointer;">
                    Cancel Loader
                </button>
            </div>

            <script>
                // Hide loader after full page load
                window.addEventListener("load", function () {
                    const loader = document.getElementById("page-loader");
                    if (loader) loader.style.display = "none";
                });

                // Show loader on form submit
                document.addEventListener("DOMContentLoaded", function () {
                    const cancelBtn = document.getElementById("cancel-loader-btn");
                    const loader = document.getElementById("page-loader");

                    // Show cancel button after 20 seconds if loader is still visible
                    setTimeout(function () {
                        if (loader && loader.style.display !== "none") {
                            cancelBtn.style.display = "block";
                        }
                    }, 20000); // 20 seconds

                    if (cancelBtn) {
                        cancelBtn.addEventListener("click", function () {
                            if (loader) loader.style.display = "none";
                        });
                    }

                    // Show loader on form submit
                    document.querySelectorAll("form").forEach(function (form) {
                        form.addEventListener("submit", function () {
                            if (loader) {
                                loader.style.display = "flex";
                                if (cancelBtn) cancelBtn.style.display = "none"; // Reset
                                // Re-enable cancel after 20 sec
                                setTimeout(function () {
                                    if (loader && loader.style.display !== "none") {
                                        cancelBtn.style.display = "block";
                                    }
                                }, 20000);
                            }
                        });
                    });
                });
            </script>
            <script>
                document.addEventListener("DOMContentLoaded", function () {
                    const loadingText = document.getElementById("loading-text");

                    if (loadingText) {
                        let dotCount = 0;
                        setInterval(function () {
                            dotCount = (dotCount + 1) % 4; // cycle through 0–3 dots
                            loadingText.textContent = "Loading Please Wait" + ".".repeat(dotCount);
                        }, 500); // Update every 0.5 seconds
                    }
                });
            </script>

            <!--end header -->