@view('header', [ 'title' => $user->firstname . ' - Users - Admin' ])

<div class="breadcrumb">
    <ul>
        <li><a href="/">Banq</a></li>
        <li><a href="/admin">Admin</a></li>
        <li><a href="/admin/users">Users</a></li>
        <li class="is-active"><a href="/admin/users/{{ $user->id }}">{{ $user->username }}</a></li>
    </ul>
</div>

<h1 class="title">{{ $user->firstname }} {{ $user->lastname }}</h1>

<div class="buttons">
    <a class="button is-link" href="/admin/users/{{ $user->id }}/edit">Edit</a>
    <a class="button is-danger" href="/admin/users/{{ $user->id }}/delete">Delete</a>
</div>

<p>Name: {{ $user->firstname }} {{ $user->lastname }}</p>
<p>Username: {{ $user->username }}</p>
<p style="margin-bottom: 2rem;">Email: <a href="mailto:{{ $user->email }}">{{ $user->email }}</a></p>

<h2 class="title is-4">Accounts</h2>

<div class="buttons">
    <a class="button is-link" href="/admin/accounts/create?user_id={{ $user->id }}">Create</a>
</div>

@if (count($accounts) > 0):
    @foreach ($accounts as $account):
        <div class="box">
            <h2 class="title is-4">
                <a href="/admin/accounts/{{ $account->id }}">{{ $account->name }}</a>
            </h2>
            <p>Amount: {!! format_money($account->amount) !!}</p>
        </div>
    @endforeach
@else:
    <p><i>There are no accounts found</i></p>
@endif

@view('footer')
