<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Masters/AgentMaster.Master"
    CodeBehind="UploadDocument.aspx.cs" Inherits="CasheeremitAgent.Customer.UploadDocument" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cpHead" runat="server">
    <script type="text/javascript">

        function swaRedirect(val, typ) {
            swal({
                title: "",
                text: val,
                type: typ,
                showConfirmButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "OK",
                closeOnConfirm: false
            }, function (isConfirm) {
                if (isConfirm) {
                    window.location.href = '<%=redurl %>';
                }
                else {
                }
            });
        }


        function DisplayWaiting(validationgroup) {

            if (Validate(validationgroup) == 'success') {
                setTimeout('document.images["imgLoad"].src = "../Styles/images/loading.gif"', 10);
            }
        }
        function Fail_alert() {
            swal({ title: "", text: "Upload failed. Please try again later.", type: "info" });
        }


        function validate_ID_FileSize(source, arguments) {

            arguments.IsValid = false;
            source.className = "errMsg";

            var uploadControl = document.getElementById('<%= FileUpDoc_ID.ClientID %>');
            var filesize = '<%=ConfigurationManager.AppSettings["UploadFileSize"].ToString() %>'

            if (uploadControl.files[0].size > filesize) {
                source.innerHTML = "FileSize exceeds the limit.please try uploading smaller size files.";
                arguments.IsValid = false;
            }
            else {
                arguments.IsValid = true;
            }
        }

        window.document.title = "File Upload";
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpLyremit" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="600">
    </asp:ScriptManager>
    <div id="Div1" runat="server" class="col-md-12">
        <script type="text/javascript">
            
        </script>
        <div class="clearfix">
            &nbsp;</div>
        <h3>
            Upload Document</h3>
        <div class="clearfix">
            &nbsp;</div>
        <div id="dvUpload" runat="server" class="col-md-12">
            <div class="col-md-6">
                <div class="row mrgBot10">
                    <div class=" col-md-3">
                        Remitter ID<span class="starRed">*</span>
                    </div>
                    <div class=" col-md-7">
                        <asp:TextBox ID="txtremid" class="txtboxM" runat="server" ReadOnly="true"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please Enter Remitter ID."
                            CssClass="errMsg" ControlToValidate="txtremid" ValidationGroup="Submit" Display="Dynamic"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="regremID" runat="server" ValidationGroup="Submit"
                            ControlToValidate="txtremid" Display="Dynamic" class="errMsg" ErrorMessage="Please enter a valid RemitterID"
                            ValidationExpression="^([a-zA-Z0-9]{5,50})$"></asp:RegularExpressionValidator>
                    </div>
                </div>
                <div id="divIDDoc" class="row mrgBot10" runat="server">
                    <div class=" col-md-3">
                        <asp:Label ID="lblFileUpload" runat="server" Text="Upload File (Photo ID Proof )"></asp:Label>
                        <span class="starRed">*</span>
                    </div>
                    <div class=" col-md-7">
                        <asp:FileUpload ID="FileUpDoc_ID" runat="server" />
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ValidationGroup="Submit"
                            ControlToValidate="FileUpDoc_ID" Display="Dynamic" class="errMsg" ErrorMessage="Please select a valid file"
                            ValidationExpression="^.*\.(jpg|JPG|jpeg|JPEG|gif|GIF|pdf|PDF|png|PNG|tif|TIF|tiff|TIFF)$"></asp:RegularExpressionValidator>
                        <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="FileUpDoc_ID"
                            ClientValidationFunction="validate_ID_FileSize" Font-Size="X-Small" Display="Dynamic"
                            ValidationGroup="Submit"></asp:CustomValidator>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="Please Select File."
                            CssClass="errMsg" ControlToValidate="FileUpDoc_ID" ValidationGroup="Submit" Display="Dynamic"></asp:RequiredFieldValidator>
                    </div>
                    <div id="divDocIDMsg" class="span12 mrg5-TB" runat="server" visible="false">
                        <span>Please upload your <b>| ID Proof :
                            <asp:Label ID="lblDocType" runat="server" Text="National Insurance Number"></asp:Label>
                            |</b> choosen at the time of registration</span>
                    </div>
                </div>
            </div>
            <br />
            <br />
            <div class="clearfix">
                &nbsp;</div>
            <div class="clearfix">
                &nbsp;</div>
            <div>
                <div class=" col-md-10">
                    <span><b style="font-size: 13px;">Note:</b>
                        <ul style="padding: 10px; font-size: 11px; color: Orange;">
                            <br />
                            <li><b>Upload file formats allowed:</b> JPEG/JPG/GIF/PDF/PNG/TIF/TIFF with a max file
                                size of <b>5 MB</b>.</li>
                        </ul>
                    </span>
                </div>
            </div>
            <div class="clearfix">
                &nbsp;</div>
            <div class="mrg10-T span7">
                <asp:Button ID="btnSubmit" runat="server" CssClass="btnB" Text="Submit" OnClick="btnSubmit_click"
                    ValidationGroup="Submit" />
            </div>
            <div class="clrfx">
                &nbsp;</div>
        </div>
    </div>
    <div id="dvProgressbar">
        <asp:Button runat="server" ID="Button1" Style="display: none" />
        <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Style="display: none">
            <div class="modal1">
                <div class="center1">
                    <!-- Start -->
                    <img id="imgLoad" alt="Please wait....." src="../Styles/images/loading.gif" />
                    <!-- End -->
                    <asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server" TargetControlID="Button1"
                        PopupControlID="Panel1" BackgroundCssClass="modalBackground" DropShadow="false" />
                </div>
            </div>
        </asp:Panel>
    </div>
</asp:Content>
