@extends('admin.base')

@section('content')
  <div class="panel panel-default">
    <div class="panel-heading">Ver Registro</div>
    <div class="panel-body">
      <div class="row">
        <div class="col-md-2"><strong>Usuario</strong></div>
        <div class="col-md-5">{{$registro->user()->name}}</div>
      </div>
      <div class="row">
        <div class="col-md-2"><strong>Roles</strong></div>
        <div class="col-md-8">
          @foreach ($registro->user()->roles() as $rol)
            <span style="padding: 3px; background-color: {{$colores[$rol->level]->toRGB()}};
              @if ($colores[$rol->level]->isDark())
                color: #fff;
              @endif
              ">{{ucwords($rol->description)}}</span>
          @endforeach
        </div>
      </div>
      <div class="row">
        <div class="col-md-2"><strong>Fecha - Hora</strong></div>
        <div class="col-md-8">{{$registro->time()->format('d-m-Y - H:i:s')}}</div>
      </div>
      <div class="row">
        <div class="col-md-2"><strong>Modelo</strong></div>
        <div class="col-md-8">{{$registro->model()}}</div>
      </div>
      <div class="row">
        <div class="col-md-2"><strong>Cambios</strong></div>
        <div class="col-md-10">
          <table class="table table-striped">
            <thead>
              <tr>
                <th rowspan="2">Columna</th>
                <th class="text-center" colspan="2">Valor</th>
              </tr>
              <tr>
                <th>Antiguo</th>
                <th>Nuevo</th>
              </tr>
            </thead>
            <tbody>
              @foreach ($registro->actions() as $column => $action)
                <tr>
                  <td>{{$column}}</td>
                  <td>{{$action->old}}</td>
                  <td>{{$action->new}}</td>
                </tr>
              @endforeach
            </tbody>
          </table>
        </div>
      </div>
      <div class="row">
        <a href="{{nUrl('registros', 'list')}}"><span class="glyphicon glyphicon-chevron-left"></span> Volver</a>
      </div>
    </div>
  </div>
@endsection
