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.2 KB
Raw Blame
@using Grand.Business.Core.Interfaces.Common.Directory
@model ProductModel
@inject ICurrencyService currencyService
@{
    var currencies = await currencyService.GetAllCurrencies();
    var defaultCurrency = await currencyService.GetPrimaryStoreCurrency();
    currencies = currencies.Where(x => x.Id != defaultCurrency.Id).ToList();
    var area = ViewContext.RouteData.Values["area"]?.ToString();
    //a product the store may see but not change (see BaseProductController.Edit)
    bool readOnly = ViewBag.IsReadOnly == true;
    var currencyOptions = currencies.Select(x => new SelectListItem(x.CurrencyCode, x.CurrencyCode));
}
@if (!string.IsNullOrEmpty(Model.Id) && currencies.Count > 0)
{
    <div class="grand-card">
        <div class="grand-card__body grand-card__body--flush">
            @*loaded by tabstrip_on_tab_show when the Prices tab opens*@
            <admin-grid id="productprices-grid"
                        read-only="@readOnly"
                        read-url="@Url.Action("ProductPriceList", "Product", new { productId = Model.Id, area })"
                        create-url="@Url.Action("ProductPriceInsert", "Product", new { productId = Model.Id, area })"
                        update-url="@Url.Action("ProductPriceUpdate", "Product", new { productId = Model.Id, area })"
                        destroy-url="@Url.Action("ProductPriceDelete", "Product", new { productId = Model.Id, area })"
                        pager="Compact"
                        auto-bind="false"
                        edit-mode="Inline"
                        confirm-destroy="true">
                <grid-toolbar-create text="@Loc[$"{Scope.ResourceKeyPrefix}.Common.AddNewRecord"]"/>
                <grid-column field="CurrencyCode" title="@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.ProductPrices.Fields.CurrencyCode"]" width="200"
                             editor="Select" options="currencyOptions" required="true"/>
                <grid-column field="Price" title="@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.ProductPrices.Fields.Price"]" width="100"
                             align="Center" format="{0:n2}" editor="Numeric"/>
                <grid-commands edit="true" destroy="true" width="200"/>
            </admin-grid>
        </div>
    </div>
}