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.

3.3 KB
Raw Blame
@model ProductModel
@{
    var area = ViewContext.RouteData.Values["area"]?.ToString();
    //a product the store may see but not change (see BaseProductController.Edit)
    bool readOnly = ViewBag.IsReadOnly == true;
}

@if (!string.IsNullOrEmpty(Model.Id))
{
    <div class="grand-card">
        <partial name="Partials/WidgetZone.Collections.Top" model="Model"/>
        <div class="grand-card__header"><h2 class="grand-card__title">@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Collections.Fields.Collection"]</h2></div>
        <div class="grand-card__body grand-card__body--flush">
            <admin-grid id="productcollections-grid"
                        read-only="@readOnly"
                        read-url="@Url.Action("ProductCollectionList", "Product", new { productId = Model.Id, area = area })"
                        create-url="@Url.Action("ProductCollectionInsert", "Product", new { productId = Model.Id, area = area })"
                        update-url="@Url.Action("ProductCollectionUpdate", "Product", new { area = area })"
                        destroy-url="@Url.Action("ProductCollectionDelete", "Product", new { area = area })"
                        pager="Compact"
                        auto-bind="false"
                        edit-mode="Inline"
                        confirm-destroy="true">
                <grid-toolbar-create text="@Loc[$"{Scope.ResourceKeyPrefix}.Common.AddNewRecord"]"/>
                <grid-column field="CollectionId" title="@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Collections.Fields.Collection"]" width="200"
                             editor="Select" options-url="@Url.Action("Collection", "Search", new { area = area })" options-filter="startswith"
                             option-label="Select collection..." text-field="Collection" required="true" default-value="">
                    @*the link is a partial: Vendor overrides it with plain text (it cannot open collections)*@
                    <cell-template><partial name="Partials/Collections.LinkTemplate"/></cell-template>
                </grid-column>
                @if (Scope.ResourceKeyPrefix != "Vendor")
                {
                    @*Vendor has no IsFeaturedProduct column*@
                    <grid-column field="IsFeaturedProduct" title="@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Collections.Fields.IsFeaturedProduct"]" width="100" align="Center" editor="Checkbox">
                        <cell-template>
                            <i data-if="IsFeaturedProduct" class="bi bi-check-lg" aria-hidden="true" style="color:green"></i>
                            <i data-else class="bi bi-x-lg" aria-hidden="true" style="color:red"></i>
                        </cell-template>
                    </grid-column>
                }
                <grid-column field="DisplayOrder" title="@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Collections.Fields.DisplayOrder"]" width="100" align="Center" format="{0:0}" min-screen-width="500" editor="Integer" default-value="0"/>
                <grid-commands edit="true" destroy="true" width="200"/>
            </admin-grid>
        </div>
        <partial name="Partials/WidgetZone.Collections.Bottom" model="Model"/>
    </div>
}
else
{
    <div class="note note-info">
        @Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Collections.SaveBeforeEdit"]
    </div>
}