<?php $__env->startSection('content'); ?>
	<div class="row">
    	<div class="col-lg-12">
    		<h1 class="page-header">Media</h1>
    	</div>
    </div>
    <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
	                    <?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="panel-heading">
                            Media Gallery <a href="<?php echo e(url('uadmin/gallery/media/add')); ?>" target="_blank"> <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>Code</th>
                                            <th>Created</th>
                                            <th>Updated</th>
                                            <th>Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    <?php $count = 0; ?>
                                    <?php foreach($variables as $variable): ?>
                                    <?php $count++; ?>
                                    <?php if($count % 2 == 1): ?>
                                        <tr class="odd">
                                    <?php else: ?>
                                    	<tr class="even">
                                    <?php endif; ?>
                                            <td><a target="blank" href='<?php echo $variable->getMedia($variable->name); ?>'><?php echo e($variable->id); ?></a></td>
                                            <td><a target="blank" href='<?php echo $variable->getMedia($variable->name); ?>'><?php echo e($variable->name); ?>

                                            	<?php if(!strpos($variable->get($variable->name), '.pdf')): ?>
                                            	<img style="max-height:100px; max-width: 200px;" src="<?php echo $variable->getMedia($variable->name); ?>"/>
                                            	<?php endif; ?>
                                            </a></td>
                                            <td>
                                            	<div id="selectable<?php echo e($count); ?>" onclick="selectText('selectable<?php echo e($count); ?>')">
                                            		<div style="font-size: 10px;">
                                            			<?php echo '&lt?php echo'.' $variable->getMedia('."'".$variable->name."'".'); ?>'; ?>
                                            		</div>
                                            	</div>
                                            </td>	
                                            <td><?php echo e($variable->created_at); ?></td>
                                            <td><?php echo e($variable->updated_at); ?></td>
                                            <td style="text-align: center;">
                                            	<form style="display: inline;" role="form" method="POST" action="<?php echo e(url('admin/variables/delete')); ?>" 
													onsubmit="return confirm('Are you sure you want to delete variable (<?php echo e($variable->name); ?>)?')">
													<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
													<input type="hidden" name="variableID" value="<?php echo e($variable->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;
    	}
    	a img { display:none; }
		a:hover img { display:block; }
    </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> 
    <script type="text/javascript">
    function selectText(containerid) {
        if (document.selection) 
        {
            var range = document.body.createTextRange();
            range.moveToElementText(document.getElementById(containerid));
            range.select();
        } 
        else if (window.getSelection) 
            {
            var range = document.createRange();
            range.selectNode(document.getElementById(containerid));
            window.getSelection().addRange(range);
        }
    }
	</script>

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



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