Branch Entity Hatası
This commit is contained in:
parent
594bf2da0c
commit
9103d1ae94
15 changed files with 420 additions and 377 deletions
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
|
||||
namespace Kurs.Platform.Identity.Dto;
|
||||
|
||||
public class AssignedBranchViewModel
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public bool IsAssigned { get; set; }
|
||||
}
|
||||
|
|
@ -36,6 +36,8 @@ public class UserInfoViewModel: ExtensibleObject
|
|||
|
||||
public AssignedRoleViewModel[] Roles { get; set; }
|
||||
|
||||
public AssignedBranchViewModel[] Branches { get; set; }
|
||||
|
||||
public bool LockUser { get; set; }
|
||||
|
||||
public DateTimeOffset? LastPasswordChangeTime { get; set; }
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ public class GridOptionsDto : AuditedEntityDto<Guid>
|
|||
/// <summary>
|
||||
/// Liste formların branch çalışıp çalışmadığını ifade eder.
|
||||
/// </summary>
|
||||
public bool IsBranch { get; set; }
|
||||
public bool IsBranch { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Liste formların ou'lu çalışıp çalışmadığını ifade eder.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Kurs.Platform.Entities;
|
||||
using Kurs.Platform.Extensions;
|
||||
using Kurs.Platform.Identity.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
|
@ -18,18 +19,23 @@ public class PlatformIdentityAppService : ApplicationService
|
|||
public IIdentityUserAppService IdentityUserAppService { get; }
|
||||
private readonly IIdentityUserRepository identityUserRepository;
|
||||
public IRepository<PermissionDefinitionRecord, Guid> permissionRepository { get; }
|
||||
|
||||
public IRepository<Branch, Guid> branchRepository { get; }
|
||||
public IRepository<BranchUsers, Guid> branchUsersRepository { get; }
|
||||
public IdentityUserManager UserManager { get; set; }
|
||||
|
||||
public PlatformIdentityAppService(
|
||||
IIdentityUserAppService identityUserAppService,
|
||||
IIdentityUserRepository identityUserRepository,
|
||||
IRepository<PermissionDefinitionRecord, Guid> permissionRepository
|
||||
IRepository<PermissionDefinitionRecord, Guid> permissionRepository,
|
||||
IRepository<Branch, Guid> branchRepository,
|
||||
IRepository<BranchUsers, Guid> branchUsersRepository
|
||||
)
|
||||
{
|
||||
this.IdentityUserAppService = identityUserAppService;
|
||||
this.identityUserRepository = identityUserRepository;
|
||||
this.permissionRepository = permissionRepository;
|
||||
this.branchRepository = branchRepository;
|
||||
this.branchUsersRepository = branchUsersRepository;
|
||||
}
|
||||
|
||||
public async Task<UserInfoViewModel> GetByIdAsync(Guid UserId)
|
||||
|
|
@ -46,6 +52,19 @@ public class PlatformIdentityAppService : ApplicationService
|
|||
}
|
||||
}
|
||||
|
||||
var query = await branchUsersRepository.GetQueryableAsync();
|
||||
var branchUsers = query.Where(a => a.UserId == UserId).Select(r => r.BranchId).ToList();
|
||||
var currentTenantId = CurrentTenant.Id.HasValue ? CurrentTenant.Id : null;
|
||||
|
||||
var branchList = await branchRepository.GetListAsync(a=> a.TenantId == currentTenantId);
|
||||
var branches = branchList.Select(branch => new AssignedBranchViewModel
|
||||
{
|
||||
Id = branch.Id,
|
||||
Name = branch.Name,
|
||||
IsAssigned = branchUsers.Contains(branch.Id)
|
||||
})
|
||||
.ToArray();
|
||||
|
||||
return new UserInfoViewModel()
|
||||
{
|
||||
Id = user.Id,
|
||||
|
|
@ -53,6 +72,7 @@ public class PlatformIdentityAppService : ApplicationService
|
|||
Name = user.Name,
|
||||
Surname = user.Surname,
|
||||
Roles = roles,
|
||||
Branches = branches,
|
||||
Email = user.Email,
|
||||
PhoneNumber = user.PhoneNumber,
|
||||
IsActive = user.IsActive,
|
||||
|
|
@ -126,6 +146,29 @@ public class PlatformIdentityAppService : ApplicationService
|
|||
user.SetRocketUsername(UserInfo.RocketUsername);
|
||||
|
||||
await UserManager.UpdateAsync(user);
|
||||
|
||||
//Braches bu kısımda güncelleniyor.
|
||||
var existingBranches = await branchUsersRepository.GetListAsync(x => x.UserId == user.Id);
|
||||
foreach (var item in existingBranches)
|
||||
{
|
||||
await branchUsersRepository.DeleteAsync(item);
|
||||
}
|
||||
|
||||
// 2. Yeni atamaları ekle
|
||||
var assignedBranchIds = UserInfo.Branches
|
||||
.Where(b => b.IsAssigned)
|
||||
.Select(b => b.Id)
|
||||
.ToList();
|
||||
|
||||
foreach (var branchId in assignedBranchIds)
|
||||
{
|
||||
var branchUser = new BranchUsers
|
||||
{
|
||||
UserId = user.Id,
|
||||
BranchId = branchId
|
||||
};
|
||||
await branchUsersRepository.InsertAsync(branchUser);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<PermissionDefinitionRecord>> GetPermissionList()
|
||||
|
|
|
|||
|
|
@ -8073,7 +8073,7 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
|
|||
},
|
||||
new ListFormField
|
||||
{
|
||||
ListFormCode = listFormTenants.ListFormCode,
|
||||
ListFormCode = listFormBranches.ListFormCode,
|
||||
RoleId = null,
|
||||
UserId = null,
|
||||
CultureName = LanguageCodes.En,
|
||||
|
|
|
|||
|
|
@ -1962,6 +1962,42 @@
|
|||
"en": "Role Management",
|
||||
"tr": "Rol Yönetimi"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "Abp.Identity.User.UserInformation.BranchManagement",
|
||||
"en": "Branch Management",
|
||||
"tr": "Şube Yönetimi"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "Abp.Identity.User.UserInformation.PersonalInformation",
|
||||
"en": "Personal Information",
|
||||
"tr": "Kişisel Bilgiler"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "Abp.Identity.User.UserInformation.ContactInformation",
|
||||
"en": "Contact Information",
|
||||
"tr": "İletişim Bilgileri"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "Abp.Identity.User.UserInformation.AccountTimestamps",
|
||||
"en": "Account Timestamps",
|
||||
"tr": "Zaman Damgaları"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "Abp.Identity.User.LockoutManagement.AccountStatus",
|
||||
"en": "Account Status",
|
||||
"tr": "Hesap Durumları"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "Abp.Identity.User.LockoutManagement.LoginAndLockoutSettings",
|
||||
"en": "Login And Lockout Settings",
|
||||
"tr": "Giriş ve Kilit Ayarları"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "Abp.Identity.User.UserInformation.EmailAddress",
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Kurs.Platform.Branches;
|
||||
|
||||
public interface IPlatformBranchesRepository
|
||||
{
|
||||
Task<List<Guid>> GetBranchIdsWithUserId(Guid userId);
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
using Kurs.Platform.Branches;
|
||||
using Kurs.Platform.Entities;
|
||||
using Kurs.Platform.Entities;
|
||||
using Kurs.Platform.Enums;
|
||||
using Kurs.Platform.Localization;
|
||||
using Kurs.Platform.OrganizationUnits;
|
||||
|
|
@ -38,7 +37,7 @@ public class ListFormManager : PlatformDomainService, IListFormManager
|
|||
private readonly IRepository<ListForm, Guid> listFormRepository;
|
||||
private readonly IDefaultValueManager defaultValueManager;
|
||||
private readonly IPlatformOuRepository ouRepository;
|
||||
private readonly IPlatformBranchesRepository branchUsersRepository;
|
||||
private readonly IRepository<BranchUsers, Guid> branchUsersRepository;
|
||||
private readonly string cultureName;
|
||||
private readonly string cultureNameDefault;
|
||||
|
||||
|
|
@ -51,7 +50,7 @@ public class ListFormManager : PlatformDomainService, IListFormManager
|
|||
IRepository<ListForm, Guid> listFormRepository,
|
||||
IDefaultValueManager defaultValueManager,
|
||||
IPlatformOuRepository ouRepository,
|
||||
IPlatformBranchesRepository branchUsersRepository)
|
||||
IRepository<BranchUsers, Guid> branchUsersRepository)
|
||||
: base(settingProvider, localizer, currentUser, objectMapper, authManager)
|
||||
{
|
||||
this.listFormRepository = listFormRepository;
|
||||
|
|
@ -133,10 +132,10 @@ public class ListFormManager : PlatformDomainService, IListFormManager
|
|||
|
||||
if (listForm.IsBranch)
|
||||
{
|
||||
var ids = await branchUsersRepository.GetBranchIdsWithUserId(CurrentUser.Id.Value);
|
||||
var ids = await branchUsersRepository.GetListAsync((a) => a.UserId == CurrentUser.Id.Value);
|
||||
if (ids.Count > 0)
|
||||
{
|
||||
fields.Add("BranchId", $"IN ({string.Join(",", ids.Select(a => $"'{a}'"))})");
|
||||
fields.Add("BranchId", $"IN ({string.Join(",", ids.Select(a => $"'{a.BranchId}'"))})");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ using System.Globalization;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using Kurs.Platform.Branches;
|
||||
using Kurs.Platform.Entities;
|
||||
using Kurs.Platform.Enums;
|
||||
using Kurs.Platform.Extensions;
|
||||
|
|
@ -13,6 +12,7 @@ using Kurs.Platform.ListForms;
|
|||
using Kurs.Platform.Localization;
|
||||
using Kurs.Platform.OrganizationUnits;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
using Volo.Abp.ObjectMapping;
|
||||
using Volo.Abp.Settings;
|
||||
using Volo.Abp.Users;
|
||||
|
|
@ -104,7 +104,7 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
|
|||
public bool IsAppliedGridFilter { get; private set; }
|
||||
public bool IsAppliedServerFilter { get; private set; }
|
||||
public IPlatformOuRepository OuRepository { get; }
|
||||
public IPlatformBranchesRepository BranchesRepository { get; }
|
||||
public IRepository<BranchUsers, Guid> BranchUsersRepository { get; }
|
||||
|
||||
public SelectQueryManager(
|
||||
ISettingProvider settingProvider,
|
||||
|
|
@ -113,7 +113,7 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
|
|||
IObjectMapper objectMapper,
|
||||
IListFormAuthorizationManager authManager,
|
||||
IPlatformOuRepository ouRepository,
|
||||
IPlatformBranchesRepository branchesRepository)
|
||||
IRepository<BranchUsers, Guid> branchUsersRepository)
|
||||
: base(settingProvider, localizer, currentUser, objectMapper, authManager)
|
||||
{
|
||||
SelectFields = [];
|
||||
|
|
@ -122,7 +122,7 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
|
|||
SortParts = [];
|
||||
SummaryQueries = [];
|
||||
OuRepository = ouRepository;
|
||||
BranchesRepository = branchesRepository;
|
||||
BranchUsersRepository = branchUsersRepository;
|
||||
}
|
||||
|
||||
public void PrepareQueries(ListForm listform,
|
||||
|
|
@ -407,10 +407,10 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
|
|||
whereParts.Add("AND");
|
||||
}
|
||||
|
||||
var ids = BranchesRepository.GetBranchIdsWithUserId(CurrentUser.Id.Value).Result;
|
||||
var ids = BranchUsersRepository.GetListAsync((a) => a.UserId == CurrentUser.Id.Value).Result;
|
||||
if (ids.Count > 0)
|
||||
{
|
||||
whereParts.Add($"\"BranchId\" IN ({string.Join(",", ids.Select(a => $"'{a}'"))})");
|
||||
whereParts.Add($"\"BranchId\" IN ({string.Join(",", ids.Select(a => $"'{a.BranchId}'"))})");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Linq.Dynamic.Core;
|
||||
using System.Threading.Tasks;
|
||||
using Kurs.Platform.Entities;
|
||||
using Kurs.Platform.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
|
||||
using Volo.Abp.EntityFrameworkCore;
|
||||
using Volo.Abp.Identity;
|
||||
|
||||
namespace Kurs.Platform.Branches
|
||||
{
|
||||
public class PlatformBranchRepository : EfCoreRepository<PlatformDbContext, IdentityUser, Guid>, IPlatformBranchesRepository
|
||||
{
|
||||
public PlatformBranchRepository(IDbContextProvider<PlatformDbContext> dbContextProvider) : base(dbContextProvider)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<Guid>> GetBranchIdsWithUserId(Guid userId)
|
||||
{
|
||||
var query = await GetQueryableAsync(userId);
|
||||
var organizationUnitCodes = await query.Select(ou => ou.Code).ToListAsync();
|
||||
var dbContext = await GetDbContextAsync();
|
||||
|
||||
return await dbContext.OrganizationUnits
|
||||
.Where(a => organizationUnitCodes.Any(b => a.Code.StartsWith(b)))
|
||||
.Select(a => a.Id)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
//Get IQueryable
|
||||
private async Task<IQueryable<Branch>> GetQueryableAsync(Guid userId)
|
||||
{
|
||||
var dbContext = await GetDbContextAsync();
|
||||
var query = from userBranch in dbContext.Set<BranchUsers>()
|
||||
join branch in dbContext.Branches on userBranch.BranchId equals branch.Id
|
||||
where userBranch.UserId == userId
|
||||
select branch;
|
||||
|
||||
return query;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -34,7 +34,8 @@ public class Program
|
|||
};
|
||||
|
||||
var loggerConfig = new LoggerConfiguration()
|
||||
.MinimumLevel.Information();
|
||||
.MinimumLevel.Error()
|
||||
.WriteTo.Console(); // Konsola da log yaz
|
||||
|
||||
switch (DefaultDatabaseProvider)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict';
|
|||
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
||||
}, {
|
||||
"url": "index.html",
|
||||
"revision": "0.5oedcrigdno"
|
||||
"revision": "0.13cgdm1rjp"
|
||||
}], {});
|
||||
workbox.cleanupOutdatedCaches();
|
||||
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ export interface UserInfoViewModel extends ExtensibleObject {
|
|||
isVerified: boolean
|
||||
userRoleNames: string[]
|
||||
roles: AssignedRoleViewModel[]
|
||||
branches: AssignedRoleViewModel[]
|
||||
lockUser: boolean
|
||||
lastPasswordChangeTime?: Date | string
|
||||
|
||||
|
|
@ -138,3 +139,8 @@ export interface AssignedRoleViewModel {
|
|||
name?: string
|
||||
isAssigned: boolean
|
||||
}
|
||||
|
||||
export interface AssignedBranchViewModel {
|
||||
name?: string
|
||||
isAssigned: boolean
|
||||
}
|
||||
|
|
@ -472,6 +472,7 @@ export interface GridOptionsDto extends AuditedEntityDto<string> {
|
|||
insertServiceAddress?: string
|
||||
deleteServiceAddress?: string
|
||||
isTenant: boolean
|
||||
isBranch: boolean
|
||||
isOrganizationUnit: boolean
|
||||
listFormType: string
|
||||
isSubForm: boolean
|
||||
|
|
|
|||
|
|
@ -79,149 +79,150 @@ function UserDetails() {
|
|||
{({ touched, errors, resetForm, isSubmitting, values }) => {
|
||||
const userRoleNames = values.userRoleNames
|
||||
const roles = values.roles
|
||||
const branches = values.branches
|
||||
|
||||
return (
|
||||
<Form>
|
||||
<FormContainer size="sm">
|
||||
<div className="w-1/2">
|
||||
<div className="form-label mb-2">{translate('::Abp.Identity.User.UserInformation.RoleManagement')}</div>
|
||||
<div className="border-2 rounded-lg">
|
||||
<FieldArray name="roles">
|
||||
{({ form, remove, push }) => (
|
||||
<div className="grid grid-cols-4 text-center">
|
||||
{roles && roles.length > 0
|
||||
? roles.map((_, index: number) => {
|
||||
return (
|
||||
<div key={index} className="p-2">
|
||||
<FormItem
|
||||
labelClass="block text-center"
|
||||
className="mb-0 justify-center"
|
||||
label={roles[index].name}
|
||||
>
|
||||
<Field
|
||||
className="mr-0"
|
||||
name={`roles[${index}].isAssigned`}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
</div>
|
||||
<div className="w-1/2">
|
||||
<FormContainer size="md">
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4 w-full">
|
||||
{/* Personal Information */}
|
||||
<div>
|
||||
<FormItem label={translate('::Abp.Identity.User.UserInformation.Name')}>
|
||||
<Field type="text" name="name" placeholder="Name" component={Input} />
|
||||
</FormItem>
|
||||
</div>
|
||||
|
||||
{/* Personal Information */}
|
||||
<div>
|
||||
<FormItem label={translate('::Abp.Identity.User.UserInformation.Surname')}>
|
||||
<Field type="text" name="surname" placeholder="Surname" component={Input} />
|
||||
</FormItem>
|
||||
</div>
|
||||
|
||||
{/* Şube Management */}
|
||||
<div>
|
||||
<h6 className="mb-4">{translate('::Abp.Identity.User.UserInformation.BranchManagement')}</h6>
|
||||
<div className="border-2 rounded-lg p-4">
|
||||
<FieldArray name="branches">
|
||||
{({ form, remove, push }) => (
|
||||
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2 text-center">
|
||||
{branches && branches.length > 0
|
||||
? branches.map((_, index: number) => (
|
||||
<div key={index} className="p-2">
|
||||
<FormItem
|
||||
labelClass="block text-center"
|
||||
className="mb-0 justify-center"
|
||||
label={branches[index].name}
|
||||
>
|
||||
<Field
|
||||
className="mr-0"
|
||||
name={`branches[${index}].isAssigned`}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
</div>
|
||||
))
|
||||
: null}
|
||||
</div>
|
||||
)}
|
||||
</FieldArray>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Role Management */}
|
||||
<div>
|
||||
<h6 className="mb-4">{translate('::Abp.Identity.User.UserInformation.RoleManagement')}</h6>
|
||||
<div className="border-2 rounded-lg p-4">
|
||||
<FieldArray name="roles">
|
||||
{({ form, remove, push }) => (
|
||||
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2 text-center">
|
||||
{roles && roles.length > 0
|
||||
? roles.map((_, index: number) => (
|
||||
<div key={index} className="p-2">
|
||||
<FormItem
|
||||
labelClass="block text-center"
|
||||
className="mb-0 justify-center"
|
||||
label={roles[index].name}
|
||||
>
|
||||
<Field
|
||||
className="mr-0"
|
||||
name={`roles[${index}].isAssigned`}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
</div>
|
||||
))
|
||||
: null}
|
||||
</div>
|
||||
)}
|
||||
</FieldArray>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Contact Information */}
|
||||
<div>
|
||||
<h6 className="mb-4">{translate('::Abp.Identity.User.UserInformation.ContactInformation')}</h6>
|
||||
<FormItem label={translate('::Abp.Identity.User.UserInformation.EmailAddress')}>
|
||||
<Field type="text" disabled name="email" placeholder="Email Address" component={Input} />
|
||||
</FormItem>
|
||||
<FormItem label={translate('::Abp.Identity.User.UserInformation.PhoneNumber')}>
|
||||
<Field type="text" name="phoneNumber" placeholder="Phone Number" component={Input} />
|
||||
</FormItem>
|
||||
<FormItem label={translate('::RocketUsername')}>
|
||||
<Field type="text" name="rocketUsername" placeholder={translate('::RocketUsername')} component={Input} />
|
||||
</FormItem>
|
||||
</div>
|
||||
|
||||
{/* Account Timestamps */}
|
||||
<div>
|
||||
<h6 className="mb-4">{translate('::Abp.Identity.User.UserInformation.AccountTimestamps')}</h6>
|
||||
<FormItem label={translate('::Abp.Identity.User.UserInformation.PasswordChangeTime')}>
|
||||
<Field name="lastPasswordChangeTime">
|
||||
{({ field, form }: FieldProps) => (
|
||||
<DateTimepicker
|
||||
field={field}
|
||||
form={form}
|
||||
value={field.value ? dayjs(field.value).toDate() : null}
|
||||
placeholder="Select Date"
|
||||
onChange={(date: any) => {
|
||||
form.setFieldValue(
|
||||
field.name,
|
||||
date ? dayjs(date).format('YYYY-MM-DDTHH:mm:ss[Z]') : null,
|
||||
)
|
||||
})
|
||||
: null}
|
||||
</div>
|
||||
)}
|
||||
</FieldArray>
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
</FormItem>
|
||||
<FormItem label={translate('::Abp.Identity.User.UserInformation.CreateTime')}>
|
||||
<Field name="creationTime">
|
||||
{({ field, form }: FieldProps) => (
|
||||
<Input
|
||||
field={field}
|
||||
form={form}
|
||||
value={field.value ? dayjs(field.value).format('L LT') : undefined}
|
||||
disabled
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
</FormItem>
|
||||
<FormItem label={translate('::Abp.Identity.User.UserInformation.UpdateTime')}>
|
||||
<Field name="lastModificationTime">
|
||||
{({ field, form }: FieldProps) => (
|
||||
<Input
|
||||
field={field}
|
||||
form={form}
|
||||
value={field.value ? dayjs(field.value).format('L LT') : undefined}
|
||||
disabled
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
</FormItem>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mb-3"></div>
|
||||
|
||||
<FormItem
|
||||
labelClass="!justify-start"
|
||||
labelWidth="40%"
|
||||
label={translate('::Abp.Identity.User.UserInformation.EmailAddress')}
|
||||
>
|
||||
<Field
|
||||
type="text"
|
||||
disabled
|
||||
name="email"
|
||||
placeholder="Email Address"
|
||||
component={Input}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem labelClass="!justify-start" labelWidth="40%"
|
||||
label={translate('::Abp.Identity.User.UserInformation.Name')}
|
||||
>
|
||||
<Field type="text" name="name" placeholder="Name" component={Input} />
|
||||
</FormItem>
|
||||
|
||||
<FormItem labelClass="!justify-start" labelWidth="40%"
|
||||
label={translate('::Abp.Identity.User.UserInformation.Surname')}
|
||||
>
|
||||
<Field
|
||||
type="text"
|
||||
name="surname"
|
||||
placeholder="Surname"
|
||||
component={Input}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem labelClass="!justify-start" labelWidth="40%"
|
||||
label={translate('::Abp.Identity.User.UserInformation.PhoneNumber')}
|
||||
>
|
||||
<Field
|
||||
type="text"
|
||||
name="phoneNumber"
|
||||
placeholder="Phone Number"
|
||||
component={Input}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
labelClass="!justify-start"
|
||||
labelWidth="40%"
|
||||
label={translate('::Abp.Identity.User.UserInformation.PasswordChangeTime')}
|
||||
>
|
||||
<Field name="lastPasswordChangeTime">
|
||||
{({ field, form }: FieldProps) => (
|
||||
<DateTimepicker
|
||||
field={field}
|
||||
form={form}
|
||||
value={field.value ? dayjs(field.value).toDate() : null}
|
||||
placeholder="Select Date"
|
||||
onChange={(date: any) => {
|
||||
form.setFieldValue(
|
||||
field.name,
|
||||
date ? dayjs(date).format('YYYY-MM-DDTHH:mm:ss[Z]') : null,
|
||||
)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
labelClass="!justify-start"
|
||||
labelWidth="40%"
|
||||
label={translate('::RocketUsername')}
|
||||
>
|
||||
<Field
|
||||
type="text"
|
||||
name="rocketUsername"
|
||||
placeholder={translate('::RocketUsername')}
|
||||
component={Input}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem labelClass="!justify-start" labelWidth="40%"
|
||||
label={translate('::Abp.Identity.User.UserInformation.CreateTime')}
|
||||
>
|
||||
<Field name="creationTime">
|
||||
{({ field, form }: FieldProps) => (
|
||||
<Input
|
||||
field={field}
|
||||
form={form}
|
||||
value={field.value ? dayjs(field.value).format('L LT') : undefined}
|
||||
disabled
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
</FormItem>
|
||||
<FormItem labelClass="!justify-start" labelWidth="40%"
|
||||
label={translate('::Abp.Identity.User.UserInformation.UpdateTime')}
|
||||
>
|
||||
<Field name="lastModificationTime">
|
||||
{({ field, form }: FieldProps) => (
|
||||
<Input
|
||||
field={field}
|
||||
form={form}
|
||||
value={field.value ? dayjs(field.value).format('L LT') : undefined}
|
||||
disabled
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
</FormItem>
|
||||
</div>
|
||||
</FormContainer>
|
||||
</FormContainer>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Button variant="solid" loading={isSubmitting} type="submit">
|
||||
|
|
@ -261,178 +262,176 @@ function UserDetails() {
|
|||
const userRoleNames = values.userRoleNames
|
||||
return (
|
||||
<Form>
|
||||
<FormContainer size="sm">
|
||||
<div className="w-1/2">
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.Status')}
|
||||
>
|
||||
<Field name="isActive" placeholder={translate('::Abp.Identity.User.LockoutManagement.Status')} component={Checkbox} />
|
||||
</FormItem>
|
||||
<div className="w-1/2">
|
||||
<FormContainer size="md">
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4 w-full">
|
||||
{/* Account Status */}
|
||||
<div>
|
||||
<h6 className="mb-4">{translate('::Abp.Identity.User.LockoutManagement.AccountStatus')}</h6>
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.Status')}
|
||||
>
|
||||
<Field name="isActive" placeholder={translate('::Abp.Identity.User.LockoutManagement.Status')} component={Checkbox} />
|
||||
</FormItem>
|
||||
|
||||
<hr className="mb-3" />
|
||||
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.AdminVerification')}
|
||||
>
|
||||
<Field
|
||||
name="isVerified"
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.AdminVerification')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<hr className="mb-3" />
|
||||
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.EmailConfirmed')}
|
||||
>
|
||||
<Field
|
||||
name="emailConfirmed"
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.EmailConfirmed')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.PhoneNumberConfirmed')}
|
||||
>
|
||||
<Field
|
||||
name="phoneNumberConfirmed"
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.PhoneNumberConfirmed')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<hr className="mb-3" />
|
||||
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.TwoFactorEnabled')}
|
||||
>
|
||||
<Field
|
||||
name="twoFactorEnabled"
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.TwoFactorEnabled')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<hr className="mb-3" />
|
||||
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.LoginEndDate')}
|
||||
>
|
||||
<Field name="loginEndDate">
|
||||
{({ field, form }: FieldProps) => (
|
||||
<DatePicker
|
||||
field={field}
|
||||
form={form}
|
||||
value={field.value ? dayjs(field.value).toDate() : null}
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.LoginEndDate')}
|
||||
onChange={(date) => {
|
||||
form.setFieldValue(
|
||||
field.name,
|
||||
date ? dayjs(date).format('YYYY-MM-DDTHH:mm:ss[Z]') : null,
|
||||
)
|
||||
}}
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.AdminVerification')}
|
||||
>
|
||||
<Field
|
||||
name="isVerified"
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.AdminVerification')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
</FormItem>
|
||||
</FormItem>
|
||||
|
||||
<hr className="mb-3" />
|
||||
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.AccountLockoutEnabled')}
|
||||
>
|
||||
<Field
|
||||
name="lockoutEnabled"
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.AccountLockoutEnabled')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.AccountLocked')}
|
||||
>
|
||||
<Field
|
||||
name="lockUser"
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.AccountLocked')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.AccountEndDate')}
|
||||
>
|
||||
<Field name="lockoutEnd">
|
||||
{({ field, form }: FieldProps) => (
|
||||
<DatePicker
|
||||
field={field}
|
||||
form={form}
|
||||
value={field.value ? dayjs(field.value).toDate() : null}
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.AccountEndDate')}
|
||||
onChange={(date) => {
|
||||
form.setFieldValue(
|
||||
field.name,
|
||||
date ? dayjs(date).format('YYYY-MM-DDTHH:mm:ss[Z]') : null,
|
||||
)
|
||||
}}
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.EmailConfirmed')}
|
||||
>
|
||||
<Field
|
||||
name="emailConfirmed"
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.EmailConfirmed')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
</FormItem>
|
||||
</FormItem>
|
||||
|
||||
<hr className="mb-3" />
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.PhoneNumberConfirmed')}
|
||||
>
|
||||
<Field
|
||||
name="phoneNumberConfirmed"
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.PhoneNumberConfirmed')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.ShouldChangePwOnNextLogin')}
|
||||
>
|
||||
<Field
|
||||
name="shouldChangePasswordOnNextLogin"
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.ShouldChangePwOnNextLogin')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.TwoFactorEnabled')}
|
||||
>
|
||||
<Field
|
||||
name="twoFactorEnabled"
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.TwoFactorEnabled')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
</div>
|
||||
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.AccessFailedCount')}
|
||||
>
|
||||
<Field type="number" name="accessFailedCount" component={Input} />
|
||||
</FormItem>
|
||||
</div>
|
||||
</FormContainer>
|
||||
{/* Login & Lockout Settings */}
|
||||
<div>
|
||||
<h6 className="mb-4">{translate('::Abp.Identity.User.LockoutManagement.LoginAndLockoutSettings')}</h6>
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.LoginEndDate')}
|
||||
>
|
||||
<Field name="loginEndDate">
|
||||
{({ field, form }: FieldProps) => (
|
||||
<DatePicker
|
||||
field={field}
|
||||
form={form}
|
||||
value={field.value ? dayjs(field.value).toDate() : null}
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.LoginEndDate')}
|
||||
onChange={(date) => {
|
||||
form.setFieldValue(
|
||||
field.name,
|
||||
date ? dayjs(date).format('YYYY-MM-DDTHH:mm:ss[Z]') : null,
|
||||
)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.AccountLockoutEnabled')}
|
||||
>
|
||||
<Field
|
||||
name="lockoutEnabled"
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.AccountLockoutEnabled')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.AccountLocked')}
|
||||
>
|
||||
<Field
|
||||
name="lockUser"
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.AccountLocked')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.AccountEndDate')}
|
||||
>
|
||||
<Field name="lockoutEnd">
|
||||
{({ field, form }: FieldProps) => (
|
||||
<DatePicker
|
||||
field={field}
|
||||
form={form}
|
||||
value={field.value ? dayjs(field.value).toDate() : null}
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.AccountEndDate')}
|
||||
onChange={(date) => {
|
||||
form.setFieldValue(
|
||||
field.name,
|
||||
date ? dayjs(date).format('YYYY-MM-DDTHH:mm:ss[Z]') : null,
|
||||
)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.ShouldChangePwOnNextLogin')}
|
||||
>
|
||||
<Field
|
||||
name="shouldChangePasswordOnNextLogin"
|
||||
placeholder={translate('::Abp.Identity.User.LockoutManagement.ShouldChangePwOnNextLogin')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
layout="horizontal"
|
||||
labelClass="!justify-start"
|
||||
labelWidth="50%"
|
||||
label={translate('::Abp.Identity.User.LockoutManagement.AccessFailedCount')}
|
||||
>
|
||||
<Field type="number" name="accessFailedCount" component={Input} />
|
||||
</FormItem>
|
||||
</div>
|
||||
</div>
|
||||
</FormContainer>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Button variant="solid" loading={isSubmitting} type="submit">
|
||||
|
|
|
|||
Loading…
Reference in a new issue