<%- include('./partials/header') %>

<div class="container edit-product-wrapper">
    <% if(data && data.status === 'success') { %>
        <h3> Edit Product </h3>
        <hr>

        <form action="/update/<%= data.data.id %>" method="POST" class="form">
            <div class="form-group">
                <label for="prod_name">Product Name: </label>
                <input type="text" name="prod_name" 
                id="prod_name" class="form-control" 
                value="<%= data.data.name %>">
            </div>

            <div class="form-group">
                <label for="prod_desc">Product Description: </label>
                <textarea rows="5" name="prod_desc" id="prod_desc" 
                    class="form-control"> 
                    <%= data.data.description %>
                </textarea>
            </div>

            <div class="form-group">
                <label for="prod_price">Product Price: </label>
                <input type="number" min="0.01" name="prod_price" 
                    id="prod_price" class="form-control"
                    value="<%= data.data.price %>">
            </div>

            <div class="form-group">
                <input type="submit" name="btn_submit" id="btn_submit" class="btn btn-primary" value="Add Product">
            </div>
        </form>
    <% } else { %> 
        <h3> <%= data.message %> </h3>
    <% } %>
</div>

<%- include('./partials/footer') %>