<div id="upload-warning-wrapper">
	<div id="upload-warning"><img src="/images/spinner.svg" width="25" /> <?php echo _("Uploading... Don't close or refresh this window..."); ?></div>
</div>
<nav class="navbar sticky-top navbar-expand-lg navbar-dark" style="background-color: #D30731;"> 
	<a class="navbar-brand" href="<?php echo $this->helper->setHash('dashboard'); ?>">
		<img src="/images/logo-64-w-nob.png" class="d-inline-block align-top logo-image" alt="Logo"> 
	</a>
	
	<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
	<span class="navbar-toggler-icon"></span>
	</button>
	<div class="collapse navbar-collapse" id="navbarTogglerDemo01">
		<a class="navbar-brand" href="<?php echo $this->helper->setHash('dashboard'); ?>"><?php echo $this->appTitle; ?> - TTRE-TLC</a>
		<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
			<?php if($this->checkPermissions([ADMIN_ROLE_ID])): ?>
				<li class="nav-item dropdown">
					<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
						Admin
					</a>
					<div class="dropdown-menu" aria-labelledby="navbarDropdown">
						<a class="dropdown-item" href="<?php echo $this->helper->setHash('users/'.time().'/surname/desc/1'); ?>"><?php echo _('Users'); ?></a>
						<a class="dropdown-item" href="<?php echo $this->helper->setHash('users-search/'.time().'/surname/asc/1'); ?>"><span class="icon-search"></span> <?php echo _('User search'); ?></a>
						<a class="dropdown-item" href="<?php echo $this->helper->setHash('centers/'.time()); ?>"><?php echo _('Clinical Centers'); ?></a>
						<div class="dropdown-divider"></div>
						
						<a class="dropdown-item" href="<?php echo $this->helper->setHash('users-access-logs/1'); ?>"><?php echo _('Access logs'); ?></a>
						<a class="dropdown-item" href="<?php echo $this->helper->setHash('users-sessions/1'); ?>"><?php echo _('Sessions'); ?></a>
						<a class="dropdown-item" href="<?php echo $this->helper->setHash('notification-tracker/'.time().'/email/1'); ?>"><?php echo _('Notification tracker'); ?></a>
						<a class="dropdown-item" href="<?php echo $this->helper->setHash('requests/'.time().'/logs'); ?>"><?php echo _('Activity logs'); ?></a>
					</div>
				</li>
			<?php endif; ?>
			
			<?php /*if($this->canViewRemoteVisit()): ?>
				<li class="nav-item dropdown">
					<a class="nav-link dropdown-toggle" id="navbarDropdownModerations" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="#"><?php echo _('Remote visits'); ?></a>
					<div class="dropdown-menu" aria-labelledby="navbarDropdownModerations">
						<a class="dropdown-item" href="<?php echo $this->helper->setHash('survey-list/'.time().'/created_at/desc/1'); ?>"><?php echo _('All'); ?></a>
						<?php if($this->checkPermissions([MANAGER_ID])): ?>
							<a class="dropdown-item" href="<?php echo $this->helper->setHash('survey-edit/'.time().'/0'); ?>"><?php echo _('New'); ?></a>
						<?php endif; ?>
					</div>
				</li>
			<?php endif;*/ ?>
			
			<?php if($this->checkPermissions([APPLICANT_ROLE_ID])): ?>
				<li class="nav-item dropdown">
					<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
						<?php echo _('Requests'); ?>
					</a>
					<div class="dropdown-menu" aria-labelledby="navbarDropdown">
						<a class="dropdown-item" href="<?php echo $this->helper->setHash('requests/'.time().'/my/created_at/desc/1'); ?>"><?php echo _('My requests'); ?></a>
						<a class="dropdown-item" href="<?php echo $this->helper->setHash('requests/'.time().'/center/created_at/desc/1'); ?>"><?php echo _('Center requests'); ?></a>
						
						<?php if($this->canViewRemoteVisit()): ?>
							<a class="dropdown-item" href="<?php echo $this->helper->setHash('survey-list/'.time().'/sy.created_at/desc/1'); ?>"><?php echo _('Center remote visits'); ?></a>
						<?php endif; ?>
						
						<?php if($this->controllerName == 'request' && $this->actionName == 'index'): ?>
							<div class="dropdown-divider"></div>
							<a class="dropdown-item" href="<?php echo $this->helper->setHash('requests-edit/'.time().'/0/new-edit/'.$this->view->actionTitle.'/'.$this->view->scope.'/'.$this->view->parentBaseUri.'/'.$this->view->orderField.'/'.$this->view->orderDir.'/'.$this->view->currentPage); ?>"><?php echo _('New request'); ?></a>
						<?php endif; ?>
						<div class="dropdown-divider"></div>
						<a class="dropdown-item btn-show-tranfer" href="#"><?php echo _('Transfer Manager'); ?></a>
					</div>
				</li>
			<?php endif; ?>
			
			<?php /*if($this->checkPermissions([APPLICANT_ROLE_ID])): ?>
				<a class="nav-link btn-show-tranfer" href="#"><?php echo _('Transfer Manager'); ?></a>
			<?php endif;*/ ?>
			
			<?php if($this->checkPermissions([MODERATOR_ROLE_ID])): ?>
				<li class="nav-item dropdown">
					<a class="nav-link dropdown-toggle" id="navbarDropdownModerations" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="#"><?php echo _('Moderations'); ?></a>
					<div class="dropdown-menu" aria-labelledby="navbarDropdownModerations">
						<a class="dropdown-item" href="<?php echo $this->helper->setHash('requests/'.time().'/moderations/request_status_number/asc/1'); ?>"><?php echo _('Center requests'); ?></a>
					</div>
				</li>
			<?php endif; ?>
			
			<?php if($this->checkPermissions([GUEST_ROLE_ID])): ?>
				<li class="nav-item dropdown">
					<a class="nav-link dropdown-toggle" id="navbarDropdownModerations" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="#"><?php echo _('Requests'); ?></a>
					<div class="dropdown-menu" aria-labelledby="navbarDropdownModerations">
						<a class="dropdown-item" href="<?php echo $this->helper->setHash('requests/'.time().'/center-guest/created_at/desc/1'); ?>"><?php echo _('Center requests'); ?></a>
					</div>
				</li>
			<?php endif; ?>
			
			<?php if($this->checkPermissions([REFERRER_ROLE_ID])): ?>
				<li class="nav-item dropdown">
					<a class="nav-link dropdown-toggle" id="navbarDropdownModerations" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="#"><?php echo _('Reports'); ?></a>
					<div class="dropdown-menu" aria-labelledby="navbarDropdownModerations">
						<a class="dropdown-item" href="<?php echo $this->helper->setHash('requests/'.time().'/reports/request_status_number/asc/1'); ?>"><?php echo _('My reports'); ?></a>
					</div>
				</li>
			<?php endif; ?>
			
			<!--<li class="nav-item">
				<a class="nav-link" href="#">Link</a>
			</li>-->
		</ul>
		<div class="my-2 my-lg-0">
			<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
				<li class="nav-item dropdown">
					<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
						<?php echo $this->helper->setAvatarView($this->user->getAvatar(), ['class'=>'nav-avatar', 'cssId'=>'nav-left-avatar', 'timestamp'=>md5($this->user->getUserField('userUpdatedAt'))]); ?>
						<span id="nav-display-name"><?php echo $this->user->setDisplayName(); ?><?php echo $this->user->getUserStatus() == STATUS_TECH_ID ? ' <span class="icon-wrench"></span>' : ''; ?> (<?php echo strtoupper($this->user->getUserField('userDefaultLang')); ?>) <?php echo $this->helper->getUserFlag($this->user->getUserField('userCountryCode'), 20); ?></span>
					</a>
					<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
						<a class="dropdown-item" href="<?php echo $this->helper->setHash('profile/'.time()); ?>"><?php echo _('Profile'); ?></a>
						<div class="dropdown-divider"></div>
						<a class="dropdown-item btn-logout" href="#"><?php echo _('Logout'); ?></a>
					</div>
				</li>
			</ul>
		</div>
	</div>
	
</nav>

<?php if($this->showBreadcrumbs): ?>
	<nav aria-label="breadcrumb">
		<ol class="breadcrumb">
			<li class="breadcrumb-item"><span class="icon-home"></span> <a href="<?php echo $this->helper->setHash('dashboard'); ?>">Home</a></li>
			
			<?php if(is_array($this->breadcrumbs) && !empty($this->breadcrumbs)): ?>
				<?php foreach($this->breadcrumbs as $bc): ?>
					<li class="breadcrumb-item" aria-current="page">
						<?php if(!is_null($bc['hash'])): ?>
							<a href="#/<?php echo $bc['hash']; ?>"><?php echo rawurldecode($bc['label']); ?></a>
						<?php else: ?>
							<?php echo $bc['label']; ?>
						<?php endif; ?>
					</li>
				<?php endforeach; ?>
			<?php endif; ?>
		</ol>
	</nav>
<?php endif; ?>