<?php echo $this->partial('Layout/nav'); ?>

<div class="container-fluid">
	<div class="container-page-wrapper shodowed bordered">
		<div class="container-page-container">

			<div class="row">
				<div class="col-lg-7">
					<h1><?php echo $this->actionTitle; ?></h1>
					<?php if($this->view->scope != 'my'): ?>
						<div><small><?php echo $this->view->ccStringList; ?>.</small></div>
					<?php endif; ?>
				</div>
				<div class="col-lg-5 clearfix">
					<div class="float-right">
						<div class="float-left margin-right-20">
							<!-- Other buttons... -->
						</div>
						<div class="float-right">
							<span class="mr-3">
									<?php echo _('Requests'); ?>
									<?php if($this->config['settings']['free'] == 0){
									?>
									<span style="color:#7f8c8d"><?php echo strtolower(_('Requested')); ?></span> <?php echo $this->view->getTotRequests; ?> / <span style="color:#7f8c8d"><?php echo strtolower(_('Total')); ?></span> <?php echo $this->view->getMaxRequests; ?>
								<?php }else{
									?>&nbsp;<span style="color:#7f8c8d"> <?php echo $this->view->getTotRequests; ?></span>
									<?php
								}
								?>
							</span>

							<button type="button" class="btn btn-info btn-refresh-list"><span class="icon-loop2"></span></button>

							<?php if($this->config['settings']['free'] == 0){

							if($this->view->getTotRequests >= $this->view->getMaxRequests){
								?>
								<a href="#" class="btn btn-secondary disabled"><?php echo _('New request'); ?></a>
								<?php
							}else{
								if($this->user->is(APPLICANT_ROLE_ID)): ?>
									<a href="<?php echo $this->helper->setHash('requests-edit/'.time().'/0/new-edit/'.rawurlencode($this->view->actionTitle).'/'.$this->view->scope.'/'.$this->view->parentBaseUri.'/'.$this->view->orderField.'/'.$this->view->orderDir.'/'.$this->view->currentPage); ?>" class="btn btn-success"><?php echo _('New request'); ?></a>
								<?php endif; ?>
								<?php
							}
						}else{
							if($this->user->is(APPLICANT_ROLE_ID)): ?>
								<a href="<?php echo $this->helper->setHash('requests-edit/'.time().'/0/new-edit/'.rawurlencode($this->view->actionTitle).'/'.$this->view->scope.'/'.$this->view->parentBaseUri.'/'.$this->view->orderField.'/'.$this->view->orderDir.'/'.$this->view->currentPage); ?>" class="btn btn-success"><?php echo _('New request'); ?></a>
							<?php endif;
						}
							?>
						</div>
					</div>
				</div>
			</div>
			<?php //debug($this->view->requests); ?>
			<?php echo $this->partial('Layout/pagination'); ?>
			<?php echo $this->partial('Request/request-list'); ?>
			<?php echo $this->partial('Layout/pagination'); ?>
	</div>
</div>
