<?php $__env->startSection('content'); ?>
	<div class="row">
    	<div class="col-lg-12">
    		<h1 class="page-header">Pages</h1>
    	</div>
    </div>
    <?php if(session('status')): ?>
        <div class="alert alert-success">
            <?php echo e(session('status')); ?>

        </div>
    <?php endif; ?>

    <?php if(count($errors) > 0): ?>
        <div class="alert alert-danger">
            <strong>Whoops!</strong> There were some problems with your input.<br><br>
            <ul>
                <?php foreach($errors->all() as $error): ?>
                    <li><?php echo e($error); ?></li>
                <?php endforeach; ?>
            </ul>
        </div>
    <?php endif; ?>
    <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
	                    
                        <div class="panel-heading">
                            All Pages <a href="<?php echo e(url('uadmin/pages/add')); ?>"> <i class="fa fa-plus fa-fw" style="float: right;"></i> </a>
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <div class="dataTable_wrapper">
                                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                    <thead>
                                        <tr>
                                            <th>ID</th>
                                            <th>Name</th>
                                            <th>URL</th>
                                            <th>Created</th>
                                            <th>Updated</th>
                                            <th>Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $count = 0; ?>
                                        <?php foreach($pages as $page): ?>
                                            <?php $count++; ?>
                                            <?php if($count % 2 == 1): ?>
                                                <tr class="odd">
                                            <?php else: ?>
                                            	<tr class="even">
                                            <?php endif; ?>
                                                <td><a href='<?php echo e(url("uadmin/pages/edit/{$page->id}")); ?>'><?php echo e($page->id); ?></a></td>
                                                <td><a href='<?php echo e(url("uadmin/pages/edit/{$page->id}")); ?>'><?php echo e($page->name); ?></a></td>
                                                <td><a target="blank" href='<?php echo e(url($page->url)); ?>'><?php echo e($page->url); ?></a></td>
                                                <td><?php echo e($page->created_at); ?></td>
                                                <td><?php echo e($page->updated_at); ?></td>
                                                <td style="text-align: center; white-space: nowrap;">
                                                	<a href='<?php echo e(url("uadmin/pages/edit/{$page->id}")); ?>'>
                                                		<i class="fa fa-edit fa-fw" style="text-align: left;"></i>
                                                	</a>
                                                    &nbsp;
                                                	<a href='<?php echo e(url("uadmin/pages/{$page->id}")); ?>'>
                                                        <i class="fa fa-puzzle-piece fa-fw" style="text-align: left;"></i>
                                                    </a>
                                                	<form style="display: inline;" role="form" method="POST" action="<?php echo e(url('admin/pages/delete')); ?>" 
    													onsubmit="return confirm('Are you sure you want to delete page (<?php echo e($page->name); ?>)?')">
    													<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
    													<input type="hidden" name="pageID" value="<?php echo e($page->id); ?>">
    													<button type="submit" style="border: none; background-color: white; padding: 0;">
                                                			<i class="fa fa-trash-o fa-fw" style="text-align: right;"></i>
                                                		</button>
                                                	</form>
                                                </td>
                                            </tr>
                                      	<?php endforeach; ?>
                                   </tbody>
                            	</table>
                            </div>
                         </div>
                     </div>
                 </div>
             </div>


 
               
<?php $__env->stopSection(); ?>

<?php $__env->startSection('extras'); ?>
	<!-- DataTables CSS -->
    <link href="<?php echo e(asset('uad/css/plugins/dataTables.bootstrap.css')); ?>" rel="stylesheet">
    
    <style>
    	a:hover{
    		text-decoration: none;
    	}
    </style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('bottom'); ?>

    <!-- DataTables JavaScript -->
    <script src="<?php echo e(asset('uad/js/plugins/dataTables/jquery.dataTables.js')); ?>"></script>
    <script src="<?php echo e(asset('uad/js/plugins/dataTables/dataTables.bootstrap.js')); ?>"></script>
    
    <!-- Page-Level Demo Scripts - Tables - Use for reference -->
    <script>
    $(document).ready(function() {
        $('#dataTables-example').dataTable({
			"pageLength": 25,
			"order": [ 4, 'desc' ]
});   
    });
    if ( typeof $.fn.dataTable == "function" && typeof $.fn.dataTableExt.fnVersionCheck == "function" && $.fn.dataTableExt.fnVersionCheck('1.9.2')/*older versions should work too*/ )
    {
        $.fn.dataTableExt.oApi.clearSearch = function ( oSettings )
        {
     
            var table = this;
             
            //any browser, must include your own file
            //var clearSearch = $('<img src="/images/delete.png" style="vertical-align:text-bottom;cursor:pointer;" alt="Delete" title="Delete"/>');
             
            //no image file needed, css embedding must be supported by browser
            var clearSearch = $('<i class="fa fa-times-circle-o fa-fw" style="vertical-align:text-bottom;cursor:pointer;color: gray;"></i>');
            $(clearSearch).click( function ()
                    {
                          table.fnFilter('');
                    });
            $(oSettings.nTableWrapper).find('div.dataTables_filter').append(clearSearch);
            $(oSettings.nTableWrapper).find('div.dataTables_filter label').css('margin-right', '-16px');//16px the image width
            $(oSettings.nTableWrapper).find('div.dataTables_filter input').css('padding-right', '16px');
        }
     
        //auto-execute, no code needs to be added
        $.fn.dataTable.models.oSettings['aoInitComplete'].push( {
            "fn": $.fn.dataTableExt.oApi.clearSearch,
            "sName": 'whatever'
        } );
    }
    </script> 

<?php $__env->stopSection(); ?>



<?php echo $__env->make('residential.templates.uadmin', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>