<%@page import="mainapp.User"%>
<%@page import="java.util.Map"%>
<%@page import="mainapp.Factory"%>
<%@page import="mainapp.FactoryInfoHelper"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.ArrayList"%>
<%@page import="mainapp.Production"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    Factory f = new Factory(Integer.parseInt(request.getParameter("factory_id")));
    HashMap map = f.getAllProductionsByUser();
%>
<h3 style="text-decoration:underline; text-align: center;margin-bottom: 5px">Αναλυτικές Αναφορές για <%= f.getName() %></h3>
<table class="info-table">
    <tr>
        <th>Χρήστης</th><th>Σύνολο</th>
    </tr>
<%
    Iterator it = map.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pair = (Map.Entry)it.next();
        System.out.println(pair.getKey() + " = " + pair.getValue());
        User u = new User((Integer)pair.getKey());
        out.print("<tr>");
        out.print("<td>"+u.getName()+"</td>");
        out.print("<td>"+(Float)pair.getValue()+"</td>");
        out.print("</tr>");
        it.remove();
    }
%>
</table>