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.0 KB
Raw Blame
@{
    //page title
    ViewBag.Title = Loc["Admin.Customers.SalesEmployees"];
}

@* The inline grid in a flush card: grid.js moves its Add new into the card header, which makes
   it the page's only add; there is nothing else to save. *@
<admin-page title="@Loc["Admin.Customers.SalesEmployees"]" icon="bi-people">
    <admin-card flush>
        <admin-grid id="employees-grid"
                    read-url="@Url.Action("List", "SalesEmployee", new { area = Constants.AreaAdmin })"
                    create-url="@Url.Action("Add", "SalesEmployee", new { area = Constants.AreaAdmin })"
                    update-url="@Url.Action("Update", "SalesEmployee", new { area = Constants.AreaAdmin })"
                    destroy-url="@Url.Action("Delete", "SalesEmployee", new { area = Constants.AreaAdmin })"
                    pager="Compact"
                    edit-mode="Inline"
                    confirm-destroy="true">
            <grid-toolbar-create/>
            <grid-column field="Name" title="@Loc["Admin.Customers.SalesEmployee.Fields.Name"]" width="200" editor="Text"/>
            <grid-column field="Email" title="@Loc["Admin.Customers.SalesEmployee.Fields.Email"]" width="200" editor="Text"/>
            <grid-column field="Phone" title="@Loc["Admin.Customers.SalesEmployee.Fields.Phone"]" width="100" editor="Text"/>
            <grid-column field="Active" title="@Loc["Admin.Customers.SalesEmployee.Fields.Active"]" width="50" align="Center" editor="Checkbox" default-value="true">
                <cell-template>
                    <i data-if="Active" class="bi bi-check-lg text-success" aria-hidden="true"></i>
                    <i data-else class="bi bi-x-lg text-danger" aria-hidden="true"></i>
                </cell-template>
            </grid-column>
            <grid-column field="Commission" title="@Loc["Admin.Customers.SalesEmployee.Fields.Commission"]" width="100" editor="Numeric" default-value=""/>
            <grid-column field="DisplayOrder" title="@Loc["Admin.Customers.SalesEmployee.Fields.DisplayOrder"]" width="50" format="{0:0}" editor="Integer" default-value="0"/>
            <grid-commands edit="true" destroy="true" width="200"/>
        </admin-grid>
    </admin-card>
</admin-page>
<script>
    function markAsPrimaryWeight(id) {
        GrandAdmin.modal.confirm('@Loc["Admin.Common.AreYouSure"]').then(function (confirmed) {
            if (!confirmed) return;
            var postData = {
                id: id
            };
            addAntiForgeryToken(postData);
            $.ajax({
                cache: false,
                type: "POST",
                url: "@(Url.Action("MarkAsPrimaryWeight", "Measure", new { area = Constants.AreaAdmin }))",
                data: postData,
                success: function(data) {
                    var grid = GrandAdmin.grids.get("#measureweight-grid");
                    grid.dataSource.read();
                },
                error: function(xhr, ajaxOptions, thrownError) {
                    alert('Failed to update weight');
                }
            });
        });
    };
</script>