<%@page import="java.util.Iterator"%>
<%@page import="mainapp.Factory"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    ArrayList<Factory> factories= Factory.getAllFactories();
%>
<form method="POST" action="${pageContext.request.contextPath}/AddProductionAction">
    <h1 class="text-center">Εισαγωγή Παραγωγής</h1>
    <hr />
    <h6 class="form_error" style="text-align: center">
        ${errorMessage}
    </h6>
    <table>
        <tr>
            <td><label for="name">Εργοστάσιο</label></td>
            <td>
                <select name="factory" id="factory" value="${factory}">
                <%
                    Iterator i;
                    i = factories.iterator();
                    Factory f = null;
                    while (i.hasNext()) {
                        f = (Factory)i.next();
                        out.print("<option value='"+f.getID()+"'>"+f.getName()+"</option>");
                    }
                %>
                </select>
            </td>
        </tr>
        <tr>
            <td><label for="bio">Βιολογικό</label></td>
            <td>
                <select name="bio" id="bio">
                    <option value="0">ΟΧΙ</option>
                    <option value="1">NAI</option>
                </select>
            </td>
        </tr>
        <tr>
            <td><label for="olives_weight">Ελιές(kg)</label></td>
            <td><input type="number" name="olives_weight" id="olives_weight" value="${olives_weight}" step="any" required="required"/></td>
        </tr>
        <tr>
            <td><label for="oil_weight">Λάδι(kg)</label></td>
            <td><input type="number" name="oil_weight" id="oil_weight" value="${oil_weight}" step="any" required="required"/></td>
        </tr>
         <tr>
            <td><label for="acidity">Οξύτητα</label></td>
            <td><input type="number" name="acidity" id="acidity" value="${acidity}" step="any" required="required"/></td>
        </tr>
        <tr>
            <td><label for="costs">Αλλεστικά</label></td>
            <td><input type="number" name="costs" id="costs" value="${costs}" step="any" required="required"/></td>
        </tr>
        <tr>
            <td></td>
            <td>
                <input type="hidden" name="user_id" value="<% out.print(request.getParameter("user_id")); %>" />
                <input type="submit" value="Εισαγωγή" />
            </td>
        </tr>
    </table>
</form>