<h2 class="page-header">Search Invoice</h2>
<form action="/invoices" method="GET">

    <div class="form-row">
        <div class="form-item">
            <label>Invoice ID</label>
            <input type="text" name="invoiceID" value="<%= searchOptions.invoiceID %>">
        </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>Generate After</label>
            <input type="date" name="generateAfter" value="<%= searchOptions.generateAfter %>">
        </div>
        <div class="form-item">
            <label>Generate Before</label>
            <input type="date" name="generateBefore" value="<%= searchOptions.generateBefore %>">
        </div>
    </div>

    <div class="form-row form-row-end btn-row">
        <button class="btn btn-primary" type="submit">Search</button>
    </div>
</form>
<br>
<% invoices.forEach(invoice=> { %>
    <div class="author-row">
        <div class="author-name">
            <%= invoice.invoiceID %>
        </div>
        <div class="author-name">
            <%= invoice.dateGenerated.toDateString() %>
        </div>
        <div class="author-name">
            <%= '$' +invoice.amount %>
        </div>
        
    </div>

    <div class="form-row form-row-end btn-row">
        <a class="btn btn-primary" href="/invoices/<%= invoice.id %>">View</a>

        <a class="btn btn-primary" href="/invoices/<%= invoice.id %>/edit">Edit</a>
        <%- include('../partials/deleteForm', { url: `/invoices/${invoice.id}` }) %>
    </div>
    <% }) %>