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.1 KB
Raw Blame
@model CustomerModel
@{
    var area = ViewContext.RouteData.Values["area"]?.ToString();
    <div class="grand-card">
        <div class="grand-card__header">
            <h2 class="grand-card__title">@Loc["Admin.Customers.Customers.ProductPrice"]</h2>
            <a id="btnAddNewProduct" href="@(Url.Action("ProductAddPopup", "Customer", new { customerId = Model.Id, btnId = "btnRefreshProducts", formId = "customer-form", area = area }))" class="btn btn-outline-secondary btn-sm"><i class="bi bi-plus-lg"></i> @Loc["Admin.Customers.Customers.ProductPrice.AddNew"]</a>
            <input type="submit" id="btnRefreshProducts" style="display: none"/>
        </div>
        <partial name="Partials/WidgetZone.ProductPriceTop" model="Model"/>
        <div class="grand-card__body grand-card__body--flush">
            <admin-grid id="productprice-grid"
                        read-url="@Url.Action("ProductsPrice", "Customer", new { customerId = Model.Id, area = area })"
                        update-url="@Url.Action("UpdateProductPrice", "Customer", new { area = area })"
                        destroy-url="@Url.Action("DeleteProductPrice", "Customer", new { area = area })"
                        auto-bind="false"
                        edit-mode="Inline"
                        reload-after-save="false">
                <grid-column field="ProductName" title="@Loc["Admin.Customers.Customers.ProductPrice.ProductName"]" width="300">
                    <cell-template>
                        <a class="text-decoration-none" href="@Url.Action("Edit", "Product", new { area = area })/{{ ProductId }}" target="_blank">{{ ProductName }}</a>
                    </cell-template>
                </grid-column>
                <grid-column field="Price" title="@Loc["Admin.Customers.Customers.ProductPrice.Price"]" width="100" editor="Numeric"/>
                <grid-commands edit="true" destroy="true" width="200"/>
            </admin-grid>
        </div>
        <partial name="Partials/WidgetZone.ProductPriceBottom" model="Model"/>
    </div>
    <div class="note note-info mt-3">
        @Loc["Admin.Customers.Customers.ProductPrice.Price.Warning"]
    </div>

    <script>
        $(document).ready(function () {
            $('#btnAddNewProduct').magnificPopup({
                type: 'ajax',
                settings: { cache: false, async: false },
                midClick: true,
                callbacks: {
                    parseAjax: function (mfpResponse) {
                        mfpResponse.data = $('<div></div>').html(mfpResponse.data);
                    },
                    ajaxContentAdded: function () {
                        $('.mfp-wrap').removeAttr('tabindex');
                    }
                }
            });
        });
    </script>
    <script>
        $(document).ready(function () {
            $('#btnRefreshProducts').click(function () {
                //refresh grid
                var grid = GrandAdmin.grids.get("#productprice-grid");
                grid.dataSource.read();

                //return false to don't reload a page
                return false;
            });
        });
    </script>
}