Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

2.6 KB
Raw Blame
@using Microsoft.AspNetCore.Routing
@model Shipping.ByWeight.Models.ShippingByWeightModel
<div asp-validation-summary="All"></div>
<input asp-for="Id" type="hidden"/>

@if (ViewBag.RefreshPage == true)
{
    <script>
        try {window.opener.document.forms['@(Context.Request.Query["formId"])'].@(Context.Request.Query["btnId"]).click();}
        catch (e){}
        window.close();
    </script>
}
<script>
    $(function () {
        $("#@Html.IdFor(model => model.CountryId)").change(function () {
            var selectedItem = $(this).val();
            var ddlStates = $("#@Html.IdFor(model => model.StateProvinceId)");
            $.ajax({
                cache: false,
                type: "GET",
                url: "@(Url.Action("GetStatesByCountryId", "Home", new RouteValueDictionary { { "area", "Admin" } }))",
                data: { "countryId": selectedItem, "addAsterisk": "true" },
                success: function (data) {
                    ddlStates.html('');
                    $.each(data, function (id, option) {
                        ddlStates.append($('<option></option>').val(option.id).html(option.name));
                    });
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    alert('Failed to retrieve states.');
                }
            });
        });
    });
</script>

@* where the rate applies, then the weight range and what it costs; the units are the ends of
   their controls instead of bare text after them *@
<div class="grand-fields grand-fields--2col">
    <admin-field asp-for="StoreId" asp-items="Model.AvailableStores"/>
    <admin-field asp-for="WarehouseId" asp-items="Model.AvailableWarehouses"/>
    <admin-field asp-for="CountryId" asp-items="Model.AvailableCountries"/>
    <admin-field asp-for="StateProvinceId" asp-items="Model.AvailableStates"/>
    <admin-field asp-for="Zip"/>
    <admin-field asp-for="ShippingMethodId" asp-items="Model.AvailableShippingMethods"/>
</div>
<div class="grand-fields grand-fields--2col">
    <admin-field asp-for="From" size="md" suffix="@Model.BaseWeightIn"/>
    <admin-field asp-for="To" size="md" suffix="@Model.BaseWeightIn"/>
    <admin-field asp-for="AdditionalFixedCost" size="md" suffix="@Model.PrimaryStoreCurrencyCode"/>
    <admin-field asp-for="LowerWeightLimit" size="md"/>
    <admin-field asp-for="RatePerWeightUnit" size="md" suffix="@Model.PrimaryStoreCurrencyCode"/>
    <admin-field asp-for="PercentageRateOfSubtotal" size="md"/>
</div>
<div class="grand-popup__actions">
    <button class="btn btn-primary" type="submit" name="save">
        <i class="bi bi-check-lg"></i> @Loc["Admin.Common.Save"]
    </button>
</div>