@view('header', [ 'title' => 'Edit account - Accounts' ])

<div class="breadcrumb">
    <ul>
        <li><a href="/">Banq</a></li>
        <li><a href="/accounts">Accounts</a></li>
        <li><a href="/accounts/{{ $account->id }}">{{ $account->name }}</a></li>
        <li class="is-active"><a href="/accounts/{{ $account->id }}/edit">Edit</a></li>
    </ul>
</div>

<h1 class="title">Edit account</h1>

@view('errors')

<form method="post" action="/accounts/{{ $account->id }}">
    @view('csrf_token')

    <div class="field">
        <label class="label" for="name">Name</label>
        <input class="input" type="text" id="name" name="name" value="{{ old('name', $account->name) }}" {{ !isset($errors) ? 'autofocus' : '' }} required>
    </div>

    <div class="field">
        <label class="label" for="type">Type</label>
        <select class="input" id="type" name="type" required>
            <option value="" disabled {{ old('type', $account->type) == '' ? 'selected' : '' }}>Choose a type</option>
            <option value="{{ Accounts::TYPE_SAVE }}" {{ old('type', $account->type) == Accounts::TYPE_SAVE ? 'selected' : '' }}>Save</option>
            <option value="{{ Accounts::TYPE_PAYMENT }}" {{ old('type', $account->type) == Accounts::TYPE_PAYMENT ? 'selected' : '' }}>Payment</option>
        </select>
    </div>

    <div class="field">
        <button class="button is-link" type="submit">Edit account</button>
    </div>
</form>

@view('footer')
