<%@ page import="ro.emid.common.constants.IncidentConstants" %>
<%@ page import="ro.emid.common.constants.NomConstants" %>
<%@ page import="ro.emid.common.db.DataDB" %>
<%@ page import="ro.emid.common.types.DataObj" %>
<%@ page import="ro.emid.common.types.Incident" %>
<%@ page import="ro.emid.common.utils.BrowseData" %>
<%@ page import="ro.emid.common.utils.ObjectUtils" %>
<%@ page import="ro.emid.incidente.obj.binder.IncidentBinder" %>

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

<%
    final IncidentBinder binder = (IncidentBinder) session.getAttribute(IncidentConstants.BEAN);
    final Incident bean = (binder != null ? (Incident) binder.getBean() : new Incident());
%>


<respmesg>
<%try{
    final BrowseData data = (BrowseData) session.getAttribute("browseData");
    final String codEmidLinie = ObjectUtils.getStringValue(request.getParameter("codEmidLinie"));
    final String codSapLinie  = ObjectUtils.getStringValue(request.getParameter("codSapLinie"));

    DataObj posturi[] = new DataObj[0];
    if( codEmidLinie.length() > 0){
        posturi = DataDB.getLFByParentCodEmid( codEmidLinie, NomConstants.NOM_PA_PT, data.getFilterCondition());
    }

    for (int i = 0; i < posturi.length; i++) {
        final DataObj papt = posturi[i]; %>
        <div class="post">
            <input type="checkbox" name="<%=BrowseData.COD_LF%>" value="<%=papt.getCod()%>" <%=bean.isLfChecked( papt.getCod(), codSapLinie) ? "checked" : ""%> codParent="<%=codSapLinie%>" />
            <label id="label<%=papt.getCod()%>" onclick='highlightLabel( this); showDetaliiLF( "<%=ro.emid.common.utils.Util.escapeToJs( papt.getCod())%>")' <%if( papt.esteSters()){%> style="text-decoration: line-through;" <% } %>>
            <%=papt.getNume()%> (<%=papt.getSters()%>)
            </label>
            <% final long durataIntreruperePT = bean.getDurataIntrerupereLF( papt.getCod()); %>
            <% final long oreToShow = durataIntreruperePT > 0 ? durataIntreruperePT/60 : data.getDurataIncidentOre();%>
            <% final long minuteToShow = durataIntreruperePT > 0 ? durataIntreruperePT%60 : data.getDurataIncidentMinute();%>
            <a class="link" id="linkDurataIntrerupere<%=papt.getCod()%>"  href="javascript: void( null)"  onclick=" editDurataIntrerupere( '<%=papt.getCod()%>'); return false;" title="Durata intrerupere. Click pentru editare"><%=oreToShow%>h <%=minuteToShow%>'</a>
            <span id="inputDurataIntrerupere<%=papt.getCod()%>" style="display: none">
                <nobr>
                    <input type="hidden" name="codSapParent<%=papt.getCod()%>" value="<%=AppConstants.format( codSapLinie)%>" />
                    <input name="durataIntrerupereOre<%=papt.getCod()%>" id="inputOre<%=papt.getCod()%>" onkeypress="myonkeypress(event)" type="text" style="width:30px; text-align:right; " class="gsapinputtext" value="<%=oreToShow%>" />h&nbsp;
                    <input name="durataIntrerupereMinute<%=papt.getCod()%>" id="inputMinute<%=papt.getCod()%>" onkeypress="myonkeypress(event)"  type="text" style="width:30px; text-align:right;" class="gsapinputtext" value="<%=minuteToShow%>"  />'
                </nobr>
            </span>
        </div>
<%  }%>
<%}catch( Exception t){%>
    <%=t.getMessage()%>
<%}%>
</respmesg>