<%@ Page Language="C#" MasterPageFile="~/masterpages/eDashboard.master" AutoEventWireup="True"
    Inherits="site_HITS_ReturnedDevices_Default" Title="Brightstar Device Protection: Returned Devices" Theme="eMain"
    Culture="auto" UICulture="auto" CodeBehind="Default.aspx.cs" %>

<%@ Register Src="~/Controls/ScriptingHelper.ascx" TagName="ScriptingHelper" TagPrefix="uc" %>
<%@ Register Src="~/Controls/HITSCalendar.ascx" TagName="HITSCalendar" TagPrefix="uc" %>
<%@ Register Src="~/Controls/DefaultHeader.ascx" TagName="DefaultHeader" TagPrefix="uc" %>
<%@ Register Src="~/Controls/CustomSorter.ascx" TagName="CustomSorter" TagPrefix="uc" %>
<%@ Register Assembly="eSecuritel.HITS.UI.Components" Namespace="eSecuritel.HITS.UI.Components" TagPrefix="cc1" %>
<%@ Register Src="~/Controls/ReturnedDevices/UpdateChargebackPopup.ascx" TagName="ucUpdateChargebackPopup" TagPrefix="uc" %>


<asp:Content ID="Content1" ContentPlaceHolderID="eContent" runat="Server">

    <script src="../../../script/eSetFormControls.js" type="text/javascript"></script>

    <script src="../../../script/eGridHelper.js" type="text/javascript"></script>
    
    <script type = "text/javascript">
        function SetTarget() {
                        document.forms[0].target = "_blank";
        }
    </script>
  
    <uc:ScriptingHelper ID="ScriptingHelper1" runat="server" />

    <table width="100%">
        <tr>
            <td>
                <h1>
                    <asp:Literal ID="m_litHeader" runat="server" Text="<%$ Resources: LogisticsManagement, TitleeSecuritelReturnedDevices %>" />
                </h1>
            </td>
        </tr>
    </table>
    <!---------------------------------UC----------------------------------->
    <uc:DefaultHeader ID="DefaultHeader1" runat="server" />
    <!---------------------------------T1----------------------------------->
    <div class="mastersearch">
        <table cellspacing="0" cellpadding="0">
            <tr>
                <td style="padding-right: 0px">
                    <img id="m_imgSearchCriteria" runat="server" src="../../../images/Collapse_13x13.jpg"
                        class="showstate" onclick="expandMasterSearch(this, 'm_pnlMasterSearchCriteria')"
                        alt="contract" />
                </td>
                <td width="100%" valign="middle">
                    <asp:Literal ID="m_litSearchUsersHeader" runat="server" Text="<%$ Resources: Default, LabelSearchCriteria %>" />
                </td>
            </tr>
        </table>
    </div>
    <div id="m_pnlMasterSearchCriteria" style="background-color: #DBDCDE">

        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
            <ContentTemplate>
                <table border="0" cellpadding="0" cellspacing="0" class="gvTable">
                    <tr valign="top">
                        <td style="width: 230px;" align="right">&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td align="right" nowrap="nowrap" style="width: 114px">&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td align="center" rowspan="1" valign="top">&nbsp;
                        </td>
                        <td rowspan="1" valign="top">&nbsp;
                        </td>
                    </tr>
                    <tr valign="top" class="gvTable">
                        <td>
                            <table width="950">

                                <tr>
                                    <td align="right">
                                        <asp:Literal ID="m_litDateFrom" runat="server" Text="<%$ Resources : Default,LabelStartDate %>" />
                                    </td>
                                    <td >
                                        <uc:HITSCalendar ID="m_calDateFrom" runat="server" DateTextBox-Width="150px"/>
                                    </td>
                                    <td align="right">
                                        <asp:Literal ID="m_litDateTo" runat="server" Text="<%$ Resources : Default,LabelEndDate %>" />
                                    </td>
                                    <td>
                                        <uc:HITSCalendar ID="m_calDateTo" runat="server" DateTextBox-Width="150px"/>
                                    </td>
                                    <td align="right">
                                        <asp:Literal ID="m_litIdentification" runat="server" Text="<%$ Resources : Default,LabelIdentification %>" />
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="ddlIdentificationSearch" runat="server" style="width: 162px">
                                            <asp:ListItem Text="<%$ Resources: Default, ListItemAll %>" Value="0"></asp:ListItem>
                                            <asp:ListItem Text="<%$ Resources:Default, LabelUnidentified %>" Value="1"></asp:ListItem>
                                            <asp:ListItem Selected="True" Text="<%$ Resources:Default, LabelIdentified %>" Value="2"></asp:ListItem>
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Literal ID="m_litEsn" runat="server" Text="<%$ Resources : Default,LabelESN %>" />
                                    </td>
                                    <td>
                                        <asp:TextBox ID="m_txtEsn" runat="server" Width="150px" />
                                    </td>
                                    <td align="right">
                                        <asp:Literal ID="m_litRma" runat="server" Text="<%$ Resources : Default,LabelRMA %>" />
                                    </td>
                                    <td>
                                        <asp:TextBox ID="m_txtRma" runat="server" Width="150px" />
                                    </td>
                                    <td align="right">
                                        <asp:Literal ID="m_litTracking" runat="server" Text="<%$ Resources : Default,LabelTracking %>" />
                                    </td>
                                    <td>
                                        <asp:TextBox ID="m_txtTracking" runat="server" Width="150px" />
                                    </td>

                                </tr>
                                <tr>
                                    <td style="text-align: right">
                                        <asp:Literal ID="ltlStatus" runat="server" Text="<%$ Resources:LogisticsManagement, LabelStatus%>"></asp:Literal></td>
                                    <td style="text-align: left" colspan="1">
                                        <%--<asp:DropDownList ID="ddlStatus" Width="150px" runat="server"></asp:DropDownList>--%>
                                        <asp:ListBox ID="ddlStatus" runat="server" SelectionMode="Multiple" Width="150px" OnSelectedIndexChanged="ddlStatus_SelectedIndexChanged" AutoPostBack="True"></asp:ListBox>
                                
                                    <td style="text-align: right">
                                        <asp:Literal ID="Literal1" runat="server" Text="<%$ Resources:LogisticsManagement, LabelActionTaken%>"></asp:Literal></td>
                                    <td style="text-align: left" colspan="1">
                                        <%--<asp:DropDownList ID="ddlActionTaken" Width="150px" runat="server"></asp:DropDownList>--%>
                                        <asp:ListBox ID="ddlActionTaken" runat="server" SelectionMode="Multiple" Width="150px" Height="60"></asp:ListBox>
                                
                                    <td style="text-align: right">
                                        <asp:Literal ID="Literal2" runat="server" Text="<%$ Resources:LogisticsManagement, LabelTriageCategory%>"></asp:Literal></td>
                                    <td style="text-align: left" colspan="1">
                                        <%--<asp:DropDownList ID="ddlTriageCategory" Width="150px" runat="server"></asp:DropDownList>--%>
                                        <asp:ListBox ID="ddlTriageCategory" runat="server" SelectionMode="Multiple" Width="150px"></asp:ListBox>
                                
                                </tr>
                                <tr>
                                     <td style="text-align: right">
                                        <asp:Literal ID="Literal3" runat="server" Text="<%$ Resources:LogisticsManagement, LabelTriageCodes%>"></asp:Literal></td>
                                    <td style="text-align: left" colspan="1">
                                        <%--<asp:DropDownList ID="ddlTriageCodes" Width="225px" runat="server"></asp:DropDownList>--%>
                                        <asp:ListBox ID="ddlTriageCodes" runat="server" SelectionMode="Multiple" Width="150px"></asp:ListBox>

                                    <td align="right" nowrap="nowrap">
                                        <asp:Literal ID="m_litPageSize" runat="server" Text="<%$ Resources:HandsetManagement, LabelRecordsPerPageColon %>" />
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="m_ddlPageSize" runat="server" style="margin-left: 0px;">
                                            <asp:ListItem Text="20" Value="20"></asp:ListItem>
                                            <asp:ListItem Text="50" Value="50"></asp:ListItem>
                                            <asp:ListItem Text="100" Value="100"></asp:ListItem>
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                            </table>
                        </td>

                    </tr>
                    <tr valign="top">
                        <td style="width: 130px" align="right">&nbsp;
                        </td>
                        <td>
                           <%-- <asp:CustomValidator ID="atLeastOneSeach" runat="server" 
                                ErrorMessage="*Atleast one of ESN, RMA, or Tracking is required"
                                OnServerValidate="atLeastOneSeach_ServerValidate"
                                ></asp:CustomValidator>--%>
                        </td>
                        <td align="right" nowrap="nowrap" style="width: 114px">&nbsp;
                        </td>
                        <td nowrap></td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                    </tr>
                     <tr valign="top">
                        <td>
                            <asp:CustomValidator ID="CustomValidator1" runat="server" 
                                ErrorMessage="<%$ Resources: LogisticsManagement, AtleastOneOfESNRMATrackingRequired %>" 
                                OnServerValidate="AtLeastOneSearchCriteria_ServerValidate">
                            </asp:CustomValidator>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>

    <!--------------------------------Buttons---------------------------------->
    <div align="center" id="divSearchButtons">
        <asp:Button ID="btnSearch" runat="server" Text="<%$ Resources: Default, ButtonSearch %>" CssClass="pagebutton" Font-Bold="False"
            OnClick="btnSearch_Click" OnClientClick="return btnSearch_Click();" />
        <input id="btnClear" type="button" runat="server" value="<%$ Resources: Default, ButtonClear %>" class="pagebutton" />
    </div>
    <br />
    <!---------------------------------Grid Pnl----------------------------------->
    <asp:Panel ID="m_pnlGrid" Visible="false" runat="server">
        <!-------------------------------------------------------------------->

        <!---------------------------------T2----------------------------------->
        <asp:Panel ID="m_pnlSearchResults" Width="100%" runat="server">
            <h2>
                <asp:Literal ID="m_litSearchResults" runat="server" Text="<%$ Resources: Default, LabelSearchResults %>" />
            </h2>
            <asp:Label ID="lblSuccess" runat="server" CssClass="successmessage" Text="<%$ Resources : Default,LabelLabel %>"></asp:Label>
        </asp:Panel>

        <div id="DivGrid" style="background-color: #DBDCDE">

            <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Always">
                <ContentTemplate>
                    <!----------------------------------HitsSearchGridView---------------------------------->
                    <cc1:HitsSearchGridView ID="m_gvReturnedDevices" runat="server" AutoGenerateColumns="False"
                        Width="100%" AllowPaging="True" OnRowDataBound="m_gvReturnedDevices_RowDataBound" OnPageIndexChanged="m_gvReturnedDevices_PageIndexChanged"
                        OnPageIndexChanging="m_gvReturnedDevices_PageIndexChanging" OnMenuItemCommand="m_gvReturnedDevices_OnMenuItemCommand"
                        ShowMenu="True" ShowSelectField="False" ShowActivateMenu="False" ShowDeActivateMenu="False"
                        ShowEmailMenu="False" ShowPrintMenu="False" ShowHotlineMenu="False" ShowDeHotlineMenu="False"
                        CustomPagerID="HitsPager1" ClientFunctionPrint="window.print();" OnCustomPageIndexChanged="m_gvReturnedDevices_PageIndexChanged"
                        OnCustomPageIndexChanging="m_gvReturnedDevices_PageIndexChanging"
                        ShowDeleteMenu="False" ShowDeSelectMenu="False" ShowExportMenu="False" ShowSelectMenu="False"
                        HeaderStyle-Font-Size="XX-Small" AtlasScriptManagerID="" ClientFunctionActivateSelected=""
                        ClientFunctionDeActivateSelected="" ClientFunctionDeHotline="" ClientFunctionDelete=""
                        ClientFunctionEmailSelected="" ClientFunctionExportSelected="" ClientFunctionHotline=""
                        ClientFunctionSetStatus="" CssClassCustomPaging="" CssClassMenu="" PropagateActionToChildID=""
                        ShowExportCSV="True" ShowExportCSVWithSummary="False" ShowExportXML="False" ShowExportXMLWithSummary="False"
                        ShowSetStatus="False">
                        <Columns>
                             <asp:TemplateField HeaderStyle-Wrap="false" HeaderText="">
                                 <ItemStyle Width="5%" CssClass="nopadding" />
                                <ItemTemplate>
                                    <asp:LinkButton ID="LblUpdate" Text="<%$ Resources: Default, LinkButtonUpdate %>" Width="20px" runat="server"
                                        CommandArgument='<%# Eval("ReturnedDeviceId") + ":" + Eval("LinkedSubsciberMDN") + ":" + Eval("LinkedClaimId")+ ":" + Eval("Status") %>' OnClick="m_UpdateLnk_Clicked">

                                    </asp:LinkButton>
                                </ItemTemplate>

                                <HeaderStyle Wrap="False"></HeaderStyle>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <asp:Literal ID="m_litRDDateReceivedHeader" Text="<%$ Resources: LogisticsManagement, LabelDateReceived %>" runat="server" />
                                    <br />
                                    <uc:CustomSorter ID="m_csDateReceived" SortExpression="RECEIVEDDATE" runat="server"
                                        OnSortAscendingClicked="customSorter_SortClicked" OnSortDescendingClicked="customSorter_SortClicked" />
                                </HeaderTemplate>
                                <ItemStyle Width="10%" CssClass="nopadding" />
                                <ItemTemplate>
                                    <asp:HiddenField ID="m_hfSCId" runat="server"></asp:HiddenField>
                                    <asp:Literal ID="m_litRDDateReceived" runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <asp:Literal ID="m_litRDESNHeader" runat="server" Text="<%$ Resources: LogisticsManagement, LabelESN %>" />
                                    <br />
                                    <uc:CustomSorter ID="m_csESN" SortExpression="ESN" runat="server" OnSortAscendingClicked="customSorter_SortClicked"
                                        OnSortDescendingClicked="customSorter_SortClicked" />
                                </HeaderTemplate>
                                <ItemStyle Width="12%" CssClass="nopadding" />
                                <ItemTemplate>
                                    <%--<asp:Literal ID="m_litRDESN" runat="server" />--%>
                                    <asp:LinkButton runat="server" ID="m_litRDESN" OnClick="m_litRDESN_Clicked"></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <asp:Literal ID="m_litRDRMAHeader" runat="server" Text="<%$ Resources: LogisticsManagement, LableRMATracking %>" />
                                    <br />
                                    <uc:CustomSorter ID="m_csRMA" SortExpression="RMA" runat="server" OnSortAscendingClicked="customSorter_SortClicked"
                                        OnSortDescendingClicked="customSorter_SortClicked" />
                                </HeaderTemplate>
                                <ItemStyle Width="10%" CssClass="nopadding" />
                                <ItemTemplate>
                                    <%--<asp:Literal ID="m_litRDRMA" runat="server" />--%>
                                    <asp:LinkButton runat="server" ID="m_litRDRMA" OnClick="m_litRDRMA_Clicked"></asp:LinkButton>/<br>
                                    <asp:LinkButton runat="server" ID="m_litRDTracking" OnClick="m_litRDTracking_Clicked"></asp:LinkButton>
                                    
                                </ItemTemplate>
                            </asp:TemplateField>


                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <asp:Literal ID="m_litRDClaimIdHeader" runat="server" Text="<%$ Resources: LogisticsManagement, LabelClaimId %>" />
                                    <br />
                                    <uc:CustomSorter ID="m_csClaimId" SortExpression="CLAIMID" runat="server" OnSortAscendingClicked="customSorter_SortClicked"
                                        OnSortDescendingClicked="customSorter_SortClicked" />
                                </HeaderTemplate>
                                <ItemStyle Width="8%" CssClass="nopadding" />
                                <ItemTemplate>
                                    <asp:Literal ID="m_litRDClaimId" runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <asp:Literal ID="m_litRDMDNHeader" runat="server" Text="<%$ Resources: LogisticsManagement, LabelMDN %>" />
                                    <br />
                                    <uc:CustomSorter ID="m_csMDN" SortExpression="MDN" runat="server" OnSortAscendingClicked="customSorter_SortClicked"
                                        OnSortDescendingClicked="customSorter_SortClicked" />
                                </HeaderTemplate>
                                <ItemStyle Width="7%" CssClass="nopadding" />
                                <ItemTemplate>
                                    <asp:Literal ID="m_litRDMDN" runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <asp:Literal ID="m_litRDLinkedToSubsciberHeader" runat="server" Text="<%$ Resources: LogisticsManagement, LabelLinkedtoSubsciber %>" />
                                    <br />
                                    <uc:CustomSorter ID="m_csSubname" SortExpression="SUBNAME" runat="server" OnSortAscendingClicked="customSorter_SortClicked"
                                        OnSortDescendingClicked="customSorter_SortClicked" />
                                </HeaderTemplate>
                                <ItemStyle Width="14%" CssClass="nopadding" />
                                <ItemTemplate>
                                    <%--<asp:Literal ID="m_litRDLinkedToSubsciber" runat="server" />--%>
                                    <asp:LinkButton runat="server" ID="m_litRDLinkedToSubsciber" OnClick="m_litRDLinkedToSubsciber_Clicked" OnClientClick = "SetTarget();" ></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <asp:Literal ID="m_litRDLinkedToClaimHeader" runat="server" Text="<%$ Resources: LogisticsManagement, LabelLinkedtoClaim %>" />
                                    <br />
                                    <uc:CustomSorter ID="m_csLinkedClaim" SortExpression="LINKEDCLAIMID" runat="server" OnSortAscendingClicked="customSorter_SortClicked"
                                        OnSortDescendingClicked="customSorter_SortClicked" />
                                </HeaderTemplate>
                                <ItemStyle Width="8%" CssClass="nopadding" />
                                <ItemTemplate>
                                    <%--<asp:Literal ID="m_litRDLinkedToClaim" runat="server" />--%>
                                    <asp:LinkButton runat="server" ID="m_litRDLinkedToClaim" OnClick="m_litRDLinkedToClaim_Clicked"></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <asp:Literal ID="m_litRDConditionCategoryHeader" runat="server" Text="<%$ Resources: LogisticsManagement, LabelCategoryCondition %>" />
                                    <br />
                                    <uc:CustomSorter ID="m_csCategory" SortExpression="CATEGORY" runat="server" OnSortAscendingClicked="customSorter_SortClicked"
                                        OnSortDescendingClicked="customSorter_SortClicked" />
                                </HeaderTemplate>
                                <ItemStyle Width="8%" CssClass="nopadding" />
                                <ItemTemplate>
                                    <asp:Literal ID="m_litRDConditionCategory" runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>


                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <asp:Literal ID="m_litRDActionHeader" runat="server" Text="<%$ Resources: LogisticsManagement, LabelActionTakenStatus %>" />
                                    <br />
                                    <uc:CustomSorter ID="m_csReturnedAction" SortExpression="RETURNEDACTION" runat="server" OnSortAscendingClicked="customSorter_SortClicked"
                                        OnSortDescendingClicked="customSorter_SortClicked" />
                                </HeaderTemplate>
                                <ItemStyle Width="8%" CssClass="nopadding" />
                                <ItemTemplate>
                                    <asp:Literal ID="m_litRDAction" runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>


                           <%-- <asp:TemplateField HeaderStyle-Wrap="false" HeaderText="">
                                <ItemTemplate>
                                    <asp:LinkButton ID="LblUpdate" Text="<%$ Resources: Default, LinkButtonUpdate %>" Width="20px" runat="server"
                                        CommandArgument='<%# Eval("ReturnedDeviceId") + ":" + Eval("LinkedSubsciberMDN") + ":" + Eval("LinkedClaimId")+ ":" + Eval("Status") %>' OnClick="m_UpdateLnk_Clicked">

                                    </asp:LinkButton>
                                </ItemTemplate>

                                <HeaderStyle Wrap="False"></HeaderStyle>
                            </asp:TemplateField>--%>
                        </Columns>
                        <PagerTemplate>
                            <cc1:HitsPager ID="HitsPager1" runat="server" />
                        </PagerTemplate>
                        <RowStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Overline="False" Font-Size="XX-Small"
                            Font-Strikeout="False" Font-Underline="False" />
                        <EditRowStyle HorizontalAlign="Left" VerticalAlign="Top" />
                        <HeaderStyle Font-Size="XX-Small" Wrap="True" />
                    </cc1:HitsSearchGridView>
                    <br />
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </asp:Panel>
    <asp:Label ID="m_lblNoFound" Font-Bold="True" ForeColor="Red" runat="server" Visible="False" Text="<%$ Resources: Default, LabelNoResultsFound %>" />

    <uc:ucUpdateChargebackPopup ID="ucUpdPopup" runat="server" OnCloseClicked="ucUpdPopup_Closed" />



    <!----------------------------------Data Source---------------------------------->
    <asp:ObjectDataSource ID="m_objReturnedDevicesDataSource" runat="server" TypeName="ReturnedDevicesDataSource" EnablePaging="True"
        SelectMethod="Select"
        SelectCountMethod="SelectCount">
        <SelectParameters>
            <asp:SessionParameter DefaultValue="null" Name="objReturnedDevicesDataSearch" SessionField="ReturnedDevicesSearchCriteria_SessionKey"
                Type="Object" />
            <asp:ControlParameter ControlID="m_gvReturnedDevices" DefaultValue="" Name="startRowIndex"
                PropertyName="PageIndex" Type="Int32" />
            <asp:Parameter DefaultValue="10" Name="maximumRows" Type="Int32" />
            <asp:SessionParameter Name="ReturnedDevicesSortExpression" SessionField="ReturnedDevicesSortExpression_SessionKey"
                Type="Object" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <!-------------------------------------------------------------------->
</asp:Content>
