<!-- BEGIN MENUBAR-->
<?php 
	use App\Models\Adminmenumanage;
	use App\Models\Option;
	use App\Models\Usergroup;
	use App\Models\Usergroupmeta;
	$menus = Adminmenumanage::where('parentId',0)->where('status','active')->get();
	$portalName = Option::getvalue("portalName");
?>
<div id="menubar" class="menubar-inverse ">
	<div class="menubar-fixed-panel">
		<div>
			<a class="btn btn-icon-toggle btn-default menubar-toggle" data-toggle="menubar" href="javascript:void(0);">
				<i class="fa fa-bars"></i>
			</a>
		</div>
		<div class="expanded">
			<a href="<?php echo URL::to('admin'); ?>">
				<span class="text-lg text-bold text-primary" style="color: #fff;"><?php echo $portalName; ?>&nbsp;ADMIN</span>
			</a>
		</div>
	</div>
	<div class="menubar-scroll-panel">

		<!-- BEGIN MAIN MENU -->
		<ul id="main-menu" class="gui-controls">		
			<?php $__currentLoopData = $menus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $first): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
				
				<?php if(Usergroup::getviewulpermission(Auth::user()->userGroup,$first->menuId) == true || Auth::User()->userGroup == 1): ?>
					<?php if(Adminmenumanage::hasSubmenu($first->menuId) != 0): ?>
						<li class="gui-folder">
					<?php else: ?>
						<li>
					<?php endif; ?>

					<?php
						$details = Adminmenumanage::getmenudetails($first->menuId);
					?>

					<?php if($details): ?>

						<?php
							if($details->url != ''){
								$url = URL::to($details->url);
							}else{
								$url = "javascript:void(0)";
							}
						?>
						
						<a href="<?php echo $url; ?>">
							<div class="gui-icon"><?php echo $details->menuicon; ?></div>
							<span class="title"><?php echo ucwords($details->menuname); ?></span>
						</a>
					<?php endif; ?>
					
					<!--start submenu -->
					<?php if(Adminmenumanage::hasSubmenu($first->menuId) != 0): ?>
						<ul>
							<?php $__currentLoopData = Adminmenumanage::getSubmenu($first->menuId); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $second): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
								<?php if(Adminmenumanage::hasSubmenu($second->menuId) != 0): ?>
									<li class="gui-folder">
								<?php else: ?>
									<li>
								<?php endif; ?>

								<?php
									$details = Adminmenumanage::getmenudetails($second->menuId);
								?>
								
								<?php if($details): ?>
									<?php
										if($details->url != ''){
											$url = URL::to($details->url);
										}else{
											$url = "javascript:void(0)";
										}
									?>
									<?php if(Usergroup::getviewpermission(Auth::user()->userGroup, $second->menuId) == true || Auth::User()->userGroup == 1): ?>
										<a href="<?php echo $url; ?>">
											<span class="title"><?php echo ucwords($details->menuname); ?></span>
										</a>
									<?php endif; ?>
								<?php endif; ?>

								<!--start submenu -->
								<?php if(Adminmenumanage::hasSubmenu($second->menuId) != 0): ?>
									<ul>
										<?php $__currentLoopData = Adminmenumanage::getSubmenu($second->menuId); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $third): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
											<?php
												$details = Adminmenumanage::getmenudetails($third->menuId);
											?>

											<?php if($details): ?>
												<?php
													$details = Adminmenumanage::getmenudetails($third->menuId);
													if($details->url!=''){
														$url = URL::to($details->url);
													}else{
														$url = "javascript:void(0)";
													}
												?>
												<li><a href="<?php echo $url; ?>" ><span class="title"><?php echo ucwords($details->menuname); ?></span></a></li>
											<?php endif; ?>
										<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
									</ul><!--end /submenu -->
								<?php endif; ?>
								</li><!--end /menu-li -->
							<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
						</ul><!--end /submenu -->
					<?php endif; ?>
					</li><!--end /menu-li -->
				<?php endif; ?>
			<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
			</ul><!--end .main-menu -->
			<!-- END MAIN MENU -->

			<div class="menubar-foot-panel">
				<small class="no-linebreak hidden-folded">
					<span class="opacity-75">Copyright &copy; <?php echo date("Y"); ?></span> <strong><?php echo $portalName; ?></strong>
				</small>
			</div>
	</div><!--end .menubar-scroll-panel-->
</div><!--end #menubar-->
<!-- END MENUBAR --><?php /**PATH /home/adclubmadras/public_html/resources/views/backend/sidebar.blade.php ENDPATH**/ ?>