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

<%--'MASINT-2194 || MohiniM || 7-Oct-2021 - Start--%>

<asp:Content runat="server" ContentPlaceHolderID="MainContent" ID="DocUpload">
    <link href="DocumentUpload.css" type="text/css" rel="stylesheet" />


    <asp:UpdatePanel runat="server" ID="upnlDocUpload" UpdateMode="Conditional">
        <ContentTemplate>
            <table>
                <tr>
                    <td>
                        <asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="upnlDocUpload"
                            DisplayAfter="0">
                            <ProgressTemplate>
                                <div class="divLoading">
                                    <img alt="Loading" src="../App_Resources/loading.gif" /><span class="lbl">Loading...&nbsp;&nbsp;
                                    </span>
                                </div>
                            </ProgressTemplate>
                        </asp:UpdateProgress>
                    </td>
                </tr>
            </table>
            <table>
                <td>
                    <tr>
                        <asp:Label ID="lblError" runat="server" CssClass="lblError MarginLeft"></asp:Label>
                    </tr>
                </td>
            </table>
            <table style="margin-left: 15px; margin-bottom: 15px">
                <tr>
                    <td class="tdheading" id="tdheading" runat="server">
                        <asp:Label runat="server" ID="lblHeading" CssClass="lbl lblHeading" Text="Attachment Details"></asp:Label>
                    </td>
                </tr>
            </table>
            <table style="margin-left: 14px; margin-bottom: 5px" align="top">
                <tr>
                    <td align="top">
                        <asp:Button ID="btnAddrow" runat="server" Text="Add Document" Width="120px" CssClass="btn" Style="margin-right: 10px" />
                    </td>
                    <td align="top">
                        <asp:Button Text="Close" runat="server" CssClass="btn" Width="120px" OnClientClick="ClosePopup();" ID="btnClose" />
                    </td>
                    <%--Code Added to show Note as suggested || Ref: MASINT-2040 || Start--%>
                     <%--'MASCLI-1461 || MohiniM || 16-Sep-2021--%>
                    <td id="tdnote" runat="server">
                        <table style="margin-left: 14px; margin-bottom: 5px">
                            <tr>
                                <td class="notepaddingtop">
                                    <asp:Label ID="lblnote" runat="server" Text="Note - " CssClass="lbl notifyorderdoc"></asp:Label>
                                </td>
                                <td class="notepaddingtop">
                                    <asp:Label ID="lbldocsizenotif" runat="server" Text="* Maximum allowed document upload size is: " CssClass="lbl notifyorderdoc"></asp:Label>
                                    <asp:Label ID="lbldocsize" runat="server" Text="" CssClass="lbl notifyorderdoc"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td class="notepaddingtop"></td>
                                <td>
                                    <asp:Label ID="lblsuppfileextmsg" runat="server" Text="* Supported file extensions are: " CssClass="lbl notifyorderdoc"></asp:Label>
                                    <asp:Label ID="lblfilestension" runat="server" Text="" CssClass="lbl notifyorderdoc"></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <%--Code Added to show Note as suggested || Ref: MASINT-2040 || End--%>

                </tr>
            </table>

            <div class="MarginLeft">
                <asp:UpdatePanel ID="grddocPnl" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:GridView runat="server" CssClass="Grid" ID="grdDocumentUpload" PageSize="99"
                            AutoGenerateColumns="false" OnRowCommand="grdDocumentUpload_RowCommand" BorderStyle="None"
                            AllowPaging="true" ShowHeaderWhenEmpty="true" EmptyDataText="No Documents found.">
                            <%--ShowHeader="false">--%>
                            <HeaderStyle CssClass="GridHeader" />
                            <PagerStyle CssClass="GridPager" />
                            <RowStyle CssClass="GridItem" />
                            <%--MASINT-2046 || MohiniM || 4-Oct-2021--%>
                            <AlternatingRowStyle CssClass="GridItem" />
                            <SelectedRowStyle CssClass="GridItemSelect" />

                            <Columns>
                                <asp:TemplateField>
                                    <HeaderStyle CssClass="widthbtnminus" />
                                    <ItemStyle CssClass="widthbtnminus" />
                                    <HeaderTemplate>
                                        <asp:LinkButton ID="btnAdd" runat="server" CssClass="btnadd visibleNone" Width="25px"   
                                            CommandName="+" Style="background-image: url('../App_Resources/plus2.png'); height: 19px !important;"></asp:LinkButton>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="btnminus" runat="server" CommandName="-" CssClass="btnadd" Width="25px"
                                            Style="background-image: url('../App_Resources/minus2.png')" Visible="true" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Event" HeaderStyle-CssClass="Event" ItemStyle-CssClass="Event">
                                    <ItemTemplate>
                                        <asp:DropDownList runat="server" ID="ddleventName" CssClass="ddl EventDll"
                                            AutoPostBack="true" OnSelectedIndexChanged="ddleventName_SelectedIndexChanged">
                                        </asp:DropDownList>
                                        <%--  Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Event").ToString)%>'
                                <%--<asp:Label runat="server" ID="lbleventname" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Event").ToString)%>'></asp:Label>--%>
                                        <asp:Label runat="server" ID="lblmand" CssClass="lbl colormandatory" Text=""></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="EDMS Y/N" HeaderStyle-CssClass="edms" ItemStyle-CssClass="edms" ItemStyle-HorizontalAlign="Center">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lblEDMSYN" CssClass="lbl edms"
                                            Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.EDMS_YN").ToString)%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Template" HeaderStyle-CssClass="Event" ItemStyle-CssClass="Event" Visible="false">
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lbltemplate" CssClass="lbl"
                                            Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.TemplateCode").ToString)%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="File Name" HeaderStyle-CssClass="uploader" ItemStyle-CssClass="uploader">
                                    <ItemTemplate>
                                        <asp:FileUpload runat="server" ID="uploader_doc" CssClass="uploader visibleNone" type="file" onchange="setFileName(this)"></asp:FileUpload>
                                        <asp:TextBox ID="txtBrowse" runat="server" CssClass="txt uploader" OnClick="openFileBrowser(this); return false;"
                                            Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Document").ToString)%>'></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Updated By" HeaderStyle-CssClass="updatedby" ItemStyle-CssClass="updatedby">
                                    <HeaderStyle CssClass="updatedby" />
                                    <ItemStyle CssClass="updatedby" />
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lbluploadedby" CssClass="lbl updatedby"
                                            Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.UploadedBy").ToString)%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Updated At" HeaderStyle-CssClass="updatedat" ItemStyle-CssClass="updatedat">
                                    <HeaderStyle CssClass="updatedat" HorizontalAlign="Center" />
                                    <ItemStyle CssClass="updatedat" HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lbluploadedAt" CssClass="lbl updatedat"
                                            Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.UploadedAt").ToString)%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="" HeaderStyle-CssClass="btnimport" ItemStyle-CssClass="btnimport">
                                    <ItemTemplate>
                                        <asp:Button Text="Upload" runat="server" ID="btnImport" CssClass="btn btnimport" CommandName="FileUpload" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="" HeaderStyle-CssClass="btnimport" ItemStyle-CssClass="btnimport">
                                    <ItemTemplate>
                                        <asp:Button Text="View" runat="server" ID="btnView" CssClass="btn btnimport" CommandName="ViewDoc" 
                                            OnClientClick="EnableDisableButton(this);" OnClick="grdDocumentUpload_RowCommand"/>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="" HeaderStyle-CssClass="btnremove" ItemStyle-CssClass="btnremove">
                                    <ItemTemplate>
                                        <asp:Button runat="server" ID="btnDelete" CssClass="imgRemove" ToolTip="Remove" CommandName="RemoveDoc" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="MandatoryYN" HeaderStyle-CssClass="Event" ItemStyle-CssClass="Event" Visible="false">
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lblmandatoryYN" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Mandatory_YN").ToString)%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Document Full Path" HeaderStyle-CssClass="Event" ItemStyle-CssClass="Event" Visible="false">
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lbldocumentFullpath" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.DocumentFullPath").ToString)%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                     <%--'MASCLI-1461 || MohiniM || 16-Sep-2021--%>
                                <asp:TemplateField HeaderText="Doc ID" HeaderStyle-CssClass="Event" ItemStyle-CssClass="Event" Visible="false">
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lbldocID" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.DGT_ID").ToString)%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>

                         <%--'MASCLI-2114 || MohiniM || 26-Nov-2021--%>
                        <asp:HiddenField ID="HdnEnableViewDocument" runat="server" />
                        <asp:HiddenField ID="hdnVirtualDocPath" runat="server" />
                        <asp:HiddenField ID="hdnviewedFile" runat="server" />
                        <asp:HiddenField ID="hdnviewrowID" runat="server" />
                        <asp:HiddenField ID="hdnVirtualDocAlias" runat="server" />
                        <asp:button ID="hdnviewdocbtn" runat="server" style="visibility:hidden"/>
                        <asp:button ID="hdndeleteviewedDoc" runat="server" style="visibility:hidden"/>
                    </ContentTemplate>
                    <Triggers>
                        <asp:PostBackTrigger ControlID="grdDocumentUpload" />
                    </Triggers>
                </asp:UpdatePanel>
            </div>
            <asp:HiddenField ID="hdndocwidth" runat="server" />  <%--changes on 6-sep-21|| mascli-1374--%>
            <asp:HiddenField ID="hdndocheight" runat="server" />  <%--changes on 6-sep-21|| mascli-1374--%>

            <asp:Button ID="hdnsaveuploadedbtn" runat="server" Visible="false" />
            <asp:HiddenField ID="hdnfileuploaded" runat="server" />
            <asp:HiddenField ID="hdnproductCode" runat="server" />
            <asp:HiddenField ID="hdntransactiontype" runat="server" />
            <asp:HiddenField ID="HdnEnableDelete" runat="server" />
            <asp:HiddenField ID="HdnEnableViewDoc" runat="server" />
            <asp:HiddenField ID="hdnTemplateId" runat="server" />
        </ContentTemplate>

    </asp:UpdatePanel>
    <script type="text/javascript" src="AttachDocument.js"></script>
</asp:Content>



<%--'MASINT-2194 || MohiniM || 7-Oct-2021 - END--%>