MMCT TEAM
Server IP : 217.21.85.138  /  Your IP : 216.73.216.103
Web Server : LiteSpeed
System : Linux in-mum-web906.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64
User : u915722082 ( 915722082)
PHP Version : 7.4.33
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u915722082/public_html/js/../pms/config/../admin/includes/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u915722082/public_html/js/../pms/config/../admin/includes/header.php
<!--header.php-->
 <div id="kt_app_header" class="app-header" data-kt-sticky="true" data-kt-sticky-activate="{default: true, lg: true}" data-kt-sticky-name="app-header-minimize" data-kt-sticky-offset="{default: '200px', lg: '0'}" data-kt-sticky-animation="false">
					<div class="app-container container-fluid d-flex align-items-stretch justify-content-between" id="kt_app_header_container">
						<div class="d-flex align-items-center d-lg-none ms-n3 me-1 me-md-2" title="Show sidebar menu">
							<div class="btn btn-icon btn-active-color-primary w-35px h-35px" id="kt_app_sidebar_mobile_toggle">
								<i class="ki-duotone ki-abstract-14 fs-2 fs-md-1">
									<span class="path1"></span>
									<span class="path2"></span>
								</i>
							</div>
						</div>
						
						<div class="d-flex align-items-center flex-grow-1 flex-lg-grow-0">
							<a href="index.php" class="d-lg-none">
								<img alt="Logo" src="assets/media/logos/default-small.svg" class="h-30px" />
							</a>
						</div>
						
					   <div class="d-flex align-items-stretch justify-content-between flex-lg-grow-1" id="kt_app_header_wrapper">
                            <!--begin::Menu wrapper-->
                            <div class="app-header-menu app-header-mobile-drawer align-items-stretch"
                                 data-kt-drawer="true"
                                 data-kt-drawer-name="app-header-menu"
                                 data-kt-drawer-activate="{default: true, lg: false}"
                                 data-kt-drawer-overlay="true"
                                 data-kt-drawer-width="250px"
                                 data-kt-drawer-direction="end"
                                 data-kt-drawer-toggle="#kt_app_header_menu_toggle"
                                 data-kt-swapper="true"
                                 data-kt-swapper-mode="{default: 'append', lg: 'prepend'}"
                                 data-kt-swapper-parent="{default: '#kt_app_body', lg: '#kt_app_header_wrapper'}">
                                <!--begin::Menu-->
                                <div class="menu menu-rounded menu-column menu-lg-row my-5 my-lg-0 align-items-stretch fw-semibold px-2 px-lg-0"
                                     id="kt_app_header_menu" data-kt-menu="true">
                                    <!--begin:Menu item-->
                                    <!--end:Menu item-->
                                </div>
                                <!--end::Menu-->
                            </div>
                            <!--end::Menu wrapper-->

                            <!--begin::Navbar-->
                           <div class="app-navbar flex-shrink-0">
								
							
								<!--end::My apps links-->
								<!--begin::Theme mode-->
								<div class="app-navbar-item ms-1 ms-md-3">
									<!--begin::Menu toggle-->
									<a href="#" class="btn btn-icon btn-custom btn-icon-muted btn-active-light btn-active-color-primary w-30px h-30px w-md-40px h-md-40px" data-kt-menu-trigger="{default:'click', lg: 'hover'}" data-kt-menu-attach="parent" data-kt-menu-placement="bottom-end">
										<!--begin::Svg Icon | path: icons/duotune/general/gen060.svg-->
										<span class="svg-icon theme-light-show svg-icon-2">
											<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
												<path d="M11.9905 5.62598C10.7293 5.62574 9.49646 5.9995 8.44775 6.69997C7.39903 7.40045 6.58159 8.39619 6.09881 9.56126C5.61603 10.7263 5.48958 12.0084 5.73547 13.2453C5.98135 14.4823 6.58852 15.6185 7.48019 16.5104C8.37186 17.4022 9.50798 18.0096 10.7449 18.2557C11.9818 18.5019 13.2639 18.3757 14.429 17.8931C15.5942 17.4106 16.5901 16.5933 17.2908 15.5448C17.9915 14.4962 18.3655 13.2634 18.3655 12.0023C18.3637 10.3119 17.6916 8.69129 16.4964 7.49593C15.3013 6.30056 13.6808 5.62806 11.9905 5.62598Z" fill="currentColor" />
												<path d="M22.1258 10.8771H20.627C20.3286 10.8771 20.0424 10.9956 19.8314 11.2066C19.6204 11.4176 19.5018 11.7038 19.5018 12.0023C19.5018 12.3007 19.6204 12.5869 19.8314 12.7979C20.0424 13.0089 20.3286 13.1274 20.627 13.1274H22.1258C22.4242 13.1274 22.7104 13.0089 22.9214 12.7979C23.1324 12.5869 23.2509 12.3007 23.2509 12.0023C23.2509 11.7038 23.1324 11.4176 22.9214 11.2066C22.7104 10.9956 22.4242 10.8771 22.1258 10.8771Z" fill="currentColor" />
												<path d="M11.9905 19.4995C11.6923 19.5 11.4064 19.6187 11.1956 19.8296C10.9848 20.0405 10.8663 20.3265 10.866 20.6247V22.1249C10.866 22.4231 10.9845 22.7091 11.1953 22.9199C11.4062 23.1308 11.6922 23.2492 11.9904 23.2492C12.2886 23.2492 12.5746 23.1308 12.7854 22.9199C12.9963 22.7091 13.1147 22.4231 13.1147 22.1249V20.6247C13.1145 20.3265 12.996 20.0406 12.7853 19.8296C12.5745 19.6187 12.2887 19.5 11.9905 19.4995Z" fill="currentColor" />
												<path d="M4.49743 12.0023C4.49718 11.704 4.37865 11.4181 4.16785 11.2072C3.95705 10.9962 3.67119 10.8775 3.37298 10.8771H1.87445C1.57603 10.8771 1.28984 10.9956 1.07883 11.2066C0.867812 11.4176 0.749266 11.7038 0.749266 12.0023C0.749266 12.3007 0.867812 12.5869 1.07883 12.7979C1.28984 13.0089 1.57603 13.1274 1.87445 13.1274H3.37299C3.6712 13.127 3.95706 13.0083 4.16785 12.7973C4.37865 12.5864 4.49718 12.3005 4.49743 12.0023Z" fill="currentColor" />
												<path d="M11.9905 4.50058C12.2887 4.50012 12.5745 4.38141 12.7853 4.17048C12.9961 3.95954 13.1147 3.67361 13.1149 3.3754V1.87521C13.1149 1.57701 12.9965 1.29103 12.7856 1.08017C12.5748 0.869313 12.2888 0.750854 11.9906 0.750854C11.6924 0.750854 11.4064 0.869313 11.1955 1.08017C10.9847 1.29103 10.8662 1.57701 10.8662 1.87521V3.3754C10.8664 3.67359 10.9849 3.95952 11.1957 4.17046C11.4065 4.3814 11.6923 4.50012 11.9905 4.50058Z" fill="currentColor" />
												<path d="M18.8857 6.6972L19.9465 5.63642C20.0512 5.53209 20.1343 5.40813 20.1911 5.27163C20.2479 5.13513 20.2772 4.98877 20.2774 4.84093C20.2775 4.69309 20.2485 4.54667 20.192 4.41006C20.1355 4.27344 20.0526 4.14932 19.948 4.04478C19.8435 3.94024 19.7194 3.85734 19.5828 3.80083C19.4462 3.74432 19.2997 3.71531 19.1519 3.71545C19.0041 3.7156 18.8577 3.7449 18.7212 3.80167C18.5847 3.85845 18.4607 3.94159 18.3564 4.04633L17.2956 5.10714C17.1909 5.21147 17.1077 5.33543 17.0509 5.47194C16.9942 5.60844 16.9649 5.7548 16.9647 5.90264C16.9646 6.05048 16.9936 6.19689 17.0501 6.33351C17.1066 6.47012 17.1895 6.59425 17.294 6.69878C17.3986 6.80332 17.5227 6.88621 17.6593 6.94272C17.7959 6.99923 17.9424 7.02824 18.0902 7.02809C18.238 7.02795 18.3844 6.99865 18.5209 6.94187C18.6574 6.88509 18.7814 6.80195 18.8857 6.6972Z" fill="currentColor" />
												<path d="M18.8855 17.3073C18.7812 17.2026 18.6572 17.1195 18.5207 17.0627C18.3843 17.006 18.2379 16.9767 18.0901 16.9766C17.9423 16.9764 17.7959 17.0055 17.6593 17.062C17.5227 17.1185 17.3986 17.2014 17.2941 17.3059C17.1895 17.4104 17.1067 17.5345 17.0501 17.6711C16.9936 17.8077 16.9646 17.9541 16.9648 18.1019C16.9649 18.2497 16.9942 18.3961 17.0509 18.5326C17.1077 18.6691 17.1908 18.793 17.2955 18.8974L18.3563 19.9582C18.4606 20.0629 18.5846 20.146 18.721 20.2027C18.8575 20.2595 19.0039 20.2887 19.1517 20.2889C19.2995 20.289 19.4459 20.26 19.5825 20.2035C19.7191 20.147 19.8432 20.0641 19.9477 19.9595C20.0523 19.855 20.1351 19.7309 20.1916 19.5943C20.2482 19.4577 20.2772 19.3113 20.277 19.1635C20.2769 19.0157 20.2476 18.8694 20.1909 18.7329C20.1341 18.5964 20.051 18.4724 19.9463 18.3681L18.8855 17.3073Z" fill="currentColor" />
												<path d="M5.09528 17.3072L4.0345 18.368C3.92972 18.4723 3.84655 18.5963 3.78974 18.7328C3.73294 18.8693 3.70362 19.0156 3.70346 19.1635C3.7033 19.3114 3.7323 19.4578 3.78881 19.5944C3.84532 19.7311 3.92822 19.8552 4.03277 19.9598C4.13732 20.0643 4.26147 20.1472 4.3981 20.2037C4.53473 20.2602 4.68117 20.2892 4.82902 20.2891C4.97688 20.2889 5.12325 20.2596 5.25976 20.2028C5.39627 20.146 5.52024 20.0628 5.62456 19.958L6.68536 18.8973C6.79007 18.7929 6.87318 18.6689 6.92993 18.5325C6.98667 18.396 7.01595 18.2496 7.01608 18.1018C7.01621 17.954 6.98719 17.8076 6.93068 17.671C6.87417 17.5344 6.79129 17.4103 6.68676 17.3058C6.58224 17.2012 6.45813 17.1183 6.32153 17.0618C6.18494 17.0053 6.03855 16.9763 5.89073 16.9764C5.74291 16.9766 5.59657 17.0058 5.46007 17.0626C5.32358 17.1193 5.19962 17.2024 5.09528 17.3072Z" fill="currentColor" />
												<path d="M5.09541 6.69715C5.19979 6.8017 5.32374 6.88466 5.4602 6.94128C5.59665 6.9979 5.74292 7.02708 5.89065 7.02714C6.03839 7.0272 6.18469 6.99815 6.32119 6.94164C6.45769 6.88514 6.58171 6.80228 6.68618 6.69782C6.79064 6.59336 6.87349 6.46933 6.93 6.33283C6.9865 6.19633 7.01556 6.05003 7.01549 5.9023C7.01543 5.75457 6.98625 5.60829 6.92963 5.47184C6.87301 5.33539 6.79005 5.21143 6.6855 5.10706L5.6247 4.04626C5.5204 3.94137 5.39643 3.8581 5.25989 3.80121C5.12335 3.74432 4.97692 3.71493 4.82901 3.71472C4.68109 3.71452 4.53458 3.7435 4.39789 3.80001C4.26119 3.85652 4.13699 3.93945 4.03239 4.04404C3.9278 4.14864 3.84487 4.27284 3.78836 4.40954C3.73185 4.54624 3.70287 4.69274 3.70308 4.84066C3.70329 4.98858 3.73268 5.135 3.78957 5.27154C3.84646 5.40808 3.92974 5.53205 4.03462 5.63635L5.09541 6.69715Z" fill="currentColor" />
											</svg>
										</span>
										<!--end::Svg Icon-->
										<!--begin::Svg Icon | path: icons/duotune/general/gen061.svg-->
										<span class="svg-icon theme-dark-show svg-icon-2">
											<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
												<path d="M19.0647 5.43757C19.3421 5.43757 19.567 5.21271 19.567 4.93534C19.567 4.65796 19.3421 4.43311 19.0647 4.43311C18.7874 4.43311 18.5625 4.65796 18.5625 4.93534C18.5625 5.21271 18.7874 5.43757 19.0647 5.43757Z" fill="currentColor" />
												<path d="M20.0692 9.48884C20.3466 9.48884 20.5714 9.26398 20.5714 8.98661C20.5714 8.70923 20.3466 8.48438 20.0692 8.48438C19.7918 8.48438 19.567 8.70923 19.567 8.98661C19.567 9.26398 19.7918 9.48884 20.0692 9.48884Z" fill="currentColor" />
												<path d="M12.0335 20.5714C15.6943 20.5714 18.9426 18.2053 20.1168 14.7338C20.1884 14.5225 20.1114 14.289 19.9284 14.161C19.746 14.034 19.5003 14.0418 19.3257 14.1821C18.2432 15.0546 16.9371 15.5156 15.5491 15.5156C12.2257 15.5156 9.48884 12.8122 9.48884 9.48886C9.48884 7.41079 10.5773 5.47137 12.3449 4.35752C12.5342 4.23832 12.6 4.00733 12.5377 3.79251C12.4759 3.57768 12.2571 3.42859 12.0335 3.42859C7.32556 3.42859 3.42857 7.29209 3.42857 12C3.42857 16.7079 7.32556 20.5714 12.0335 20.5714Z" fill="currentColor" />
												<path d="M13.0379 7.47998C13.8688 7.47998 14.5446 8.15585 14.5446 8.98668C14.5446 9.26428 14.7693 9.48891 15.0469 9.48891C15.3245 9.48891 15.5491 9.26428 15.5491 8.98668C15.5491 8.15585 16.225 7.47998 17.0558 7.47998C17.3334 7.47998 17.558 7.25535 17.558 6.97775C17.558 6.70015 17.3334 6.47552 17.0558 6.47552C16.225 6.47552 15.5491 5.76616 15.5491 4.93534C15.5491 4.65774 15.3245 4.43311 15.0469 4.43311C14.7693 4.43311 14.5446 4.65774 14.5446 4.93534C14.5446 5.76616 13.8688 6.47552 13.0379 6.47552C12.7603 6.47552 12.5357 6.70015 12.5357 6.97775C12.5357 7.25535 12.7603 7.47998 13.0379 7.47998Z" fill="currentColor" />
											</svg>
										</span>
										<!--end::Svg Icon-->
									</a>
									<!--begin::Menu toggle-->
									<!--begin::Menu-->
									<div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-title-gray-700 menu-icon-muted menu-active-bg menu-state-color fw-semibold py-4 fs-base w-150px" data-kt-menu="true" data-kt-element="theme-mode-menu">
										<!--begin::Menu item-->
										<div class="menu-item px-3 my-0">
											<a href="#" class="menu-link px-3 py-2" data-kt-element="mode" data-kt-value="light">
												<span class="menu-icon" data-kt-element="icon">
													<!--begin::Svg Icon | path: icons/duotune/general/gen060.svg-->
													<span class="svg-icon svg-icon-3">
														<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
															<path d="M11.9905 5.62598C10.7293 5.62574 9.49646 5.9995 8.44775 6.69997C7.39903 7.40045 6.58159 8.39619 6.09881 9.56126C5.61603 10.7263 5.48958 12.0084 5.73547 13.2453C5.98135 14.4823 6.58852 15.6185 7.48019 16.5104C8.37186 17.4022 9.50798 18.0096 10.7449 18.2557C11.9818 18.5019 13.2639 18.3757 14.429 17.8931C15.5942 17.4106 16.5901 16.5933 17.2908 15.5448C17.9915 14.4962 18.3655 13.2634 18.3655 12.0023C18.3637 10.3119 17.6916 8.69129 16.4964 7.49593C15.3013 6.30056 13.6808 5.62806 11.9905 5.62598Z" fill="currentColor" />
															<path d="M22.1258 10.8771H20.627C20.3286 10.8771 20.0424 10.9956 19.8314 11.2066C19.6204 11.4176 19.5018 11.7038 19.5018 12.0023C19.5018 12.3007 19.6204 12.5869 19.8314 12.7979C20.0424 13.0089 20.3286 13.1274 20.627 13.1274H22.1258C22.4242 13.1274 22.7104 13.0089 22.9214 12.7979C23.1324 12.5869 23.2509 12.3007 23.2509 12.0023C23.2509 11.7038 23.1324 11.4176 22.9214 11.2066C22.7104 10.9956 22.4242 10.8771 22.1258 10.8771Z" fill="currentColor" />
															<path d="M11.9905 19.4995C11.6923 19.5 11.4064 19.6187 11.1956 19.8296C10.9848 20.0405 10.8663 20.3265 10.866 20.6247V22.1249C10.866 22.4231 10.9845 22.7091 11.1953 22.9199C11.4062 23.1308 11.6922 23.2492 11.9904 23.2492C12.2886 23.2492 12.5746 23.1308 12.7854 22.9199C12.9963 22.7091 13.1147 22.4231 13.1147 22.1249V20.6247C13.1145 20.3265 12.996 20.0406 12.7853 19.8296C12.5745 19.6187 12.2887 19.5 11.9905 19.4995Z" fill="currentColor" />
															<path d="M4.49743 12.0023C4.49718 11.704 4.37865 11.4181 4.16785 11.2072C3.95705 10.9962 3.67119 10.8775 3.37298 10.8771H1.87445C1.57603 10.8771 1.28984 10.9956 1.07883 11.2066C0.867812 11.4176 0.749266 11.7038 0.749266 12.0023C0.749266 12.3007 0.867812 12.5869 1.07883 12.7979C1.28984 13.0089 1.57603 13.1274 1.87445 13.1274H3.37299C3.6712 13.127 3.95706 13.0083 4.16785 12.7973C4.37865 12.5864 4.49718 12.3005 4.49743 12.0023Z" fill="currentColor" />
															<path d="M11.9905 4.50058C12.2887 4.50012 12.5745 4.38141 12.7853 4.17048C12.9961 3.95954 13.1147 3.67361 13.1149 3.3754V1.87521C13.1149 1.57701 12.9965 1.29103 12.7856 1.08017C12.5748 0.869313 12.2888 0.750854 11.9906 0.750854C11.6924 0.750854 11.4064 0.869313 11.1955 1.08017C10.9847 1.29103 10.8662 1.57701 10.8662 1.87521V3.3754C10.8664 3.67359 10.9849 3.95952 11.1957 4.17046C11.4065 4.3814 11.6923 4.50012 11.9905 4.50058Z" fill="currentColor" />
															<path d="M18.8857 6.6972L19.9465 5.63642C20.0512 5.53209 20.1343 5.40813 20.1911 5.27163C20.2479 5.13513 20.2772 4.98877 20.2774 4.84093C20.2775 4.69309 20.2485 4.54667 20.192 4.41006C20.1355 4.27344 20.0526 4.14932 19.948 4.04478C19.8435 3.94024 19.7194 3.85734 19.5828 3.80083C19.4462 3.74432 19.2997 3.71531 19.1519 3.71545C19.0041 3.7156 18.8577 3.7449 18.7212 3.80167C18.5847 3.85845 18.4607 3.94159 18.3564 4.04633L17.2956 5.10714C17.1909 5.21147 17.1077 5.33543 17.0509 5.47194C16.9942 5.60844 16.9649 5.7548 16.9647 5.90264C16.9646 6.05048 16.9936 6.19689 17.0501 6.33351C17.1066 6.47012 17.1895 6.59425 17.294 6.69878C17.3986 6.80332 17.5227 6.88621 17.6593 6.94272C17.7959 6.99923 17.9424 7.02824 18.0902 7.02809C18.238 7.02795 18.3844 6.99865 18.5209 6.94187C18.6574 6.88509 18.7814 6.80195 18.8857 6.6972Z" fill="currentColor" />
															<path d="M18.8855 17.3073C18.7812 17.2026 18.6572 17.1195 18.5207 17.0627C18.3843 17.006 18.2379 16.9767 18.0901 16.9766C17.9423 16.9764 17.7959 17.0055 17.6593 17.062C17.5227 17.1185 17.3986 17.2014 17.2941 17.3059C17.1895 17.4104 17.1067 17.5345 17.0501 17.6711C16.9936 17.8077 16.9646 17.9541 16.9648 18.1019C16.9649 18.2497 16.9942 18.3961 17.0509 18.5326C17.1077 18.6691 17.1908 18.793 17.2955 18.8974L18.3563 19.9582C18.4606 20.0629 18.5846 20.146 18.721 20.2027C18.8575 20.2595 19.0039 20.2887 19.1517 20.2889C19.2995 20.289 19.4459 20.26 19.5825 20.2035C19.7191 20.147 19.8432 20.0641 19.9477 19.9595C20.0523 19.855 20.1351 19.7309 20.1916 19.5943C20.2482 19.4577 20.2772 19.3113 20.277 19.1635C20.2769 19.0157 20.2476 18.8694 20.1909 18.7329C20.1341 18.5964 20.051 18.4724 19.9463 18.3681L18.8855 17.3073Z" fill="currentColor" />
															<path d="M5.09528 17.3072L4.0345 18.368C3.92972 18.4723 3.84655 18.5963 3.78974 18.7328C3.73294 18.8693 3.70362 19.0156 3.70346 19.1635C3.7033 19.3114 3.7323 19.4578 3.78881 19.5944C3.84532 19.7311 3.92822 19.8552 4.03277 19.9598C4.13732 20.0643 4.26147 20.1472 4.3981 20.2037C4.53473 20.2602 4.68117 20.2892 4.82902 20.2891C4.97688 20.2889 5.12325 20.2596 5.25976 20.2028C5.39627 20.146 5.52024 20.0628 5.62456 19.958L6.68536 18.8973C6.79007 18.7929 6.87318 18.6689 6.92993 18.5325C6.98667 18.396 7.01595 18.2496 7.01608 18.1018C7.01621 17.954 6.98719 17.8076 6.93068 17.671C6.87417 17.5344 6.79129 17.4103 6.68676 17.3058C6.58224 17.2012 6.45813 17.1183 6.32153 17.0618C6.18494 17.0053 6.03855 16.9763 5.89073 16.9764C5.74291 16.9766 5.59657 17.0058 5.46007 17.0626C5.32358 17.1193 5.19962 17.2024 5.09528 17.3072Z" fill="currentColor" />
															<path d="M5.09541 6.69715C5.19979 6.8017 5.32374 6.88466 5.4602 6.94128C5.59665 6.9979 5.74292 7.02708 5.89065 7.02714C6.03839 7.0272 6.18469 6.99815 6.32119 6.94164C6.45769 6.88514 6.58171 6.80228 6.68618 6.69782C6.79064 6.59336 6.87349 6.46933 6.93 6.33283C6.9865 6.19633 7.01556 6.05003 7.01549 5.9023C7.01543 5.75457 6.98625 5.60829 6.92963 5.47184C6.87301 5.33539 6.79005 5.21143 6.6855 5.10706L5.6247 4.04626C5.5204 3.94137 5.39643 3.8581 5.25989 3.80121C5.12335 3.74432 4.97692 3.71493 4.82901 3.71472C4.68109 3.71452 4.53458 3.7435 4.39789 3.80001C4.26119 3.85652 4.13699 3.93945 4.03239 4.04404C3.9278 4.14864 3.84487 4.27284 3.78836 4.40954C3.73185 4.54624 3.70287 4.69274 3.70308 4.84066C3.70329 4.98858 3.73268 5.135 3.78957 5.27154C3.84646 5.40808 3.92974 5.53205 4.03462 5.63635L5.09541 6.69715Z" fill="currentColor" />
														</svg>
													</span>
													<!--end::Svg Icon-->
												</span>
												<span class="menu-title">Light</span>
											</a>
										</div>
										<!--end::Menu item-->
										<!--begin::Menu item-->
										<div class="menu-item px-3 my-0">
											<a href="#" class="menu-link px-3 py-2" data-kt-element="mode" data-kt-value="dark">
												<span class="menu-icon" data-kt-element="icon">
													<!--begin::Svg Icon | path: icons/duotune/general/gen061.svg-->
													<span class="svg-icon svg-icon-3">
														<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
															<path d="M19.0647 5.43757C19.3421 5.43757 19.567 5.21271 19.567 4.93534C19.567 4.65796 19.3421 4.43311 19.0647 4.43311C18.7874 4.43311 18.5625 4.65796 18.5625 4.93534C18.5625 5.21271 18.7874 5.43757 19.0647 5.43757Z" fill="currentColor" />
															<path d="M20.0692 9.48884C20.3466 9.48884 20.5714 9.26398 20.5714 8.98661C20.5714 8.70923 20.3466 8.48438 20.0692 8.48438C19.7918 8.48438 19.567 8.70923 19.567 8.98661C19.567 9.26398 19.7918 9.48884 20.0692 9.48884Z" fill="currentColor" />
															<path d="M12.0335 20.5714C15.6943 20.5714 18.9426 18.2053 20.1168 14.7338C20.1884 14.5225 20.1114 14.289 19.9284 14.161C19.746 14.034 19.5003 14.0418 19.3257 14.1821C18.2432 15.0546 16.9371 15.5156 15.5491 15.5156C12.2257 15.5156 9.48884 12.8122 9.48884 9.48886C9.48884 7.41079 10.5773 5.47137 12.3449 4.35752C12.5342 4.23832 12.6 4.00733 12.5377 3.79251C12.4759 3.57768 12.2571 3.42859 12.0335 3.42859C7.32556 3.42859 3.42857 7.29209 3.42857 12C3.42857 16.7079 7.32556 20.5714 12.0335 20.5714Z" fill="currentColor" />
															<path d="M13.0379 7.47998C13.8688 7.47998 14.5446 8.15585 14.5446 8.98668C14.5446 9.26428 14.7693 9.48891 15.0469 9.48891C15.3245 9.48891 15.5491 9.26428 15.5491 8.98668C15.5491 8.15585 16.225 7.47998 17.0558 7.47998C17.3334 7.47998 17.558 7.25535 17.558 6.97775C17.558 6.70015 17.3334 6.47552 17.0558 6.47552C16.225 6.47552 15.5491 5.76616 15.5491 4.93534C15.5491 4.65774 15.3245 4.43311 15.0469 4.43311C14.7693 4.43311 14.5446 4.65774 14.5446 4.93534C14.5446 5.76616 13.8688 6.47552 13.0379 6.47552C12.7603 6.47552 12.5357 6.70015 12.5357 6.97775C12.5357 7.25535 12.7603 7.47998 13.0379 7.47998Z" fill="currentColor" />
														</svg>
													</span>
													<!--end::Svg Icon-->
												</span>
												<span class="menu-title">Dark</span>
											</a>
										</div>
										<!--end::Menu item-->
										<!--begin::Menu item-->
										<div class="menu-item px-3 my-0">
											<a href="#" class="menu-link px-3 py-2" data-kt-element="mode" data-kt-value="system">
												<span class="menu-icon" data-kt-element="icon">
													<!--begin::Svg Icon | path: icons/duotune/general/gen062.svg-->
													<span class="svg-icon svg-icon-3">
														<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
															<path fill-rule="evenodd" clip-rule="evenodd" d="M1.34375 3.9463V15.2178C1.34375 16.119 2.08105 16.8563 2.98219 16.8563H8.65093V19.4594H6.15702C5.38853 19.4594 4.75981 19.9617 4.75981 20.5757V21.6921H19.2403V20.5757C19.2403 19.9617 18.6116 19.4594 17.8431 19.4594H15.3492V16.8563H21.0179C21.919 16.8563 22.6562 16.119 22.6562 15.2178V3.9463C22.6562 3.04516 21.9189 2.30786 21.0179 2.30786H2.98219C2.08105 2.30786 1.34375 3.04516 1.34375 3.9463ZM12.9034 9.9016C13.241 9.98792 13.5597 10.1216 13.852 10.2949L15.0393 9.4353L15.9893 10.3853L15.1297 11.5727C15.303 11.865 15.4366 12.1837 15.523 12.5212L16.97 12.7528V13.4089H13.9851C13.9766 12.3198 13.0912 11.4394 12 11.4394C10.9089 11.4394 10.0235 12.3198 10.015 13.4089H7.03006V12.7528L8.47712 12.5211C8.56345 12.1836 8.69703 11.8649 8.87037 11.5727L8.0107 10.3853L8.96078 9.4353L10.148 10.2949C10.4404 10.1215 10.759 9.98788 11.0966 9.9016L11.3282 8.45467H12.6718L12.9034 9.9016ZM16.1353 7.93758C15.6779 7.93758 15.3071 7.56681 15.3071 7.1094C15.3071 6.652 15.6779 6.28122 16.1353 6.28122C16.5926 6.28122 16.9634 6.652 16.9634 7.1094C16.9634 7.56681 16.5926 7.93758 16.1353 7.93758ZM2.71385 14.0964V3.90518C2.71385 3.78023 2.81612 3.67796 2.94107 3.67796H21.0589C21.1839 3.67796 21.2861 3.78023 21.2861 3.90518V14.0964C15.0954 14.0964 8.90462 14.0964 2.71385 14.0964Z" fill="currentColor" />
														</svg>
													</span>
													<!--end::Svg Icon-->
												</span>
												<span class="menu-title">System</span>
											</a>
										</div>
										<!--end::Menu item-->
									</div>
									<!--end::Menu-->
								</div>
								<!--begin::Notifications-->
<div class="app-navbar-item ms-1 ms-md-3">
    <!--begin::Menu- wrapper-->
    <div class="btn btn-icon btn-custom btn-icon-muted btn-active-light btn-active-color-primary w-30px h-30px w-md-40px h-md-40px position-relative" 
         data-kt-menu-trigger="{default: 'click', lg: 'hover'}" 
         data-kt-menu-attach="parent" 
         data-kt-menu-placement="bottom-end"
         id="kt_drawer_chat_toggle">
        <i class="ki-duotone ki-notification-bing fs-2">
            <span class="path1"></span>
            <span class="path2"></span>
            <span class="path3"></span>
        </i>
        <?php
        // Fetch domains and count notifications
        function fetchDomainsForNotification() {
            $api_token = HOSTINGER_API_TOKEN;
            $api_url = 'https://developers.hostinger.com/api/domains/v1/portfolio';
            
            $ch = curl_init();
            curl_setopt_array($ch, [
                CURLOPT_URL => $api_url,
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_HTTPHEADER => [
                    'Authorization: Bearer ' . $api_token,
                    'Content-Type: application/json',
                    'Accept: application/json'
                ],
                CURLOPT_TIMEOUT => 30,
                CURLOPT_SSL_VERIFYPEER => true
            ]);
            
            $response = curl_exec($ch);
            $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);
            
            if ($http_code === 200) {
                $data = json_decode($response, true);
                return $data['data'] ?? $data['domains'] ?? $data ?? [];
            }
            
            return [];
        }

        // Get service type for domain
        function getDomainServiceType($con, $domain_name) {
            $domain_escaped = mysqli_real_escape_string($con, $domain_name);
            $query = "SELECT service_type FROM tbl_domain_assignments WHERE domain_name = '$domain_escaped'";
            $result = mysqli_query($con, $query);
            
            if ($result && mysqli_num_rows($result) > 0) {
                $row = mysqli_fetch_assoc($result);
                return $row['service_type'] ?? 'domain';
            }
            
            return 'not_assigned';
        }

        $notification_domains = fetchDomainsForNotification();
        $critical_count = 0;
        $warning_count = 0;
        $total_notifications = 0;

        foreach ($notification_domains as $domain) {
            $expiry_date = $domain['expiry_date'] ?? $domain['expires_at'] ?? null;
            if ($expiry_date) {
                $days = floor((strtotime($expiry_date) - time()) / (60 * 60 * 24));
                if ($days <= 30) {
                    $total_notifications++;
                    if ($days <= 7) {
                        $critical_count++;
                    } elseif ($days <= 30) {
                        $warning_count++;
                    }
                }
            }
        }
        
        if ($total_notifications > 0):
        ?>
        <span class="bullet bullet-dot bg-danger h-6px w-6px position-absolute translate-middle top-0 start-50 animation-blink"></span>
        <?php endif; ?>
    </div>
    
    <!--begin::Menu-->
    <div class="menu menu-sub menu-sub-dropdown menu-column w-350px w-lg-375px" data-kt-menu="true">
        <!--begin::Heading-->
        <div class="d-flex flex-column bgi-no-repeat rounded-top" style="background-image:url('assets/media/misc/menu-header-bg.jpg')">
            <!--begin::Title-->
            <h3 class="text-white fw-semibold px-9 mt-10 mb-6">
                Domain Notifications 
                <span class="fs-8 opacity-75 ps-3"><?php echo $total_notifications; ?> domains expiring soon</span>
            </h3>
            <!--end::Title-->
            
            <!--begin::Tabs-->
            <ul class="nav nav-line-tabs nav-line-tabs-2x nav-stretch fw-semibold px-9">
                <li class="nav-item">
                    <a class="nav-link text-white opacity-75 opacity-state-100 pb-4 active" data-bs-toggle="tab" href="#kt_topbar_notifications_1">
                        All (<?php echo $total_notifications; ?>)
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-white opacity-75 opacity-state-100 pb-4" data-bs-toggle="tab" href="#kt_topbar_notifications_2">
                        Critical (<?php echo $critical_count; ?>)
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-white opacity-75 opacity-state-100 pb-4" data-bs-toggle="tab" href="#kt_topbar_notifications_3">
                        Warning (<?php echo $warning_count; ?>)
                    </a>
                </li>
            </ul>
            <!--end::Tabs-->
        </div>
        <!--end::Heading-->
        
        <!--begin::Tab content-->
        <div class="tab-content">
            <!--begin::Tab panel - All-->
            <div class="tab-pane fade show active" id="kt_topbar_notifications_1" role="tabpanel">
                <!--begin::Items-->
                <div class="scroll-y mh-325px my-5 px-8">
                    <?php
                    // Sort domains by expiry date
                    usort($notification_domains, function($a, $b) {
                        $expiryA = $a['expiry_date'] ?? $a['expires_at'] ?? '9999-12-31';
                        $expiryB = $b['expiry_date'] ?? $b['expires_at'] ?? '9999-12-31';
                        return strtotime($expiryA) - strtotime($expiryB);
                    });
                    
                    $displayed = 0;
                    foreach ($notification_domains as $domain):
                        $domain_name = $domain['domain'] ?? $domain['name'] ?? 'N/A';
                        $expiry_date = $domain['expiry_date'] ?? $domain['expires_at'] ?? null;
                        
                        if (!$expiry_date) continue;
                        
                        $days = floor((strtotime($expiry_date) - time()) / (60 * 60 * 24));
                        
                        // Only show domains expiring within 30 days
                        if ($days > 30) continue;
                        
                        $displayed++;
                        
                        // Get service type
                        $service_type = getDomainServiceType($con, $domain_name);
                        
                        // Determine badge and icon
                        if ($days < 0) {
                            $badge_class = 'danger';
                            $icon = 'ki-cross-circle';
                            $status = 'Expired';
                            $days_text = abs($days) . ' days ago';
                        } elseif ($days <= 7) {
                            $badge_class = 'danger';
                            $icon = 'ki-information';
                            $status = 'Critical';
                            $days_text = $days . ' days left';
                        } elseif ($days <= 30) {
                            $badge_class = 'warning';
                            $icon = 'ki-notification-bing';
                            $status = 'Warning';
                            $days_text = $days . ' days left';
                        }
                        
                        // Service type display
                        $service_display = '';
                        $service_icon = '';
                        switch($service_type) {
                            case 'hostinger':
                                $service_display = 'Hostinger';
                                $service_icon = 'ki-cloud';
                                break;
                            case 'domain':
                                $service_display = 'Domain';
                                $service_icon = 'ki-abstract-26';
                                break;
                            case 'both':
                                $service_display = 'Both';
                                $service_icon = 'ki-toggle-on';
                                break;
                            default:
                                $service_display = 'Not Assigned';
                                $service_icon = 'ki-question';
                        }
                    ?>
                    <!--begin::Item-->
                    <div class="d-flex flex-stack py-4">
                        <!--begin::Section-->
                        <div class="d-flex align-items-center">
                            <!--begin::Symbol-->
                            <div class="symbol symbol-35px me-4">
                                <span class="symbol-label bg-light-<?php echo $badge_class; ?>">
                                    <i class="ki-duotone <?php echo $icon; ?> fs-2 text-<?php echo $badge_class; ?>">
                                        <span class="path1"></span>
                                        <span class="path2"></span>
                                        <span class="path3"></span>
                                    </i>
                                </span>
                            </div>
                            <!--end::Symbol-->
                            
                            <!--begin::Title-->
                            <div class="mb-0 me-2">
                                <a href="admin/view_domain.php?domain=<?php echo urlencode($domain_name); ?>" 
                                   class="fs-6 text-gray-800 text-hover-primary fw-bold">
                                    <?php echo htmlspecialchars($domain_name); ?>
                                </a>
                                <div class="text-gray-400 fs-7">
                                    <i class="ki-duotone <?php echo $service_icon; ?> fs-6 me-1">
                                        <span class="path1"></span>
                                        <span class="path2"></span>
                                    </i>
                                    <?php echo $service_display; ?>
                                    <span class="mx-2">•</span>
                                    <?php echo $days_text; ?>
                                </div>
                            </div>
                            <!--end::Title-->
                        </div>
                        <!--end::Section-->
                        
                        <!--begin::Label-->
                        <span class="badge badge-light-<?php echo $badge_class; ?> fs-8 fw-bold">
                            <?php echo $status; ?>
                        </span>
                        <!--end::Label-->
                    </div>
                    <!--end::Item-->
                    <?php endforeach; ?>
                    
                    <?php if ($displayed == 0): ?>
                    <div class="text-center py-10">
                        <i class="ki-duotone ki-shield-tick fs-3x text-success mb-5">
                            <span class="path1"></span>
                            <span class="path2"></span>
                        </i>
                        <div class="text-gray-600 fw-semibold fs-6">
                            All domains are safe!
                        </div>
                    </div>
                    <?php endif; ?>
                </div>
                <!--end::Items-->
                
                <!--begin::View more-->
               <!--begin::View more-->
<?php if (basename($_SERVER['PHP_SELF']) != 'domain_portfolio.php'): ?>
<div class="py-3 text-center border-top">
    <a href="admin/domain_portfolio.php" class="btn btn-color-gray-600 btn-active-color-primary">
        View All Domains
        <i class="ki-duotone ki-arrow-right fs-5">
            <span class="path1"></span>
            <span class="path2"></span>
        </i>
    </a>
</div>
<?php else: ?>
<div class="py-3 text-center border-top">
    <span class="text-gray-600 fs-7 fw-semibold">You're viewing all domains</span>
</div>
<?php endif; ?>
<!--end::View more-->
                <!--end::View more-->
            </div>
            <!--end::Tab panel-->
            
            <!--begin::Tab panel - Critical-->
            <div class="tab-pane fade" id="kt_topbar_notifications_2" role="tabpanel">
                <div class="scroll-y mh-325px my-5 px-8">
                    <?php
                    $displayed_critical = 0;
                    foreach ($notification_domains as $domain):
                        $domain_name = $domain['domain'] ?? $domain['name'] ?? 'N/A';
                        $expiry_date = $domain['expiry_date'] ?? $domain['expires_at'] ?? null;
                        
                        if (!$expiry_date) continue;
                        
                        $days = floor((strtotime($expiry_date) - time()) / (60 * 60 * 24));
                        
                        // Only show critical (7 days or less)
                        if ($days > 7) continue;
                        
                        $displayed_critical++;
                        $service_type = getDomainServiceType($con, $domain_name);
                        
                        if ($days < 0) {
                            $badge_class = 'danger';
                            $icon = 'ki-cross-circle';
                            $status = 'Expired';
                            $days_text = abs($days) . ' days ago';
                        } else {
                            $badge_class = 'danger';
                            $icon = 'ki-information';
                            $status = 'Critical';
                            $days_text = $days . ' days left';
                        }
                        
                        switch($service_type) {
                            case 'hostinger':
                                $service_display = 'Hostinger';
                                $service_icon = 'ki-cloud';
                                break;
                            case 'domain':
                                $service_display = 'Domain';
                                $service_icon = 'ki-abstract-26';
                                break;
                            case 'both':
                                $service_display = 'Both';
                                $service_icon = 'ki-toggle-on';
                                break;
                            default:
                                $service_display = 'Not Assigned';
                                $service_icon = 'ki-question';
                        }
                    ?>
                    <div class="d-flex flex-stack py-4">
                        <div class="d-flex align-items-center">
                            <div class="symbol symbol-35px me-4">
                                <span class="symbol-label bg-light-<?php echo $badge_class; ?>">
                                    <i class="ki-duotone <?php echo $icon; ?> fs-2 text-<?php echo $badge_class; ?>">
                                        <span class="path1"></span>
                                        <span class="path2"></span>
                                        <span class="path3"></span>
                                    </i>
                                </span>
                            </div>
                            <div class="mb-0 me-2">
                                <a href="admin/view_domain.php?domain=<?php echo urlencode($domain_name); ?>" 
                                   class="fs-6 text-gray-800 text-hover-primary fw-bold">
                                    <?php echo htmlspecialchars($domain_name); ?>
                                </a>
                                <div class="text-gray-400 fs-7">
                                    <i class="ki-duotone <?php echo $service_icon; ?> fs-6 me-1">
                                        <span class="path1"></span>
                                        <span class="path2"></span>
                                    </i>
                                    <?php echo $service_display; ?>
                                    <span class="mx-2">•</span>
                                    <?php echo $days_text; ?>
                                </div>
                            </div>
                        </div>
                        <span class="badge badge-light-<?php echo $badge_class; ?> fs-8 fw-bold">
                            <?php echo $status; ?>
                        </span>
                    </div>
                    <?php endforeach; ?>
                    
                    <?php if ($displayed_critical == 0): ?>
                    <div class="text-center py-10">
                        <i class="ki-duotone ki-shield-tick fs-3x text-success mb-5">
                            <span class="path1"></span>
                            <span class="path2"></span>
                        </i>
                        <div class="text-gray-600 fw-semibold fs-6">
                            No critical domains!
                        </div>
                    </div>
                    <?php endif; ?>
                </div>
                
               <?php if (basename($_SERVER['PHP_SELF']) != 'domain_portfolio.php'): ?>
<div class="py-3 text-center border-top">
    <a href="admin/domain_portfolio.php" class="btn btn-color-gray-600 btn-active-color-primary">
        View All Domains
        <i class="ki-duotone ki-arrow-right fs-5">
            <span class="path1"></span>
            <span class="path2"></span>
        </i>
    </a>
</div>
<?php else: ?>
<div class="py-3 text-center border-top">
    <span class="text-gray-600 fs-7 fw-semibold">You're viewing all domains</span>
</div>
<?php endif; ?>
            </div>
            <!--end::Tab panel-->
            
            <!--begin::Tab panel - Warning-->
            <div class="tab-pane fade" id="kt_topbar_notifications_3" role="tabpanel">
                <div class="scroll-y mh-325px my-5 px-8">
                    <?php
                    $displayed_warning = 0;
                    foreach ($notification_domains as $domain):
                        $domain_name = $domain['domain'] ?? $domain['name'] ?? 'N/A';
                        $expiry_date = $domain['expiry_date'] ?? $domain['expires_at'] ?? null;
                        
                        if (!$expiry_date) continue;
                        
                        $days = floor((strtotime($expiry_date) - time()) / (60 * 60 * 24));
                        
                        // Only show warning (8-30 days)
                        if ($days <= 7 || $days > 30) continue;
                        
                        $displayed_warning++;
                        $service_type = getDomainServiceType($con, $domain_name);
                        
                        $badge_class = 'warning';
                        $icon = 'ki-notification-bing';
                        $status = 'Warning';
                        $days_text = $days . ' days left';
                        
                        switch($service_type) {
                            case 'hostinger':
                                $service_display = 'Hostinger';
                                $service_icon = 'ki-cloud';
                                break;
                            case 'domain':
                                $service_display = 'Domain';
                                $service_icon = 'ki-abstract-26';
                                break;
                            case 'both':
                                $service_display = 'Both';
                                $service_icon = 'ki-toggle-on';
                                break;
                            default:
                                $service_display = 'Not Assigned';
                                $service_icon = 'ki-question';
                        }
                    ?>
                    <div class="d-flex flex-stack py-4">
                        <div class="d-flex align-items-center">
                            <div class="symbol symbol-35px me-4">
                                <span class="symbol-label bg-light-<?php echo $badge_class; ?>">
                                    <i class="ki-duotone <?php echo $icon; ?> fs-2 text-<?php echo $badge_class; ?>">
                                        <span class="path1"></span>
                                        <span class="path2"></span>
                                        <span class="path3"></span>
                                    </i>
                                </span>
                            </div>
                            <div class="mb-0 me-2">
                                <a href="admin/view_domain.php?domain=<?php echo urlencode($domain_name); ?>" 
                                   class="fs-6 text-gray-800 text-hover-primary fw-bold">
                                    <?php echo htmlspecialchars($domain_name); ?>
                                </a>
                                <div class="text-gray-400 fs-7">
                                    <i class="ki-duotone <?php echo $service_icon; ?> fs-6 me-1">
                                        <span class="path1"></span>
                                        <span class="path2"></span>
                                    </i>
                                    <?php echo $service_display; ?>
                                    <span class="mx-2">•</span>
                                    <?php echo $days_text; ?>
                                </div>
                            </div>
                        </div>
                        <span class="badge badge-light-<?php echo $badge_class; ?> fs-8 fw-bold">
                            <?php echo $status; ?>
                        </span>
                    </div>
                    <?php endforeach; ?>
                    
                    <?php if ($displayed_warning == 0): ?>
                    <div class="text-center py-10">
                        <i class="ki-duotone ki-shield-tick fs-3x text-success mb-5">
                            <span class="path1"></span>
                            <span class="path2"></span>
                        </i>
                        <div class="text-gray-600 fw-semibold fs-6">
                            No warnings!
                        </div>
                    </div>
                    <?php endif; ?>
                </div>
                
               <?php if (basename($_SERVER['PHP_SELF']) != 'domain_portfolio.php'): ?>
<div class="py-3 text-center border-top">
    <a href="admin/domain_portfolio.php" class="btn btn-color-gray-600 btn-active-color-primary">
        View All Domains
        <i class="ki-duotone ki-arrow-right fs-5">
            <span class="path1"></span>
            <span class="path2"></span>
        </i>
    </a>
</div>
<?php else: ?>
<div class="py-3 text-center border-top">
    <span class="text-gray-600 fs-7 fw-semibold">You're viewing all domains</span>
</div>
<?php endif; ?>
            </div>
            <!--end::Tab panel-->
        </div>
        <!--end::Tab content-->
    </div>
    <!--end::Menu-->
    <!--end::Menu wrapper-->
</div>
<!--end::Notifications-->
								<!--end::Theme mode-->
								<!--begin::User menu-->
							<!--begin::User menu-->
<!--begin::User menu-->
<div class="app-navbar-item ms-1 ms-md-3" id="kt_header_user_menu_toggle">
    <!--begin::Menu wrapper-->
    <div class="cursor-pointer symbol symbol-30px symbol-md-40px" 
         data-kt-menu-trigger="{default: 'click', lg: 'hover'}" 
         data-kt-menu-attach="parent" 
         data-kt-menu-placement="bottom-end">
        <?php
        // Get current user's profile image
        $profile_query = "SELECT profile_image, fname FROM tbl_user WHERE uid = ?";
        $profile_stmt = mysqli_prepare($con, $profile_query);
        mysqli_stmt_bind_param($profile_stmt, "i", $_SESSION['admin_id']);
        mysqli_stmt_execute($profile_stmt);
        $profile_result = mysqli_stmt_get_result($profile_stmt);
        $profile_data = mysqli_fetch_assoc($profile_result);
        mysqli_stmt_close($profile_stmt);
        
        $profile_image = $profile_data['profile_image'] ?? null;
        $user_name = $profile_data['fname'] ?? 'User';
        $user_initial = strtoupper(substr($user_name, 0, 1));
        
        // ✅ FIXED: Added '../' for correct relative path
        if ($profile_image && file_exists('../uploads/profiles/' . $profile_image)): 
        ?>
            <img src="uploads/profiles/<?php echo htmlspecialchars($profile_image); ?>" alt="<?php echo htmlspecialchars($user_name); ?>" />
        <?php else: ?>
            <div class="symbol-label fs-3 bg-light-primary text-primary">
                <?php echo $user_initial; ?>
            </div>
        <?php endif; ?>
    </div>
    
    <!--begin::User account menu-->
    <div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-800 menu-state-bg menu-state-color fw-semibold py-4 fs-6 w-275px" data-kt-menu="true">
        <!--begin::Menu item-->
        <div class="menu-item px-3">
            <div class="menu-content d-flex align-items-center px-3">
                <div class="symbol symbol-50px me-5">
                    <?php 
                    // ✅ FIXED: Added '../' for correct relative path
                    if ($profile_image && file_exists('../uploads/profiles/' . $profile_image)): 
                    ?>
                        <img src="uploads/profiles/<?php echo htmlspecialchars($profile_image); ?>" alt="<?php echo htmlspecialchars($user_name); ?>" />
                    <?php else: ?>
                        <div class="symbol-label fs-2 fw-semibold bg-light-primary text-primary">
                            <?php echo $user_initial; ?>
                        </div>
                    <?php endif; ?>
                </div>
                <div class="d-flex flex-column">
                    <div class="fw-bold d-flex align-items-center fs-5">
                        <?php echo htmlspecialchars($user_name); ?>
                    </div>
                    <span class="fw-semibold text-muted fs-7">
                        <?php echo htmlspecialchars($_SESSION['role'] ?? 'User'); ?>
                    </span>
                </div>
            </div>
        </div>
        <!--end::Menu item-->
        
        <!--begin::Menu separator-->
        <div class="separator my-2"></div>
        <!--end::Menu separator-->
        
        <!--begin::Menu item-->
        <div class="menu-item px-5">
            <a href="#" class="menu-link px-5" onclick="openProfileModal(); return false;">
                <span class="menu-icon">
                    <i class="ki-duotone ki-profile-circle fs-3">
                        <span class="path1"></span>
                        <span class="path2"></span>
                        <span class="path3"></span>
                    </i>
                </span>
                My Profile
            </a>
        </div>
        <!--end::Menu item-->
        
        <!--begin::Menu separator-->
        <div class="separator my-2"></div>
        <!--end::Menu separator-->
        
        <!--begin::Menu item-->
        <div class="menu-item px-5">
            <a href="admin/logout.php" class="menu-link px-5">Sign Out</a>
        </div>
        <!--end::Menu item-->
    </div>
    <!--end::User account menu-->
    <!--end::Menu wrapper-->
</div>
<!--end::User menu-->
<!--end::User menu-->
								<!--end::User menu-->
								<!--begin::Header menu toggle-->
								<div class="app-navbar-item d-lg-none ms-2 me-n3" title="Show header menu">
									<div class="btn btn-icon btn-active-color-primary w-30px h-30px w-md-35px h-md-35px" id="kt_app_header_menu_toggle">
										<!--begin::Svg Icon | path: icons/duotune/text/txt001.svg-->
										<span class="svg-icon svg-icon-2 svg-icon-md-1">
											<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
												<path d="M13 11H3C2.4 11 2 10.6 2 10V9C2 8.4 2.4 8 3 8H13C13.6 8 14 8.4 14 9V10C14 10.6 13.6 11 13 11ZM22 5V4C22 3.4 21.6 3 21 3H3C2.4 3 2 3.4 2 4V5C2 5.6 2.4 6 3 6H21C21.6 6 22 5.6 22 5Z" fill="currentColor" />
												<path opacity="0.3" d="M21 16H3C2.4 16 2 15.6 2 15V14C2 13.4 2.4 13 3 13H21C21.6 13 22 13.4 22 14V15C22 15.6 21.6 16 21 16ZM14 20V19C14 18.4 13.6 18 13 18H3C2.4 18 2 18.4 2 19V20C2 20.6 2.4 21 3 21H13C13.6 21 14 20.6 14 20Z" fill="currentColor" />
											</svg>	
										</span>
										<!--end::Svg Icon-->
									</div>
								</div>
								<!--end::Header menu toggle-->
							</div>
                            <!--end::Navbar-->
                        </div>
						<!--end::Header wrapper-->
					</div>
					<!--end::Header container-->
				</div>
				
				
				<!-- Profile Management Modal -->
<div class="modal fade" id="profileModal" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered mw-650px">
        <div class="modal-content">
            <div class="modal-header">
                <h2 class="fw-bolder">Profile Picture</h2>
                <div class="btn btn-icon btn-sm btn-active-icon-primary" data-bs-dismiss="modal">
                    <i class="ki-duotone ki-cross fs-1">
                        <span class="path1"></span>
                        <span class="path2"></span>
                    </i>
                </div>
            </div>
            
            <form id="profileForm" method="POST" enctype="multipart/form-data">
                <div class="modal-body py-10 px-lg-17">
                    <input type="hidden" name="action" value="update_profile">
                    
                    <div id="profileAlertBox"></div>
                    
                    <!-- Metronic-Style Profile Image Section -->
                    <div class="fv-row mb-7">
                        <label class="d-block fw-semibold fs-6 mb-5">Profile Picture</label>
                        
                        <!-- Image input wrapper -->
                        <div class="image-input image-input-outline" 
                             data-kt-image-input="true" 
                             style="background-image: url('assets/media/avatars/blank.png')">
                            
                            <!-- Preview Image -->
                            <div class="image-input-wrapper w-125px h-125px" 
                                 id="profileImageWrapper"
                                 style="background-image: url('<?php 
                                    if ($profile_image && file_exists('../uploads/profiles/' . $profile_image)) {
                                        echo 'uploads/profiles/' . htmlspecialchars($profile_image);
                                    } else {
                                        echo 'assets/media/avatars/blank.png';
                                    }
                                 ?>')">
                            </div>
                            
                            <!-- Edit Button -->
                            <label class="btn btn-icon btn-circle btn-active-color-primary w-25px h-25px bg-body shadow" 
                                   data-kt-image-input-action="change" 
                                   data-bs-toggle="tooltip" 
                                   title="Change profile picture">
                                <i class="ki-duotone ki-pencil fs-7">
                                    <span class="path1"></span>
                                    <span class="path2"></span>
                                </i>
                                <input type="file" 
                                       name="profile_image" 
                                       id="profile_image" 
                                       accept=".png, .jpg, .jpeg, .gif" />
                                <input type="hidden" name="profile_image_remove" id="profile_image_remove" />
                            </label>
                            
                            <!-- Cancel Button -->
                            <span class="btn btn-icon btn-circle btn-active-color-primary w-25px h-25px bg-body shadow" 
                                  data-kt-image-input-action="cancel" 
                                  data-bs-toggle="tooltip" 
                                  title="Cancel profile picture">
                                <i class="ki-duotone ki-cross fs-2">
                                    <span class="path1"></span>
                                    <span class="path2"></span>
                                </i>
                            </span>
                            
                            <!-- Remove Button -->
                            <span class="btn btn-icon btn-circle btn-active-color-primary w-25px h-25px bg-body shadow" 
                                  data-kt-image-input-action="remove" 
                                  data-bs-toggle="tooltip" 
                                  title="Remove profile picture">
                                <i class="ki-duotone ki-cross fs-2">
                                    <span class="path1"></span>
                                    <span class="path2"></span>
                                </i>
                            </span>
                        </div>
                        
                        <!-- Help text -->
                        <div class="form-text">Allowed file types: png, jpg, jpeg, gif. Max size: 2MB</div>
                    </div>
                    
                </div>
                
                <div class="modal-footer flex-center">
                    <button type="reset" class="btn btn-light me-3" data-bs-dismiss="modal">Cancel</button>
                    <button type="submit" class="btn btn-primary" id="profileSubmitBtn">
                        <span class="indicator-label">Save Changes</span>
                        <span class="indicator-progress">Please wait...
                            <span class="spinner-border spinner-border-sm align-middle ms-2"></span>
                        </span>
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
				
				
				<script>
// Open Profile Modal
function openProfileModal() {
    const modal = new bootstrap.Modal(document.getElementById('profileModal'));
    modal.show();
}

// Initialize Metronic Image Input
document.addEventListener('DOMContentLoaded', function() {
    const imageInput = document.querySelector('[data-kt-image-input="true"]');
    if (imageInput) {
        const wrapper = imageInput.querySelector('.image-input-wrapper');
        const fileInput = imageInput.querySelector('input[type="file"]');
        const removeInput = imageInput.querySelector('input[name="profile_image_remove"]');
        const cancelBtn = imageInput.querySelector('[data-kt-image-input-action="cancel"]');
        const removeBtn = imageInput.querySelector('[data-kt-image-input-action="remove"]');
        
        let originalImage = wrapper.style.backgroundImage;
        
        // Handle file selection
        fileInput.addEventListener('change', function(e) {
            const file = e.target.files[0];
            if (file) {
                // Validate file size (2MB)
                if (file.size > 2 * 1024 * 1024) {
                    Swal.fire({
                        text: 'File size must be less than 2MB',
                        icon: 'error',
                        buttonsStyling: false,
                        confirmButtonText: 'Ok',
                        customClass: {
                            confirmButton: 'btn btn-primary'
                        }
                    });
                    fileInput.value = '';
                    return;
                }
                
                // Validate file type
                const allowedTypes = ['image/jpeg', 'image/png', 'image/jpg', 'image/gif'];
                if (!allowedTypes.includes(file.type)) {
                    Swal.fire({
                        text: 'Only JPG, JPEG, PNG and GIF files are allowed',
                        icon: 'error',
                        buttonsStyling: false,
                        confirmButtonText: 'Ok',
                        customClass: {
                            confirmButton: 'btn btn-primary'
                        }
                    });
                    fileInput.value = '';
                    return;
                }
                
                // Preview image
                const reader = new FileReader();
                reader.onload = function(event) {
                    wrapper.style.backgroundImage = `url('${event.target.result}')`;
                    imageInput.classList.add('image-input-changed');
                    imageInput.classList.remove('image-input-empty');
                    removeInput.value = '0';
                };
                reader.readAsDataURL(file);
            }
        });
        
        // Handle cancel
        cancelBtn.addEventListener('click', function(e) {
            e.preventDefault();
            wrapper.style.backgroundImage = originalImage;
            fileInput.value = '';
            imageInput.classList.remove('image-input-changed');
            imageInput.classList.remove('image-input-empty');
            removeInput.value = '0';
        });
        
        // Handle remove
        removeBtn.addEventListener('click', function(e) {
            e.preventDefault();
            wrapper.style.backgroundImage = "url('assets/media/avatars/blank.png')";
            fileInput.value = '';
            imageInput.classList.remove('image-input-changed');
            imageInput.classList.add('image-input-empty');
            removeInput.value = '1';
        });
    }
});

// Profile Form Submit
document.getElementById('profileForm')?.addEventListener('submit', function(e) {
    e.preventDefault();
    
    const submitBtn = document.getElementById('profileSubmitBtn');
    const formData = new FormData(this);
    
    submitBtn.setAttribute('data-kt-indicator', 'on');
    submitBtn.disabled = true;
    
fetch('admin/profile_actions.php', {
        method: 'POST',
        body: formData
    })
    .then(response => response.json())
    .then(data => {
        submitBtn.removeAttribute('data-kt-indicator');
        submitBtn.disabled = false;
        
        if (data.success) {
            const modalElement = document.getElementById('profileModal');
            const modal = bootstrap.Modal.getInstance(modalElement);
            if (modal) {
                modal.hide();
            }
            
            setTimeout(() => {
                document.querySelectorAll('.modal-backdrop').forEach(el => el.remove());
                document.body.classList.remove('modal-open');
                document.body.style.removeProperty('padding-right');
                document.body.style.removeProperty('overflow');
                
                Swal.fire({
                    text: data.message,
                    icon: "success",
                    buttonsStyling: false,
                    confirmButtonText: "Ok, got it!",
                    customClass: {
                        confirmButton: "btn btn-primary"
                    }
                }).then(() => {
                    location.reload();
                });
            }, 300);
        } else {
            showProfileAlert(data.message, 'danger');
        }
    })
    .catch(error => {
        submitBtn.removeAttribute('data-kt-indicator');
        submitBtn.disabled = false;
        showProfileAlert('An error occurred. Please try again.', 'danger');
        console.error('Error:', error);
    });
});

function showProfileAlert(message, type) {
    document.getElementById('profileAlertBox').innerHTML = 
        `<div class="alert alert-${type} d-flex align-items-center p-5 mb-10">
            <i class="ki-duotone ki-shield-${type === 'danger' ? 'cross' : 'tick'} fs-2hx text-${type} me-4">
                <span class="path1"></span>
                <span class="path2"></span>
                <span class="path3"></span>
            </i>
            <div class="d-flex flex-column">
                <h4 class="mb-1 text-${type}">${type === 'danger' ? 'Error' : 'Success'}</h4>
                <span>${message}</span>
            </div>
        </div>`;
}
</script>

MMCT - 2023