<%@ 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" %>

<%@ taglib prefix="emid" tagdir="/WEB-INF/tags" %>


<%
    /**
     * @see ro.emid.lpod.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");
%>


<emid:template-lp title="Centre exploatare">
    <jsp:attribute name="breadcrumb">
        <emid:localizare-lp/>
    </jsp:attribute>
    <jsp:attribute name="body">
        <table border=0 cellpadding=2 cellspacing=1 width="100%" class="gSAPTHEAD" style="background-color: white">
            <tr>
                <th class="gsapthead" colSpan=2 height=25 nowrap>Centre de Exploatare Electrica:</th>
                <th class="gsapthead" nowrap width=80>Nr. lucrări</th>
                <th class="gsapthead" nowrap width=150>Data ultimei editări</th>
            </tr>
            <% if (null == centre) {%>
            <tr>
                <td>
                    No 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" width="1%">
                            <img
                                height=25
                                src="<%= AppConstants.WEB_RESOURCE_PATH + "/images/folder_big.gif" %>"
                                width=46></td>
                        <td height=50>
                            <span style="font-size:12px"><%=AppConstants.format(centre[i].getCodSap())%></span> -
                            <A title="Lucrări programate <%=centre[i].getName()%>" class="link" href="<%=AppConstants.APP_NAME%>?action=lucrari-programate&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>
    </jsp:attribute>
</emid:template-lp>
