mirror of https://github.com/abpframework/abp.git
5 changed files with 154 additions and 69 deletions
@ -0,0 +1,69 @@ |
|||
@using Microsoft.Extensions.Localization |
|||
@using Volo.Abp.Identity.Web.Areas.Identity.Localization.Resource |
|||
@using Volo.Abp.Identity.Web.Pages.Identity.Users |
|||
@model CreateModalModel |
|||
@inject IStringLocalizer<IdentityResource> Localizer |
|||
|
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="userModalLabel">@Localizer["CreateUser"]</h5> |
|||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|||
<span aria-hidden="true">×</span> |
|||
</button> |
|||
</div> |
|||
|
|||
<div class="modal-body"> |
|||
<form id="createUserForm"> |
|||
<!-- Nav tabs --> |
|||
<ul class="nav nav-tabs" role="tablist"> |
|||
<li class="nav-item"> |
|||
<a class="nav-link active" data-toggle="tab" href="#userInformations" role="tab">@Localizer["CreateUser"]</a> |
|||
</li> |
|||
<li class="nav-item"> |
|||
<a class="nav-link" data-toggle="tab" href="#roles" role="tab">@Localizer["Roles"]</a> |
|||
</li> |
|||
</ul> |
|||
|
|||
<!-- Tab panes --> |
|||
<div class="tab-content pt-3"> |
|||
|
|||
<div class="tab-pane active" id="userInformations" role="tabpanel"> |
|||
|
|||
<div class="form-group"> |
|||
<label for="userName">@Localizer["UserName"]</label> |
|||
<input type="text" class="form-control" id="userName" name="UserName" placeholder="User name"> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="password">@Localizer["Password"]</label> |
|||
<input type="password" class="form-control" id="password" name="Password" placeholder="Password"> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="email">@Localizer["EmailAddress"]</label> |
|||
<input type="email" class="form-control" id="email" name="Email" placeholder="Enter email"> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="phoneNumber">@Localizer["PhoneNumber"]</label> |
|||
<input type="tel" class="form-control" id="phoneNumber" name="PhoneNumber" placeholder="Phone number"> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="tab-pane" id="roles" role="tabpanel"> |
|||
<div class="user-role-checkbox-list"> |
|||
@foreach (var role in Model.Roles) |
|||
{ |
|||
<div class="form-check"> |
|||
<label class="form-check-label"> |
|||
<input id="CreateUser_@(role.Name)" class="form-check-input" type="checkbox" name="@(role.Name)" value="true" @Html.Raw(role.IsAssigned ? "checked=\"checked\"" : "")> |
|||
@role.Name |
|||
</label> |
|||
</div> |
|||
} |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</form> |
|||
</div> |
|||
<div class="modal-footer"> |
|||
<button type="button" class="btn btn-secondary" data-dismiss="modal">@Localizer["Close"]</button> |
|||
<button type="button" class="btn btn-primary" id="btnCreateUserSave">@Localizer["Save"]</button> |
|||
</div> |
|||
@ -0,0 +1,31 @@ |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.AspNetCore.Mvc.RazorPages; |
|||
using Volo.Abp.Threading; |
|||
|
|||
namespace Volo.Abp.Identity.Web.Pages.Identity.Users |
|||
{ |
|||
public class CreateModalModel : AbpPageModel |
|||
{ |
|||
public IdentityUserDto User { get; set; } |
|||
|
|||
public IdentityUserRoleDto[] Roles { get; set; } |
|||
|
|||
private readonly IIdentityUserAppService _identityUserAppService; |
|||
private readonly IIdentityRoleAppService _identityRoleAppService; |
|||
|
|||
public CreateModalModel(IIdentityUserAppService identityUserAppService, IIdentityRoleAppService identityRoleAppService) |
|||
{ |
|||
_identityUserAppService = identityUserAppService; |
|||
_identityRoleAppService = identityRoleAppService; |
|||
} |
|||
|
|||
public void OnGet() |
|||
{ |
|||
User = new IdentityUserDto(); |
|||
Roles = ObjectMapper.Map<List<IdentityRoleDto>, IdentityUserRoleDto[]>( |
|||
AsyncHelper.RunSync(() => _identityRoleAppService.GetAllListAsync()) |
|||
); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue