@section('header')
	@include('common.header')
@stop

@section('content')
	<div class="row">
		<div class="col-sm-8">
			<div class="widget widget-classic">
				<div class="widget-content">

					<!-- Page title -->
					<p class="lead">
						Configure REST Clients
						<a href="{!! URL::route('admin.settings.rest.create') !!}" class="btn btn-primary pull-right"><i class="fa fa-plus"></i> Add a new client</a>
					</p>

					@if (Session::has('message'))
						<div class="alert alert-success">
							<i class="fa fa-check-circle"></i> {!! Session::get('message') !!}
						</div>
					@endif

					<table class="table table-hover">
						<tbody>
							@foreach($accounts as $account)
								<tr>
									<td>{!! $account->name !!}</td>
									<td>
										<div><span class="muted">ID:</span> {!! $account->id !!}</div>
										<div><span class="muted">Secret:</span> {!! $account->secret !!}</div>
									</td>
									<td><span tooltip="{!! $account->created_at !!}">{!! Carbon\Carbon::parse($account->created_at)->diffForHumans() !!}</span></td>
									<td><a href="{!! URL::route('admin.settings.rest.edit', $account->id) !!}" class="pull-right">Edit</a></td>
								</tr>
							@endforeach
						</tbody>
					</table>

					@if (count($accounts) == 0)
						<p class="text-warning"><i class="fa fa-info-circle"></i> No REST clients defined</p>
					@else
						<hr>
						<p><small>Total of {!! count($accounts) !!} entries</small></p>
					@endif
				</div>
			</div>
		</div>
		<div class="col-sm-4">
			@include('admin::settings.rest.partials.info')
		</div>
	</div>
@stop