<% if (onerec === null) { %>
    <h1>No Record Found</h1>
<% } else { %>
    <h1>Edit Sale Order</h1>
    <form action="/saleorder/save" method="post">
        <input type="hidden" name="order_id" value="<%= onerec.order_id %>" >
        <table>
            <tr> <td> Customer ID: </td> <td> <input type="number" name="customer_id" value="<%= onerec.customer_id %>" required> </td> </tr>
            <tr> <td> Sale Date: </td> <td> <input type="date" name="saledate" value=<%= new Date(onerec.saledate).toISOString().split('T')[0] %> required> </td> </tr>
            <tr> <td> Customer Notes: </td> <td> <textarea name="customernotes" rows="10" cols="30"><%= onerec.customernotes %></textarea></td> </tr>
            <tr> <td> Payment Status: </td> <td> <input type="number" name="paymentstatus" value="<%= onerec.paymentstatus %>" required> </td> </tr>
        </table>
        <button type="submit">Save</button>
    </form>
<% } %>