<?php require_once __DIR__."/mobile-detect/Mobile_Detect.php"; 
$screen_size = new Mobile_Detect;

?>
<?php
$UserID = $_SESSION['user_id'];
$getEmpQuery = $conn->query("SELECT branch_id FROM tbl_user_branch WHERE user_id='$UserID' ");
if ($emp = $getEmpQuery->fetch_array()) {
	$branch_id = $emp['0'];
}

?>



<div class="header">
	<?php

	$stmt = $DB_con->prepare('SELECT * FROM mobilesettings where status="1" ORDER BY stid');

	$stmt->execute();

	if ($stmt->rowCount() > 0) {

		while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {

			extract($row);

	?>



			<div class="header-left active">
				<a href="index.php" class="logo">
					<?php if ($row['systemlogo'] == "") {
						$pro_img = "assets/img/empty.png";
					} else {
						$pro_img = "images/settings/" . $row['systemlogo'];
					} ?>
					<img src="<?php echo $pro_img; ?>" alt="<?php echo $row['systemname']; ?> | Dashboard" />
				</a>
				<a href="index.php" class="logo-small">
					<?php if ($row['systemlogo'] == "") {
						$pro_img = "assets/img/empty.png";
					} else {
						$pro_img = "images/settings/" . $row['systemlogo'];
					} ?>
					<img src="<?php echo $pro_img; ?>" alt="<?php echo $row['systemname']; ?> | Dashboard" />
				</a>
			</div>

	<?php
		}
	}
	?>
	<a id="mobile_btn" class="mobile_btn" href="#sidebar">
		<span class="bar-icon">
			<span></span>
			<span></span>
			<span></span>
		</span>
	</a>

	<ul class="nav user-menu">
		<?php if ( $screen_size->isMobile() ) { ?>
			<li class="nav-item dropdown mobile-none">
			<a href="pos-panel.php" class="btns pos_panel_bt" target="_blank" style="fontweight:600;font-size:18px;">
				<i class="fa fa-fax" data-bs-toggle="tooltip" title="" data-bs-original-title="Pos Panel" aria-label="fa fa-fax"></i> 
			</a>
		</li>
		<?php }else{ ?>
			<li class="nav-item dropdown mobile-none">
			<a href="pos-panel.php" class="btns pos_panel_bt" target="_blank" style="fontweight:600;font-size:18px;">
				<i class="fa fa-fax" data-bs-toggle="tooltip" title="" data-bs-original-title="Pos Panel" aria-label="fa fa-fax"></i> POS PANEL
			</a>
		</li>
			<?php }?>
		<li class="nav-item dropdown has-arrow main-drop">
			<a href="javascript:void(0);" class="dropdown-toggle nav-link userset" data-bs-toggle="dropdown">
				<span class="user-img"><img src="<?php echo $image_path; ?>" alt="">
					<span class="status online"></span></span>
			</a>
			<div class="dropdown-menu menu-drop-user">
				<div class="profilename">
					<div class="profileset">
						<span class="user-img"><img src="<?php echo $image_path; ?>" alt="">
							<span class="status online"></span></span>
						<div class="profilesets">
							<h6 style="font-weight:700;font-size:12px;"><?php echo $user_resalt['fullname']; ?></h6>
							<h5 style="font-weight:700;font-size:11px;"><?php
																		$id = $user_resalt['admintype'];
																		$groupinfo = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM user_groups WHERE group_id='$id'"));

																		echo $groupinfo['group_name'];
																		?></h5>
							<h6 style="font-size:10px;"><?php

														$id4 = $branch_id;

														$query4 = $DB_con->prepare('SELECT branch_name FROM branch WHERE branch_id=' . $id4);

														$query4->execute();

														$result4 = $query4->fetch();

														echo $result4['branch_name'];

														?>
							</h6>
						</div>
					</div>
					<hr class="m-0">
					<a class="dropdown-item logout pb-0" href="index.php" style="font-weight:700;font-size:12px;"><img src="assets/img/icons/log-out.svg" class="me-2" alt="img" style="font-weight:700;font-size:12px;">Logout</a>
				</div>
			</div>
		</li>
	</ul>


	<div class="dropdown mobile-user-menu">
		<a href="javascript:void(0);" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"><i class="fa fa-ellipsis-v"></i></a>
		<div class="dropdown-menu dropdown-menu-right">
			<a class="dropdown-item" href="index.php">Logout</a>
		</div>
	</div>

</div>
<style>
	@media only screen and (max-width: 767px) {
		.bar-icon span {
			background-color: #fff;
		}

		.header .mobile-user-menu a {
			color: #fff;
		}

		.user-menu {
			display: flex;
		}

		.nav-item .user-img {}

		.user-menu.nav>li>a {
			margin-left: -11px;
		}

		.header .header-left .logo img {
			width: 110px;
		}

		.header {
			border-right: 0 !important;
		}

		.fa.fa-home {
			font-size: 25px !important;
		}
	}

	.sidebar .slimScrollDiv,
	.header {
		background-color: #000000;
	}


	.header {
		border-right: 22px solid #000000;
	}

	.bar-icon span {
		background-color: #fff;
	}
	@media only screen and (max-width: 1025px) {
		.header {
    		justify-content: space-between  !important;
		}
		.admin_title h2{
			font-size: 18px;
		}
		.card h6, .card h5 {
    		font-size: 12px;
    
			}
			.card h2 {
    			font-size: 16px;
			}
			.btns {
		font-size: 12px !important;
		padding: 10px;
		display: block;
		width: 148px;
		height: 50px;
		line-height: 50px;
		border-radius: 0;
		text-align: center;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.select2-container--default .select2-selection--single .select2-selection__rendered{
		font-size: 15px;
	}
	}
</style>