<%@page import="java.util.Date" %>
<%@ page import="ro.emid.common.constants.AppConstants" %>
<%@ page import="ro.emid.common.types.Category" %>
<%@ page import="ro.emid.common.types.CategoryInfo" %>
<%@ page import="java.util.Map" %>

<%@include file="declaratii.jsp"%>

<%
    /**
     * @see ro.emid.incidente.action.category.ShowCentreAction
     */
    final Category[] centre = (Category[]) request.getAttribute("centre");
    final Map<Long, CategoryInfo> categoryInfoMap = (Map<Long, CategoryInfo>) request.getAttribute("categoryInfoMap");
    final Long nrIncidenteTotal = (Long) request.getAttribute("nrIncidenteTotal");
%>

<TABLE border=0 cellPading=0 cellSpacing=0 width="100%">
    <TR>
        <TD>
               <%@ include file="../header-localizare.jsp"%>
        </TD>
        <TD align="RIGHT">
            <%--<A href="javascript: alert('[to-do]');" class="link">Lista ultimelor 10 incidente per total</A>--%>
            <%--<IMG alt=FAQ border=0 width=12 height=13 hspace=3 src="<%= AppConstants.WEB_RESOURCE_PATH + "/images/icon_mini_search.gif" %>">--%>
        </TD>
    </TR>
</TABLE>
<TABLE border=0 cellPadding=2 cellSpacing=1 width="100%" class="gSAPTHEAD" style="BACKGROUND-COLOR: white">
    <TR>
        <TH class="gsapthead" colSpan=2 height=25 noWrap><%=sucursala.isCuSectiiSiCentre() ? "Sectii" : "Centre de Exploatare"%> Electrica:</TH>
        <TH class="gsapthead" noWrap width=60>Nr.incidente</TH>
        <TH class="gsapthead" noWrap width=150>Data ultimei editari</TH>
    </TR>
    <% if (null == centre) {%>
    <TR>
        <TD>
            Nu sunt centre definite ...
        </TD>
    </TR>
    <%} else{
        for(int i=0; i<centre.length; i++) { %>
        <% CategoryInfo categoryInfo = categoryInfoMap.get(centre[i].getId());%>
        <TR class="row<%=i%2%>">
            <TD height=50 valign="middle" align="center">
                <IMG
                    height=25
                    src="<%= AppConstants.WEB_RESOURCE_PATH + "/images/folder_big.gif" %>"
                    width=46></TD>
            <TD height=50 width="100%">
                <span style="font-size:12px"><%=AppConstants.format(centre[i].getCodSap())%></span> -
                <A title="Lista evenimente <%=centre[i].getName()%>" class="link" href="<%=AppConstants.APP_NAME%>?action=showEvenimente&centruId=<%=centre[i].getId()%>"><%=centre[i].getName()%></A>&nbsp;
                <%=(centre[i].getDescription() == null) ? "": '-' + centre[i].getDescription()%>
            </TD>
            <TD height=50 valign="middle" align="center">
                <SPAN class=gensmall><%=AppConstants.format(categoryInfo.getCountFise(),"")%></SPAN>
            </TD>
            <TD height=50 noWrap valign="middle" align="center">
                <SPAN class=gensmall><%=AppConstants.formatZiSaptaminaData(categoryInfo.getLastDate())%></SPAN>
            </TD>
        </TR>
    <%}%>
        <tr style="font-weight:bold;">
            <td class="gsapthead" colspan="2" align="right">&nbsp;Total:&nbsp;</td>
            <td class="gsapthead" align="center"><%=nrIncidenteTotal%></td>
            <td class="gsapthead">&nbsp;</td>
        </tr>
    <%}%>

</TABLE>