@model TaxSettingsModel

@using Telerik.Web.Mvc.UI;
@using (Html.BeginForm())
{
    
<script type="text/javascript">
    $(document).ready(function () {

        $("#@Html.FieldIdFor(model => model.AllowCustomersToSelectTaxDisplayType)").click(toggleTaxDisplayType);
        $("#@Html.FieldIdFor(model => model.ShippingIsTaxable)").click(toggleShipping);
        $("#@Html.FieldIdFor(model => model.PaymentMethodAdditionalFeeIsTaxable)").click(togglePayment);
        $("#@Html.FieldIdFor(model => model.EuVatEnabled)").click(toggleEUVAT);
          
          
        toggleTaxDisplayType();
        toggleShipping();
        togglePayment();
        toggleEUVAT();
    });

    function toggleTaxDisplayType() {
        if (getE('@Html.FieldIdFor(model => model.AllowCustomersToSelectTaxDisplayType)').checked) {
            $('#pnlTaxDisplayType').hide();
        }
        else {
            $('#pnlTaxDisplayType').show();
        }
    }

    function toggleShipping() {
        if (getE('@Html.FieldIdFor(model => model.ShippingIsTaxable)').checked) {
            $('#pnlShippingPriceIncludesTax').show();
            $('#pnlShippingTaxClass').show();
        }
        else {
            $('#pnlShippingPriceIncludesTax').hide();
            $('#pnlShippingTaxClass').hide();
        }
    }

    function togglePayment() {
        if (getE('@Html.FieldIdFor(model => model.PaymentMethodAdditionalFeeIsTaxable)').checked) {
            $('#pnlPaymentMethodAdditionalFeeIncludesTax').show();
            $('#pnlPaymentMethodAdditionalFeeTaxClass').show();
        }
        else {
            $('#pnlPaymentMethodAdditionalFeeIncludesTax').hide();
            $('#pnlPaymentMethodAdditionalFeeTaxClass').hide();
        }
    }

    function toggleEUVAT() {
        if (getE('@Html.FieldIdFor(model => model.EuVatEnabled)').checked) {
            $('#pnlEuVatShopCountry').show();
            $('#pnlEuVatAllowVATExemption').show();
            $('#pnlEuVatUseWebService').show();
            $('#pnlEuVatEmailAdminWhenNewVATSubmitted').show();
        }
        else {
            $('#pnlEuVatShopCountry').hide();
            $('#pnlEuVatAllowVATExemption').hide();
            $('#pnlEuVatUseWebService').hide();
            $('#pnlEuVatEmailAdminWhenNewVATSubmitted').hide();
        }
    }
</script>
    
    <div class="section-header">
        <div class="title">
            <img src="@Url.Content("~/Administration/Content/images/ico-configuration.png")" alt="" />
            @T("Admin.Configuration.Settings.Tax")
        </div>
        <div class="options">
            <button type="submit" name="save" value="save" class="t-button">@T("Admin.Common.Save")</button>
        </div>
    </div>
@Html.ValidationSummary(false)
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.PricesIncludeTax):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.PricesIncludeTax)
                @Html.ValidationMessageFor(model => model.PricesIncludeTax)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.AllowCustomersToSelectTaxDisplayType):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.AllowCustomersToSelectTaxDisplayType)
                @Html.ValidationMessageFor(model => model.AllowCustomersToSelectTaxDisplayType)
            </td>
        </tr>
        <tr id="pnlTaxDisplayType">
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.TaxDisplayType):
            </td>
            <td class="adminData">
                @(Html.Telerik().DropDownList()
                .Name("taxDisplayType")
                .BindTo(Model.TaxDisplayTypeValues)
                )
                @Html.ValidationMessageFor(model => model.TaxDisplayType)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.DisplayTaxSuffix):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.DisplayTaxSuffix)
                @Html.ValidationMessageFor(model => model.DisplayTaxSuffix)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.DisplayTaxRates):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.DisplayTaxRates)
                @Html.ValidationMessageFor(model => model.DisplayTaxRates)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.HideZeroTax):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.HideZeroTax)
                @Html.ValidationMessageFor(model => model.HideZeroTax)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.HideTaxInOrderSummary):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.HideTaxInOrderSummary)
                @Html.ValidationMessageFor(model => model.HideTaxInOrderSummary)
            </td>
        </tr>
        <tr class="adminSeparator">
            <td colspan="2">
                <hr />
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.TaxBasedOn):
            </td>
            <td class="adminData">
                @(Html.Telerik().DropDownList()
                .Name("taxBasedOn")
                .BindTo(Model.TaxBasedOnValues)
                )
                @Html.ValidationMessageFor(model => model.TaxBasedOn)
            </td>
        </tr>
        <tr>
            <td class="adminTitle" colspan="2">
                <b>@Html.LabelFor(model => model.DefaultTaxAddress):</b>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                @Html.EditorFor(x => x.DefaultTaxAddress, "Address")
            </td>
        </tr>
        <tr class="adminSeparator">
            <td colspan="2">
                <hr />
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.ShippingIsTaxable):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.ShippingIsTaxable)
                @Html.ValidationMessageFor(model => model.ShippingIsTaxable)
            </td>
        </tr>
        <tr id="pnlShippingPriceIncludesTax">
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.ShippingPriceIncludesTax):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.ShippingPriceIncludesTax)
                @Html.ValidationMessageFor(model => model.ShippingPriceIncludesTax)
            </td>
        </tr>
        <tr id="pnlShippingTaxClass">
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.ShippingTaxClassId):
            </td>
            <td class="adminData">
                @(Html.Telerik().DropDownList()
                .Name("shippingTaxClassId")
                .BindTo(Model.ShippingTaxCategories)
                )
                @Html.ValidationMessageFor(model => model.ShippingTaxClassId)
            </td>
        </tr>
        <tr class="adminSeparator">
            <td colspan="2">
                <hr />
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.PaymentMethodAdditionalFeeIsTaxable):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.PaymentMethodAdditionalFeeIsTaxable)
                @Html.ValidationMessageFor(model => model.PaymentMethodAdditionalFeeIsTaxable)
            </td>
        </tr>
        <tr id="pnlPaymentMethodAdditionalFeeIncludesTax">
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.PaymentMethodAdditionalFeeIncludesTax):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.PaymentMethodAdditionalFeeIncludesTax)
                @Html.ValidationMessageFor(model => model.PaymentMethodAdditionalFeeIncludesTax)
            </td>
        </tr>
        <tr id="pnlPaymentMethodAdditionalFeeTaxClass">
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.PaymentMethodAdditionalFeeTaxClassId):
            </td>
            <td class="adminData">
                @(Html.Telerik().DropDownList()
                .Name("paymentMethodAdditionalFeeTaxClassId")
                .BindTo(Model.PaymentMethodAdditionalFeeTaxCategories)
                )
                @Html.ValidationMessageFor(model => model.PaymentMethodAdditionalFeeTaxClassId)
            </td>
        </tr>
        <tr class="adminSeparator">
            <td colspan="2">
                <hr />
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.EuVatEnabled):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.EuVatEnabled)
                @Html.ValidationMessageFor(model => model.EuVatEnabled)
            </td>
        </tr>
        <tr id="pnlEuVatShopCountry">
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.EuVatShopCountryId):
            </td>
            <td class="adminData">
                @(Html.Telerik().DropDownList()
                .Name("euVatShopCountryId")
                .BindTo(Model.EuVatShopCountries)
                )
                @Html.ValidationMessageFor(model => model.EuVatShopCountryId)
            </td>
        </tr>
        <tr id="pnlEuVatAllowVATExemption">
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.EuVatAllowVatExemption):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.EuVatAllowVatExemption)
                @Html.ValidationMessageFor(model => model.EuVatAllowVatExemption)
            </td>
        </tr>
        <tr id="pnlEuVatUseWebService">
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.EuVatUseWebService):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.EuVatUseWebService)
                @Html.ValidationMessageFor(model => model.EuVatUseWebService)
            </td>
        </tr>
        <tr id="pnlEuVatEmailAdminWhenNewVATSubmitted">
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.EuVatEmailAdminWhenNewVatSubmitted):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.EuVatEmailAdminWhenNewVatSubmitted)
                @Html.ValidationMessageFor(model => model.EuVatEmailAdminWhenNewVatSubmitted)
            </td>
        </tr>
    </table>
}