@view('header', [ 'title' => 'Payment Links' ])

<div class="breadcrumb">
    <ul>
        <li><a href="/">Banq</a></li>
        <li class="is-active"><a href="/payment-links">Payment Links</a></li>
    </ul>
</div>

<h1 class="title">Payment Links</h1>

<div class="columns">
    <div class="column">
        <div class="buttons">
            <a class="button is-link" href="/payment-links/create">Create</a>
        </div>
    </div>
    <form class="column" method="get">
        <div class="field has-addons">
            <div class="control" style="width: 100%;">
                <input class="input" type="text" id="q" name="q" placeholder="Search..." value="{{ request('q') }}">
            </div>
            <div class="control">
                <button class="button is-link" type="submit">Search</button>
            </div>
        </div>
    </form>
</div>

@if (count($payment_links) > 0):
    @view('pagination', [ 'page' => $page, 'last_page' => $last_page ])

    @foreach ($payment_links as $payment_link):
        <div class="box">
            <h2 class="title is-4">
                <a href="/payment-links/{{ $payment_link->id }}">{{ $payment_link->name }}</a>
            </h2>
            <p>For: <a href="/accounts/{{ $payment_link->to_account_id }}">{{ $payment_link->account->name }}</a></p>
            <p>Amount: {!! format_money($payment_link->amount) !!}</p>
        </div>
    @endforeach

    @view('pagination', [ 'page' => $page, 'last_page' => $last_page ])
@else:
    <p><i>There are no payment links found</i></p>
@endif

@view('footer')
