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
@{
    //page title
    ViewBag.Title = Loc["Admin.System.APIUsers"];
}

@* An inline-edit grid in a flush card; its Add new moves into the card header on its own
   (grid.js), so the screen has no primary button. The ids and the OnEdit hook are unchanged. *@
<admin-page title="@Loc["Admin.System.APIUsers"]" icon="bi-list-task">
    <page-actions>
        <vc:admin-widget widget-zone="api_user_list_buttons" additional-data="null"/>
    </page-actions>

    <admin-card flush>
        <admin-grid id="apiuser-grid"
                    read-url="@Url.Action("List", "ApiUser", new { area = Constants.AreaAdmin })"
                    create-url="@Url.Action("Insert", "ApiUser", new { area = Constants.AreaAdmin })"
                    update-url="@Url.Action("Update", "ApiUser", new { area = Constants.AreaAdmin })"
                    destroy-url="@Url.Action("Delete", "ApiUser", new { area = Constants.AreaAdmin })"
                    pager="Compact"
                    edit-mode="Inline"
                    confirm-destroy="true"
                    on-edit="OnEdit">
            <grid-toolbar-create/>
            <grid-column field="Email" title="@Loc["Admin.System.UserApi.Email"]" width="300" editor="Text"/>
            <grid-column field="Password" title="@Loc["Admin.System.UserApi.Password"]" width="300" editor="Text">
                <cell-template>****</cell-template>
            </grid-column>
            <grid-column field="IsActive" title="@Loc["Admin.System.UserApi.IsActive"]" width="100" editor="Checkbox">
                <cell-template>
                    <i data-if="IsActive" 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-commands edit="true" destroy="true" width="200"/>
        </admin-grid>
    </admin-card>
</admin-page>

<script>
        function OnEdit(e) {
            //the e-mail of an existing API user is not changed; it is still posted with the row
            var cell = $(e.container).find('[data-field="Email"]');
            cell.prop("readOnly", !e.model.isNew());
        }
    </script>