<h2 class="page-header">Search Payment</h2>
<form action="/payments" method="GET">
    <div class="form-row">
        <div class="form-item">
            <label>Method</label>
            <select name="method">
                <option value=""></option>
                <option value="Cash">Cash</option>
                <option value="Credit">Credit</option>
                <option value="Debit">Debit</option>
                <option value="Apple Pay">Apple Pay</option>
                <option value="Paypal">Paypal</option>
            </select>
        </div>
    </div>

    <div class="form-row">
        <div class="form-item">
            <label>Amount Above</label>
            <input type="number" name="amountAbove" min="0.0" step="0.01" value="<%= searchOptions.amountAbove %>">
        </div>
        <div class="form-item">
            <label>Amount Under</label>
            <input type="number" name="amountUnder" min="0.0" step="0.01" value="<%= searchOptions.amountUnder %>">
        </div>
    </div>

    <div class="form-row">
        <div class="form-item">
            <label>Pay After</label>
            <input type="date" name="payAfter" value="<%= searchOptions.payAfter %>">
        </div>
        <div class="form-item">
            <label>Pay Before</label>
            <input type="date" name="payBefore" value="<%= searchOptions.payBefore %>">
        </div>
    </div>

    <div class="form-row form-row-end btn-row">
        <button class="btn btn-primary" type="submit">Search</button>
    </div>
</form>
<br>
<% payments.forEach(payment=> { %>
    <div class="author-row">
        <div class="author-name">
            <%= payment.method %>
        </div>
        <div class="author-name">
            <%= '$' + payment.amount %>
        </div>
        <div class="author-name">
            <%= payment.payDate.toDateString() %>
        </div>
    </div>
    <div class="form-row form-row-end btn-row">
        <a class="btn btn-primary" href="/payments/<%= payment.id %>">View</a>
        <a class="btn btn-primary" href="/payments/<%= payment.id %>/edit">Edit</a>
    
    <%- include('../partials/deleteForm', { url: `/payments/${payment.id}` }) %>
    </div>
    <% }) %>