<%@ page import="ro.emid.administrare.AdministrareSessionUtils" %>
<%@ page import="ro.emid.common.constants.AppConstants" %>
<%@ page import="ro.emid.common.constants.NomConstants" %>
<%@ page import="ro.emid.common.constants.RoleConstants" %>
<%@ page import="ro.emid.common.constants.UserConstants" %>
<%@ page import="ro.emid.common.db.CategoryAccessDB" %>
<%@ page import="ro.emid.common.db.CategoryODAccessDB" %>
<%@ page import="ro.emid.common.db.NomAccessDB" %>
<%@ page import="ro.emid.common.types.Category" %>
<%@ page import="ro.emid.common.types.Nomenclator" %>
<%@ page import="ro.emid.common.types.User" %>
<%@ page import="ro.emid.common.utils.UserUtils" %>
<%@ page import="ro.emid.common.AppProperties" %>

<%
    /**
     * @see ro.emid.administrare.action.user.ViewUserAction
     */
    String hasAccessImg = AppConstants.WEB_RESOURCE_PATH + "/images/checked_green.gif";
    String noAccessImg  = AppConstants.WEB_RESOURCE_PATH + "/images/grey_cross.gif";

    User useru = (User) request.getAttribute("useru");
%>

<%@ include file="../../layout/messages.jspf" %>


<table border="0" class=gSAPTHEAD cellspacing=1 cellpadding=2 width="100%">
    <tr>
        <td align="left">
            <span style="font-weight: bold; font-size: 16px;">Detalii utilizator:</span>
        </td>
    </tr>
</table>
<table border="0" cellpadding=2 cellspacing=1 width="100%" class="gSAPTHEAD">
<tr class="compartiment">
    <td colspan="2"> </td>
</tr>
<tr>
    <td width="70px" height="10px"></td>
    <td>
        <table border="0" >
            <tr valign="top">
                <td width="400px">
                    <table border="0" width="100%">
                        <tr>
                            <td width="130px">Username:</td>
                            <td>
                                <%=AppConstants.format(useru.getUsername())%>
                            </td>
                        </tr>
                        <tr>
                            <td>Nume Prenume:</td>
                            <td>
                                <%=AppConstants.format( useru.getFullName())%>
                            </td>
                        </tr>
                    </table>
                </td>

                <td width="250px">
                    Status: <%= useru.getLocked() == 0 ? "activ" : "blocat" %>
                </td>

                <td width="200px">
                    <input style="width: 100px; margin-bottom: 3px;"
                           type="button"
                           onclick="window.location='<%=AppConstants.APP_NAME%>?action=show-users';"
                           value="Închide"
                           title="Mergi la lista utilizatori"
                            />
                    <br/>
                    <br/>
                    <% User userLogat = AdministrareSessionUtils.getUserLogat(session);                                 %>
                    <% if (UserUtils.hasAccessAdministrare(userLogat) && UserUtils.hasAdmRightUtilizatori(userLogat)) { %>

                    <input type="button"
                           style="width: 100px"
                           onclick="modificaUser(this)"
                           value="Modifică"
                           title="Actualizare date utiizator"
                            />

                    <input type="button"
                           style="width: 100px;margin-top: 5px;"
                           onclick="lockUnlockUser(this)"
                           value="<%= useru.getLocked() == 0 ? "Blochează" : "Activeză" %>"
                           title="<%= useru.getLocked() == 0 ? "Blocheaza utilizatorul" : "Activeza utilizatorul" %>"
                            />

                    <% } %>

                </td>
            </tr>
        </table>


    </td>
</tr>
<tr>
    <td>&nbsp;</td>
</tr>


<tr>
    <td>&nbsp;
</tr>


<tr class="compartiment">
    <td colspan="2">Drepturi aplicatii:</td>
</tr>
<tr>
<td></td>
<td>


<%------------------------------ Incidente--%>

<fieldset style="margin: 0; cursor: default;">
    <legend><img id="appIncidente" src="<%=useru.isIeAccess() ? hasAccessImg : noAccessImg %>"/>
        <label for="appIncidente">Incidente</label></legend>

    <% if (useru.isIeAccess()) { %>

    <div id="div_enable_incidente">
        <table border="0" style="font-size:13px" cellspacing="0" cellpadding="0" width="100%">
            <tr valign="top">
                <td width="200px"><b>Rol:</b></td>
                <td><img id="ieAdmin" src="<%=useru.getIeRole() == RoleConstants.ROL_ADMIN ?  hasAccessImg : noAccessImg %>"/>
                    <label for="ieAdmin">Administrator</label> &nbsp;&nbsp;&nbsp;

                    <img id="ieWorker"
                         src="<%=useru.getIeRole() == RoleConstants.ROL_UTILIZATOR ?  hasAccessImg : noAccessImg %>"/>
                    <label for="ieWorker">Utilizator</label> &nbsp;&nbsp;&nbsp;

                    <img id="ieView"
                         src="<%=useru.getIeRole() == RoleConstants.ROL_VIEW  ? hasAccessImg : noAccessImg %>"/>
                    <label for="ieView">View</label>
                    &nbsp;&nbsp;&nbsp;
                </td>
            </tr>


            <tr valign="top">
                <td><b>Zona:</b></td>
                <td>
                    <table border="0">
                        <tr>
                            <td width="150"><label>Filiala:</label></td>
                            <td>
                                <%= useru.getIeFilialaId() == -1 || CategoryAccessDB.getById(useru.getIeFilialaId()) == null ? " - " : CategoryAccessDB.getById(useru.getIeFilialaId()).getName() %>
                            </td>
                        </tr>
                        <tr>
                            <td><label>Sucursala:</label></td>
                            <td>
                                <%= useru.getIeSucursalaId() == -1 || CategoryAccessDB.getById(useru.getIeSucursalaId()) == null ? " - " : CategoryAccessDB.getById(useru.getIeSucursalaId()).getName() %>
                            </td>
                        </tr>
                        <tr>
                            <td><label>C.E.:</label></td>
                            <td>
                                <%= useru.getIeCentruId() == -1 || CategoryAccessDB.getById(useru.getIeCentruId()) == null ? " - " : CategoryAccessDB.getById(useru.getIeCentruId()).getName() %>
                            </td>
                        </tr>
                        <tr>
                            <td><label>Formatia de lucru:</label></td>
                            <td>
                                <%= useru.getIeFormatiaId() == -1 || CategoryAccessDB.getById(useru.getIeFormatiaId()) == null ? " - " : CategoryAccessDB.getById(useru.getIeFormatiaId()).getName() %>
                            </td>
                        </tr>
                    </table>


                </td>
            </tr>


            <tr valign="top">
                <td><b>Drepturi:</b>&nbsp;&nbsp;</td>
                <td>
                    <img id="<%=UserConstants.IE_RIGHT_ARHIVARE%>"
                         src=" <%=UserUtils.hasIeRightArhivare(useru) ? hasAccessImg : noAccessImg %>"/>

                    <label for="<%=UserConstants.IE_RIGHT_ARHIVARE%>"><%=UserConstants.IE_LABEL_ARHIVARE%>
                    </label>&nbsp;

                    <img id="<%=UserConstants.IE_RIGHT_RAPOARTE_INCIDENTE%>"
                         src=" <%=UserUtils.hasIeRightRapoarteIncidente(useru) ? hasAccessImg : noAccessImg %>"/>

                    <label for="<%=UserConstants.IE_RIGHT_RAPOARTE_INCIDENTE%>"><%=UserConstants.IE_LABEL_RAPOARTE_INCIDENTE%>
                    </label>&nbsp;

                    <img id="<%=UserConstants.IE_RIGHT_TRIMITERE_IE%>"
                         src=" <%=UserUtils.hasIeRightTrimitereIE(useru) ? hasAccessImg : noAccessImg %>"/>

                    <label><%=UserConstants.IE_LABEL_TRIMITERE_IE%></label>&nbsp;

                    <img id="<%=UserConstants.IE_RIGHT_VIZUALIZARE_VOLUM_INSTALATII%>"
                         src="<%=UserUtils.hasIeRightVizualizareVolumInstalatii(useru) ? hasAccessImg : noAccessImg %>"/>

                    <label for="<%=UserConstants.IE_RIGHT_VIZUALIZARE_VOLUM_INSTALATII%>"><%=UserConstants.IE_LABEL_VIZUALIZARE_VOLUM_INSTALATII%>
                    </label>&nbsp;

                    <img id="<%=UserConstants.IE_RIGHT_VIZUALIZARE_NOMENCLATOR_BDI%>"
                         src="<%=UserUtils.hasIeRightVizualizareNomenclatorBDI(useru) ? hasAccessImg : noAccessImg %>"/>

                    <label><%=UserConstants.IE_LABEL_VIZUALIZARE_NOMENCLATOR_BDI%></label>&nbsp;
                </td>
            </tr>
        </table>
    </div>
    <% } %>

</fieldset>


<%---------------------------------- Call center / Deranjamente--%>


<fieldset style="margin: 0; cursor: default;">
<legend>
    <img id="appDeranjamente"
         src="<%=useru.isCcAccess() ? hasAccessImg : noAccessImg %>"/>

    <label for="appDeranjamente">Callcenter / Deranjamente</label>
</legend>
<% if (useru.isCcAccess()) { %>
<table border="0" style="font-size:13px" cellspacing="0" cellpadding="0" width="100%">
<tr>
    <td width="200px"><b>Rol:</b></td>
    <td>
        <img id="rdAdmin"
             src="<%= useru.getCcRole() == RoleConstants.ROL_ADMIN ? hasAccessImg : noAccessImg %>"/>

        <label for="ieAdmin">Administrator</label> &nbsp;&nbsp;&nbsp;

        <img id="rdWorker"
             src="<%=useru.getCcRole() == RoleConstants.ROL_UTILIZATOR ? hasAccessImg : noAccessImg %>"/>

        <label for="ieWorker">Utilizator</label> &nbsp;&nbsp;&nbsp;

        <img id="rdView"
             src="<%=useru.getCcRole() == RoleConstants.ROL_VIEW ?  hasAccessImg : noAccessImg %>"/>

        <label for="ieView">View</label>
        &nbsp;&nbsp;&nbsp;
    </td>
</tr>

<tr valign="top">
    <td><b>Zona:</b></td>
    <td>
        <table border="0">
            <tr>
                <td width="150">Filiala:</td>
                <td>
                    <%= useru.getCcFilialaId() == -1 || CategoryAccessDB.getById(useru.getCcFilialaId()) == null ? " - " : CategoryAccessDB.getById(useru.getCcFilialaId()).getName() %>
                </td>
            </tr>
            <tr>
                <td>Sucursala:</td>
                <td>
                    <%= useru.getCcSucursalaId() == -1 || CategoryAccessDB.getById(useru.getCcSucursalaId()) == null ? " - " : CategoryAccessDB.getById(useru.getCcSucursalaId()).getName() %>
                </td>
            </tr>
            <tr>
                <td>C.E.:</td>
                <td>
                    <%= useru.getCcCentruId() == -1 || CategoryAccessDB.getById(useru.getCcCentruId()) == null ? " - " : CategoryAccessDB.getById(useru.getCcCentruId()).getName() %>
                </td>
            </tr>
            <tr>
                <td>Formatia de lucru:</td>
                <td><%= useru.getCcFormatiaId() == -1 || CategoryAccessDB.getById(useru.getCcFormatiaId()).getName() == null ? " - " : CategoryAccessDB.getById(useru.getCcFormatiaId()).getName() %>
                </td>
            </tr>
        </table>


    </td>
</tr>


<tr valign="top">
    <td><b>Zona+:</b></td>
    <td>
        <%Category.ArboreView categs[] = CategoryAccessDB.getAllCategoriesArboreView("");%>
<span id="locatieSelectTemplate" style="display:none">
<select class="gSAPSelect" name="<%=UserConstants.ID_LOCATII_SUPL%>">
    <option>Selectati:</option>
    <% for (int indexfor3 = 0; indexfor3 < categs.length; indexfor3++) {
        Category.ArboreView categ = categs[indexfor3]; %>

    <option class="<%=categ.isF()?"f":categ.isS()?"s":categ.isC()?"c":""%>"
            value="<%=categ.getId()%>"><%=categ.getFullPath(" - ")%>
    </option>
    <% } %>
</select>
<input type="button" value="-" onclick="stergeLocatieSelect(this.parentNode.parentNode);">
</span>

        <table border="0">
            <tr valign="bottom">
                <td>
                    <% Long[] ids = UserUtils.getIdLocatiiSuplAsArray(useru); %>
                    <table border="0" border="0" id="locatii">
                        <% for (int indexfor1 = 0; indexfor1 < ids.length; indexfor1++) {
                            Long id = ids[indexfor1]; %>
                        <tr>
                            <td nowrap>
                                <select id="zonaplusselect" class="gSAPSelect"
                                        name="<%=UserConstants.ID_LOCATII_SUPL%>">
                                    <option>Selectati:</option>
                                    <% for (int k = 0; k < categs.length; k++) {
                                        Category.ArboreView categ = categs[k]; %>

                                    <option <%=categ.getId() == id.longValue() ? "selected" : ""%>
                                            class="<%=categ.isF()?"f":categ.isS()?"s":categ.isC()?"c":""%>"
                                            value="<%=categ.getId()%>"><%=categ.getFullPath(" - ")%>
                                    </option>
                                    <% } %>
                                </select>

                            </td>
                        </tr>
                        <% } %>
                    </table>
                </td>
                <td style="padding-bottom: 3px">

                </td>
            </tr>
        </table>

        <script type="text/javascript">
            var table = $("locatii");

            function addLocatieSelect() {
                var rowCount = table.rows.length;
                var row = table.insertRow(rowCount);

                var td = row.insertCell(0);
                td.noWrap = true;
                td.innerHTML = $("locatieSelectTemplate").innerHTML;
            }

            function stergeLocatieSelect(tr) {
                var rows = table.rows;
                var index = -1;
                for (var i = 0; i < rows.length; i++) {
                    if (rows[i] == tr) {
                        index = i;
                        break;
                    }
                }

                if (index >= 0) {
                    table.deleteRow(i);
                }
            }
        </script>

    </td>
</tr>
<%if (AppConstants.CIR_ACTIV) {%>
<tr>
    <td><b>CIR:</b></td>
    <td>
        <select name="<%=UserConstants.COD_CIR%>" class="gSAPSelect" id="cir">
            <option value="-1">Selectati:</option>
            <% Nomenclator[] cirs = NomAccessDB.getAllNom(NomConstants.NOM_CIR);%>
            <% for (int indexfor = 0; indexfor < cirs.length; indexfor++) {
                Nomenclator cir = cirs[indexfor]; %>
            <option value="<%=cir.getCod()%>" <%=cir.getCod() == useru.getCcCodCir() ? "selected" : ""%> ><%=cir.getDescriere()%>
            </option>
            <%}%>
        </select>
    </td>
</tr>
<%}%>

<tr valign="top">
    <td><b>Drepturi:</b></td>
    <td><img id="<%=UserConstants.CC_RIGHT_INREGISTRARE_RECLAMATII%>"
             src="<%=UserUtils.hasCcRightInregistrareReclamatii(useru) ? hasAccessImg : noAccessImg %>"/>

        <label
                for="<%=UserConstants.CC_RIGHT_INREGISTRARE_RECLAMATII%>"><%=UserConstants.CC_LABEL_INREGISTRARE_RECLAMATII%>
        </label> &nbsp;


        <img id="<%=UserConstants.CC_RIGHT_ATASARE_RECLAMATII%>"
             src="<%=UserUtils.hasCcRightAtasareReclamatii(useru) ?   hasAccessImg : noAccessImg %>"/>

        <label
                for="<%=UserConstants.CC_RIGHT_ATASARE_RECLAMATII%>"><%=UserConstants.CC_LABEL_ATASARE_RECLAMATII%>
        </label> &nbsp;


        <img id="<%=UserConstants.CC_RIGHT_LITTLE_INCIDENTE%>"
             src="<%=UserUtils.hasCcRightEditareLittleIncidente(useru)  ?   hasAccessImg : noAccessImg %>"/>

        <label
                for="<%=UserConstants.CC_RIGHT_LITTLE_INCIDENTE%>"><%=UserConstants.CC_LABEL_LITTLE_INCIDENTE%>
        </label>&nbsp;


        <img id="<%=UserConstants.CC_RIGHT_DERANJAMENTE%>"
             src="<%=UserUtils.hasCcRightEditareDeranjamente(useru) ? hasAccessImg : noAccessImg %>"/>

        <label
                for="<%=UserConstants.CC_RIGHT_DERANJAMENTE%>"><%=UserConstants.CC_LABEL_DERANJAMENTE%>
        </label>&nbsp;


        <img id="<%=UserConstants.CC_RIGHT_LUCRARI_PROGRAMATE%>"
             src="<%=UserUtils.hasCcRightEditareLucrariProgramate(useru) ? hasAccessImg : noAccessImg %>"/>

        <label
                for="<%=UserConstants.CC_RIGHT_LUCRARI_PROGRAMATE%>"><%=UserConstants.CC_LABEL_LUCRARI_PROGRAMATE%>
        </label> <br>


        <img id="<%=UserConstants.CC_RIGHT_CLIENTI_ELIGIBILI%>"
             src="<%=UserUtils.hasCcRightEditareClientiEligibili(useru) ? hasAccessImg : noAccessImg %>"/>

        <label
                for="<%=UserConstants.CC_RIGHT_CLIENTI_ELIGIBILI%>"><%=UserConstants.CC_LABEL_CLIENTI_ELIGIBILI%>
        </label>&nbsp;


        <img id="<%=UserConstants.CC_RIGHT_RAPOARTE_DERANJAMENTE%>"
             src="<%=UserUtils.hasCcRightRapoarteDeranjamente(useru) ? hasAccessImg : noAccessImg %>"/>

        <label
                for="<%=UserConstants.CC_RIGHT_RAPOARTE_DERANJAMENTE%>"><%=UserConstants.CC_LABEL_RAPOARTE_DERANJAMENTE%>
        </label>&nbsp;


        <img id="<%=UserConstants.CC_RIGHT_ALOCARE_LOCALITATI_CENTRE%>"
             src="<%=UserUtils.hasCcRightAlocareLocalitatiCentre(useru) ? hasAccessImg : noAccessImg %>"/>

        <label
                for="<%=UserConstants.CC_RIGHT_ALOCARE_LOCALITATI_CENTRE%>"><%=UserConstants.CC_LABEL_ALOCARE_LOCALITATI_CENTRE%>
        </label>&nbsp;


        <div id="flagsRapoarteDeranjamente"
             style="padding-left: 30px;<% if( !UserUtils.hasCcRightRapoarteDeranjamente(useru)){ %> display:none;<%}%>">
            <% int indexRapoarte = 0; %>

            <img id="<%=indexRapoarte%>"
                 src=" <%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ? hasAccessImg : noAccessImg %>"/>

            <label
                    for="rd<%=indexRapoarte++%>"> Raport indicatori performanta distributie (raport anual)</label>
            <br/>
            <img id="<%=indexRapoarte%>"
                 src="<%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ? hasAccessImg : noAccessImg %>"/>
            <label
                    for="rd<%=indexRapoarte++%>"> Raport indicatori performanta furnizare (raport anual)</label>
            <br/> <img id="<%=indexRapoarte%>"
                       src=" <%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ? hasAccessImg : noAccessImg %>"/>
            <label
                    for="rd<%=indexRapoarte++%>"> Energia electrica nelivrata consumatorilor datorita producerii
                deranjamentelor</label>
            <br/> <img id="<%=indexRapoarte%>"
                       src="<%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ? hasAccessImg : noAccessImg %>"/>

            <label
                    for="rd<%=indexRapoarte++%>"> Situatia sintetica a deranjamentelor produse</label>
            <br/>
            <img id="<%=indexRapoarte%>"
                 src="<%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ? hasAccessImg : noAccessImg %>"/>

            <label
                    for="rd<%=indexRapoarte++%>"> Situatia sintetica a deranjamentelor individual colectiv</label>
            <br/>
            <img id="<%=indexRapoarte%>"
                 src="<%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ?  hasAccessImg : noAccessImg %>"/>

            <label
                    for="rd<%=indexRapoarte++%>"> Registrul de Deranjamente</label>
            <br/> <img id="<%=indexRapoarte%>"
                       src="<%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ? hasAccessImg : noAccessImg %>"/>

            <label
                    for="rd<%=indexRapoarte++%>"> Statistica evenimentelor produse in instalatiile de JT</label>
            <br/>
            <img id="<%=indexRapoarte%>"
                 src="<%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ? hasAccessImg : noAccessImg %>"/>

            <label
                    for="rd<%=indexRapoarte++%>"> Raport Zilnic</label>
            <br/>
            <img id="<%=indexRapoarte%>"
                 src=" <%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ? hasAccessImg : noAccessImg %>"/>

            <label
                    for="rd<%=indexRapoarte++%>"> Raport Evenimente Cauze</label>
            <br/>
            <img id="<%=indexRapoarte%>"
                 src=" <%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ? hasAccessImg : noAccessImg %>"/>
            <label
                    for="rd<%=indexRapoarte++%>"> Raport Provizorate</label>
            <br/>
            <img id="<%=indexRapoarte%>"
                 src="<%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ? hasAccessImg : noAccessImg %>"/>

            <label
                    for="rd<%=indexRapoarte++%>"> Deranjamente cu emitere comanda catre AISE</label>
            <br/> <img id="<%=indexRapoarte%>"
                       src="<%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ? hasAccessImg : noAccessImg %>"/>

            <label
                    for="rd<%=indexRapoarte++%>"> Deranjamente cu referat catre S.O CEMTJT</label>
            <br/> <img id="<%=indexRapoarte%>"
                       src="<%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ? hasAccessImg : noAccessImg %>"/>

            <label
                    for="rd<%=indexRapoarte++%>"> Raport Reclamatii</label>
            <br/> <img id="<%=indexRapoarte%>"
                       src="<%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ? hasAccessImg : noAccessImg %>"/>

            <label
                    for="rd<%=indexRapoarte++%>"> Raport Reclamatii grupate dupa continut sesizare</label>
            <br/> <img id="<%=indexRapoarte%>"
                       src="<%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ? hasAccessImg : noAccessImg %>"/>

            <label
                    for="rd<%=indexRapoarte++%>"> Raport Motive solicitari informatii</label>
            <br/> <img id="<%=indexRapoarte%>"
                       src="<%= UserUtils.hasRightRaportDeranjamente(useru, indexRapoarte) ? hasAccessImg : noAccessImg %>"/>

            <label
                    for="rd<%=indexRapoarte++%>"> Raport Solicitari informatii</label>
        </div>
    </td>
</tr>
</table>
<% } %>
</fieldset>


<%----------------------------------------- Lucrari programate--%>


<fieldset style="margin: 0; cursor: default;">
    <legend>
        <img id="appLp"
             src=" <%=useru.isLpAccess() ? hasAccessImg : noAccessImg %>"/>


        <label for="appLp">Lucrari programate</label></legend>
    <% if (useru.isLpAccess()) { %>


    <table border="0" style="font-size:13px" cellspacing="0" cellpadding="0" width="100%">
        <tr valign="top">
            <td width="200px"><b>Rol:</b></td>
            <td><img id="lpWorker"
                     src="<%=useru.getLpRole() == RoleConstants.ROL_UTILIZATOR ? hasAccessImg : noAccessImg %>"/>

                <label for="lpWorker">Utilizator</label>
                &nbsp;&nbsp;&nbsp;

                <img id="lpView"
                     src="<%=useru.getLpRole() == RoleConstants.ROL_VIEW  ?  hasAccessImg : noAccessImg %>"/>

                <label for="lpView">View</label> &nbsp;&nbsp;&nbsp;
            </td>
        </tr>


        <tr valign="top">
            <td><b>Zona:</b></td>
            <td>
                <table border="0">
                    <tr>
                        <td width="150">Filiala:</td>
                        <td>
                            <%= (useru.getLpFilialaId() == -1 || CategoryAccessDB.getById(useru.getLpFilialaId()) == null) ? " - " : CategoryAccessDB.getById(useru.getLpFilialaId()).getName() %>
                        </td>
                    </tr>
                    <tr>
                        <td>Sucursala:</td>
                        <td>
                            <%= useru.getLpSucursalaId() == -1 || CategoryAccessDB.getById(useru.getLpSucursalaId()) == null ? " - " : CategoryAccessDB.getById(useru.getLpSucursalaId()).getName() %>
                        </td>
                    </tr>
                    <tr>
                        <td>C.E.:</td>
                        <td>
                            <%= useru.getLpCentruId() == -1 || CategoryAccessDB.getById(useru.getLpCentruId()) == null ? " - " : CategoryAccessDB.getById(useru.getLpCentruId()).getName() %>
                        </td>
                    </tr>
                    <tr>
                        <td>Formatia de lucru:</td>
                        <td>
                            <%= useru.getLpFormatiaId() == -1 || CategoryAccessDB.getById(useru.getLpFormatiaId()) == null ? " - " : CategoryAccessDB.getById(useru.getLpFormatiaId()).getName() %>
                        </td>
                    </tr>
                </table>


            </td>
        </tr>
    </table>

    <% } %>
</fieldset>


<%-------------------------- Operatiuni dispecer--%>


<fieldset style="margin: 0; cursor: default;">
    <legend>
        <img id="appD"
             src=" <%=useru.isOdAccess() ? hasAccessImg : noAccessImg %>"/>

        <label for="appD">Dispecer</label>
    </legend>

    <% if (useru.isOdAccess()) { %>

    <table border="0" style="font-size:13px" cellspacing="0" cellpadding="0" width="100%">
        <tr>
            <td width="200px"><b>Rol:</b></td>
            <td>
                <img id="odWorker"
                     src="<%=useru.getOdRole() == RoleConstants.ROL_UTILIZATOR ? hasAccessImg : noAccessImg %>"/>

                <label for="lpWorker">Utilizator</label>
                &nbsp;&nbsp;&nbsp;

                <img id="odView"
                     src="<%=useru.getOdRole() == RoleConstants.ROL_VIEW  ? hasAccessImg : noAccessImg %>"/>

                <label for="lpView">View</label> &nbsp;&nbsp;&nbsp;

            </td>
        </tr>

        <tr valign="top">
            <td><b>Zona:</b></td>
            <td>
                <table border="0">
                    <tr>
                        <td width="150">Filiala:</td>
                        <td>
                            <%= (useru.getOdFilialaD() == -1 || CategoryODAccessDB.getById(useru.getOdFilialaD()) == null) ? " - " : CategoryODAccessDB.getById(useru.getOdFilialaD()).getName() %>
                        </td>
                    </tr>
                    <tr>
                        <td>DED:</td>
                        <td>
                            <%= (useru.getOdDedId() == -1 || CategoryODAccessDB.getById(useru.getOdDedId()) == null) ? " - " : CategoryODAccessDB.getById(useru.getOdDedId()).getName() %>
                        </td>
                    </tr>
                    <tr>
                        <td>DED-L:</td>
                        <td>
                            <%= (useru.getOdDedLId() == -1 || CategoryODAccessDB.getById(useru.getOdDedLId()) == null) ? " - " : CategoryODAccessDB.getById(useru.getOdDedLId()).getName() %>
                        </td>
                    </tr>
                </table>

            </td>
        </tr>
    </table>
    <% }%>
</fieldset>


<%---------------------  Administrare--%>


<fieldset style="margin: 0; cursor: default;">
    <legend><img id="appA"
                 src="<%=useru.isAdmAccess() ? hasAccessImg : noAccessImg %>"/>

        <label for="appA">Administrare</label>
    </legend>

    <% if (useru.isAdmAccess()) { %>

    <table>
        <tr>
            <td width="200px">

            <td width="200px">


                <img id="<%=UserConstants.ADM_RIGHT_UTILIZATORI%>"
                     src="<%=UserUtils.hasAdmRightUtilizatori(useru) ? hasAccessImg : noAccessImg %>"/>

                <label
                        for="<%=UserConstants.ADM_RIGHT_UTILIZATORI%>"><%=UserConstants.ADM_LABEL_UTILIZATORI%>
                </label> &nbsp;
                <br/>


                <div id="EditareUtilizatoriPerAplicatie"
                     style="padding-left: 30px;width:300px; <% if( !UserUtils.hasAdmRightUtilizatori(useru)){ %> display:none;<%}%>">

                    <img id="<%=UserConstants.ADM_RIGHT_UTILIZ_IE%>"
                         src="<%=UserUtils.hasAdmRightUtilizatoriIncidente(useru) ? hasAccessImg : noAccessImg %>"/>

                    <label
                            for="<%= UserConstants.ADM_RIGHT_UTILIZ_IE%>"><%= UserConstants.ADM_LABEL_UTILIZ_IE%>
                    </label><br/>


                    <img id="<%=UserConstants.ADM_RIGHT_UTILIZ_CC%>"
                         src=" <%=UserUtils.hasAdmRightUtilizatoriCallCenterDeranjamente(useru) ? hasAccessImg : noAccessImg %>"/>

                    <label
                            for="<%= UserConstants.ADM_RIGHT_UTILIZ_CC%>"><%= UserConstants.ADM_LABEL_UTILIZ_CC%>
                    </label><br/>


                    <img id="<%=UserConstants.ADM_RIGHT_UTILIZ_LP%>"
                         src="<%=UserUtils.hasAdmRightUtilizatoriLucrariProgramate(useru) ? hasAccessImg : noAccessImg %>"/>

                    <label
                            for="<%= UserConstants.ADM_RIGHT_UTILIZ_LP%>"><%= UserConstants.ADM_LABEL_UTILIZ_LP%>
                    </label><br/>


                    <img id="<%=UserConstants.ADM_RIGHT_UTILIZ_OD%>"
                         src="<%=UserUtils.hasAdmRightUtilizatoriLucrariProgramate(useru) ? hasAccessImg : noAccessImg %>"/>

                    <label
                            for="<%= UserConstants.ADM_RIGHT_UTILIZ_OD%>"><%= UserConstants.ADM_LABEL_UTILIZ_OD%>
                    </label><br/>


                    <img id="<%=UserConstants.ADM_RIGHT_UTILIZ_ADM%>"
                         src="<%=UserUtils.hasAdmRightUtilizatoriAdministrare(useru) ? hasAccessImg : noAccessImg %>"/>

                    <label
                            for="<%= UserConstants.ADM_RIGHT_UTILIZ_ADM%>"><%= UserConstants.ADM_LABEL_UTILIZ_ADM%>
                    </label><br/>
                </div>


                <img id="<%=UserConstants.ADM_RIGHT_NOMENCLATOR_BDI%>"
                     src="<%=UserUtils.hasAdmRightNomenclatoareBdi(useru) ? hasAccessImg : noAccessImg %>"/>

                <label
                        for="<%=UserConstants.ADM_RIGHT_NOMENCLATOR_BDI%>"><%=UserConstants.ADM_LABEL_NOMENCLATOR_BDI%>
                </label> &nbsp;
                <br/>


                <img id="<%=UserConstants.ADM_RIGHT_NOMENCLATOR_GENERALE%>"
                     src="<%= UserUtils.hasAdmRightNomenclatoareGenerale(useru) ?hasAccessImg : noAccessImg %>"/>

                <label
                        for="<%=UserConstants.ADM_RIGHT_NOMENCLATOR_GENERALE%>"><%=UserConstants.ADM_LABEL_NOMENCLATOR_GENERALE%>
                </label> &nbsp;
                <br/>


                <img id="<%=UserConstants.ADM_RIGHT_VOLUM_INSTALATII%>"
                     src="<%= UserUtils.hasAdmRightVolumInstalatii(useru) ? hasAccessImg : noAccessImg %>"/>

                <label
                        for="<%=UserConstants.ADM_RIGHT_VOLUM_INSTALATII%>"><%=UserConstants.ADM_LABEL_VOLUM_INSTALATII%>
                </label> &nbsp;
                <br/>


                <img id="<%=UserConstants.ADM_RIGHT_SESIUNI_RAPORTARE%>"
                     src="<%=UserUtils.hasAdmRightSesiuniRaportare(useru)  ? hasAccessImg : noAccessImg %>"/>

                <label
                        for="<%=UserConstants.ADM_RIGHT_SESIUNI_RAPORTARE%>"><%=UserConstants.ADM_LABEL_SESIUNI_RAPORTARE%>
                </label> &nbsp;
                <br/>


                <img id="<%=UserConstants.ADM_RIGHT_CONSTANTA_AD%>"
                     src="<%=UserUtils.hasAdmRightConstantaAD(useru)  ?  hasAccessImg : noAccessImg %>"/>

                <label
                        for="<%=UserConstants.ADM_RIGHT_CONSTANTA_AD%>"><%=UserConstants.ADM_LABEL_CONSTANTA_AD%>
                </label> &nbsp;
                <br/>


                <img id="<%=UserConstants.ADM_RIGHT_PROPRIETATI%>"
                     src="<%=UserUtils.hasAdmRightProprietati(useru)  ? hasAccessImg : noAccessImg %>"/>

                <label
                        for="<%=UserConstants.ADM_RIGHT_PROPRIETATI%>"><%=UserConstants.ADM_LABEL_PROPRIETATI%>
                </label> &nbsp;


            </td>
            <td width="200px">


                <img id="<%=UserConstants.ADM_RIGHT_SEMNALIZARI%>"
                     src="<%=UserUtils.hasAdmRightSemnalizari(useru)  ? hasAccessImg : noAccessImg %>"/>

                <label
                        for="<%=UserConstants.ADM_RIGHT_SEMNALIZARI%>"><%=UserConstants.ADM_LABEL_SEMNALIZARI%>
                </label> &nbsp;
                <br/>


                <img id="<%=UserConstants.ADM_RIGHT_CE_NIVELE_TENSIUNE%>"
                     src="<%=UserUtils.hasAdmRightCeNiveleTensiune(useru) ? hasAccessImg : noAccessImg %>"/>

                <%=UserConstants.ADM_LABEL_CE_NIVELE_TENSIUNE%>
                </label> &nbsp;
                <br/>


                <img id="<%=UserConstants.ADM_RIGHT_CE_DISPECERI%>%>"
                     src="<%=UserUtils.hasAdmRightCeDispeceri(useru)  ? hasAccessImg : noAccessImg %>"/>

                <label
                        for="<%=UserConstants.ADM_RIGHT_CE_DISPECERI%>"><%=UserConstants.ADM_LABEL_CE_DISPECERI%>
                </label> &nbsp;
                <br/>


                <img id="<%=UserConstants.ADM_RIGHT_SYNC_AC_MANAGER%>"
                     src=" <%=UserUtils.hasAdmRightSyncAcManager(useru)  ? hasAccessImg : noAccessImg %>"/>

                <label
                        for="<%=UserConstants.ADM_RIGHT_SYNC_AC_MANAGER%>"><%=UserConstants.ADM_LABEL_SYNC_AC_MANAGER%>
                </label> &nbsp;
                <br/>


                <img id="<%=UserConstants.ADM_RIGHT_MESSAGE%>%>"
                     src="<%=UserUtils.hasAdmRightMessage(useru)  ?  hasAccessImg : noAccessImg %>"/>

                <label
                        for="<%=UserConstants.ADM_RIGHT_MESSAGE%>"><%=UserConstants.ADM_LABEL_MESSAGE%>
                </label> &nbsp;
                <br/>


                <img id="<%=UserConstants.ADM_RIGHT_LOGURI%>"
                     src=" <%=UserUtils.hasAdmRightLoguri(useru) ? hasAccessImg : noAccessImg %>"/>

                <label
                        for="<%=UserConstants.ADM_RIGHT_LOGURI%>"><%=UserConstants.ADM_LABEL_LOGURI%>
                </label> &nbsp;


            </td>
        </tr>
    </table>
    <% } %>


</fieldset>
</td>
</TABLE>

<script type="text/javascript">

    function lockUnlockUser( btn){
        if( confirm('Doriti <%= useru.getLocked() == 0 ? "blocarea" : "deblocarea" %> utilizatorului ?')) {
            btn.enabled = false;
            window.location = '<%=AppConstants.APP_NAME%>?action=edit-user-lock&id=<%=useru.getId()%>';
        }
    }

    function modificaUser( btn){
        btn.enabled = false;
        window.location = '<%=AppConstants.APP_NAME%>?action=edit-user&id=<%=useru.getId()%>';
    }

</script>

<%@include file="../../message.jsp" %>
