<%- include('../includes/main/head.ejs') %> 
    <link rel='stylesheet' href='/css/product.css' />
    <link rel='stylesheet' href='/css/forms.css' />
</head>

<body>
    <%- include('../includes/main/navigation.ejs') %> 
    <main>
        <form class="product-form" action='<% if(editing) { %> /admin/edit-product <% } else { %> /admin/add-product <% } %>' method="POST">
            <div class="form-control">
                <h1>Title</h1>
                <label for='title'></label>
                <input type='text' name='title' id="title" value='<% if(editing) { %> <%= product.title %> <% } %>'>

                <h1>Image</h1>
                <label for='imageUrl'></label>
                <input type='text' name='imageUrl' id="imageUrl" value='<% if(editing) { %> <%= product.imageUrl %> <% } %>'>

                <h1>Price</h1>
                <label for='price'></label>
                <input type='float' name='price' id="price" value='<% if(editing) { %> <%= product.price %> <% } %>'>

                <h3>Content</h3>
                <label for='content'></label>
                <textarea type='text' name='content' id='content'><% if(editing) { %> <%= product.content %> <% } %></textarea>
                <% if (editing) { %> <input type='hidden' value='<%= product.id %>' name='productId'> <%} %> 
            </div>
            <button class="btn" type='submit'><% if (editing) { %> Update Product <% } else { %>Add Product<% } %> </button>
        </form>
    </main>
    <%- include("../includes/main/end.ejs") %>