Branch Entity Hatası

This commit is contained in:
Sedat Öztürk 2025-06-15 23:57:14 +03:00
parent 594bf2da0c
commit 9103d1ae94
15 changed files with 420 additions and 377 deletions

View file

@ -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; }
}

View file

@ -36,6 +36,8 @@ public class UserInfoViewModel: ExtensibleObject
public AssignedRoleViewModel[] Roles { get; set; } public AssignedRoleViewModel[] Roles { get; set; }
public AssignedBranchViewModel[] Branches { get; set; }
public bool LockUser { get; set; } public bool LockUser { get; set; }
public DateTimeOffset? LastPasswordChangeTime { get; set; } public DateTimeOffset? LastPasswordChangeTime { get; set; }

View file

@ -270,7 +270,7 @@ public class GridOptionsDto : AuditedEntityDto<Guid>
/// <summary> /// <summary>
/// Liste formların branch çalışıp çalışmadığını ifade eder. /// Liste formların branch çalışıp çalışmadığını ifade eder.
/// </summary> /// </summary>
public bool IsBranch { get; set; } public bool IsBranch { get; set; } = false;
/// <summary> /// <summary>
/// Liste formların ou'lu çalışıp çalışmadığını ifade eder. /// Liste formların ou'lu çalışıp çalışmadığını ifade eder.
/// </summary> /// </summary>

View file

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Kurs.Platform.Entities;
using Kurs.Platform.Extensions; using Kurs.Platform.Extensions;
using Kurs.Platform.Identity.Dto; using Kurs.Platform.Identity.Dto;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
@ -18,18 +19,23 @@ public class PlatformIdentityAppService : ApplicationService
public IIdentityUserAppService IdentityUserAppService { get; } public IIdentityUserAppService IdentityUserAppService { get; }
private readonly IIdentityUserRepository identityUserRepository; private readonly IIdentityUserRepository identityUserRepository;
public IRepository<PermissionDefinitionRecord, Guid> permissionRepository { get; } public IRepository<PermissionDefinitionRecord, Guid> permissionRepository { get; }
public IRepository<Branch, Guid> branchRepository { get; }
public IRepository<BranchUsers, Guid> branchUsersRepository { get; }
public IdentityUserManager UserManager { get; set; } public IdentityUserManager UserManager { get; set; }
public PlatformIdentityAppService( public PlatformIdentityAppService(
IIdentityUserAppService identityUserAppService, IIdentityUserAppService identityUserAppService,
IIdentityUserRepository identityUserRepository, IIdentityUserRepository identityUserRepository,
IRepository<PermissionDefinitionRecord, Guid> permissionRepository IRepository<PermissionDefinitionRecord, Guid> permissionRepository,
IRepository<Branch, Guid> branchRepository,
IRepository<BranchUsers, Guid> branchUsersRepository
) )
{ {
this.IdentityUserAppService = identityUserAppService; this.IdentityUserAppService = identityUserAppService;
this.identityUserRepository = identityUserRepository; this.identityUserRepository = identityUserRepository;
this.permissionRepository = permissionRepository; this.permissionRepository = permissionRepository;
this.branchRepository = branchRepository;
this.branchUsersRepository = branchUsersRepository;
} }
public async Task<UserInfoViewModel> GetByIdAsync(Guid UserId) 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() return new UserInfoViewModel()
{ {
Id = user.Id, Id = user.Id,
@ -53,6 +72,7 @@ public class PlatformIdentityAppService : ApplicationService
Name = user.Name, Name = user.Name,
Surname = user.Surname, Surname = user.Surname,
Roles = roles, Roles = roles,
Branches = branches,
Email = user.Email, Email = user.Email,
PhoneNumber = user.PhoneNumber, PhoneNumber = user.PhoneNumber,
IsActive = user.IsActive, IsActive = user.IsActive,
@ -126,6 +146,29 @@ public class PlatformIdentityAppService : ApplicationService
user.SetRocketUsername(UserInfo.RocketUsername); user.SetRocketUsername(UserInfo.RocketUsername);
await UserManager.UpdateAsync(user); 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() public async Task<List<PermissionDefinitionRecord>> GetPermissionList()

View file

@ -8073,7 +8073,7 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
}, },
new ListFormField new ListFormField
{ {
ListFormCode = listFormTenants.ListFormCode, ListFormCode = listFormBranches.ListFormCode,
RoleId = null, RoleId = null,
UserId = null, UserId = null,
CultureName = LanguageCodes.En, CultureName = LanguageCodes.En,

View file

@ -1962,6 +1962,42 @@
"en": "Role Management", "en": "Role Management",
"tr": "Rol Yönetimi" "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", "resourceName": "Platform",
"key": "Abp.Identity.User.UserInformation.EmailAddress", "key": "Abp.Identity.User.UserInformation.EmailAddress",

View file

@ -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);
}

View file

@ -1,5 +1,4 @@
using Kurs.Platform.Branches; using Kurs.Platform.Entities;
using Kurs.Platform.Entities;
using Kurs.Platform.Enums; using Kurs.Platform.Enums;
using Kurs.Platform.Localization; using Kurs.Platform.Localization;
using Kurs.Platform.OrganizationUnits; using Kurs.Platform.OrganizationUnits;
@ -38,7 +37,7 @@ public class ListFormManager : PlatformDomainService, IListFormManager
private readonly IRepository<ListForm, Guid> listFormRepository; private readonly IRepository<ListForm, Guid> listFormRepository;
private readonly IDefaultValueManager defaultValueManager; private readonly IDefaultValueManager defaultValueManager;
private readonly IPlatformOuRepository ouRepository; private readonly IPlatformOuRepository ouRepository;
private readonly IPlatformBranchesRepository branchUsersRepository; private readonly IRepository<BranchUsers, Guid> branchUsersRepository;
private readonly string cultureName; private readonly string cultureName;
private readonly string cultureNameDefault; private readonly string cultureNameDefault;
@ -51,7 +50,7 @@ public class ListFormManager : PlatformDomainService, IListFormManager
IRepository<ListForm, Guid> listFormRepository, IRepository<ListForm, Guid> listFormRepository,
IDefaultValueManager defaultValueManager, IDefaultValueManager defaultValueManager,
IPlatformOuRepository ouRepository, IPlatformOuRepository ouRepository,
IPlatformBranchesRepository branchUsersRepository) IRepository<BranchUsers, Guid> branchUsersRepository)
: base(settingProvider, localizer, currentUser, objectMapper, authManager) : base(settingProvider, localizer, currentUser, objectMapper, authManager)
{ {
this.listFormRepository = listFormRepository; this.listFormRepository = listFormRepository;
@ -133,10 +132,10 @@ public class ListFormManager : PlatformDomainService, IListFormManager
if (listForm.IsBranch) 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) 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 else
{ {

View file

@ -5,7 +5,6 @@ using System.Globalization;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using Kurs.Platform.Branches;
using Kurs.Platform.Entities; using Kurs.Platform.Entities;
using Kurs.Platform.Enums; using Kurs.Platform.Enums;
using Kurs.Platform.Extensions; using Kurs.Platform.Extensions;
@ -13,6 +12,7 @@ using Kurs.Platform.ListForms;
using Kurs.Platform.Localization; using Kurs.Platform.Localization;
using Kurs.Platform.OrganizationUnits; using Kurs.Platform.OrganizationUnits;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.ObjectMapping; using Volo.Abp.ObjectMapping;
using Volo.Abp.Settings; using Volo.Abp.Settings;
using Volo.Abp.Users; using Volo.Abp.Users;
@ -104,7 +104,7 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
public bool IsAppliedGridFilter { get; private set; } public bool IsAppliedGridFilter { get; private set; }
public bool IsAppliedServerFilter { get; private set; } public bool IsAppliedServerFilter { get; private set; }
public IPlatformOuRepository OuRepository { get; } public IPlatformOuRepository OuRepository { get; }
public IPlatformBranchesRepository BranchesRepository { get; } public IRepository<BranchUsers, Guid> BranchUsersRepository { get; }
public SelectQueryManager( public SelectQueryManager(
ISettingProvider settingProvider, ISettingProvider settingProvider,
@ -113,7 +113,7 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
IObjectMapper objectMapper, IObjectMapper objectMapper,
IListFormAuthorizationManager authManager, IListFormAuthorizationManager authManager,
IPlatformOuRepository ouRepository, IPlatformOuRepository ouRepository,
IPlatformBranchesRepository branchesRepository) IRepository<BranchUsers, Guid> branchUsersRepository)
: base(settingProvider, localizer, currentUser, objectMapper, authManager) : base(settingProvider, localizer, currentUser, objectMapper, authManager)
{ {
SelectFields = []; SelectFields = [];
@ -122,7 +122,7 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
SortParts = []; SortParts = [];
SummaryQueries = []; SummaryQueries = [];
OuRepository = ouRepository; OuRepository = ouRepository;
BranchesRepository = branchesRepository; BranchUsersRepository = branchUsersRepository;
} }
public void PrepareQueries(ListForm listform, public void PrepareQueries(ListForm listform,
@ -407,10 +407,10 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
whereParts.Add("AND"); 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) 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 else
{ {

View file

@ -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;
}
}
}

View file

@ -34,7 +34,8 @@ public class Program
}; };
var loggerConfig = new LoggerConfiguration() var loggerConfig = new LoggerConfiguration()
.MinimumLevel.Information(); .MinimumLevel.Error()
.WriteTo.Console(); // Konsola da log yaz
switch (DefaultDatabaseProvider) switch (DefaultDatabaseProvider)
{ {

View file

@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict';
"revision": "3ca0b8505b4bec776b69afdba2768812" "revision": "3ca0b8505b4bec776b69afdba2768812"
}, { }, {
"url": "index.html", "url": "index.html",
"revision": "0.5oedcrigdno" "revision": "0.13cgdm1rjp"
}], {}); }], {});
workbox.cleanupOutdatedCaches(); workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {

View file

@ -122,6 +122,7 @@ export interface UserInfoViewModel extends ExtensibleObject {
isVerified: boolean isVerified: boolean
userRoleNames: string[] userRoleNames: string[]
roles: AssignedRoleViewModel[] roles: AssignedRoleViewModel[]
branches: AssignedRoleViewModel[]
lockUser: boolean lockUser: boolean
lastPasswordChangeTime?: Date | string lastPasswordChangeTime?: Date | string
@ -138,3 +139,8 @@ export interface AssignedRoleViewModel {
name?: string name?: string
isAssigned: boolean isAssigned: boolean
} }
export interface AssignedBranchViewModel {
name?: string
isAssigned: boolean
}

View file

@ -472,6 +472,7 @@ export interface GridOptionsDto extends AuditedEntityDto<string> {
insertServiceAddress?: string insertServiceAddress?: string
deleteServiceAddress?: string deleteServiceAddress?: string
isTenant: boolean isTenant: boolean
isBranch: boolean
isOrganizationUnit: boolean isOrganizationUnit: boolean
listFormType: string listFormType: string
isSubForm: boolean isSubForm: boolean

View file

@ -79,149 +79,150 @@ function UserDetails() {
{({ touched, errors, resetForm, isSubmitting, values }) => { {({ touched, errors, resetForm, isSubmitting, values }) => {
const userRoleNames = values.userRoleNames const userRoleNames = values.userRoleNames
const roles = values.roles const roles = values.roles
const branches = values.branches
return ( return (
<Form> <Form>
<FormContainer size="sm"> <div className="w-1/2">
<div className="w-1/2"> <FormContainer size="md">
<div className="form-label mb-2">{translate('::Abp.Identity.User.UserInformation.RoleManagement')}</div> <div className="grid grid-cols-1 lg:grid-cols-2 gap-4 w-full">
<div className="border-2 rounded-lg"> {/* Personal Information */}
<FieldArray name="roles"> <div>
{({ form, remove, push }) => ( <FormItem label={translate('::Abp.Identity.User.UserInformation.Name')}>
<div className="grid grid-cols-4 text-center"> <Field type="text" name="name" placeholder="Name" component={Input} />
{roles && roles.length > 0 </FormItem>
? roles.map((_, index: number) => { </div>
return (
<div key={index} className="p-2"> {/* Personal Information */}
<FormItem <div>
labelClass="block text-center" <FormItem label={translate('::Abp.Identity.User.UserInformation.Surname')}>
className="mb-0 justify-center" <Field type="text" name="surname" placeholder="Surname" component={Input} />
label={roles[index].name} </FormItem>
> </div>
<Field
className="mr-0" {/* Şube Management */}
name={`roles[${index}].isAssigned`} <div>
component={Checkbox} <h6 className="mb-4">{translate('::Abp.Identity.User.UserInformation.BranchManagement')}</h6>
/> <div className="border-2 rounded-lg p-4">
</FormItem> <FieldArray name="branches">
</div> {({ 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> )}
)} </Field>
</FieldArray> </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>
<div className="mb-3"></div> </FormContainer>
</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>
<div> <div>
<Button variant="solid" loading={isSubmitting} type="submit"> <Button variant="solid" loading={isSubmitting} type="submit">
@ -261,178 +262,176 @@ function UserDetails() {
const userRoleNames = values.userRoleNames const userRoleNames = values.userRoleNames
return ( return (
<Form> <Form>
<FormContainer size="sm"> <div className="w-1/2">
<div className="w-1/2"> <FormContainer size="md">
<FormItem <div className="grid grid-cols-1 lg:grid-cols-2 gap-4 w-full">
layout="horizontal" {/* Account Status */}
labelClass="!justify-start" <div>
labelWidth="50%" <h6 className="mb-4">{translate('::Abp.Identity.User.LockoutManagement.AccountStatus')}</h6>
label={translate('::Abp.Identity.User.LockoutManagement.Status')} <FormItem
> layout="horizontal"
<Field name="isActive" placeholder={translate('::Abp.Identity.User.LockoutManagement.Status')} component={Checkbox} /> labelClass="!justify-start"
</FormItem> 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"
<FormItem labelClass="!justify-start"
layout="horizontal" labelWidth="50%"
labelClass="!justify-start" label={translate('::Abp.Identity.User.LockoutManagement.AdminVerification')}
labelWidth="50%" >
label={translate('::Abp.Identity.User.LockoutManagement.AdminVerification')} <Field
> name="isVerified"
<Field placeholder={translate('::Abp.Identity.User.LockoutManagement.AdminVerification')}
name="isVerified" component={Checkbox}
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>
</Field>
</FormItem>
<hr className="mb-3" /> <FormItem
layout="horizontal"
<FormItem labelClass="!justify-start"
layout="horizontal" labelWidth="50%"
labelClass="!justify-start" label={translate('::Abp.Identity.User.LockoutManagement.EmailConfirmed')}
labelWidth="50%" >
label={translate('::Abp.Identity.User.LockoutManagement.AccountLockoutEnabled')} <Field
> name="emailConfirmed"
<Field placeholder={translate('::Abp.Identity.User.LockoutManagement.EmailConfirmed')}
name="lockoutEnabled" component={Checkbox}
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>
</Field>
</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 <FormItem
layout="horizontal" layout="horizontal"
labelClass="!justify-start" labelClass="!justify-start"
labelWidth="50%" labelWidth="50%"
label={translate('::Abp.Identity.User.LockoutManagement.ShouldChangePwOnNextLogin')} label={translate('::Abp.Identity.User.LockoutManagement.TwoFactorEnabled')}
> >
<Field <Field
name="shouldChangePasswordOnNextLogin" name="twoFactorEnabled"
placeholder={translate('::Abp.Identity.User.LockoutManagement.ShouldChangePwOnNextLogin')} placeholder={translate('::Abp.Identity.User.LockoutManagement.TwoFactorEnabled')}
component={Checkbox} component={Checkbox}
/> />
</FormItem> </FormItem>
</div>
<FormItem {/* Login & Lockout Settings */}
layout="horizontal" <div>
labelClass="!justify-start" <h6 className="mb-4">{translate('::Abp.Identity.User.LockoutManagement.LoginAndLockoutSettings')}</h6>
labelWidth="50%" <FormItem
label={translate('::Abp.Identity.User.LockoutManagement.AccessFailedCount')} layout="horizontal"
> labelClass="!justify-start"
<Field type="number" name="accessFailedCount" component={Input} /> labelWidth="50%"
</FormItem> label={translate('::Abp.Identity.User.LockoutManagement.LoginEndDate')}
</div> >
</FormContainer> <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> <div>
<Button variant="solid" loading={isSubmitting} type="submit"> <Button variant="solid" loading={isSubmitting} type="submit">