<%@ page import="ro.emid.common.types.EvenimentDispecer" %>
<%@ page import="ro.emid.common.constants.EvenimentDispecerConstants" %>
<%@ page import="ro.emid.common.utils.StringUtils" %>
<%@ page import="ro.emid.common.constants.AppConstants" %>
<%@ page import="ro.emid.common.types.TipInstalatie" %>
<%@ page import="ro.emid.common.utils.Util" %>


<%
    final EvenimentDispecer bean = (EvenimentDispecer) request.getAttribute( EvenimentDispecerConstants.EVENT);
    if( bean == null){ %> The bean is null !!!  <%
        return;
    }
%>

<TABLE class=gSAPTHEAD cellSpacing=1 cellPadding=2 width="100%" border=1>
  <TBODY>
      <TR>
        <TH class=gsapthead noWrap colSpan=2 height=25>&nbsp;Fisa de Eveniment:&nbsp; </TH>
      </TR>
    <TR>
        <TD width="25%"><b>1.</b> Numar curent eveniment: </TD>
        <TD width="100%" wdth="75%">
            <%=bean.getNumar()%>
        </TD></TR>
    <TR>
    <TR>
        <TD width="25%"><b>2.</b> Data producere:</TD>
        <TD width="100%" wdth="75%">
            <%=AppConstants.format(bean.getDataProducere(), "-")%>
            &nbsp;&nbsp;&nbsp;
            <b>Data realimentare:<b/> <%=AppConstants.format(bean.getDataRealimentare(), "-")%>
            &nbsp;&nbsp;&nbsp;
            <b>Data revenire SN:</b> <%=AppConstants.format( bean.getDataRevenireSN(), "-")%>
        </TD></TR>
    <TR>
    <TD vAlign=top><b>3.</b> Localizare Eveniment:&nbsp;</TD>
    <TD>
      <TABLE class=gsapthead>
        <TBODY>
            <TR valign="top" class=gSAPGroup>
              <TD>
                <table style="font-size:13px">
                    <tr>
                        <td valign="top" nowrap>
                            <table width="300px"><tr>
                                <td >
                                    <input name="<%=EvenimentDispecerConstants.JSP.TIP_INSTALATIE_RADIO%>" type="radio"
                                           value="<%=TipInstalatie.STATIE%>" id="radioStatie" <%=TipInstalatie.STATIE == bean.getTipInstalatieRadio()?"checked":""%>
                                           onClick="onClickRadioTipInstalatie( this, 1);" disabled><label for="radioStatie" >Statie</label>
                                </td>
                                <td >
                                    <input name="<%=EvenimentDispecerConstants.JSP.TIP_INSTALATIE_RADIO%>" type="radio"
                                           value="<%=TipInstalatie.LINIE%>" id="radioLinie" <%=TipInstalatie.LINIE == bean.getTipInstalatieRadio()?"checked":""%>
                                           onClick="onClickRadioTipInstalatie( this, 1)" disabled><label for="radioLinie" >Linie</label>
                                </td>
                                <td >
                                    <input name="<%=EvenimentDispecerConstants.JSP.TIP_INSTALATIE_RADIO%>" type="radio"
                                           value="<%=TipInstalatie.PA_PT%>" id="radioPAPT" <%=TipInstalatie.PA_PT == bean.getTipInstalatieRadio()?"checked":""%>
                                           onClick="onClickRadioTipInstalatie( this, 1);" disabled><label for="radioPAPT" >PA/PT</label>
                                </td>
                            </tr></table>
                        </td>
                    </tr>
                    <tr>
                        <td nowrap>
                            <%=getText( bean.getDenInstalatie())%>
                            &nbsp;&nbsp;&nbsp;

                            Tip: <%=getText( bean.getTipInstalatie())%>
                            &nbsp;&nbsp;&nbsp;

                            U: <%=getText( bean.getU())%> [kV]
                        </td>
                     </tr>

                     <% if( !StringUtils.isZeroLength(bean.getDenInstalatie2())){ %>
                     <tr id="radiosChildStatie">
                        <td nowrap>
                            <br/>
                            <table width="300px"><tr>
                                <td >
                                    <input name="<%=EvenimentDispecerConstants.JSP.TIP_INSTALATIE_RADIO2%>" type="radio"
                                        value="<%=TipInstalatie.CELULA%>" id="radioCelula"
                                        <%=TipInstalatie.CELULA == bean.getTipInstalatieRadio2()?"checked":""%>
                                        disabled
                                        ><label for="radioCelula" >Celula</label>
                                </td>
                                <td >
                                    <input name="<%=EvenimentDispecerConstants.JSP.TIP_INSTALATIE_RADIO2%>" type="radio"
                                           value="<%=TipInstalatie.TRAFO%>" id="radioTrafo" <%=TipInstalatie.TRAFO == bean.getTipInstalatieRadio2()?"checked":""%>
                                           disabled
                                           ><label for="radioTrafo" >Trafo</label>
                                </td>
                                <td >
                                    <input name="<%=EvenimentDispecerConstants.JSP.TIP_INSTALATIE_RADIO2%>" type="radio"
                                           value="<%=TipInstalatie.BARA%>" id="radioBara" <%=TipInstalatie.BARA == bean.getTipInstalatieRadio2()?"checked":""%>
                                           disabled
                                           ><label for="radioBara" >Bara</label>
                                </td>
                                <td >
                                    <input name="<%=EvenimentDispecerConstants.JSP.TIP_INSTALATIE_RADIO2%>" type="radio"
                                           value="<%=TipInstalatie.BOBINA%>" id="radioBobina" <%=TipInstalatie.BOBINA == bean.getTipInstalatieRadio2()?"checked":""%>
                                           disabled
                                           ><label for="radioBobina" >Bobina</label>
                                </td>
                            </tr></table>
                        </td>
                     </tr>
                     <tr id="instalatie2Inputs">
                        <td >
                            <%=getText( bean.getDenInstalatie2())%>
                            &nbsp;&nbsp;&nbsp;
                            Tip: <%=getText( bean.getTipInstalatie2())%>
                            &nbsp;&nbsp;&nbsp;
                            U: <%=getText( bean.getU2())%> [kV]
                        </td>
                    </tr>
                    <% } %>
                </table>
                </TD>
            </TR>
          </TBODY></TABLE>
        </TD></TR>

        <tr>
            <td align="left"><b>4.</b>Descriere eveniment</TD>
            <td>
                <%=getText( bean.getDescriereEveniment())%>
            </td>
        </TR>
        <tr>
            <td align="left"><b>5.</b>Defect</TD>
            <td>
                <%=getText( bean.getDefect())%>
            </td>
        </TR>
        <tr>
            <td align="left"><b>6.</b>Semnalizari</TD>
            <td>
                <%=getText( bean.getSemnalizari())%>
            </td>
        </TR>
        <tr>
            <td align="left"><b>7.</b>Durata eveniment</TD>
            <td>
                <% final long durataMinute = bean.getDurata(); %>
                <%=durataMinute/60%>h &nbsp;<%=durataMinute%60%>'
            </td>
        </TR>
        <tr>
            <td align="left"><b>8.</b>Pi</TD>
            <td>
                <%=getText( bean.getPi())%>&nbsp;[kW]
            </td>
        </TR>
        <tr>
            <td align="left"><b>9.</b>Gestionar</TD>
            <td>
                <%=getText( bean.getGestionar())%>
            </td>
        </TR>
        <tr>
            <td align="left"><b>10.</b>Consumatori intrerupti</TD>
            <td>
                <table>
                    <tr valign="top">
                        <td >
                            <TABLE class=gSAPTHEAD cellSpacing=1 width="400px">
                              <TBODY>
                                <TR class=gSAPGroup align=middle>
                                  <TD>Inalta(IT)</TD>
                                  <TD>Medie(MT)</TD>
                                  <TD>Joasa(JT)</TD>
                                </TR>
                                <TR>
                                  <TD align=middle><%=bean.getUtilizatoriIT()%></TD>
                                  <TD align=middle><%=bean.getUtilizatoriMT()%></TD>
                                  <TD align=middle><%=bean.getUtilizatoriJT()%></TD>
                                </TR>
                                <tr>
                                    <td align="left"></td>
                                    <td align="right"><b>Total:</b></td>
                                    <td align="center"><%=bean.getConsumatoriIntrerupti()%></td>
                                  </tr>
                                </TBODY>
                            </TABLE>

                        </td>
                        <td width="10"></td>
                        <td>
                            <TABLE class=gSAPTHEAD cellSpacing=1 width="300px">
                              <TBODY>
                                <TR class=gSAPGroup align=middle>
                                  <TD>Casnici</TD>
                                  <TD>Mici</TD>
                                  <TD>Mari</TD>
                                </TR>
                                <TR align="center">
                                    <td><%=bean.getUtilizatoriCasnici()%></td>
                                    <td><%=bean.getUtilizatoriMici()%></td>
                                    <td><%=bean.getUtilizatoriMari()%></td>
                                </tr>
                              </TBODY>
                            </TABLE>
                        </td>
                    </tr>
                </table>
            </td>
        </TR>
        <tr>
            <td align="left"><b>11.</b>Observatii suplimentare</TD>
            <td>
                <%=getText( bean.getObservatii())%>
            </td>
        </TR>
</TABLE>

<%!
    private String getText(final String str){
        return Util.formatForHtml(str);
    }
%>