<% @Import Namespace="Seven.Front" %>
<% @Import Namespace="Seven.Front.Globals" %>
<% @Import Namespace="Seven.Front.Objects" %>
<%@ Page Language="C#" MasterPageFile="Model.Master" AutoEventWireup="true" CodeBehind="DisponibilidadHabitaciones.aspx.cs" Inherits="Seven.Front.DisponibilidadHabitaciones" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

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

    <title><%=L.TIT("DisponibilidadHabitaciones") %> [4.6]</title>
    
    <script type="text/javascript">

        function Ver()
        {
            window.location.href = "DisponibilidadHabitaciones.aspx?s=" + $('#txtFecIni').val() +
                "&f=" + $('#txtFecFin').val() + "&t=" + $('#cbTipoHabi').val() + "&o=" + $('input[name=rbOrden]:checked').val();
        }

        function VerW() {
            window.open("DisponibilidadHabitacionesW.aspx?s=" + $('#txtFecIni').val() +
                "&f=" + $('#txtFecFin').val() + "&t=" + $('#cbTipoHabi').val() + "&o=" + $('input[name=rbOrden]:checked').val(), "_blank");
        }

        function DialogoDetalle(hab, fecha, estado) {
            $.ajax({
                url: 'Servicio.svc/GetDisponibilidadHabitacionesDetalle',
                data: {
                    "id_habi": hab, "fecha" : fecha, "estado": estado
                , "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 %>"
                },
                dataType: "json",
                type: "GET",
                contentType: "application/json; charset=utf-8",
                beforeSend: function () {
                    $('#dlgCargando').dialog('open');
                },
                success: function (json) {
                    $('#dlgCargando').dialog('close');
                    try {
                        $('#dlgDetalleCargo').html(json.d);
                        $('#dlgDetalleCargo').dialog('open');
                    }
                    catch (err) {
                        $('#dlgInformation').html(json.d);
                        $('#dlgInformation').dialog('open');
                    }
                }
            });
        }

        function CambiarHabi(rese, nro, hab) {
            $.ajax({
                url: 'Servicio.svc/PutDHCambioHabitacion',
                data: {
                    "reserva": rese, "numero": nro, "id_habi_ori": hab, "id_habi_des": $('#cbCambioHabiDH').val()
                , "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 %>"
                },
                dataType: "json",
                type: "GET",
                contentType: "application/json; charset=utf-8",
                beforeSend: function () {
                    $('#dlgCargando').dialog('open');
                },
                success: function (json) {
                    var res = json.d;
                    if (res > 0 || res < 0) {
                        Ver();
                    }
                    else {
                        $('#dlgCargando').dialog('close');
                        $('#dlgInformation').html(json.d);
                        $('#dlgInformation').dialog('open');
                    }
                }
            });
        }

        Date.prototype.addDays = function (days) {
            var dat = new Date(this.valueOf());
            dat.setDate(dat.getDate() + days);
            return dat;
        }

        function InitializeComponentsDH()
        {
            $('#txtFecIni').on('change', function () {
                var hasta = $('#txtFecIni').datepicker('getDate');
                $('#txtFecFin').datepicker('setDate', hasta.addDays(30));
            });
            $('#txtFecIni').on('input', function ()
            {
                var hasta = $('#txtFecIni').datepicker('getDate');
                $('#txtFecFin').datepicker('setDate', hasta.addDays(30));
            });
        }

    </script>

    <script type="text/javascript">

        $(document).ready(function () {

            $("#dlgCargando").dialog({
                autoOpen: false,
                show: "fade",
                hide: "curtain",
                resizable: false,
                height: 100,
                width: 270,
                modal: true,
                dialogClass: 'no-close'
            });

            $("#dlgDetalleCargo").dialog({
                autoOpen: false,
                show: "fade",
                hide: "curtain",
                resizable: false,
                height: 500,
                width: 510,
                modal: true,
                buttons: {
                    "<%=L.LBL("LblGENAceptar") %>": function () {
                        $(this).dialog("close");
                    }
                }
            });

            $("#dlgInformation").dialog({
                autoOpen: false,
                show: "fade",
                hide: "curtain",
                resizable: false,
                height: 167,
                width: 500,
                modal: true
            });

            $("#SevenMenu").accordion("option", "active", 4);

            $("#EnlaceMaestro").focus();

            $("#cbTipoHabi").val(<%=id_thab %>);

            InitializeComponentsDH();

        });

    </script>

</asp:Content>

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

    <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#M5';" style="cursor: pointer;">
                        <table>
                            <tr>
                                <td>
                                    <img src="img/application-icon-large.png" />
                                </td>
                                <td>
                                    <%=L.LBL("LblGENMenuTactil") %>
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
                <td>&nbsp;</td>
                <td>
                    <a href="../Inicio.aspx"><%=L.LBL("LblGENInicio") %></a>
                    <img src="../img/arrow.png" alt="" />
                    <a href="#"><%=L.TIT("DisponibilidadHabitaciones") %> [4.6]</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="SevenMedio">
                    
            <div id="SevenInterno" style="width: 1000px; height: 850px;">

                <div id="dlgCargando" title="<%=L.LBL("LblGENLoading") %>" style="text-align: center; padding-top: 25px">
                    <img src="img/cargando2.gif" alt="<%=L.LBL("LblGENLoading") %>" />
                </div>

                <div id="dlgInformation" title="<%=L.LBL("LblGENInformation") %>" style="text-align: center; padding-top: 25px">
                </div>

                <div id="dlgDetalleCargo" title="<%=L.LBL("LblGENInformation") %>" style="padding-top: 25px">
                    
                </div>

                <br />

                <table>
                    <tr>
                        <td>
                            <span class="SevenTitulo"><%=L.TIT("DisponibilidadHabitaciones") %> [4.6]</span>
                        </td>
                        <td>&nbsp;&nbsp;&nbsp;</td>
                        <td>
                            <div class="SevenEnlaces">
                                <table>
                                    <tr>
                                        <td>
                                            <a href="#" onclick="window.open('http://mysevenmanuales.jimdo.com/front-desk/4-6-disponibilidad-por-habitaciones/', '_blank');" id="A1" >
                                                <img src="img/question.png" /> <%=L.LBL("LblGENHelp") %>
                                            </a>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                        <td>
                            <div class="SevenEnlaces">
                                <table>
                                    <tr>
                                        <td>
                                            <a href="#" onclick="VerW();" id="A2" >
                                                <img src="img/Seven/FDK/DispHab.png" /> <%=L.LBL("LblGENOriginal") %>
                                            </a>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>

                <br />

                <table>
                    <tr>
                        <td>
                            <%=L.LBL("LblGENStart") %>:
                        </td>
                        <td>
                            <input type="text" id="txtFecIni" value="<%=String.Format("{0:d}", FecIni) %>" class="eligeFecha" style="width: 100px;" />
                        </td>
                        <td>
                            <%=L.LBL("LblGENEnd") %>:
                        </td>
                        <td>
                            <input type="text" id="txtFecFin" value="<%=String.Format("{0:d}", FecFin) %>" class="eligeFecha" style="width: 100px;" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <%=L.LBL("LblGENTipoHab") %>:
                        </td>
                        <td colspan="3">
                            <%=cbTipoHabi %>
                        </td>
                        <td>
                            <%=L.LBL("LblGENOrder") %>:
                        </td>
                        <td>
                            <input type="radio" name="rbOrden" value="1" <% if(orden == 1){ %> checked="checked" <% } %> /><%=L.LBL("LblGENRoomType") %>
                            <input type="radio" name="rbOrden" value="0" <% if(orden == 0){ %> checked="checked" <% } %> /><%=L.LBL("LblGENRoom") %>
                            <%--<input type="radio" name="rbOrden" value="1" <% if(orden == 2){ %> checked="checked" <% } %> /><%=L.LBL("LblGENRoomTypeByOrder") %>--%>
                        </td>
                        <td>
                            <button type="button" onclick="Ver();">
                                <table>
                                    <tr>
                                        <td>
                                            <img src="img/magnifier16.png" alt="" />
                                        </td>
                                        <td>
                                            <%=L.LBL("LblGENVer") %>
                                        </td>
                                    </tr>
                                </table>
                            </button>
                        </td>
                    </tr>
                </table>

                <br />

                <table>
                    <tr>
                        <td style="background-color: #FFFFFF">
                            <asp:ScriptManager ID="ScriptManager1" runat="server">
                            </asp:ScriptManager>
                            <rsweb:ReportViewer ID="rpvReporte" runat="server" Font-Names="Verdana" 
                                Font-Size="8pt" InteractiveDeviceInfos="(Colección)" 
                                WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Width="1000px" Height="700px">
                                
                            </rsweb:ReportViewer>
                        </td>
                    </tr>
                </table> 
            </div>
                    
        </div>
                
    </div>

</asp:Content>
