<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ImportPaymentRequest.aspx.cs" Inherits="APC.Forms.Workflow.ImportPaymentRequest" %>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script src="../../Scripts/script.js"></script>
    <script language="javascript">
        var progressKey;
    </script>
</head>
<body>
    <form id="form1" runat="server">
            <ext:ResourceManager ID="ResourceManager" runat="server"  Theme="Gray" />
         <ext:Viewport ID="Viewport1" runat="server" Layout="BorderLayout">
         <Items>
          <ext:FormPanel ID="UploadForm" runat="server" Width="500" Title="Upload an Attachment" AutoHeight="true" LabelWidth="50" Header="false" Layout="VBoxLayout" Frame=true>    
           <LayoutConfig>
            <ext:VBoxLayoutConfig Align="Stretch" />   
           </LayoutConfig>
            
            <Defaults>
                <ext:Parameter Name="allowBlank" Value="false" Mode="Raw" />
                <ext:Parameter Name="msgTarget" Value="side" Mode="Value" />
            </Defaults>
            <Items>
                 <ext:FileUploadField ID="fuExcel" runat="server"  EmptyText="Select an attachment"   FieldLabel="Import Excel"  Icon="ImageAdd" />
                 <ext:FileUploadField ID="fuAttachments" runat="server"  EmptyText="Select an attachment"   FieldLabel="Attachment Zip"  Icon="TransmitAdd" AllowBlank="true"/>
                 <ext:ProgressBar ID="pbProgress" runat="server" Width="480" Padding="2" Frame="False"/>
            </Items>
            <Buttons>
                <ext:Button ID="SaveButton" runat="server" Text="OK">
                    <DirectEvents>
                        <Click OnEvent="SaveClick"
                            Before="if (!#{UploadForm}.getForm().isValid()) { return false; }
                            #{SaveButton}.setDisabled(true);
                            #{CancelButton}.setDisabled(true); 
                            Ext.Msg.wait('Uploading your Attachments...', 'Uploading');"                                
                            Failure="Ext.Msg.show({ title   : 'Error',   msg : 'Error during uploading',  minWidth: 200, modal   : true, icon    : Ext.Msg.ERROR, buttons : Ext.Msg.OK  });">
                        </Click>
                    </DirectEvents>
                </ext:Button>
                <ext:Button ID="CancelButton" runat="server" Text="Cancel">
                <Listeners>
                <Click Handler="parent.Ext.WindowMgr.getActive().close()" />
                </Listeners>
                </ext:Button>

            </Buttons>
            </ext:FormPanel>
         </Items>
         </ext:Viewport>
                          <ext:TaskManager ID="taskProgress" runat="server">
                 <Tasks>
                                 <ext:Task TaskID="longactionprogress"  Interval="1000" AutoRun="True" OnStart="Ext.Msg.hide();"  OnStop="#{SaveButton}.setDisabled(false);#{CancelButton}.setDisabled(false);">
                    <DirectEvents>
                        <Update OnEvent="RefreshProgress">
                        <ExtraParams>
                            <ext:Parameter Name="ProgressId" Value=progressKey Mode="Raw" Encode="false"/>
                        </ExtraParams>
                        </Update>

                    </DirectEvents>                    
                </ext:Task>
            </Tasks>
        </ext:TaskManager>


    </form>
</body>
</html>
