<hr class="separate-title"/>
<p align="center">
	<?php echo $this->Paginator->counter(array('format' => __('Page {{page}} of {{pages}}, showing {{current}} records out of {{count}} total, starting on record {{start}}, ending on {{end}}'))); ?>
</p>
<hr class="separate-title"/>
	
<div class="row section-row">
	<div class="col-sm-12">
		<div style="float: left">
			<?php echo '<div class="search-text">Search Listing:&nbsp;&nbsp</div>'; ?>
		</div>
		<div style="float: left;margin-right: 20px">
			<?php
			 
				echo $this->Form->create(null, ['type'=>'get', 'url'=>['action'=>'subSections']]);
				echo $this->Form->input('search',array('id' => 'search','class' => 'form-control search-box', 'label' => false));
			?>
		</div>
		<div style="float: left">
			<?php
				echo $this->Form->button('Search',['type' => 'submit', 'class'=>'btn btn-primary']);
				echo $this->Form->end();
			 ?>
		</div>
		<div class="pull-right">
			<?php // $this->Html->link('Add New '. ucwords($section).' Sub Category', ['controller'=>'Autos','action'=>'addSubCategory'], ['class'=>'btn btn-primary']) ?>
		</div>
	</div>
</div>
<center><?= $this->Flash->render() ?></center>

<div class="row">
	<div class="col-sm-12">
		<div class="table-responsive">
			<table class="table table-striped">
				<thead>
					<th>Name</th>
					<th>Descriptions</th>
					<th>Actions</th>
				</thead>
				<tbody>
					<?php
						$i = 0;
						foreach ($listings as $listing):  
					?>
					<tr>
										
						<td><?php echo $listing->label; ?></td>
						<td><?php echo $listing->description; ?></td>
							
						<td class="actions">
							<?php
								
									echo $this->Html->link(__('Edit '), ['controller' => $section, 'action' => 'editSubCategory',$listing->parent_section_id, $listing->id]); 
									echo ' | ';
								
									echo $this->Html->link(__('View'), ['action' => 'viewSection', $listing->id]); 
									
								
								
									echo " | ";
									if($listing->status==1){
									echo $this->Form->postLink(__('Disable '), ['action' => 'disableCategory', $listing->id], ['confirm'=>'desable this listing?']); 
								   }else{
								   	echo $this->Form->postLink(__('Enable '), ['action' => 'enableCategory', $listing->id], ['confirm'=>'enable this listing?']); 
								   }
								
							?>
						</td>
					</tr>
					<?php endforeach; ?>		
				</tbody>
			</table>
		</div>	
	</div>
</div>

<div class="row">
	<div class="col-sm-12">
		<div class="paginator" style="text-align: center;">
			<ul class="pagination">
				<?= $this->Paginator->prev('< ' . __('prev')) ?>
				<?= $this->Paginator->numbers(['first' => 3, 'last' => 3, 'modulus' => 4]) ?>
				<?= $this->Paginator->next(__('next') . ' >') ?>
			</ul>
			<p><?= $this->Paginator->counter() ?></p>
		</div>
	</div>
</div>

		