<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="AttachDocument_Gen.aspx.vb" Inherits="FinIQWebApp.AttachDocument_Gen" MasterPageFile="~/FiniqAppMasterPage.Master" %>

<asp:content id="Content1" contentplaceholderid="MainContent" runat="Server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"></asp:ScriptManagerProxy>
    <link href="../App_Themes/Style1.css?V=1" rel="stylesheet" />
    <asp:Panel ID="Panel1" runat="server" Width="725px">
        <style>
            .lblwarning {
                color: #0368b6 !important;
            }

            .lblSuccess {
                color: #008000 !important;
            }

            .lblerror {
                color: #ff6767 !important;
            }

            .lblBlue {
                color: #0284e0 !important;
                font : normal 11px verdana !important;
                /*font-weight: bold !important;*/
                text-decoration: none !important;
                margin-left: -140px;
            }
        </style>

        <table class="tbl">

            <tr>
                <td style="vertical-align: middle;">
                    <asp:Label ID="LblAttached" Style="white-space: nowrap;" CssClass="lbl lblwarning" runat="server"></asp:Label>
                    <asp:LinkButton ID="lblViewDocument" Visible="false" runat="server" Text="" Style="white-space: nowrap;"></asp:LinkButton>
                </td>

                <td rowspan="2"></td>
            </tr>
            <tr>
                <td colspan="3" style="height:20px;">
                    <asp:Label ID="LblErrorMessage" Style="white-space: nowrap;" CssClass="lbl lblerror" runat="server"></asp:Label>
                    <asp:Label ID="lblSuccess" Style="white-space: nowrap;" CssClass="lbl lblSuccess" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="LblTemplateName" Style="white-space: nowrap;" CssClass="lbl" runat="server" Text="Template Name"></asp:Label></td>
                <td colspan="3" style="width: 300px !important; text-wrap: normal !important;">
                    <asp:Label ID="LblTemplateNameValue" Style="white-space: nowrap;" CssClass="lbl" runat="server" Width="265px"></asp:Label></td>
            </tr>

            <tr>
                <td>
                    <asp:Label ID="LblProducName" Style="white-space: nowrap;" CssClass="lbl" runat="server" Text="Product Name"></asp:Label></td>
                <td colspan="3">
                    <asp:Label ID="LblProducNameValue" Style="white-space: nowrap;" CssClass="lbl" runat="server"></asp:Label></td>
            </tr>

            <%--<tr>
                <td>
                    <asp:Label ID="LblCounterParty" Style="white-space: nowrap;" CssClass="lbl" runat="server" Text="Counter-Party"></asp:Label></td>
                <td colspan="3">
                    <asp:Label ID="LblCounterPartyValue" Style="white-space: nowrap;" CssClass="lbl" runat="server"></asp:Label></td>

            </tr>--%>
            <%--<tr>
                <td>
                    <asp:Label ID="LblDealNo" Style="white-space: nowrap;" CssClass="lbl" runat="server" Text="Tranche No."></asp:Label></td>
                <td colspan="3">
                    <asp:Label ID="lblTrancheNoValue" Style="white-space: nowrap;" CssClass="lbl" runat="server"></asp:Label></td>
            </tr>--%>

            <tr>
                <td>
                    <label id="lbl1" style="white-space: nowrap;" class="lbl">Attach document for </label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlEventCode" CssClass="ddl" runat="server" Width="265px" AutoPostBack="true" />
                    <asp:ImageButton ImageUrl="../App_Resources/Excel.jpg"  runat="server" ID="lnkSampleSchedule" ToolTip="Sample Schedule file" Visible="False" style="vertical-align:middle;"/>                                  
                </td>

                <%--<td id="tdSampleScheduleFile" runat="server" style="display:none;">
                   -<asp:HyperLink ID="lnkSample" runat="server" CssClass="lblBlue">Sample Schedule file</asp:HyperLink>  --NavigateUrl="~/DocumentGeneration/CertPlus_Schedule_SampleFile.xls"---
                     <asp:ImageButton ImageUrl="../App_Resources/Excel.jpg"  runat="server" ID="lnkSampleSchedule" ToolTip="Sample Schedule file" />
                </td>--%>
            </tr>
            <tr>
                <td>
                    <label id="lbl2" class="lbl" style="white-space: nowrap;">Select document</label></td>
                <td>
                    <asp:FileUpload ID="FileUpload1" runat="server" Height="17px" Width="264px" />
                </td>
            </tr>           

            <tr>
                <td style="vertical-align: middle;">
                    <label id="Label1" class="lbl">Remark (max 200 characters) </label>
                </td>
                <td>
                    <asp:TextBox ID="txtRemark" TextMode="MultiLine" runat="server" Height="82px" Width="257px" onkeypress="return CheckLength();" /></td>
                <%-- maxlength="5" onkeypress="maxLength(this);"--%>
            </tr>
            <tr>
                <td colspan="4"></td>
            </tr>
            <tr>
                <td></td>
                <%--Changed By : Pooja S || Asked By : Tushar || For ELI || 08-Jan-2018--%>
                <td style="vertical-align: middle;">
                    <asp:Button ID="btnAttachDocument" CssClass="btn" runat="server" Text="Attach document" Width="125px" />
                    &nbsp;
                    <asp:Button ID="btnAttachmentDone" CssClass="btn" runat="server" Text="Generate Docs" Width="125px" />

                    <asp:Button ID="btnSkipAttachment" CssClass="btn" runat="server" Text="Skip attachment" Width="125px" Visible="false" />
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <%--Changed By : Pooja S || Asked By : Tushar || For ELI || 08-Jan-2018--%>
                    <asp:Button ID="btnAttachAndDoNotGenerateDocument" CssClass="btn" runat="server" Enabled="true" Text="Attach document &amp; don't generate confo" Visible="false" Width="260px" />
                    <asp:Button ID="btnSkipAttachmentAndDoNotGenerateDocument" CssClass="btn" runat="server" Enabled="false" Text="Skip document &amp; don't generate confo" Visible="false" Width="260px" />

                </td>
            </tr>

        </table>
        <table>
            <tr>
                <td>
                    <asp:Label ID="AttchedTermSheetDetails" runat="server">  Attached Termsheet</asp:Label>
                </td>
            </tr>
            <tr>
                <td style="text-align: center;">
                    <%--<asp:GridView ID="GridViewAttachedDocument" CssClass="Grid" runat="server" AutoGenerateColumns="False" EmptyDataText="No files uploaded">--%>
                    <asp:GridView ID="GridViewAttachedDocument" runat="server" AllowSorting="True" AutoGenerateColumns="False" BorderStyle="None" BorderWidth="0px" CellPadding="3"
                        CssClass="Grid" ShowHeaderWhenEmpty="true" Width="800px">
                        <HeaderStyle CssClass="GridHeader" />
                        <RowStyle CssClass="GridItem" />

                        <EmptyDataTemplate>
                            <asp:Label ID="lblqueuedatagrid" runat="server" Text="No files uploaded"></asp:Label>
                        </EmptyDataTemplate>
                        <Columns>
                            <asp:BoundField DataField="SrNo" HeaderText="Sr. No." ItemStyle-Width="50px">
                                <ItemStyle Wrap="false" HorizontalAlign="right" />
                            </asp:BoundField>
                            <asp:BoundField DataField="DGT_ID" HeaderText="Attached Document Id" Visible="true" ItemStyle-Width="80px">
                                <ItemStyle Wrap="False" HorizontalAlign="right" />
                                <HeaderStyle Wrap="true" HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="EventName" HeaderText="Event Name" ItemStyle-Width="150px"></asp:BoundField>
                            <asp:BoundField DataField="VersionDetails" HeaderText="Version Details" ItemStyle-Width="30px">
                                <ItemStyle Wrap="false" HorizontalAlign="Right" />
                            </asp:BoundField>

                            <%-- <Start || Added by Nikita S || To display filename || 04-Apr-2018 || told by Tushar A>--%>

                            <asp:TemplateField HeaderText="File Name">
                                <HeaderStyle Width="93px" Wrap="true" HorizontalAlign="Center" VerticalAlign="Middle" />
                                <ItemStyle Width="93px" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="True" />
                                <ItemTemplate>
                                    <asp:Label ID="lblFileName" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Document_Output_Path").ToString)%>' />
                                </ItemTemplate>
                            </asp:TemplateField>

                            <%-- <End || Added by Nikita S || To display filename || 04-Apr-2018 || told by Tushar A>--%>

                            <asp:BoundField DataField="AttachedBy" HeaderText="Attached By" ItemStyle-Width="80px" />

                            <asp:BoundField DataField="AttachedAt" HeaderText="Attached At" DataFormatString="{0:dd-MMM-yyyy hh:mm:ss tt}">
                                <ItemStyle Wrap="false" HorizontalAlign="center" />
                                <HeaderStyle Wrap="true" HorizontalAlign="Center" />
                            </asp:BoundField>

                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:LinkButton ID="lnkDownload" Text="View Document" runat="server" CommandArgument='<%# Container.DataItemIndex %>' CommandName="DownLoad" Width="90px"></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="Event Code" Visible="false">                               
                                <ItemTemplate>
                                    <asp:Label ID="lblEventCode" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Event_Code").ToString)%>' />
                                </ItemTemplate>
                            </asp:TemplateField>                           
                        </Columns>
                    </asp:GridView>
                </td>
            </tr>
        </table>
        <%--<input type="hidden" id="hdnButtonCaption" value="" runat="server" />--%>
        <%--<asp:HiddenField ID="hdnButtonCaption" runat="server" />   --%>
    </asp:Panel>

    <script type="text/javascript">
        function closepop() {
            window.top.CloseParentDialog();
        }
        //Added By : Pooja S || Asked By : yeshwant || JIRA || 19-JAN-18
        function CheckLength() {
            var textbox = document.getElementById("<%=txtRemark.ClientID%>").value;
            if (textbox.trim().length >= 200) {
                return false;
            }
            else {
                return true;
            }
        }
    </script>

</asp:content>
