Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

OpcBillingAddress.cshtml

@model CheckoutBillingAddressModel
@using Nop.Core;
@inject IWebHelper webHelper

@{
    var storeLocation = webHelper.GetStoreLocation();
}

<div class="checkout-data">
    @await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.OpCheckoutBillingAddressTop, additionalData = Model })
    @if (Model.ShipToSameAddressAllowed)
    {
        <div class="section ship-to-same-address">
            <p class="selector">
                <input asp-for="ShipToSameAddress"/>
                <label asp-for="ShipToSameAddress">@T("Checkout.ShipToSameAddress")</label>
            </p>
        </div>
    }
    @if (Model.ExistingAddresses.Count > 0)
    {
        <div class="section select-billing-address">
            <label for="billing-address-select">@T("Checkout.SelectBillingAddressOrEnterNewOne")</label>
            @if (Model.InvalidExistingAddresses.Count > 0)
            {
                <label class="min-amount-warning">
                    @string.Format(T("Checkout.Addresses.Invalid").Text, Model.InvalidExistingAddresses.Count)
                </label>
            }
            <div class="opc-select-address-container">
                <select name="billing_address_id" id="billing-address-select" class="address-select"
                        title="" onchange="Billing.resetBillingForm();Billing.setDefaultCountry(@(Model.BillingNewAddress.CountryId ?? Model.BillingNewAddress.DefaultCountryId ?? 0));Billing.newAddress(this.value == 0)">
                    @foreach (var address in Model.ExistingAddresses)
                    {
                        var addressLine = "";
                        addressLine += address.FirstName;
                        addressLine += " " + address.LastName;
                        addressLine += ", " + address.AddressLine;
                        //how should we render "FormattedCustomAddressAttributes" here?
                        <option value="@(address.Id)">@(addressLine)</option>
                    }
                    <option value="0" selected="@Model.NewAddressPreselected">@T("Checkout.NewAddress")</option>
                </select>

                <button id="edit-billing-address-button" type="button" class="button-1" style="display: none" onclick="Billing.editAddress(); return false;">@T("Common.Edit")</button>

                <button id="delete-billing-address-button" type="button" class="button-1" style="display: none" onclick="Billing.deleteAddress('@(storeLocation)checkout/DeleteEditBillingAddress/'); return false;">@T("Common.Delete")</button>
        
            </div>
        </div>
    }
    @await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.OpCheckoutBillingAddressMiddle, additionalData = Model })
    <div class="section new-billing-address" id="billing-new-address-form">
        @if (Model.EuVatEnabled)
        {
            <div class="inputs">
                <label asp-for="VatNumber" asp-postfix=":"></label>
                @if (Model.EuVatEnabledForGuests)
                {
                    <input asp-for="VatNumber" />
                    <span asp-validation-for="VatNumber"></span>
                }
                else
                {
                    <span class="vat-number-warning">
                        @T("Checkout.VatNumber.Disabled", Url.RouteUrl(NopRouteNames.General.CUSTOMER_INFO))
                    </span>
                }
            </div>
        }
        <div class="enter-address">
            <div asp-validation-summary="ModelOnly" class="message-error"></div>
            @{
                var dataDictAddress = new ViewDataDictionary(ViewData);
                dataDictAddress.TemplateInfo.HtmlFieldPrefix = "BillingNewAddress";
                @await Html.PartialAsync("_CreateOrUpdateAddress", Model.BillingNewAddress, dataDictAddress)
            }
        </div>
    </div>
    @await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.OpCheckoutBillingAddressBottom, additionalData = Model })
</div>