<%@ Page Language="C#" MasterPageFile="~/masterpages/eDashboard.master" AutoEventWireup="True" ValidateRequest="false"  
    CodeBehind="TaxSettings.aspx.cs" Inherits="site_HITS_Organization_TaxSettings"
    Culture="auto" UICulture="auto" Theme="eMain" %>

<%@ Register TagPrefix="eSecuritelHITSControls" Namespace="WebSite.Controls" Assembly="WebSite" %>

<%@ Register Assembly="eSecuritel.HITS.UI.Components" Namespace="eSecuritel.HITS.UI.Components"
    TagPrefix="cc1" %>

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

    <link  href="<%=ResolveClientUrl("~/style/ModelMatrixForCarriers/css/jquery-ui-1.8.18.custom.css")%>" rel="stylesheet" />
    <link  href="<%=ResolveClientUrl("~/style/ModelMatrixForCarriers/css/style.css")%>" rel="stylesheet" />

    <style>
        .ui-widget-overlay {
            position: fixed;
        }     
        
        #<%= grdAllTaxSettings.ClientID %> {
            margin: 0 auto;
            margin-bottom: 25px;
        }

    </style>

    <script type="text/javascript" src="<%=ResolveClientUrl("~/script/ModelMatrixForCarriers/js/jquery-ui.js")%>"></script>

    <script language="javascript" type="text/javascript">
        function ConfirmDelete() {            
            return confirm("<%= Resources.Default.VerifyDeleteLabel %>");
        }

        function CloseLoader() {
            $("#loading_dialog").loading("loadStop");

            setTimeout(function () { ScrollToBottom(); }, 500);
        }

        function ShowAlert(msg) {
            alert(msg);
        }


        (function ($) {

            $.widget("artistan.loading", $.ui.dialog, {
                options: {
                    // your options
                    spinnerClassSuffix: 'spinner',
                    spinnerHtml: "<%= Resources.ModelMatrixManagement.LabelLoading %>",// allow for spans with callback for timeout...
                    maxHeight: true,
                    maxWidth: false,
                    minHeight: 80,
                    minWidth: 220,
                    height: 80,
                    width: 220,
                    modal: true

                },
                _create: function () {
                    $.ui.dialog.prototype._create.apply(this);
                    // constructor
                    $(this.uiDialog).children('*').hide();
                    var self = this,
                        options = self.options;
                    self.uiDialogSpinner = $('.ui-dialog-content', self.uiDialog).html(options.spinnerHtml).addClass('ui-dialog-' + options.spinnerClassSuffix);
                },
                _setOption: function (key, value) {
                    var original = value;
                    $.ui.dialog.prototype._setOption.apply(this, arguments);
                    // process the setting of options
                    var self = this;

                    switch (key) {
                    case "innerHeight":
                        // remove old class and add the new one.
                        self.uiDialogSpinner.height(value);
                        break;
                    case "spinnerClassSuffix":
                        // remove old class and add the new one.
                        self.uiDialogSpinner.removeClass('ui-dialog-' + original).addClass('ui-dialog-' + value);
                        break;
                    case "spinnerHtml":
                        // convert whatever was passed in to a string, for html() to not throw up
                        self.uiDialogSpinner.html("" + (value || '&#160;'));
                        break;
                    }
                },
                _size: function () {
                    $.ui.dialog.prototype._size.apply(this, arguments);
                },
                // other methods
                loadStart: function (newHtml) {
                    if (typeof (newHtml) != 'undefined') {
                        this._setOption('spinnerHtml', newHtml);
                    }
                    this.open();
                },
                loadStop: function () {
                    this._setOption('spinnerHtml', this.options.spinnerHtml);
                    this.close();
                }
            });
        })(jQuery);

        function setStyle() {
            var rv = -1; // Return value assumes failure.
            if (navigator.appName == 'Microsoft Internet Explorer') {
                var ua = navigator.userAgent;
                var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
                if (re.exec(ua) != null)
                    rv = parseFloat(RegExp.$1);
                if (rv == 7.0) {
                    $('[id$=ddlTaxCode]').css('width', '175px');
                    $('[id$=ddlState]').css('width', '175px');
                    $('[id$=ddlCoverageType]').css('width', '175px');
                    $('[id$=ddlTaxCategoryType]').css('width', '175px');
                }
            }

            $('[id$=grdAllTaxSettings_mnuHeader1__divMenuContainer]').attr('style', 'height: 30px; vertical-align: middle; width: 70%; margin: 0 auto;');
            $('[id$=grdAllTaxSettings_mnuHeader2__divMenuContainer]').attr('style', 'height: 30px; vertical-align: middle; width: 70%; margin: 0 auto;');
            $('table.gvTable tr.thead').css('background-image', 'linear-gradient(rgb(81, 112, 162) 0%, rgb(51, 77, 140) 100%)');
        }


    </script>
    <asp:LinkButton ID="lbtnBackToCarrierDetails" runat="server" Text="<%$ Resources: OrganizationManagement, Back2CarrierDetailsLabel %>" OnClick="lbtnBackToCarrierDetails_Click"></asp:LinkButton>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always" style="margin-top: 15px;">
        <ContentTemplate>
            <div id="divTaxSettings">
                <h2><asp:Literal ID="m_litOrganizationDetails" runat="server" Text="<%$ Resources: OrganizationManagement, LabelTaxSettings %>" /></h2>
                <asp:Label runat="server" ID="lblTaxSettingMessage" CssClass="failuremessage"></asp:Label>
                <div class="greyblock">
                    <cc1:HitsSearchGridView ID="grdAllTaxSettings" runat="server" AutoGenerateColumns="False"
                                Width="70%" AllowPaging="False" OnRowDataBound="grdAllTaxSettings_OnRowDataBound"                                
                                OnMenuItemCommand="grdAllTaxSettings_OnMenuItemCommand" ShowMenu="True" ShowSelectField="True"
                                ShowActivateMenu="False" ShowDeActivateMenu="False" ShowEmailMenu="False" ShowPrintMenu="False"
                                ShowHotlineMenu="False" ShowDeHotlineMenu="False" CustomPagerID="HitsPager1"
                                ClientFunctionPrint="window.print();" ShowDeleteMenu="True"
                                ShowDeSelectMenu="True" ShowExportMenu="False" ShowSelectMenu="True" 
                                AtlasScriptManagerID="" ClientFunctionActivateSelected="" ClientFunctionDeActivateSelected=""
                                ClientFunctionDeHotline="" ClientFunctionDelete="" ClientFunctionEmailSelected=""
                                ClientFunctionExportSelected="" ClientFunctionHotline="" ClientFunctionSetStatus=""
                                CssClassCustomPaging="" CssClassMenu="" PropagateActionToChildID="" ShowExportCSV="False"
                                ShowExportCSVWithSummary="False" ShowExportXML="False" ShowExportXMLWithSummary="False"
                                ShowSetStatus="False" ShowHeaderWhenEmpty="True">
            
			                    <Columns>                            
			                    <asp:TemplateField>
				                    <HeaderTemplate>
					                    <div class="gridLabelItem" ></div>
						                    <asp:Literal ID="m_litCoverageType" Text="<%$ Resources: OrganizationManagement, CoverageType %>" runat="server" />
						                    <br />
					                    </div>
				                    </HeaderTemplate>
				                    <ItemTemplate>
					                    <div class="gridLabelItem" ></div>
						                    <asp:Label ID="m_lblCoverageType" runat="server"></asp:Label>
					                    </div>
				                    </ItemTemplate>
				                    <ItemStyle Width="100" Wrap="false" />
			                    </asp:TemplateField>
			                    <asp:TemplateField>
				                    <HeaderTemplate>
					                    <div class="gridLabelItem" >
						                    <asp:Literal ID="m_litState" Text="<%$ Resources: OrganizationManagement, State %>" runat="server" />
						                    <br />
					                    </div>
				                    </HeaderTemplate>
				                    <ItemTemplate>
					                    <div class="gridLabelItem" >
						                    <asp:Label ID="m_lblState" runat="server"></asp:Label>
					                    </div>
				                    </ItemTemplate>
				                    <ItemStyle Width="100" Wrap="false" />
			                    </asp:TemplateField>
			                    <asp:TemplateField>
				                    <HeaderTemplate>
					                    <div class="gridLabelItem" >
						                    <asp:Literal ID="m_litTransactionGroupType" Text="<%$ Resources: OrganizationManagement, TransactionGroupType %>" runat="server" />
						                    <br />
					                    </div>
				                    </HeaderTemplate>
				                    <ItemTemplate>
					                    <div class="gridLabelItem" >
						                    <asp:Label ID="m_lblTransactionGroupType" runat="server"></asp:Label>
					                    </div>
				                    </ItemTemplate>
				                    <ItemStyle Width="100" Wrap="false" />
			                    </asp:TemplateField>
                                <asp:TemplateField>
				                    <HeaderTemplate>
					                    <div class="gridLabelItem" >
						                    <asp:Literal ID="m_litTaxCategoryType" Text="<%$ Resources: OrganizationManagement, TaxCategoryType %>" runat="server" />
						                    <br />
					                    </div>
				                    </HeaderTemplate>
				                    <ItemTemplate>
					                    <div class="gridLabelItem" >
						                    <asp:Label ID="m_lblTaxCategoryType" runat="server"></asp:Label>
					                    </div>
				                    </ItemTemplate>
				                    <ItemStyle Width="100" Wrap="false" />
			                    </asp:TemplateField>
			                    <asp:TemplateField>
				                    <HeaderTemplate>
					                    <div class="gridLabelItem" >
						                    <asp:Literal ID="m_litTaxCode" Text="<%$ Resources: OrganizationManagement, TaxCode %>" runat="server" />
						                    <br />
					                    </div>
				                    </HeaderTemplate>
				                    <ItemTemplate>
					                    <div class="gridLabelItem" >
						                    <asp:Label ID="m_lblTaxCode" runat="server"></asp:Label>
					                    </div>
				                    </ItemTemplate>
				                    <ItemStyle Width="100" Wrap="false" />
			                    </asp:TemplateField>                                                        
			                    <asp:TemplateField>
				                    <HeaderTemplate>
					                    <br />
				                    </HeaderTemplate>
				                    <ItemTemplate>
					                    <asp:LinkButton ID="lblTaxSettingUpdate" Text="<%$ Resources: Default, LinkButtonUpdate %>" Width="20px" runat="server"
						                    OnClick="lblTaxSettingUpdate_OnClick">
					                    </asp:LinkButton>
				                    </ItemTemplate>
				                    <ItemStyle Width="50" Wrap="false" />
			                    </asp:TemplateField>
			                    <asp:TemplateField>
				                    <HeaderTemplate>
					                    <br />
				                    </HeaderTemplate>
				                    <ItemTemplate>
					                    <asp:LinkButton ID="lblTaxSettingDelete" Text="<%$ Resources: Default, DeleteButtonLabel %>" OnClientClick="return ConfirmDelete()" Width="20px" runat="server"
						                    OnClick="lblTaxSettingDelete_OnClick">
					                    </asp:LinkButton>
				                    </ItemTemplate>
				                    <ItemStyle Width="50" Wrap="false" />
			                    </asp:TemplateField>
		                    </Columns>
        
			
	                    <PagerTemplate>
		                    <cc1:HitsPager ID="HitsPager1" runat="server" GoButtonText="<%$ Resources : Default, GoButtonText %>" />
	                    </PagerTemplate>
	                    <HeaderStyle HorizontalAlign = "Center" />
	                    <RowStyle VerticalAlign="Top" />
	                    <EditRowStyle HorizontalAlign="Left" VerticalAlign="Top" />
                    </cc1:HitsSearchGridView>
                </div>
                
                <div style="text-align: center">
                    <asp:Button ID="lblTaxSettingInsert" Text="<%$ Resources: Default, ButtonAdd %>" Width="100px" runat="server"
                        OnClick="lblTaxSettingInsert_OnClick"></asp:Button>
                    <br />
                </div>

                <!-- Modal window -->
                <div>
                    <asp:Panel ID="pnlPopupWindow" runat="server" CssClass="pnlInventoryPopup">
                        <asp:Panel ID="pnlPopupWindowHeader" runat="server" EnableViewState="false" CssClass="modalHeader">
                            <table cellpadding="0" cellspacing="0" width="90%" style="margin: 0px;">
                                <tr>
                                    <td style="margin: 0px; padding: 2px;">
                                        <asp:Label ID="lblHeaderText" runat="server" EnableViewState="false" Text="<%$ Resources:OrganizationManagement, LabelTaxSettings%>" />
                                    </td>

                                    <td align="right" style="text-align: right; margin: 0px; padding: 2px;">
                                        <asp:ImageButton ID="imgCloseTerm" runat="server" Height="18px" CausesValidation="false" ImageUrl="~/images/closeButton.png"
                                            ToolTip="<%$ Resources: Default, ToolTipClose %>" Width="18px" CssClass="modalClose" OnClick="imgCloseTerm_OnClick" />
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                        <asp:Panel ID="pnlBody" runat="server" CssClass="modalContent">
                            <asp:HiddenField runat="server" ID="taxSettingId"/>
                            <table>
                                <tr>
                                    <td colspan="4"></td>
                                </tr>   
                                <tr>
                                    <td style="text-align: right">
                                        <asp:Literal ID="litCoverageType" runat="server" Text="<%$ Resources: OrganizationManagement, CoverageType %>"></asp:Literal></td>
                                    <td style="text-align: left" colspan="3">
                                        <asp:DropDownList runat="server" ID="ddlCoverageType" Width="150px"/>
                                    </td>
                                </tr>                             
                                <tr>
                                    <td style="text-align: right">
                                        <asp:Literal ID="litState" runat="server" Text="<%$ Resources: OrganizationManagement, State %>"></asp:Literal></td>
                                    <td style="text-align: left" colspan="3">
                                        <asp:DropDownList runat="server" ID="ddlState" Width="150px"/>
                                    </td>
                                </tr>  
                                <tr>
                                    <td style="text-align: right">
                                        <asp:Literal ID="litTaxProductCategory" runat="server" Text="<%$ Resources: OrganizationManagement, TransactionGroupType %>"></asp:Literal></td>
                                    <td style="text-align: left" colspan="3">
                                        <asp:DropDownList runat="server" ID="ddlTaxProductCategory" Width="150px" OnSelectedIndexChanged="ddlTaxProductCategory_SelectedIndexChanged"
                                            AutoPostBack="True"/>
                                    </td>
                                </tr> 
                                <tr>
                                    <td style="text-align: right">
                                        <asp:Literal ID="litTaxCategoryType" runat="server" Visible="False" Text="<%$ Resources: OrganizationManagement, TaxCategoryType %>"></asp:Literal></td>
                                    <td style="text-align: left" colspan="3">
                                        <asp:DropDownList runat="server" ID="ddlTaxCategoryType" Visible="False" Width="150px"/>
                                    </td>
                                </tr>                             
                                <tr>
                                    <td style="text-align: right">
                                        <asp:Literal ID="litTaxCode" runat="server" Text="<%$ Resources: OrganizationManagement, TaxCode %>"></asp:Literal></td>
                                    <td style="text-align: left" colspan="3">
                                        <asp:DropDownList runat="server" ID="ddlTaxCode" Width="150px"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td>
                                        <asp:Button ID="btnUpdateTaxSetting" runat="server" Text="<%$ Resources: Default, ButtonUpdate %>" OnClick="btnUpdateTaxSetting_OnClick" />
                                        <asp:Button ID="btnInsertTaxSetting" runat="server" Text="<%$ Resources: Default, ButtonInsert %>" OnClick="btnInsertTaxSettingt_OnClick" /></td>
                                    <td>
                                        <asp:Button ID="btnTaxSettingClose" runat="server" ValidationGroup="UpdateCC" CausesValidation="false" Text="<%$ Resources: Default, ButtonClose %>" OnClick="btnTaxSettingClose_OnClick"></asp:Button></td>
                                    <td>&nbsp;</td>

                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="4">

                                        <asp:Literal ID="ltlResults" runat="server"></asp:Literal>
                                    </td>

                                </tr>
                            </table>
                        </asp:Panel>
                    </asp:Panel>
                    <asp:Button runat="server" EnableViewState="false" ID="hiddenTargetControlForModalPopup_New"
                        Style="display: none" />
                    <esecuritelhitscontrols:hitsmodalpopupextender runat="server" id="modalPopupWindow" targetcontrolid="hiddenTargetControlForModalPopup_New"
                        popupcontrolid="pnlPopupWindow" backgroundcssclass="modalBackground"
                        popupdraghandlecontrolid="pnlPopupWindowHeader" />
                </div>                                
            </div>

        </ContentTemplate>
    </asp:UpdatePanel>
    <div id="loading_dialog"></div>
    
    

</asp:Content>
