<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AuditHistory.ascx.cs" Inherits="APC.Forms.BaseUserControls.AuditHistory" %>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<ext:FormPanel ID="pnlContainer" runat="server" Layout="ColumnLayout" AutoScroll="true">
<Items>
 <ext:GridPanel ID="grdData" runat="server" Title="Audit History" AutoScroll="true" ColumnWidth=".5">
            <Store>
                <ext:Store ID="storeItems" runat="server">
                <Model>
                    <ext:Model ID="modelItems" runat="server" IDProperty="Oid">
                    <Fields>
                        <ext:ModelField Name="AuditDate" SortType=AsDate Type=Date/>
                        <ext:ModelField Name="UserName"/>
                        <ext:ModelField Name="Step"/>
                        <ext:ModelField Name="AssignedDate" Type="Date" />
                        <ext:ModelField Name="CompletedDate" Type="Date" />
                        <ext:ModelField Name="TimeTaken" />
                    </Fields>
                </ext:Model>
                </Model>
                <Sorters>
                    <ext:DataSorter Property="AuditDate" Direction="ASC" />
                </Sorters>
                </ext:Store>
               </Store>
                <ColumnModel>
                <Columns>
                <ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" />
                 <ext:DateColumn ID="colAuditDate" Format="yyyy-MM-dd hh:mmtt" runat="server" Text="Date" DataIndex="AuditDate" Width="130" Sortable="True"/>             
                 <ext:Column ID="colAuditUser" runat="server" Text="User" DataIndex="UserName" Width="150" Sortable="True"/>
                 <ext:Column ID="colAuditStep" runat="server" Text="Step Description" DataIndex="Step" Width="150" Sortable="True" />
                 <ext:DateColumn ID="colAuditAssign" Format="yyyy-MM-dd hh:mmtt" runat="server" Text="Assign Date" DataIndex="AssignedDate" Width="130"/>            
                 <ext:DateColumn ID="colAuditComplete" Format="yyyy-MM-dd hh:mmtt" runat="server" Text="Complete Date" DataIndex="CompletedDate" Width="130"/>              
                 <ext:Column ID="colAuditTime" runat="server" Text="Time Taken" DataIndex="TimeTaken" Width="130"/>             
            </Columns>            
        </ColumnModel> 
        <SelectionModel>
        <ext:RowSelectionModel ID="rsmAudit" runat="server" SingleSelect="true">
         <DirectEvents>
            <Select OnEvent="LoadAuditDetail" Buffer="250">
                    <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="#{pnlAuditInfo}" />
                        <ExtraParams>
                            <ext:Parameter Name="AuditId" Value="record.getId()" Mode="Raw" />
                        </ExtraParams>
                 </Select>
           </DirectEvents>
        </ext:RowSelectionModel>
    </SelectionModel>
</ext:GridPanel>
        <ext:FormPanel runat="server" ID="pnlAuditInfo" Title="Details" Border="True" Icon="Information" Layout="AnchorLayout" ColumnWidth=".5" AutoScroll="true" Height="260" Frame="true">
        <FieldDefaults LabelAlign="Top" LabelStyle="font-weight:bold"/>
        <Items>
                <ext:DisplayField ID="txtAuditDate" runat="server" FieldLabel="Date" AnchorHorizontal="100%"/>
                <ext:DisplayField ID="txtAuditUser" runat="server" FieldLabel="User" AnchorHorizontal="100%"/>
                <ext:DisplayField ID="txtAuditStep" runat="server" FieldLabel="Step" AnchorHorizontal="100%"/>
                <ext:TextArea ID="txtAuditNotes" runat="server" FieldLabel="Internal Notes" AnchorHorizontal="100%" LabelAlign="Top" ReadOnly="true" Height="50" MaxHeight="50" Padding="2" />
                <ext:TextArea ID="txtAuditExtNotes" runat="server" FieldLabel="External Notes" AnchorHorizontal="100%" LabelAlign="Top" ReadOnly="true" Height="50" MaxHeight="50" Padding="2" />
            </Items>

         </ext:FormPanel>
         </Items>
          <Buttons>
                 <ext:Button ID="OKButton" runat="server" Text="OK">
                 <Listeners>
                 <Click Handler="parent.Ext.WindowMgr.getActive().close();" />
                 </Listeners>
                </ext:Button>
            </Buttons>
</ext:FormPanel>