<%@ page import="ro.emid.common.db.SesiuneRaportareAccessDB" %>
<%@ page import="ro.emid.common.types.SesiuneRaportare" %>
<%@ page import="ro.emid.Application" %>
<%@ page import="ro.emid.common.constants.AppConstants" %>

<%
    final SesiuneRaportare[] items = SesiuneRaportareAccessDB.getAll("");
%>


<span style="float: left;">
    Exista fise de incident pe urmatoarele sesiuni de raportare:
</span>

<% if( !Application.runAsAparatCentral()){ %>
    <a class="link" href="<%=AppConstants.APP_NAME%>?action=editSesiuniRaportare&id=-1" style="float: right;">Adauga sesiune raportare</a>
<% } %>

<table cellpadding=2 cellspacing=1 width="100%" class="table mt5">
    <thead>
        <tr>
            <th height=25 nowrap width="10">Nr.</th>
            <th class="align-center">AN</th>
            <th class="align-center">STARE </th>
            <% if( !Application.runAsAparatCentral()){ %>
                <th noWrap width="80">&nbsp;</th>
            <% } %>
        </tr>
    </thead>
    <tbody>
        <% if( items.length == 0){ %>
            <tr><td class="no-data" colspan="3">Nu sunt date ...</td></tr>
        <%} else for (int i=0; i < items.length; i++) {
            SesiuneRaportare item = items[i]; %>
            <tr align="center">
                <td align="center"><%=i+1%></td>
                <td> <%=item.getAn()%> </td>
                <td> <%=item.isDeschisa() ? "Deschisa" : "Inchisa"%> </td>
                <% if( !Application.runAsAparatCentral()){ %>
                <td nowrap>
                    <a class="link" href="<%=AppConstants.APP_NAME%>?action=editSesiuniRaportare&id=<%=item.getId()%>">Modifică</a>&nbsp;
                    <% if(item.isDeschisa()){%>
                    <a class="link" href="<%=AppConstants.APP_NAME%>?action=change-status-sesiune&id=<%=item.getId()%>">Închide</a>
                    <% } else { %>
                    <a class="link" href="<%=AppConstants.APP_NAME%>?action=change-status-sesiune&id=<%=item.getId()%>">Deschide</a>
                    <% } %>
                </td>
                <% } %>
            </tr>
        <% } %>
    </tbody>
</table>

<span>
    Nota: <br/>
    &nbsp; - La inchiderea unei sesiuni, operatiile de actualizare a "datelor" sint blocate. <br/>
    &nbsp; - Prin "date" se intelege: <br/>
    &nbsp;&nbsp; - fise de incident <br/>
    &nbsp;&nbsp; - fise de echpament <br/>
    &nbsp;&nbsp; - fise de deranjament <br/>
    &nbsp;&nbsp; - fise de lucrari programate <br/>
    &nbsp;&nbsp; - fise de evenimente dispecer <br/>
</span>
