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

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> 
<asp:content id="Content1" contentplaceholderid="MainContent" runat="Server">

   
    <link href="../App_Themes/Style1.css" rel="stylesheet" type="text/css" />

   

    <style type="text/css">
         fieldset
         {
             border:1px solid #ddd !important;
         }

    </style>


        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>

                <table width="100%">
                    <tr>
                        <td>
                            <asp:Label ID="lblerror" runat="server" CssClass="lblerror"></asp:Label>   
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div>
                                <table>
                                    <tr>
                                        <td>
                                            <asp:Panel ID="PnlUploadPDS" runat="server" GroupingText="Upload PDS" CssClass="lbl"  >
                                                <table>
        
                                                <tr>
                                                    <td >
                                                        <div style="display: none;">
                                                            <asp:FileUpload ID="PDSUpload" runat="server" style="width:433px;" autopostback="true" onchange="setFileName(this)"/>
                                                        </div>
                                                            <asp:TextBox ID="txtBrowse" runat="server" CssClass="txt txtBrowse" Width="240px" OnClick="openFileBrowser(); return false;" TabIndex="3" ToolTip=""></asp:TextBox>
                                                            <asp:Button ID="btnBrowse" Text="Browse" runat="server" CssClass="btn btnSize" Width="118px" style="margin-left:8px;" TabIndex="4"  OnClientClick="openFileBrowser(); return false;" />
                                                    </td>
                                                    <td>
                                                        <asp:Button ID="BtnUpload" runat="server" Text="Upload" CssClass="btn" Width="118px" Enabled="false" OnClientClick="Upload_Document()"/>  <%--OnClientClick="move()"--%>
                                                        <asp:Label ID="lblNotification" runat="server" CssClass="lblerror"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="0" >
                                                            <ProgressTemplate >
                                                                <div>
                                                                        <img alt="Loading" src="../App_Resources/loading.gif" /><span class="">Loading...</span> 
                                                                </div> 
                                                            </ProgressTemplate>
                                                        </asp:UpdateProgress>
                                                    </td>
                                                </tr>
                                            </asp:Panel> 
                                        </td> 
                                    </tr>
                                    <tr>
                                        <td>
    
                                        <td colspan="2">
                                        </td>
                                    </tr>  
                                    </table>   
                            </div>
                        </td>
                    </tr>  
                </table>
                <table>
                    <tr>
                        <td>

                             <asp:Panel ID="pnlAllDocuments" runat="server" GroupingText="Uploaded Documents">
                              <asp:DataGrid ID="dgUploadedBond" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="3" CssClass="Grid" PageSize="20" Width="600px"      >
                                        <SelectedItemStyle CssClass="GridItemSelect" />
                                        <ItemStyle CssClass="GridItem" />
                                        <HeaderStyle CssClass="GridHeader" />
                                        <FooterStyle CssClass="GridFooter"  />
                                        <PagerStyle Mode="NumericPages" CssClass="GridPager"     />
                                        <Columns>
                                               <asp:TemplateColumn HeaderText="Ref ID." Visible="false">
                            
                                                  <ItemTemplate>
                                                        <asp:Label  ID="lblNote_Ref_ID" runat="server"  Text ='<%#  Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Note_Ref_ID").tostring) %>'      /> 
                                                             <%--<asp:LinkButton ID = "lnkShowFile" runat = "server"  Text = '<%#  Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Note_Ref_ID").tostring) %>' />--%>                 
                                                    </ItemTemplate>
                                                        <HeaderStyle Wrap="true" HorizontalAlign="Center" VerticalAlign="Middle"  />
                                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="True" />
                                                 </asp:TemplateColumn>
                                        
                     
                                                <asp:TemplateColumn  HeaderText="File Name"  >
                            
                                                <ItemTemplate>
                                                    <asp:Label  ID="lblDocument_Output_Path" runat="server"  Text ='<%#  Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Document_Output_Path").tostring) %>'       />      
                                                
                                                </ItemTemplate>
                                                    <HeaderStyle Wrap="true" HorizontalAlign="Center" VerticalAlign="Middle"  />
                                                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Wrap="True" />
                                                </asp:TemplateColumn>
                     
                                             <asp:TemplateColumn  HeaderText="Remove File"  >
                        
                                              <ItemTemplate>
                                                    <asp:LinkButton   ID="lnkRemove" runat="server" Text ="Remove"  CommandName="Remove_File" CommandArgument='<%#  Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.DGT_ID").tostring) %>' Font-Underline="true"           />      
                                                           <cc1:ConfirmButtonExtender ID ="BtnExtDelete" runat="server" ConfirmText="Are you sure you want to delete ?" TargetControlID="lnkRemove"></cc1:ConfirmButtonExtender>                  
                                                </ItemTemplate>
                                                    <HeaderStyle Wrap="true" HorizontalAlign="Center" VerticalAlign="Middle"  />
                                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="True" />
                                             </asp:TemplateColumn>
                      
                                       
                                         </Columns> 
                              </asp:DataGrid>
                             </asp:Panel> 

                             <asp:HiddenField ID="hdnConfigValuePDSUpload" runat="server" />
                             <asp:HiddenField ID="hdnConfigValueDocgen_PDS_Upload_VirtualPath" runat="server" />
                             <asp:HiddenField ID="hdnConfigValuePDS_Path" runat="server" />
                             <asp:HiddenField ID="hdnIssuerInsertion" runat="server" />
                             <asp:HiddenField ID="hdnDoc_Limit" runat="server" />
                        </td>
                    </tr>
                </table>

                <script type="text/javascript">

                    window.onload = function () {
                        //alert(window.top.name);
                        if ((window.top.name == 'openprofile') || (window.top.name == 'openaccount') || (window.top.name == 'OrderEntryDetails') || (window.top.name == 'OpenPopup') || (window.top.name == 'ORDAMEND') || (window.top.name == 'ModalPopUp')) {
                            $("#ctl00_trMenu").css("display", "none");
                        }
                        $('body').focus();
                    }
                    function Upload_Document() {
                        //alert("1");
                        document.getElementById("<%=lblNotification.ClientID%>").innerHTML = "Uploading Document...Please wait...!";

                    }

                    function openFileBrowser() {
                        var fileuploadctrl = document.getElementById('<%=PDSUpload.ClientID%>');
                        fileuploadctrl.click();
                    }

                    function setFileName(selectedFile) {
                        var file = selectedFile.files[0];
                        var filename = file.name;
                        if (filename != "") {
                            document.getElementById('<%=BtnUpload.ClientID%>').disabled = false;
                        }
                        else {
                            document.getElementById('<%=BtnUpload.ClientID%>').disabled = true;
                        }
                        $('#<%=txtBrowse.ClientID%>').val(filename);


                        document.getElementById('<%=txtBrowse.ClientID%>').setAttribute('title', selectedFile.value);
                    }

                </script>

                </ContentTemplate>
                <Triggers><asp:PostBackTrigger ControlID="BtnUpload" /> </Triggers>
        </asp:UpdatePanel>

</asp:content>

