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 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; }
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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",
|
||||||
|
|
|
||||||
|
|
@ -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.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
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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()
|
var loggerConfig = new LoggerConfiguration()
|
||||||
.MinimumLevel.Information();
|
.MinimumLevel.Error()
|
||||||
|
.WriteTo.Console(); // Konsola da log yaz
|
||||||
|
|
||||||
switch (DefaultDatabaseProvider)
|
switch (DefaultDatabaseProvider)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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"), {
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -79,19 +79,66 @@ 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">
|
||||||
<div className="form-label mb-2">{translate('::Abp.Identity.User.UserInformation.RoleManagement')}</div>
|
<FormContainer size="md">
|
||||||
<div className="border-2 rounded-lg">
|
<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">
|
<FieldArray name="roles">
|
||||||
{({ form, remove, push }) => (
|
{({ form, remove, push }) => (
|
||||||
<div className="grid grid-cols-4 text-center">
|
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2 text-center">
|
||||||
{roles && roles.length > 0
|
{roles && roles.length > 0
|
||||||
? roles.map((_, index: number) => {
|
? roles.map((_, index: number) => (
|
||||||
return (
|
|
||||||
<div key={index} className="p-2">
|
<div key={index} className="p-2">
|
||||||
<FormItem
|
<FormItem
|
||||||
labelClass="block text-center"
|
labelClass="block text-center"
|
||||||
|
|
@ -105,62 +152,32 @@ function UserDetails() {
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
)
|
))
|
||||||
})
|
|
||||||
: null}
|
: null}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</FieldArray>
|
</FieldArray>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3"></div>
|
</div>
|
||||||
|
|
||||||
<FormItem
|
{/* Contact Information */}
|
||||||
labelClass="!justify-start"
|
<div>
|
||||||
labelWidth="40%"
|
<h6 className="mb-4">{translate('::Abp.Identity.User.UserInformation.ContactInformation')}</h6>
|
||||||
label={translate('::Abp.Identity.User.UserInformation.EmailAddress')}
|
<FormItem label={translate('::Abp.Identity.User.UserInformation.EmailAddress')}>
|
||||||
>
|
<Field type="text" disabled name="email" placeholder="Email Address" component={Input} />
|
||||||
<Field
|
|
||||||
type="text"
|
|
||||||
disabled
|
|
||||||
name="email"
|
|
||||||
placeholder="Email Address"
|
|
||||||
component={Input}
|
|
||||||
/>
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
<FormItem label={translate('::Abp.Identity.User.UserInformation.PhoneNumber')}>
|
||||||
<FormItem labelClass="!justify-start" labelWidth="40%"
|
<Field type="text" name="phoneNumber" placeholder="Phone Number" component={Input} />
|
||||||
label={translate('::Abp.Identity.User.UserInformation.Name')}
|
|
||||||
>
|
|
||||||
<Field type="text" name="name" placeholder="Name" component={Input} />
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
<FormItem label={translate('::RocketUsername')}>
|
||||||
<FormItem labelClass="!justify-start" labelWidth="40%"
|
<Field type="text" name="rocketUsername" placeholder={translate('::RocketUsername')} component={Input} />
|
||||||
label={translate('::Abp.Identity.User.UserInformation.Surname')}
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
type="text"
|
|
||||||
name="surname"
|
|
||||||
placeholder="Surname"
|
|
||||||
component={Input}
|
|
||||||
/>
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
</div>
|
||||||
|
|
||||||
<FormItem labelClass="!justify-start" labelWidth="40%"
|
{/* Account Timestamps */}
|
||||||
label={translate('::Abp.Identity.User.UserInformation.PhoneNumber')}
|
<div>
|
||||||
>
|
<h6 className="mb-4">{translate('::Abp.Identity.User.UserInformation.AccountTimestamps')}</h6>
|
||||||
<Field
|
<FormItem label={translate('::Abp.Identity.User.UserInformation.PasswordChangeTime')}>
|
||||||
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 name="lastPasswordChangeTime">
|
||||||
{({ field, form }: FieldProps) => (
|
{({ field, form }: FieldProps) => (
|
||||||
<DateTimepicker
|
<DateTimepicker
|
||||||
|
|
@ -178,23 +195,7 @@ function UserDetails() {
|
||||||
)}
|
)}
|
||||||
</Field>
|
</Field>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
<FormItem label={translate('::Abp.Identity.User.UserInformation.CreateTime')}>
|
||||||
<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 name="creationTime">
|
||||||
{({ field, form }: FieldProps) => (
|
{({ field, form }: FieldProps) => (
|
||||||
<Input
|
<Input
|
||||||
|
|
@ -206,9 +207,7 @@ function UserDetails() {
|
||||||
)}
|
)}
|
||||||
</Field>
|
</Field>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem labelClass="!justify-start" labelWidth="40%"
|
<FormItem label={translate('::Abp.Identity.User.UserInformation.UpdateTime')}>
|
||||||
label={translate('::Abp.Identity.User.UserInformation.UpdateTime')}
|
|
||||||
>
|
|
||||||
<Field name="lastModificationTime">
|
<Field name="lastModificationTime">
|
||||||
{({ field, form }: FieldProps) => (
|
{({ field, form }: FieldProps) => (
|
||||||
<Input
|
<Input
|
||||||
|
|
@ -221,7 +220,9 @@ function UserDetails() {
|
||||||
</Field>
|
</Field>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</FormContainer>
|
</FormContainer>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<Button variant="solid" loading={isSubmitting} type="submit">
|
<Button variant="solid" loading={isSubmitting} type="submit">
|
||||||
|
|
@ -261,8 +262,12 @@ 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">
|
||||||
|
<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
|
<FormItem
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
labelClass="!justify-start"
|
labelClass="!justify-start"
|
||||||
|
|
@ -272,8 +277,6 @@ function UserDetails() {
|
||||||
<Field name="isActive" placeholder={translate('::Abp.Identity.User.LockoutManagement.Status')} component={Checkbox} />
|
<Field name="isActive" placeholder={translate('::Abp.Identity.User.LockoutManagement.Status')} component={Checkbox} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<hr className="mb-3" />
|
|
||||||
|
|
||||||
<FormItem
|
<FormItem
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
labelClass="!justify-start"
|
labelClass="!justify-start"
|
||||||
|
|
@ -287,8 +290,6 @@ function UserDetails() {
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<hr className="mb-3" />
|
|
||||||
|
|
||||||
<FormItem
|
<FormItem
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
labelClass="!justify-start"
|
labelClass="!justify-start"
|
||||||
|
|
@ -315,8 +316,6 @@ function UserDetails() {
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<hr className="mb-3" />
|
|
||||||
|
|
||||||
<FormItem
|
<FormItem
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
labelClass="!justify-start"
|
labelClass="!justify-start"
|
||||||
|
|
@ -329,9 +328,11 @@ function UserDetails() {
|
||||||
component={Checkbox}
|
component={Checkbox}
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr className="mb-3" />
|
{/* Login & Lockout Settings */}
|
||||||
|
<div>
|
||||||
|
<h6 className="mb-4">{translate('::Abp.Identity.User.LockoutManagement.LoginAndLockoutSettings')}</h6>
|
||||||
<FormItem
|
<FormItem
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
labelClass="!justify-start"
|
labelClass="!justify-start"
|
||||||
|
|
@ -356,8 +357,6 @@ function UserDetails() {
|
||||||
</Field>
|
</Field>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<hr className="mb-3" />
|
|
||||||
|
|
||||||
<FormItem
|
<FormItem
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
labelClass="!justify-start"
|
labelClass="!justify-start"
|
||||||
|
|
@ -408,8 +407,6 @@ function UserDetails() {
|
||||||
</Field>
|
</Field>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<hr className="mb-3" />
|
|
||||||
|
|
||||||
<FormItem
|
<FormItem
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
labelClass="!justify-start"
|
labelClass="!justify-start"
|
||||||
|
|
@ -432,7 +429,9 @@ function UserDetails() {
|
||||||
<Field type="number" name="accessFailedCount" component={Input} />
|
<Field type="number" name="accessFailedCount" component={Input} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</FormContainer>
|
</FormContainer>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<Button variant="solid" loading={isSubmitting} type="submit">
|
<Button variant="solid" loading={isSubmitting} type="submit">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue