<?php $__env->startSection('content'); ?>
	
	<div class="row">
		<div class="col-xs-5">
			<h2>Insights Categories</h2>
		</div>
		<div class="col-xs-7">
			<div class="row" id="user-search-form-box">
				<div class="col-xs-8">
				<?php echo Form::open(array('method' => 'get')); ?>
					<div class="input-group buttons">
						<input type="text" name="query" class="form-control" value="<?php echo Input::get('query'); ?>" placeholder="Type here...">
                      	<span class="input-group-btn">
                        	<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
                        	<button class="btn btn-default" onclick="location.href='<?php echo URL::to('admin/insights/categories'); ?>'" type="button"><i class="glyphicon glyphicon-remove"></i></button>
                      	</span>
					</div><!-- /input-group -->
					<?php echo Form::close(); ?>
				</div>
				<div class="col-xs-4 no-padding-margin">
					<a href="<?php echo URL::to('admin/insights/categories/create'); ?>" class="btn btn-primary btn-block"><i class="glyphicon glyphicon-plus"></i> Add a new category</a>
				</div>
			</div>
		</div>
	</div>
	
	<table class="table table-bordered table-striped">
		<thead>
			<tr>
				<th class="text-center">ID</th>
				<th class="col-md-8">Title</th>
				<th class="text-center">Last Updated</th>
				<th class="text-center" colspan="2">Actions</th>
			</tr>
		</thead>
		<tbody>
		<?php if($categories): ?>
			<?php foreach($categories as $category): ?>
			<tr>
				<td class="text-center"><?php echo $category->category_id; ?></td>
				<td><?php echo $category->title; ?></td>
				<td class="text-center"><?php echo date('M d, Y, g:ia',strtotime($category->updated_at)); ?></td>
				<td><a href="<?php echo URL::to('admin/insights/categories/'.$category->category_id.'/edit'); ?>" title="Edit"><i class="glyphicon glyphicon-pencil"></i></a></td>
				<td>
					<?php echo Form::open(array('route' => array('admin.insights.categories.destroy', $category->category_id), 'method' => 'DELETE')); ?>
					<button type="submit" onclick="return confirm('Are you sure?')" class="btn btn-link"  title="Delete"><i class="glyphicon glyphicon-trash"></i></button>
					<?php echo Form::close(); ?>
				</td>
			</tr>
			<?php endforeach; ?>
		<?php else: ?>
			<tr>
				<td colspan="6">No categories yet.</td>
			</tr>
		<?php endif; ?>
		</tbody>
	</table>
    
    <?php echo $categories->appends(array('query' => Input::get('query')))->links(); ?>

<?php $__env->stopSection(); ?>