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

	<div class="row">
    	<div class="col-lg-12">
    		<h1 class="page-header">Switches</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">
                    <?php echo e($switch->name); ?> - <?php echo e($switch->address); ?> - Interfaces 
                    <form method="POST" action="<?php echo e(url('admin/switches/process_update')); ?>" style="display: inline;" onsubmit=" return confirm('Manual updates can take a few minutes. Please do not close browser window or click back. Proceed?')">
                        <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>"> 
                        <input type="hidden" name="switch" value="<?php echo e($switch->id); ?>">
                        <input type="hidden" name="type" value="show_ints">
                        <button type="submit" title="Update Switch Interfaces" style="float: right;">
                            <i class="fa fa-refresh"></i>
                        </button>
                    </form>

                    <i style="float: right; padding-right: 5px; padding-left: 5px;">Last Updated: <?php echo e($ssh->date); ?></i>
                </div>
                <!-- /.panel-heading -->
                <div class="panel-body">
                    <div class="dataTable_wrapper">
                        <table class="table table-striped table-bordered table-hover" id="dataTables-example2">
                            <thead>
                                <tr>
                               		<th>Interface</th>
                                    <th>Description</th>
                               		<th>Status</th>
                               		<th>Bandwidth</th>
                                    <th>IP</th>
                                    <th>CRC</th>
                               		<th>In Error</th>
                               		<th>Out Error</th>
                                    <th>Tx</th>
                                    <th>Rx</th>
                               		<th>Order</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php 
                                $count = 0;
                                $lights = json_decode($ssh3->json, true);
                            ?>
                            <?php foreach(json_decode($ssh->json, true) as $k => $interface): ?>
                                <?php $count++; ?>
                                <?php if($count % 2 == 1): ?>
                                    <tr class="odd">
                                <?php else: ?>
                                	<tr class="even">
                                <?php endif; ?>
                                		<td title="<?php echo e(isset($interface['interface']) ? $interface['interface'] : ''); ?>">
                                			<?php echo e($k); ?>

                                		</td>
                                        <td>
                                            <?php echo e(isset($interface['description']) ? $interface['description'] : ''); ?>

                                        </td>
                                		<td>
                                			<?php echo e(isset($interface['status']) ? $interface['status'] : ''); ?>

                                		</td>
                                		<td>
                                			<?php echo isset($interface['bandwidth']) && $interface['bandwidth'] > 0 ? $interface['bandwidth']/1000000 . '' : ''; ?>

                                		</td>
                                        <td>
                                            <?php echo e(isset($interface['ip_address']) ? $interface['ip_address'] : 'unassigned'); ?>

                                        </td>
                                        <td>
                                            <?php echo e(isset($interface['crc']) ? $interface['crc'] : ''); ?>

                                        </td>
                                		<td>
                                			<?php echo e(isset($interface['in_error']) ? $interface['in_error'] : ''); ?>

                                		</td>
                                		<td>
                                			<?php echo e(isset($interface['out_error']) ? $interface['out_error'] : ''); ?>

                                		</td>
                                        <td>
                                            <?php if(array_key_exists($k, $lights)): ?>
                                                <?php if(array_key_exists('tx', $lights[$k])): ?>
                                                    <?php echo e($lights[$k]['tx']); ?>

                                                <?php endif; ?>
                                            <?php endif; ?>
                                        </td>
                                        <td>
                                            <?php if(array_key_exists($k, $lights)): ?>
                                                <?php if(array_key_exists('rx', $lights[$k])): ?>
                                                    <?php echo e($lights[$k]['rx']); ?>

                                                <?php endif; ?>
                                            <?php endif; ?>
                                        </td>
                                		<td>
                                			<?php echo e($count); ?>

                                		</td>
                                    </tr>
                          	 <?php endforeach; ?>
                               </tbody>
                        	</table>
                        </div>
                     </div>
                 </div>
             </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">
                    <?php echo e($switch->name); ?> - <?php echo e($switch->address); ?> - Version/Info 
                    <form method="POST" action="<?php echo e(url('admin/switches/process_update')); ?>" style="display: inline;">
                        <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>"> 
                        <input type="hidden" name="switch" value="<?php echo e($switch->id); ?>">
                        <input type="hidden" name="type" value="show_version">
                        <button type="submit" title="Update Switch Version Information" style="float: right;">
                            <i class="fa fa-refresh"></i>
                        </button>
                    </form>

                    <i style="float: right; padding-right: 5px; padding-left: 5px;">Last Updated: <?php echo e($ssh2->date); ?></i>
                </div>
                <!-- /.panel-heading -->
                <div class="panel-body">
                    <div class="rowx">
                        <?php foreach(json_decode($ssh2->json, true) as $line): ?>
                            <?php echo e($line); ?><br>
                        <?php endforeach; ?>
                    </div>
                </div>
             </div>
         </div>
     </div>

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

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

    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/t/bs/pdfmake-0.1.18,dt-1.10.11,b-1.1.2,b-flash-1.1.2,b-html5-1.1.2,b-print-1.1.2/datatables.min.css"/>
    
    
    <style>
    	a:hover{
    		text-decoration: none;
    	}
    	.odd .subBack {
    		background-color: #f0fcff;
    	}
    	.even .subBack {
    		background-color: #ecf7fa;
    	}
    	.floatLeft
    	{
    		float: left;
    	}

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

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

	<script type="text/javascript" src="https://cdn.datatables.net/t/bs/pdfmake-0.1.18,dt-1.10.11,b-1.1.2,b-flash-1.1.2,b-html5-1.1.2,b-print-1.1.2/datatables.min.js"></script>

	
    
    <!-- Page-Level Demo Scripts - Tables - Use for reference -->
    <script>
    $(document).ready(function() {
    var table1 =    $('#dataTables-example2').dataTable( {
					"pageLength": 100,
					"order": [[ 6, 'desc' ],[ 7, 'desc' ],[ 5, 'desc' ],[ 8, 'desc' ],[ 9, 'desc' ],[ 2, 'asc' ]],
					"stateSave" : false,
					"scrollX" : window.innerWidth < 800 ? true : false,
					"columnDefs": [
			               {
			                   "targets": [ 10 ],
			                   "visible": false,
			                   "searchable": false
			               },
                           {
                               "targets": [ 3,5,6,7,8,9 ],
                               "type": 'num'
                           },
			           ],

					
        } ); 
 


    });

    

    
    
    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(); ?>