<?php

	$permission  = explode(',',$_SESSION['permission_id']);
               
    asort($permission); ?>
    <style>
    	.navbar-nav {
    		margin-left: 0px;
    		margin-right: -15px;
		}

		html[dir="rtl"].navbar-nav {
    		margin-left: -15px !important;
		}

		html[dir="rtl"].navbar-nav {
    	margin-right: 0px !important;
		}

		html[dir="rtl"].navbar-brand {
		    
		    padding: 15px 15px;
		}

		.navbar-nav > li {
		    margin-left: -15px;
		}

		.navbar-header {
		    min-width: 100px;
		}

		.dropdown-menu {
    		min-width: 240px;
    	}

    </style>          
						
	<div class="navbar navbar-inverse bg-indigo navbar-fixed-top">
		<div class="navbar-header">
			<a tabindex="1" class="navbar-brand" href="starter.php"><i class="icon-home2 position-left"></i> <span class="multi_lang">الرئيسية</span></a>
			
			<ul class="nav navbar-nav pull-right visible-xs-block">
				<li><a data-toggle="collapse" data-target="#navbar-mobile"><i class="icon-tree5"></i></a></li>
			</ul>
		</div>

		<div class="navbar-collapse collapse" id="navbar-mobile">
			<ul class="nav navbar-nav">



				<?php if(in_array(1,$permission) || in_array(2,$permission)){ ?>
				<li class="dropdown">
					<a tabindex="2" href="index.php?p=dashboard" class="dropdown-toggle" >
						<i class="icon-display4 position-left"></i><span class="multi_lang">Dashboard</span> 
						<span class="visible-xs-inline-block position-right"></span>
					</a>
				</li>
				<?php } ?>

				<?php if(in_array(1,$permission) || in_array(3,$permission)){ ?>
				<li class="dropdown">
					<a tabindex="2" href="index.php?p=report" class="dropdown-toggle" >
						<i class="icon-display4 position-left"></i><span class="multi_lang">تقارير عامة</span> 
						<span class="visible-xs-inline-block position-right"></span>
					</a>
				</li>
				<?php } ?>

				

				



				<?php if(in_array(1,$permission) || in_array(4,$permission) || in_array(10,$permission)  ){ ?>

				<li class="dropdown">
					<a class="dropdown-toggle" data-toggle="dropdown">
						<i class="icon-diff-added position-left"></i><span class="multi_lang">المواد</span>
						<span class="visible-xs-inline-block position-right"></span>
						<span class="caret"></span>
					</a>

					<ul class="dropdown-menu">

						<?php if(in_array(1,$permission) || in_array(4,$permission)  ){ ?>
						<li><a href="index.php?p=category">
							<i class="icon-tree7 position-left"></i><span class="multi_lang">اصناف المواد</span>
							</a>
						</li>
						<?php } ?>

						<?php if(in_array(1,$permission) || in_array(10,$permission)  ){ ?>
						<li><a href="index.php?p=product">
							<i class="icon-dropbox position-left"></i><span class="multi_lang">المواد</span>
							</a>
						</li>
						<?php } ?>

						
						
						
					</ul>
				</li>

				
				<?php } ?>

				


				<?php if(in_array(1,$permission) || in_array(5,$permission) || in_array(6,$permission) || in_array(7,$permission) || in_array(8,$permission) || in_array(12,$permission) || in_array(15,$permission) || in_array(17,$permission) || in_array(18,$permission) || in_array(19,$permission) || in_array(20,$permission) || in_array(21,$permission) || in_array(24,$permission) ){ ?>

				<li class="dropdown">
					<a class="dropdown-toggle" data-toggle="dropdown">
						<i class="icon-menu6 position-left"></i><span class="multi_lang">الاضافات</span>
						<span class="visible-xs-inline-block position-right"></span>
						<span class="caret"></span>
					</a>

					<ul class="dropdown-menu">

						<?php if(in_array(1,$permission) || in_array(7,$permission)  ){ ?>
						<li><a href="index.php?p=doctor"><i class="icon-repo-forked position-left"></i> <span class="multi_lang">Doctor</span>   </a></li>
						<?php } ?>

						<?php if(in_array(1,$permission) || in_array(17,$permission)  ){ ?>
						<li><a href="index.php?p=doctor_duplicate"><i class="icon-repo-forked position-left text-danger"></i> <span class="multi_lang text-danger">معالجة تكرر الاطباء</span>   </a></li>
						<?php } ?>

						<?php if(in_array(1,$permission) || in_array(8,$permission)  ){ ?>
						<li><a href="index.php?p=pharmacy"><i class="icon-store position-left"></i> <span class="multi_lang">Pharmacy</span>   </a></li>
						<?php } ?>

						<?php if(in_array(1,$permission) || in_array(18,$permission)  ){ ?>
						<li><a href="index.php?p=pharmacy_duplicate"><i class="icon-store position-left text-danger"></i> <span class="multi_lang text-danger">معالجة تكرار الصيدليات</span>   </a></li>
						<?php } ?>

						<?php if(in_array(1,$permission) || in_array(19,$permission)  ){ ?>
						<li><a href="index.php?p=specialty"><i class="icon-grid5 position-left"></i> <span class="multi_lang">تخصصات الاطباء</span>   </a></li>
						<?php } ?>

						<?php if(in_array(1,$permission) || in_array(6,$permission)  ){ ?>
						<li><a href="index.php?p=class"><i class="icon-grid5 position-left"></i> <span class="multi_lang">Doctor Class</span>   </a></li>
						<?php } ?>

						<?php if(in_array(1,$permission) || in_array(12,$permission)  ){ ?>
						<li><a href="index.php?p=sub_class"><i class="icon-grid-alt position-left"></i> <span class="multi_lang">Doctor Sub-Class</span>   </a></li>
						<?php } ?>

						<?php if(in_array(1,$permission) || in_array(5,$permission)  ){ ?>
						<li><a href="index.php?p=city"><i class="icon-city position-left"></i> <span class="multi_lang">City</span>   </a></li>
						<?php } ?>

						<?php if(in_array(1,$permission) || in_array(15,$permission)  ){ ?>
						<li><a href="index.php?p=zone"><i class="icon-office position-left"></i> <span class="multi_lang">Zone</span>   </a></li>
						<?php } ?>

						<?php if(in_array(1,$permission) || in_array(20,$permission)  ){ ?>
						<li><a href="index.php?p=sub_zone"><i class="icon-office position-left"></i> <span class="multi_lang">Sub Zone</span>   </a></li>
						<?php } ?>
						<?php if(in_array(1,$permission) || in_array(21,$permission)  ){ ?>
						<li><a href="index.php?p=quarter"><i class="icon-office position-left"></i> <span class="multi_lang">الاحياء</span>   </a></li>
						<?php } ?>
						<?php if(in_array(1,$permission) || in_array(24,$permission)  ){ ?>
						<li><a href="index.php?p=street"><i class="icon-office position-left"></i> <span class="multi_lang">الشوارع</span>   </a></li>
						<?php } ?>

						
						
					</ul>
				</li>

				
				<?php } ?>


				

				<?php if(in_array(1,$permission) || in_array(11,$permission) || in_array(13,$permission) || in_array(22,$permission) ){ ?>

				<li class="dropdown">
					<a class="dropdown-toggle" data-toggle="dropdown">
						<i class="icon-users4 position-left"></i><span class="multi_lang">الموظفين</span>
						<span class="visible-xs-inline-block position-right"></span>
						<span class="caret"></span>
					</a>

					<ul class="dropdown-menu">

						<?php if(in_array(1,$permission) || in_array(22,$permission)  ){ ?>
						<li><a href="index.php?p=users">
							<i class="icon-users position-left"></i><span class="multi_lang">مستخدمي النظام</span>
							</a>
						</li>
						<?php } ?>

						<?php if(in_array(1,$permission) || in_array(13,$permission)  ){ ?>
						<li><a href="index.php?p=teamleader">
							<i class="icon-user-tie position-left"></i><span class="multi_lang">TeamLeaders</span>
							</a>
						</li>
						<?php } ?>

						<?php if(in_array(1,$permission) || in_array(11,$permission)  ){ ?>
						<li><a href="index.php?p=saleman">
							<i class="icon-man position-left"></i><span class="multi_lang">Saleman</span>
							</a>
						</li>
						<?php } ?>

						
						
					</ul>
				</li>

				
				<?php } ?>

				



				<?php if(in_array(1,$permission) || in_array(9,$permission)  ){ ?>
				<li class="dropdown">
					<a tabindex="5" href="index.php?p=plan" class="dropdown-toggle" >
						<i class="icon-folder-check position-left"></i><span class="multi_lang">الخطط</span>
						<span class="visible-xs-inline-block position-right"></span>
					</a>
				</li>
				<?php } ?>

				<?php if(in_array(1,$permission) || in_array(14,$permission)  ){ ?>
				<li class="dropdown">
					<a tabindex="5" href="index.php?p=visit" class="dropdown-toggle" >
						<i class="icon-file-text2 position-left"></i><span class="multi_lang">تقارير المندوب</span>
						<span class="visible-xs-inline-block position-right"></span>
					</a>
				</li>
				<?php } ?>

				<?php if(in_array(1,$permission) || in_array(16,$permission)  ){ ?>
				<li class="dropdown">
					<a tabindex="5" href="index.php?p=visit_delivery" class="dropdown-toggle" >
						<i class="icon-file-text2 position-left"></i><span class="multi_lang">تقرير تسليم المواد</span>
						<span class="visible-xs-inline-block position-right"></span>
					</a>
				</li>
				<?php } ?>

				

				
			</ul>

			

			<ul class="nav navbar-nav navbar-right">
				<!--
				<li class="dropdown language-switch">
					<a class="dropdown-toggle" data-toggle="dropdown">
						<img src="assets/images/flags/gb.png" class="position-left" alt="">
						English
						<span class="caret"></span>
					</a>

					<ul class="dropdown-menu">
						<li><a class="deutsch"><img src="assets/images/flags/de.png" alt=""> Deutsch</a></li>
						<li><a class="ukrainian"><img src="assets/images/flags/ua.png" alt=""> Українська</a></li>
						<li><a class="english"><img src="assets/images/flags/gb.png" alt=""> English</a></li>
						<li><a class="espana"><img src="assets/images/flags/es.png" alt=""> España</a></li>
						<li><a class="russian"><img src="assets/images/flags/ru.png" alt=""> Русский</a></li>
					</ul>
				</li>
				-->
				
				<?php if(in_array(1,$permission) || in_array(23,$permission) || in_array(27,$permission) || in_array(28,$permission) ){ ?>

				<li class="dropdown">
					<a class="dropdown-toggle" data-toggle="dropdown">
						<i class="icon-cog6 position-left"></i><span class="multi_lang">اعدادات</span> 
						<span class="visible-xs-inline-block position-right"></span>
						<span class="caret"></span>
					</a>

					<ul class="dropdown-menu">
						
						<?php if(in_array(1,$permission) || in_array(23,$permission)  ){ ?>
						<li><a href="index.php?p=setting"><i class="icon-cog6 position-left"></i><span class="multi_lang">اعدادات النظام</span>  </a></li>
						<?php } ?>
						<?php if(in_array(1,$permission) || in_array(27,$permission)  ){ ?>
						<li><a href="index.php?p=languages"><i class="icon-earth position-left"></i><span class="multi_lang">اللغات</span></a></li>
						<?php } ?>
						<?php if(in_array(1,$permission) || in_array(28,$permission)  ){ ?>
						<li><a href="index.php?p=translation"><i class="icon-ampersand2 position-left"></i><span class="multi_lang">الترجمة</span></a></li>
						<?php } ?>
						
						
					</ul>
				</li>

				
				<?php } ?>
				
				

				<li class="dropdown dropdown-user">
					<a class="dropdown-toggle" data-toggle="dropdown">
						<?php if($_SESSION['profile_image']==null){  ?>
						<img src="image/profile/noimg.png" alt="">
						<?php }else{ ?>
						<img src="<?php echo $_SESSION['image_path'].$_SESSION['profile_image']; ?>" alt="">
						<?php } ?>
						<span><?php echo $_SESSION['username']; ?></span>
						<i class="caret"></i>
					</a>

					<ul class="dropdown-menu dropdown-menu-right">
						<li><a href="index.php?p=profile"><i class="icon-user-plus"></i><span class="multi_lang">صفحتي الشخصية</span> </a></li>
						
						<li class="divider"></li>
						<li><a href="models/logout.php"><i class="icon-switch2"></i><span class="multi_lang">تسجيل الخروج</span> </a></li>
					</ul>
				</li>
			</ul>
		</div>
	</div>
	