<%@ page import="ro.emid.common.utils.ObjectUtils" %>
<%@ page import="ro.emid.common.db.InstalatieDB" %>
<%@ page import="ro.emid.common.types.Fisa" %>
<%@ page import="ro.emid.common.types.Instalatie" %>
<%@ page import="ro.emid.common.types.TipInstalatie" %>
<%@ page import="ro.emid.common.utils.BrowseController" %>
<%@ page import="ro.emid.common.utils.BrowseData" %>
<%@ page import="ro.emid.common.constants.AppConstants" %>

<respmesg>
<%try{

    final Fisa fisa = BrowseController.getBrowseFisa(session);
    final BrowseData data = BrowseController.getBrowseData( session);

    final String codEmidLinie = ObjectUtils.getStringValue(request.getParameter("codEmidLinie"));
    final String codSapLinie  = ObjectUtils.getStringValue(request.getParameter("codSapLinie"));

    Instalatie posturi[] = new Instalatie[0];
    if( codEmidLinie.length() > 0){
        posturi = data.getProvider().getLFByParentCodEmid( codEmidLinie, TipInstalatie.PA_PT, data.getFilterCondition());
    }

    for (int i = 0; i < posturi.length; i++) {
        final Instalatie papt = posturi[i]; %>
        <div class="post">
            <input type="checkbox" name="<%=BrowseData.COD_LF%>" value="<%=papt.getCod()%>" <%=fisa.isLfChecked( papt.getCod(), codSapLinie) ? "checked" : ""%> codParent="<%=codSapLinie%>" />
            <label id="label<%=papt.getCod()%>" class="<%=papt.esteSters()?"deleted":""%>" onclick='highlightLabel( this); showDetaliiLF( "<%=ro.emid.common.utils.Util.escapeToJs( papt.getCod())%>")'>
                <%=papt.getNume()%>
            </label>
            <% final long durataIntreruperePT = fisa.getDurataIntrerupereLF( papt.getCod()); %>
            <% final long oreToShow = durataIntreruperePT > 0 ? durataIntreruperePT/60 : data.getDurataParentOre();%>
            <% final long minuteToShow = durataIntreruperePT > 0 ? durataIntreruperePT%60 : data.getDurataParentMinute();%>
            <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>