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

<%@ Register Src="~/Controls/PhoneNumber.ascx" TagName="PhoneNumber" TagPrefix="uc1" %>
<%@ Register Src="~/Controls/PersistNav.ascx" TagName="PersistNav" TagPrefix="uc" %>
<%@ 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/PopupWindow.ascx" TagName="PopupWindow" TagPrefix="uc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="eContent" runat="Server">
    <div Id="abcHtml" runat="server" style="font:18; color:Red; font-weight:bold; text-align:center">
    </div>

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

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

    <uc:ScriptingHelper ID="ScriptingHelper1" runat="server" />
    <!-------------------------------Page Heading---------------------------------------->
    <h1>
        <asp:Literal ID="Literal1" runat="server" Text="<%$ Resources : FulfillmentManagement, PageTitleFulfillments %>" />
    </h1>
    <!-------------------------------HEADER UC---------------------------------------->
    <uc:DefaultHeader ID="DefaultHeader1" runat="server" />
    <!---------------------------------------------------------------------------------->
    <table cellspacing="0" cellpadding="0">
                    <tr>
                <td style="padding-right: 0px">
                        <asp:Label ID="m_lblSuccessMessage" runat="server" Visible="true" CssClass="failuremessage"/><br />
                </td>
            </tr>
    </table>

    <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="Literal2" runat="server" Text="<%$ Resources : Default, LabelSearchCriteria %>"  />
                </td>
            </tr>
        </table>
    </div>
    <!-----------------------------------TABLE 1----------------------------------------->
    <asp:UpdatePanel runat="server" ID="update" UpdateMode="Conditional">
        <ContentTemplate>
            <div id="m_pnlMasterSearchCriteria" style="background-color: #DBDCDE">
                <div>
                    <table id="fulfillmentsCriteriaTable" border="0" cellpadding="0" cellspacing="0" class="gvTable">
                        <tr>
                            <td align="right" >
                                <asp:Literal ID="Literal4" runat="server" Text="<%$ Resources: OrganizationManagement, LabelClientColon %>" />
                            </td>
                            <td align="left">
                                <asp:DropDownList ID="m_ddlCarriers" runat="server">
                                </asp:DropDownList>
                            </td>
                            <td nowrap align="right">
                                <asp:Literal ID="Literal7" runat="server" Text="<%$ Resources: Default, DateFromLabel %>" />
                            </td>
                            <td nowrap align="left">
                                <uc:HITSCalendar ID="m_calDateFrom" runat="server" />
                            </td>
                            <td nowrap align="right">
                                <asp:Literal ID="Literal3" runat="server" Text="<%$ Resources: ClaimsManagement, LabelClaimIDColon %>" />
                            </td>
                            <td align="left">
                                <asp:TextBox ID="m_txtClaimID" runat="server"></asp:TextBox>
                                <SmartAjaxToolkit:SmartAutoCompleteExtender ID="SmartAutoCompleteExtender1" runat="server"
                                    OnAutoCompleteCallback="SearchClaimIds" TargetControlID="m_txtClaimID" UpdateMode="Callback"
                                    EnableCaching="false" MinimumPrefixLength="2" CompletionSetCount="20" />
                            </td>

                        </tr>
                        <tr>
                             <td nowrap align="right">
                                <asp:Literal ID="Literal8" runat="server" Text="<%$ Resources: SubscriberManagement, LabelSubscriberFirstName %>" />
                            </td>
                            <td align="left">
                                <asp:TextBox ID="m_txtSubscriberFirstName" runat="server"></asp:TextBox>
                                <SmartAjaxToolkit:SmartAutoCompleteExtender ID="SmartAutoCompleteExtender3" runat="server"
                                    OnAutoCompleteCallback="SearchFirstNames" TargetControlID="m_txtSubscriberFirstName"
                                    UpdateMode="Callback" EnableCaching="false" MinimumPrefixLength="2" />
                            </td>
                            <td nowrap align="right">
                                <asp:Literal ID="Literal10" runat="server" Text="<%$ Resources: Default, DateToLabel %>" />
                            </td>
                            <td nowrap align="left">
                                <uc:HITSCalendar ID="m_calDateTo" runat="server" />
                            </td>
                            <td align="right">
                                <asp:Literal ID="Literal6" runat="server" Text="<%$ Resources: HandsetManagement, LabelMDNColon %>" />
                            </td>
                            <td align="left">
                                <uc1:PhoneNumber ID="m_ucMDN" runat="server" Required="false" />
                            </td>
                        </tr>
                        <tr>
                           <td nowrap align="right">
                                <asp:Literal ID="Literal5" runat="server" Text="<%$ Resources: SubscriberManagement, LabelSubscriberLastName %>" />
                            </td>
                            <td align="left">
                                <asp:TextBox ID="m_txtSubscriberLastName" runat="server"></asp:TextBox>
                                <SmartAjaxToolkit:SmartAutoCompleteExtender ID="SmartAutoCompleteExtender2" runat="server"
                                    OnAutoCompleteCallback="SearchLastNames" TargetControlID="m_txtSubscriberLastName"
                                    UpdateMode="Callback" EnableCaching="false" MinimumPrefixLength="2" />
                            </td>
                            <td nowrap align="right">
                                <asp:Literal ID="Literal9" runat="server" Text="<%$Resources: Default, ApplyDateToLabel %>" />
                            </td>
                            <td align="left">
                                <asp:DropDownList ID="m_ddlApplyDateRangeTo" runat="server">
                                    <asp:ListItem Text="<%$ Resources: Default, ListItemLoss %>" Value="1"> </asp:ListItem>
                                    <asp:ListItem Text="<%$ Resources: Default, ListItemClaim %>" Value="2"></asp:ListItem>
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                <asp:Literal ID="Literal12" runat="server" Text="<%$ Resources : Default, RecordsperpageLabel %>" />
                            </td>
                            <td align="left">
                                <asp:DropDownList ID="m_ddlPageSize" runat="server" style="width: 50px !important">
                                </asp:DropDownList>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </ContentTemplate>

    </asp:UpdatePanel>
    <!----------------------------------------------------Buttons----------------------------------------------------->
    <div style="text-align:center;">
        <asp:Button ID="m_btnSetFilter" runat="server" Text="<%$ Resources : Default, ButtonSearch %>" CssClass="pagebutton"   
            OnClick="m_btnSetFilter_Click" />
        <input id="m_btnClear" type="button" runat="server" value="<%$ Resources : Default, ButtonClear %>" class="pagebutton" />
    </div>
    <!----------------------------------Search Results--------------------------------------------------------->
    <asp:Panel ID="m_pnlSearchResults" runat="server" style="margin-bottom: 30px;">
        <h2>
            <asp:Literal ID="Literal20" runat="server" Text="<%$ Resources : Default, LabelSearchResults %>" />
            <asp:Label ID="lblSuccess" runat="server" CssClass="successmessage" ></asp:Label>
        </h2>
    </asp:Panel>
    <!----------------------------------Claim Type Grid--------------------------------------------------------->
    <asp:Panel ID="m_pnlFulfillmentClaimsGrid" Visible="False" runat="server" CssClass="pnlFulfillmentClaimsGrid">
        <!----------------------------------Results Grid--------------------------------------------------------->
        <cc1:HitsSearchGridView ID="m_gvFulfillmentClaims" runat="server" AutoGenerateColumns="False" style="margin-bottom:10px !important;"  CssClass="gvTable gvTable-marginB10"
            AllowPaging="True" OnRowDataBound="m_gvFulfillmentClaims_RowDataBound" OnPageIndexChanged="m_gvFulfillmentClaims_PageIndexChanged"
            OnPageIndexChanging="m_gvFulfillmentClaims_PageIndexChanging" OnMenuItemCommand="m_gvFulfillmentClaims_OnMenuItemCommand"
            ShowMenu="True" ShowSelectField="True" ShowSetStatus="False" ShowExportCSVWithSummary="False"
            ShowExportXMLWithSummary="False" ShowActivateMenu="False" ShowDeActivateMenu="False"
            ShowEmailMenu="False" ShowHotlineMenu="False" ShowDeHotlineMenu="False" CustomPagerID="HitsPager1"
            ClientFunctionPrint="window.print();" OnCustomPageIndexChanged="m_gvFulfillmentClaims_PageIndexChanged"
            OnCustomPageIndexChanging="m_gvFulfillmentClaims_PageIndexChanging" AtlasScriptManagerID=""
            ClientFunctionActivateSelected="" ClientFunctionDeActivateSelected="" ClientFunctionDeHotline=""
            ClientFunctionDelete="" ClientFunctionEmailSelected="" ClientFunctionExportSelected=""
            ClientFunctionHotline="" ClientFunctionSetStatus="" CssClassCustomPaging="" CssClassMenu=""
            PropagateActionToChildID="" EnableViewState="True" MenuStyle="margin-bottom:10px;"
            ShowDeleteMenu="True" ShowDeSelectMenu="True" ShowExportCSV="True" ShowExportMenu="True"
            ShowExportXML="True" ShowPrintMenu="True" ShowSelectMenu="True" Width="100%">
            <Columns>
                <asp:TemplateField>
                    <HeaderTemplate>
                        <asp:Literal runat="server" ID="Literal24" Text="<%$ Resources : ClaimsManagement, ColumnHeaderClaimID %>" ></asp:Literal>
                        <br />
                        <uc:CustomSorter runat="server" ID="m_csClaimId" SortExpression="ClaimId" OnSortAscendingClicked="customSorter_SortClicked"
                            OnSortDescendingClicked="customSorter_SortClicked"></uc:CustomSorter>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:LinkButton runat="server" ID="m_lbtnClaimId"
                            OnClick="m_lbtnClaimId_Click"></asp:LinkButton>
                        <asp:HiddenField ID="m_hfClaimId" runat="server"></asp:HiddenField>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <HeaderTemplate>
                        <asp:Literal runat="server" ID="Literal51" Text="<%$ Resources : FulfillmentManagement ,ColumnHeaderName %>"></asp:Literal>
                        <br />
                        <uc:CustomSorter runat="server" ID="m_csName" SortExpression="Name" OnSortAscendingClicked="customSorter_SortClicked"
                            OnSortDescendingClicked="customSorter_SortClicked"></uc:CustomSorter>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:LinkButton runat="server" ID="m_lbtnSubscriberName"
                            OnClick="m_lbtnSubscriberName_Click"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <HeaderTemplate>
                        <asp:Literal runat="server" ID="Literal52" Text="<%$ Resources : HandsetManagement, LabelMDN %>"></asp:Literal>
                        <br />
                        <uc:CustomSorter runat="server" ID="m_csMDN" SortExpression="MDN" OnSortAscendingClicked="customSorter_SortClicked"
                            OnSortDescendingClicked="customSorter_SortClicked"></uc:CustomSorter>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:LinkButton runat="server" ID="m_lbtnMDN"
                            OnClick="m_lbtnMDN_Click"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <HeaderTemplate>
                        <asp:Literal runat="server" ID="Literal53" Text="<%$ Resources : FulfillmentManagement ,ColumnHeaderClaimType %>" ></asp:Literal>
                        <br />
                        <uc:CustomSorter runat="server" ID="m_csClaimType" SortExpression="ClaimType" OnSortAscendingClicked="customSorter_SortClicked"
                            OnSortDescendingClicked="customSorter_SortClicked"></uc:CustomSorter>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:HyperLink runat="server" ID="m_linkClaimType"></asp:HyperLink>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <HeaderTemplate>
                        <asp:Literal runat="server" ID="Literal28" Text="<%$ Resources : FulfillmentManagement ,ColumnHeaderLosstDate %>" ></asp:Literal>
                        <br />
                        <uc:CustomSorter runat="server" ID="m_csLossDate" SortExpression="LossDate" OnSortAscendingClicked="customSorter_SortClicked"
                            OnSortDescendingClicked="customSorter_SortClicked"></uc:CustomSorter>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label runat="server" ID="m_lblLossDate"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <HeaderTemplate>
                        <asp:Literal runat="server" ID="Literal50" Text="<%$ Resources: ClaimsManagement, HeaderTextClaimDate %>" ></asp:Literal>
                        <br />
                        <uc:CustomSorter runat="server" ID="m_csClaimDate" SortExpression="ClaimDate" OnSortAscendingClicked="customSorter_SortClicked"
                            OnSortDescendingClicked="customSorter_SortClicked"></uc:CustomSorter>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label runat="server" ID="m_lblClaimDate"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <PagerTemplate>
                <cc1:HitsPager ID="HitsPager1" runat="server" CssClass="m_gvFulfillmentClaims-pager-bottom" GoButtonText="<%$ Resources : Default, GoButtonText %>" />
            </PagerTemplate>
            <PagerSettings Mode="NumericFirstLast" />
            <RowStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="XX-Small" />
            <EditRowStyle HorizontalAlign="Left" VerticalAlign="Top"  />
            <HeaderStyle Font-Size="XX-Small" />
        </cc1:HitsSearchGridView>
    </asp:Panel>
    <asp:Label ID="m_lblNoFulfillmentClaimsResultsFound" Font-Bold="True" ForeColor="Red"
        runat="server" Visible="False" Text="<%$ Resources : Default, LabelNoResultsFound %>" />

    <asp:Label ID="m_lblMDNNotValidForCompany" Font-Bold="True" ForeColor="Red"
        runat="server" Visible="False" Text="" />


    <!-----------------------------------------------Data Source----------------------------------------->
    <asp:ObjectDataSource ID="odsFulfillmentClaimsDataSource" runat="server" SelectMethod="Select"
        TypeName="FulfillmentClaimsDataSource" EnablePaging="True" SelectCountMethod="SelectCount">
        <SelectParameters>
            <asp:SessionParameter Name="objFulfillmentClaimSearchCriteria" SessionField="FulfillmentClaimsData"
                Type="Object" />
            <asp:ControlParameter ControlID="m_gvFulfillmentClaims" DefaultValue="1" Name="startRowIndex"
                PropertyName="PageIndex" Type="Int32" />
            <asp:Parameter DefaultValue="10" Name="maximumRows" Type="Int32" />
            <asp:SessionParameter Name="FulfillmentClaimsSortExpression" SessionField="FulfillmentClaimsSortExpression"
                Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <!--------------------------------------------------------------------------------------------------------->

    <uc:popupwindow ID="ucPopupWindow" runat="server" />
    <script type="text/javascript">
        $(document).ready(function () {
            var currentLength = $('.pnlFulfillmentClaimsGrid .gvTable:last tr:first th').length;
            var selector = '.pnlFulfillmentClaimsGrid .gvTable:last td[colspan="' + currentLength + '"]';
            $(selector).prop('colspan', currentLength + 1);
        });
    </script>
</asp:Content>

