Webiant Logo Webiant Logo
  1. No results found.

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

BillingAddress.cshtml

@using Nop.Core
@using Nop.Services.Customers
@model CheckoutBillingAddressModel
@inject IWebHelper webHelper
@inject IWorkContext workContext
@inject ICustomerService _customerService
@{
    Layout = "_ColumnsOne";

    var storeLocation = webHelper.GetStoreLocation();

    //title
    NopHtml.AddTitleParts(T("PageTitle.Checkout").Text);
    //page class
    NopHtml.AppendPageCssClassParts("html-checkout-page");
    NopHtml.AppendPageCssClassParts("html-billing-address-page");
}

<script src="~/js/public.billingaddress.js" asp-location="Footer"></script>

<div class="page checkout-page billing-address-page">
    @await Component.InvokeAsync(typeof(CheckoutProgressViewComponent), new { step = CheckoutProgressStep.Address })
    <div class="page-title">
        <h1>@T("Checkout.BillingAddress")</h1>
    </div>
    <div class="page-body checkout-data">
        <form id="billing-form" asp-route="@NopRouteNames.Standard.CHECKOUT_BILLING_ADDRESS" method="post">
            <div class="billing-addresses">
                <div id="toggle-billing-address">
                    @await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.CheckoutBillingAddressTop, additionalData = Model })
                    @if (Model.ShipToSameAddressAllowed)
                    {
                        <div class="section ship-to-same-address">
                            <div class="selector">
                                <input asp-for="ShipToSameAddress" />
                                <label asp-for="ShipToSameAddress">@T("Checkout.ShipToSameAddress")</label>
                            </div>
                        </div>
                    }
                    @if (Model.ExistingAddresses.Count > 0)
                    {
                        <div class="section select-billing-address">
                            <h2 class="title">
                                @T("Checkout.SelectBillingAddress")
                            </h2>
                            @if (Model.InvalidExistingAddresses.Count > 0)
                            {
                                <label class="min-amount-warning">
                                    @string.Format(T("Checkout.Addresses.Invalid").Text, Model.InvalidExistingAddresses.Count)
                                </label>
                            }
                            <div class="address-grid">
                                @foreach (var item in Model.ExistingAddresses)
                                {
                                    <div class="address-item">
                                        <div class="address-list-page">
                                            <button id="edit-button-@(item.Id)" type="button" class="button-2 edit-address-button" onclick="CheckoutBilling.editAddress('@(storeLocation)checkout/GetAddressById/', @(item.Id), '@T("Checkout.EditAddress")'); return false;">@T("Common.Edit")</button>
                                            <button id="delete-button-@(item.Id)" type="button" class="button-2 delete-address-button" onclick="CheckoutBilling.deleteEditAddress('@(storeLocation)checkout/DeleteEditBillingAddress/', @(item.Id)); return false;">@T("Common.Delete")</button>
                                        </div>
                                        <ul class="address-box">
                                            <li class="name">
                                                @item.FirstName @item.LastName
                                            </li>
                                            <li class="email">
                                                <label>@T("Address.Fields.Email"):</label>
                                                <span>@item.Email</span>
                                            </li>
                                            @if (item.PhoneEnabled)
                                            {
                                                <li class="phone">
                                                    <label>@T("Address.Fields.PhoneNumber"):</label>
                                                    <span>@item.PhoneNumber</span>
                                                </li>
                                            }
                                            @if (item.FaxEnabled)
                                            {
                                                <li class="fax">
                                                    <label>@T("Address.Fields.FaxNumber"):</label>
                                                    <span>@item.FaxNumber</span>
                                                </li>
                                            }
                                            @if (item.CompanyEnabled && !string.IsNullOrEmpty(item.Company))
                                            {
                                                <li class="company">
                                                    @item.Company
                                                </li>
                                            }
                                            @if (item.StreetAddressEnabled)
                                            {
                                                <li class="address1">
                                                    @item.Address1
                                                </li>
                                            }
                                            @if (item.StreetAddress2Enabled && !string.IsNullOrEmpty(item.Address2))
                                            {
                                                <li class="address2">
                                                    @item.Address2
                                                </li>
                                            }
                                            @if (item.CityEnabled && !string.IsNullOrEmpty(item.City) ||
                                                item.CountyEnabled && !string.IsNullOrEmpty(item.County) ||
                                                item.StateProvinceEnabled && !string.IsNullOrEmpty(item.StateProvinceName) ||
                                                item.ZipPostalCodeEnabled && !string.IsNullOrEmpty(item.ZipPostalCode))
                                            {
                                                <li class="city-state-zip">
                                                    @if (item.CityEnabled && !string.IsNullOrEmpty(item.City))
                                                    {
                                                        @item.City
                                                        if (item.CountyEnabled && !string.IsNullOrEmpty(item.County) ||
                                                            item.StateProvinceEnabled && !string.IsNullOrEmpty(item.StateProvinceName) ||
                                                            item.ZipPostalCodeEnabled && !string.IsNullOrEmpty(item.ZipPostalCode))
                                                        {
                                                            <text>,</text>
                                                        }
                                                    }
                                                    @if (item.CountyEnabled && !string.IsNullOrEmpty(item.County))
                                                    {
                                                        @item.County
                                                        if (item.StateProvinceEnabled && !string.IsNullOrEmpty(item.StateProvinceName) ||
                                                            item.ZipPostalCodeEnabled && !string.IsNullOrEmpty(item.ZipPostalCode))
                                                        {
                                                            <text>,</text>
                                                        }
                                                    }
                                                    @if (item.StateProvinceEnabled && !string.IsNullOrEmpty(item.StateProvinceName))
                                                    {
                                                        @item.StateProvinceName
                                                        if (item.ZipPostalCodeEnabled && !string.IsNullOrEmpty(item.ZipPostalCode))
                                                        {
                                                            <text>,</text>
                                                        }
                                                    }
                                                    @if (item.ZipPostalCodeEnabled && !string.IsNullOrEmpty(item.ZipPostalCode))
                                                    {
                                                        @item.ZipPostalCode
                                                    }
                                                </li>
                                            }
                                            @if (item.CountryEnabled && !string.IsNullOrEmpty(item.CountryName))
                                            {
                                                <li class="country">
                                                    @item.CountryName
                                                </li>
                                            }
                                            @if (!string.IsNullOrEmpty(item.FormattedCustomAddressAttributes))
                                            {
                                                <li class="custom-attributes-view">
                                                    @Html.Raw(item.FormattedCustomAddressAttributes)
                                                </li>
                                            }
                                        </ul>
                                        <div class="select-button">
                                            <button type="button" class="button-1 select-billing-address-button" onclick="selectBillingAddress@(item.Id)()">@T("Checkout.BillToThisAddress")</button>
                                            
                                            <script asp-location="Footer">
                                                function selectBillingAddress@(item.Id)() {
                                                    if ($('#@Html.IdFor(model => model.ShipToSameAddress)')
                                                        .is(':checked')) {
                                                        setLocation(
                                                            '@Html.Raw(Url.RouteUrl(NopRouteNames.Standard.CHECKOUT_SELECT_BILLING_ADDRESS, new { addressId = item.Id, shipToSameAddress = "true" }))');
                                                    } else {
                                                        setLocation(
                                                            '@Url.RouteUrl(NopRouteNames.Standard.CHECKOUT_SELECT_BILLING_ADDRESS, new { addressId = item.Id })');
                                                    }
                                                }
                                            </script>
                                        </div>
                                    </div>
                                }
                            </div>
                        </div>
                    }
                </div>
                @await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.CheckoutBillingAddressMiddle, additionalData = Model })
                <div class="section new-billing-address" id="billingaddress-new-form">
                    <h2 class="title title-text">
                        @(Model.ExistingAddresses.Count > 0 ? T("Checkout.OrEnterNewAddress") : T("Checkout.EnterBillingAddress"))
                    </h2>
                    @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.CheckoutBillingAddressBottom, additionalData = Model })
            </div>
            <div class="buttons">
                <button id="billingaddress-save-button" type="button" class="button-1" style="display: none" onclick="CheckoutBilling.saveEditAddress('@(storeLocation)checkout/SaveEditBillingAddress/'); return false;">@T("Common.Save")</button>

                <button id="billingaddress-cancel-button" type="button" class="button-1" style="display: none" onclick="setLocation('@Url.RouteUrl(NopRouteNames.Standard.CHECKOUT_BILLING_ADDRESS)')">@T("Common.Cancel")</button>

                <button id="billingaddress-next-button" type="submit" name="nextstep" class="button-1 new-address-next-step-button">@T("Checkout.NextButton")</button>
            </div>
        </form>
        <script asp-location="Footer">
            CheckoutBilling.init('#billing-form');            
            $('#edit-billing-address-button').show();
            $('#delete-billing-address-button').show();
        </script>
        <div class="section order-summary">
            <h2 class="title">
                @T("Checkout.OrderSummary")
            </h2>
            @await Component.InvokeAsync(typeof(OrderSummaryViewComponent))
        </div>
    </div>
</div>