<%@ Import Namespace="Seven.Front" %>
<%@ Import Namespace="Seven.Front.Globals" %>
<%@ Import Namespace="Seven.Front.Objects" %>

<%@ Page Language="C#" MasterPageFile="Model.Master" AutoEventWireup="true" CodeBehind="Menu.aspx.cs" Inherits="Seven.Front.Menu" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cpHeader" runat="server">

    <% try
        { %>

    <title><%=L.LBL("LblGENMenu") %></title>

    <script type="text/javascript">

        function mostrarAjaxAccordionP() {

            $.ajax({
                type: "GET",
                url: 'Servicio.svc/GetMenuP',
                data: {
                    "U": "<%=Request.Cookies[Parametros.COOKIE_USR].Value %>", "N": "<%=Request.Cookies[Parametros.COOKIE_NOM].Value %>"
                    , "D": "<%=Request.Cookies[Parametros.COOKIE_DAT].Value %>", "I": "<%=Enigma.Encriptar(Request.ServerVariables["REMOTE_ADDR"]) %>"
                    , "LangCode": "<%=LangCode %>", "SubDir": "0"
                },
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (json) {

                    datos = JSON.parse(json.d);

                    //console.log(json.d);

                    var j = 0;
                    var k = 0;
                    for (var i = 0; i < datos.rows.length; i++) {
                        if (datos.rows[i].cell[4] == 0) {
                            $("#MenuP ul").append('<li ><a href="#M' + j + '"><table><tr><td><img src="img/' + datos.rows[i].cell[1] + '" /></td><td class="CLogo"></td><td> <%=L.LBL("LblGENMyMenu")%> </td></tr></table></a></li>');
                            var Padre = i;
                            $("#MenuP").append('<div id="M' + j + '"><table id="SubMenu' + j + '"><tr></tr></table></div>');
                            j++;
                        }
                        else {
                            k = j - 1;
                            $("#M" + k + "").append('<button type="button" id="' + i + '" class="SubMenubutton" onclick="Pagina(datos.rows[' + i + '].cell[3])"><table><tr><td><img src="img/' + datos.rows[i].cell[1] + '"/></td><td style=\"padding-left: 5px;\">' + datos.rows[i].cell[2] + '</td></tr></table></button>');

                        }

                    }

                    jQueryUIOtraVez();

                    //$("#MenuP").tabs();

                }
            });
        };

        function mostrarAjaxAccordion() {

            $.ajax({
                type: "GET",
                url: 'Servicio.svc/GetMenu',
                data: {
                    "U": "<%=Request.Cookies[Parametros.COOKIE_USR].Value %>", "N": "<%=Request.Cookies[Parametros.COOKIE_NOM].Value %>"
                    , "D": "<%=Request.Cookies[Parametros.COOKIE_DAT].Value %>", "I": "<%=Enigma.Encriptar(Request.ServerVariables["REMOTE_ADDR"]) %>"
                    , "LangCode": "<%=LangCode %>", "SubDir": "0"
                },
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (json) {

                    datos = JSON.parse(json.d);

                    //console.log(json.d);

                    var j = 1;
                    var k = 1;
                    for (var i = 0; i < datos.rows.length; i++) {
                        if (datos.rows[i].cell[4] == 0) {
                            $("#MenuP ul").append('<li ><a href="#M' + j + '"><table><tr><td><img src="img/' + datos.rows[i].cell[1] + '" /></td><td class="CLogo"></td><td>' + datos.rows[i].cell[2] + '</td></tr></table></a></li>');
                            var Padre = i;
                            $("#MenuP").append('<div id="M' + j + '"><table id="SubMenu' + j + '"><tr></tr></table></div>');
                            j++;
                        }
                        else {
                            k = j - 1;
                            $("#M" + k + "").append('<button type="button" id="' + i + '" class="SubMenubutton" onclick="Pagina(datos.rows[' + i + '].cell[3])"><table><tr><td><img src="img/' + datos.rows[i].cell[1] + '"/></td><td style=\"padding-left: 5px;\">' + datos.rows[i].cell[2] + '</td></tr></table></button>');

                        }

                    }

                    $("#MenuP").tabs();

                    jQueryUIOtraVez();

                }
            });
        };

        function Pagina(Dir) {
            //window.open(Dir, "", '_top');
            window.top.location.href = Dir;
        }

        $(document).ready(function () {

            //mostrarAjaxAccordionP();
            //mostrarAjaxAccordion();

            $("#MenuP").tabs();
        });

    </script>

    <style type="text/css">
        /*******************************************************
         *
         * Menú Táctil
         *
         *******************************************************/

        #MenuP {
            background: transparent;
            border: none;
            white-space: normal;
            text-align: center;
        }

        #MenuTactilMedio {
            display: table-cell;
        }

        #MenuTactil {
            margin-left: 0 auto;
            margin-right: 0 auto;
            font-size: 8pt;
            white-space: nowrap;
        }

        /*Fondo de Botones*/
        .SubMenubutton {
            /*background: rgba(231, 243, 231,1);
            border: none;*/
            margin: 5px;
            width: 185px;
            height: 70px;
            cursor: pointer;
            overflow: hidden;
            text-align: left;
        }

            /*Aclarar color al pasar el mouse encima*/
            .SubMenubutton:hover {
                /*background: rgba(167, 195, 167, 0.40);*/
            }

        /*Para la cabecera*/
        .MenuPesta ul { /*.ui-tabs .ui-tabs-nav*/
            background: transparent;
            border: none;
        }

        /*Para el botón pestana*/
        .MenuPesta a { /*.ui-tabs .ui-state-default a*/
            font-size: 14px;
            font-weight: bold;
            text-transform: uppercase;
            background: #E6EDF7;
            border: none;
            /*border-bottom:3px solid #1ec40b;*/
            border-bottom: 3px solid #829DB4;
            /*border-bottom:10px solid #3e3e3e;*/
            padding: unset;
        }

            /*Para el botón pestana al pasar por encima*/
            .MenuPesta a:hover { /*.ui-tabs .ui-state-default a:hover*/
                background: #C7E1ED;
                color: black;
            }

        /*Para el botón pestana activo*/
        .MenuPesta .ui-tabs-active a, .MenuPesta .ui-tabs-active a:hover {
            background: #DCF1F7;
            /*border-bottom:3px solid #25f50e;*/
            border-bottom: 6px solid #95BDDE;
            color: black;
        }

        .MenuPesta .ui-tabs-nav .ui-state-default {
            background: transparent;
            border: none;
        }

        /*quita cuadro de selecion en los tabs*/
        a:focus {
            outline: 0px;
        }

        /*Centrar Tabs*/
        .MenuPesta .ui-tabs-nav {
            text-align: center;
        }

            .MenuPesta .ui-tabs-nav li {
                float: none !important;
                display: inline-block;
            }

        /*separar logo y titulo*/
        .CLogo {
            width: 5px;
        }
    </style>


    <% }
        catch { } %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="cpPrincipal" runat="server">

    <% try
        { %>

    <div id="SevenBreadcrumb" class="ui-state-default">
        <table style="width: 100%; white-space: nowrap;">
            <tr>
                <td>
                    <div class="SevenEnlaces" onclick="window.location.href='Menu.aspx#M1';" style="cursor: pointer;">
                        <table>
                            <tr>
                                <td>
                                    <img src="img/application-icon-large.png" />
                                </td>
                                <td>
                                    <%=Seven.Front.L.LBL("LblGENMenuTactil") %>
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
                <td>&nbsp;</td>
                <td>
                    <a href="Menu.aspx"><%=L.LBL("LblGENMenu") %></a>
                </td>
                <td style="width: 100%;"></td>
                <td>
                    <%=L.LBL("LblGENLanguage") %>
                </td>
                <td>
                    <!-- #include file="LanguageCombo.html" -->
                </td>
            </tr>
        </table>
    </div>

    <div id="SevenPrincipal">


        <div id="MenuTactilMedio">

            <div id="MenuTactil" style="width: 100%;">

                <div id="MenuP" class="MenuPesta">
                    <ul>
                        <%
                            foreach (System.Data.DataRow dr in MenuUser.Rows)
                            {
                                if (dr[1].ToString() == "1")
                                {
                                    Response.Write(Utils.GetMenuOption(dr[0].ToString(), dr[1].ToString()));
                                    //Response.Write(dr[0].ToString());
                                }
                            }

                            foreach (System.Data.DataRow dr in MenuP.Rows)
                            {
                                if (dr[1].ToString() == "1")
                                {
                                    //Response.Write(Utils.GetMenuOption(dr[0].ToString(), dr[1].ToString()));
                                    Response.Write(dr[0].ToString());
                                }
                            }
                        %>
                    </ul>

                    <%
                        foreach (System.Data.DataRow dr in MenuUser.Rows)
                        {
                            if (dr[1].ToString() != "1")
                            {
                                //Response.Write(Utils.GetMenuOption(dr[0].ToString(), dr[1].ToString()));
                                Response.Write(dr[0].ToString());
                            }
                        }

                        foreach (System.Data.DataRow dr in MenuP.Rows)
                        {
                            if (dr[1].ToString() != "1")
                            {
                                //Response.Write(Utils.GetMenuOption(dr[0].ToString(), dr[1].ToString()));
                                Response.Write(dr[0].ToString());
                            }
                        }
                    %>
                </div>

            </div>

        </div>

    </div>

    <% }
        catch { } %>
</asp:Content>

