<%@ Page Language="C#" Async="true" AutoEventWireup="true" CodeBehind="frmeSign.aspx.cs" Inherits="KPlus_DocuSign.frmeSign" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    
    <link href="App_Themes/css/StyleSheet.css" rel="stylesheet" />
    <link href="App_Themes/css/form-style.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" />
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>

    <style type="text/css">
        #overlay {
            background-color: rgba(0, 0, 0, 0.8);
            z-index: 99;
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            display: none;
        }

        #dialogShowInvoice {
            z-index: 9999;
        }

        #pdfviewer {
            width: 100%;
        }
        .showInvoiceButton {
            background-color: rgb(0,71,111);
            border-radius: 3px;
            border: none;
            cursor: pointer;
            color: #ffffff;
            font-family: Arial;
            font-size: 14px;
            font-weight: bold;
            padding: 7px;
            text-decoration: none;
        }
        .showInvoiceButton:hover {
        background-color: #337bc4;
    }

    </style>
</head>
<body>
    <form id="form1" runat="server">
        <asp:SqlDataSource ID="sqlDSPDF" runat="server" ConnectionString="<%$ ConnectionStrings:dbConnectionString %>" ProviderName="<%$ ConnectionStrings:dbConnectionString.ProviderName %>"></asp:SqlDataSource>
        <asp:SqlDataSource ID="sqlDSDocuSign" runat="server" ConnectionString="<%$ ConnectionStrings:dbConnectionString %>" ProviderName="<%$ ConnectionStrings:dbConnectionString.ProviderName %>"></asp:SqlDataSource>
        <div style="display: none;" id="dialogShowInvoice">
            <div style="width: 100%; height: 100%" id="divInvoice"></div>
        </div>

<%--        <div id="overlay"></div>

        <script>
            $(function () {
                $('#dialogShowInvoice').dialog({
                    autoOpen: false,
                    draggable: true,
                    resizable: true,
                    modal: false,
                    title: 'eSignature',
                    width: 400,
                    height: 'auto',
                    closeOnEscape: true,
                    position: { my: "center", at: "center", of: window },
                    close: function (event, ui) {
                        $("#overlay").hide();
                        var nr = $('#dialogShowInvoice').data('param');
                        $("#" + '<%= hdnImgData.ClientID %>').val(nr);
                        document.getElementById("<%=btnSaveeSign.ClientID %>").click();
                    }
                });

                $('.showInvoiceButton').click(function (event) {
                    //var adr = $('#address').val();
                    //$("#overlay").show();
                    //$('#dialogShowInvoice').dialog('open');
                    //$('#divInvoice').html("<iframe src='" + adr + "' frameBorder='0' scrolling='no' height='100%' style='min-height:100%;'></iframe>");
                    //$('#divInvoice iframe').width(370);
                    //$('#divInvoice iframe').height(180);
                });
            });
        </script>--%>
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div class="container">
            <img src="images/kplus_helpdesk.gif" />
            <header>
                <h1>Sign Backup Document</h1>
            </header>    
            <hr />
            <section class="main">
                <asp:HiddenField ID="hdnImgData" runat="server" />
                <asp:HiddenField ID="hdnUserId" runat="server" />
                <asp:HiddenField ID="hdnFileName" runat="server" />
                <asp:HiddenField ID="hdnUrl" runat="server" />
                <asp:HiddenField ID="hdnClientId" runat="server" />
                <asp:HiddenField ID="address" runat="server" />
                <asp:Label ID="lblErrMsg" runat="server" CssClass="errmsg"></asp:Label>
                <div class="section group">
                    <div class="col span_4_of_4">
                        <iframe runat="server" id="pdfviewer" style="background-color: #fff;"></iframe>
                    </div>
                    <asp:Panel ID="Panel1" runat="server" Style="text-align: center">
                        <%--<asp:HyperLink ID="hlSignature" runat="server" CssClass="showInvoiceButton" NavigateUrl="#" Font-Bold="True" Font-Underline="False">Click here to Sign Document</asp:HyperLink>&nbsp;--%>
                        <asp:Button ID="btnSaveeSign" runat="server" CssClass="showInvoiceButton" Text="Click here to Sign Document" OnClick="btnSaveeSign_Click" />
                    </asp:Panel>
                </div>
            </section>
        <asp:LinkButton ID="lbtnBNote" runat="server" Style="display: none"></asp:LinkButton>
        <asp:ModalPopupExtender ID="mpeBillingNote" runat="server" BackgroundCssClass="modalBackground" CancelControlID="btnClose" DropShadow="True" Enabled="True" PopupControlID="pnlBillingNote" TargetControlID="lbtnBNote"></asp:ModalPopupExtender>
        <asp:Panel ID="pnlBillingNote" runat="server" CssClass="modalPopupB" Style="display: none;">
            <div class="header">
                <asp:Label ID="lblHeader" runat="server" Text=""></asp:Label>
            </div>
            <div class="body">
                <br />
                <table style="width: 100%;">
                    <tr>
                        <td>Enter Your Name</td>
                        <td>&nbsp;</td>
                        <td><asp:TextBox ID="txtName" runat="server" Width="250px" AutoCompleteType="Disabled"></asp:TextBox></td>
                    </tr>                    
                </table>
                <br />
            </div>
            <div class="footer">
                <asp:Button ID="btnSave" runat="server" Text="Save" Width="70px" Height="25px" OnClick="btnSave_Click" />
                <asp:Button ID="btnClose" runat="server" Text="Cancel" Width="70px" Height="25px" />
            </div>
        </asp:Panel>
        </div>
        <script type="text/javascript">            
            // Selecting the iframe element
            document.getElementById("pdfviewer").height = window.innerHeight - 220;
            $(window).load(function () {
                var $contents = $('#pdfviewer').contents();
                $contents.scrollTop($contents.height());
            });
        </script>
    </form>
</body>
</html>
