@extends('layouts.master')
  @section('page_title')
      @if(isset($page_title))
          {{ $page_title }}
      @endif
  @endsection

@section('content')
  <div class="">
      <div class="page-title">
        <div class="title_left">
          <div class="title_left">
            <ol class="breadcrumb">
              <li><a href="{!! url('dashboard') !!}">Dashboard</a></li>
              <li class="active">Server List</li>
            </ol>
          </div>
        </div>

        
      </div>

      <div class="clearfix"></div>
      <div class="row">
        @include('commons.notifications')
        <div class="col-md-12 col-sm-12 col-xs-12">
        <div class="x_panel">
          <div class="x_title">
            <h2> Servers </h2>
            <div class="pull-right">
                <!-- <a class="btn btn-primary btn-sm" href="{!! url('clients/create') !!}"><i class="fa fa-plus-circle"></i> Add Client
                </a> -->
            </div>
            <div class="clearfix"></div>
          </div>

          <div class="x_content">

            <div class="table-responsive">
              <table class="table table-striped ">
                <thead>
                  <tr class="headings">
                    {{-- <th>#</th> --}}
                    <th class="column-title">Friendly Name</th>
                    <th class="column-title">Public IP</th>
                    <th class="column-title">Private IP</th>
                    <th class="column-title">Main Use</th>
                    <th class="column-title">Remarks</th>
                    <th class="column-title">Root Password (encrypted)</th>
                    <th class="column-title">Last Modified By</th>
                    <th class="column-title no-link last"><span class="nobr">Action</span>
                    </th>
                    <th class="bulk-actions" colspan="7">
                      <a class="antoo" style="color:#fff; font-weight:500;">Bulk Actions ( <span class="action-cnt"> </span> ) <i class="fa fa-chevron-down"></i></a>
                    </th>
                  </tr>
                </thead>

                <tbody>
                  @if ($servers->isEmpty())
                    <tr>
                      <td class="" colspan="6">No Records found</td>
                    </tr>
                  @else
                  @foreach ($servers as $row)
                  <tr class="even pointer">
                    <td class="mes-td">{{ $row->friendly_name }}</td>
                    <td class="mes-td">{{ $row->public_ip_address }}</td>
                    <td class="mes-td">{{ $row->private_ip_address }}</td>
                    <td class="mes-td">{{ $row->main_use }}</td>
                    <td class="mes-td">{{ $row->remarks }}</td>
                    <td class="mes-td">
                      <?php $credentials = $row->credentials_info->where('username', 'root')->first(); 
                      if ($credentials) {
                        if ($credentials->password) {
                          echo substr($credentials->password, -200, 20);
                        }
                      }
                      ?>

                    </td>
                    <td class="mes-td">{{ $row->modified_by_info->name }}</td>
                    
                    <td class="last">
                      <a href="{!! url('infrastructure/editserver-list', $row->id) !!}" class="btn btn-xs btn-primary"><i class="fa fa-edit"></i></a>
                      <input type="hidden" name="server_id" class="serverID" value="{{ $row->id }}">
                    </td>
                  </tr>
                  @endforeach
                  @endif
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
</div>

@endsection

@section('javascript')
  <script type="text/javascript">
  $(document).ready(function(){
  });
  </script>


@endsection
