Merge remote-tracking branch 'devops.sozsoft.com/main'

This commit is contained in:
Sedat ÖZTÜRK 2025-06-16 08:41:30 +03:00
commit 0878da4a36
32 changed files with 5249 additions and 330 deletions

View file

@ -403,6 +403,7 @@ namespace Kurs.Platform.Charts.Dto
} }
public bool IsTenant { get; set; } public bool IsTenant { get; set; }
public bool IsBranch { get; set; }
public bool IsOrganizationUnit { get; set; } public bool IsOrganizationUnit { get; set; }
} }

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

@ -26,6 +26,7 @@ public class ListFormsDto : AuditedEntityDto<Guid>
public string Description { get; set; } // Liste aciklamasi public string Description { get; set; } // Liste aciklamasi
public string Title { get; set; } // Liste basligi public string Title { get; set; } // Liste basligi
public bool IsTenant { get; set; } // Liste formun Tenant durumu public bool IsTenant { get; set; } // Liste formun Tenant durumu
public bool IsBranch { get; set; } // Liste formun Branch durumu
public bool IsOrganizationUnit { get; set; } // Liste formun Organization Unit durumu public bool IsOrganizationUnit { get; set; } // Liste formun Organization Unit durumu
} }

View file

@ -268,6 +268,10 @@ public class GridOptionsDto : AuditedEntityDto<Guid>
/// </summary> /// </summary>
public bool IsTenant { get; set; } public bool IsTenant { get; set; }
/// <summary> /// <summary>
/// Liste formların branch çalışıp çalışmadığını ifade eder.
/// </summary>
public bool IsBranch { get; set; } = false;
/// <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>
public bool IsOrganizationUnit { get; set; } = false; public bool IsOrganizationUnit { get; set; } = false;

View file

@ -64,6 +64,7 @@ public class ChartsAppService : CrudAppService<
entity.CultureName = updateInput.CultureName; entity.CultureName = updateInput.CultureName;
entity.DataSourceCode = updateInput.DataSourceCode; entity.DataSourceCode = updateInput.DataSourceCode;
entity.IsTenant = updateInput.IsTenant; entity.IsTenant = updateInput.IsTenant;
entity.IsBranch = updateInput.IsBranch;
entity.IsOrganizationUnit = updateInput.IsOrganizationUnit; entity.IsOrganizationUnit = updateInput.IsOrganizationUnit;
entity.CommonJson = JsonSerializer.Serialize(updateInput.CommonDto); entity.CommonJson = JsonSerializer.Serialize(updateInput.CommonDto);

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

@ -12,7 +12,7 @@ using static Kurs.Platform.PlatformConsts;
namespace Kurs.Platform.ListForms.Administration; namespace Kurs.Platform.ListForms.Administration;
[Authorize(PlatformConsts.AppCodes.Listforms.Listform)] [Authorize(AppCodes.Listforms.Listform)]
public class ListFormsAppService : CrudAppService< public class ListFormsAppService : CrudAppService<
ListForm, ListForm,
GridOptionsDto, GridOptionsDto,
@ -28,9 +28,9 @@ public class ListFormsAppService : CrudAppService<
{ {
authManager = _authManager; authManager = _authManager;
CreatePolicyName = $"{PlatformConsts.AppCodes.Listforms.Listform}.Create"; CreatePolicyName = $"{AppCodes.Listforms.Listform}.Create";
UpdatePolicyName = $"{PlatformConsts.AppCodes.Listforms.Listform}.Update"; UpdatePolicyName = $"{AppCodes.Listforms.Listform}.Update";
DeletePolicyName = $"{PlatformConsts.AppCodes.Listforms.Listform}.Delete"; DeletePolicyName = $"{AppCodes.Listforms.Listform}.Delete";
} }
public async Task<GridOptionsEditDto> GetByListFormCodeAsync(string listFormCode) public async Task<GridOptionsEditDto> GetByListFormCodeAsync(string listFormCode)
@ -76,6 +76,7 @@ public class ListFormsAppService : CrudAppService<
item.KeyFieldName = input.KeyFieldName; item.KeyFieldName = input.KeyFieldName;
item.KeyFieldDbSourceType = input.KeyFieldDbSourceType; item.KeyFieldDbSourceType = input.KeyFieldDbSourceType;
item.IsTenant = input.IsTenant; item.IsTenant = input.IsTenant;
item.IsBranch = input.IsBranch;
item.IsOrganizationUnit = input.IsOrganizationUnit; item.IsOrganizationUnit = input.IsOrganizationUnit;
} }
else if (input.EditType == ListFormEditTabs.Database.Select.SelectForm) else if (input.EditType == ListFormEditTabs.Database.Select.SelectForm)

View file

@ -2229,7 +2229,6 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
SendOnlyChangedFormValuesUpdate = false, SendOnlyChangedFormValuesUpdate = false,
}), }),
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() { EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
//Items=["Code","DisplayName","Order","Url","Icon","ParentCode","CssClass","RequiredPermissionName","Target","IsDisabled","ElementId"] },
new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=
[ [
new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
@ -7761,5 +7760,615 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
]); ]);
#endregion #endregion
#endregion #endregion
#region Branches
var listFormBranches = await _listFormRepository.InsertAsync(
new ListForm()
{
CultureName = LanguageCodes.En,
ListFormCode = ListFormCodes.Branch,
Name = AppCodes.Branches,
Title = AppCodes.Branches,
DataSourceCode = SeedConsts.DataSources.DefaultCode,
IsTenant = false,
IsOrganizationUnit = false,
Description = AppCodes.Branches,
SelectCommandType = SelectCommandTypeEnum.Table,
SelectCommand = DbTablePrefix + "Branch",
KeyFieldName = "Id",
KeyFieldDbSourceType = DbType.Guid,
DefaultFilter = "\"IsDeleted\" = 'false'",
SortMode = GridOptions.SortModeSingle,
FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto
{
Visible = true
}),
HeaderFilterJson = JsonSerializer.Serialize(new
{
Visible = true
}),
SearchPanelJson = JsonSerializer.Serialize(new
{
Visible = true
}),
GroupPanelJson = JsonSerializer.Serialize(new
{
Visible = true
}),
SelectionJson = JsonSerializer.Serialize(new SelectionDto
{
Mode = GridOptions.SelectionModeSingle,
AllowSelectAll = false
}),
ColumnOptionJson = JsonSerializer.Serialize(new
{
ColumnFixingEnabled = true,
ColumnChooserEnabled = true
}),
PermissionJson = JsonSerializer.Serialize(new PermissionCrudDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
D = AppCodes.Branches + ".Delete",
E = AppCodes.Branches + ".Export"
}),
PagerOptionJson = JsonSerializer.Serialize(new GridPagerOptionDto
{
Visible = true,
AllowedPageSizes = "10,20,50,100",
ShowPageSizeSelector = true,
ShowNavigationButtons = true,
ShowInfo = false,
InfoText = "Page {0} of {1} ({2} items)",
DisplayMode = GridColumnOptions.PagerDisplayModeAdaptive,
ScrollingMode = GridColumnOptions.ScrollingModeStandard,
LoadPanelEnabled = "auto",
LoadPanelText = "Loading..."
}),
EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto
{
Popup = new GridEditingPopupDto()
{
Title = "Branch Form",
Width = 500,
Height = 550
},
AllowDeleting = true,
AllowAdding = true,
AllowUpdating = true,
SendOnlyChangedFormValuesUpdate = false,
}),
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
{
new() { Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =
[
new EditingFormItemDto { Order=1, DataField="TenantId", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions="{ \"showClearButton\" : true }" },
new EditingFormItemDto { Order=2, DataField="Code", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox, EditorOptions="{ \"showClearButton\" : true }" },
new EditingFormItemDto { Order=3, DataField="Name", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox, EditorOptions="{ \"showClearButton\" : true }" },
new EditingFormItemDto { Order=4, DataField="VknTckn", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxNumberBox, EditorOptions="{ \"showClearButton\" : true }" },
new EditingFormItemDto { Order=5, DataField="TaxOffice", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox, EditorOptions="{ \"showClearButton\" : true }" },
new EditingFormItemDto { Order=6, DataField="Mobile", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxNumberBox },
new EditingFormItemDto { Order=7, DataField="Phone", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxNumberBox },
new EditingFormItemDto { Order=8, DataField="Fax", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions="{ \"showClearButton\" : true }" },
new EditingFormItemDto { Order=9, DataField="IsActive", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox },
]
},
new() { Order=2, ColCount=1, ColSpan=2, ItemType="group", Items =
[
new EditingFormItemDto { Order=1, DataField="Address", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions="{ \"showClearButton\" : true }" },
new EditingFormItemDto { Order=2, DataField="Address2", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions="{ \"showClearButton\" : true }" },
new EditingFormItemDto { Order=3, DataField="City", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox, EditorOptions="{ \"showClearButton\" : true }" },
new EditingFormItemDto { Order=4, DataField="District", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions="{ \"showClearButton\" : true }" },
new EditingFormItemDto { Order=5, DataField="PostalCode", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions="{ \"showClearButton\" : true }" },
new EditingFormItemDto { Order=6, DataField="Email", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox, EditorOptions="{ \"showClearButton\" : true }" },
new EditingFormItemDto { Order=7, DataField="Website", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox, EditorOptions="{ \"showClearButton\" : true }" },
]
}
}),
DeleteCommand = $"UPDATE \"{DbTablePrefix}Branch\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id",
DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
new() {
FieldName = "DeleterId",
FieldDbType = DbType.Guid,
Value = "@USERID",
CustomValueType = FieldCustomValueTypeEnum.CustomKey },
new() {
FieldName = "Id",
FieldDbType = DbType.Guid,
Value = "@ID",
CustomValueType = FieldCustomValueTypeEnum.CustomKey }
}),
InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
new FieldsDefaultValue() {
FieldName = "CreationTime",
FieldDbType = DbType.DateTime,
Value = "@NOW",
CustomValueType = FieldCustomValueTypeEnum.CustomKey },
new FieldsDefaultValue() {
FieldName = "CreatorId",
FieldDbType = DbType.Guid,
Value = "@USERID",
CustomValueType = FieldCustomValueTypeEnum.CustomKey }
}),
FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
new() {
FieldName = "IsActive",
FieldDbType = DbType.Boolean,
Value = "true",
CustomValueType = FieldCustomValueTypeEnum.Value }
})
}
);
#region Branches Fields
await _listFormFieldRepository.InsertManyAsync(
[
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "Id",
Width = 500,
ListOrderNo = 0,
Visible = false,
IsActive = true,
IsDeleted = false,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "TenantId",
Width = 200,
ListOrderNo = 1,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = JsonSerializer.Serialize(new LookupDto {
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = $"SELECT \"AbpTenants\".\"Id\" AS \"Key\", \"AbpTenants\".\"Name\" as \"Name\" FROM \"AbpTenants\" ORDER BY \"AbpTenants\".\"Name\"",
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Code",
Width = 100,
ListOrderNo = 2,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Name",
Width = 200,
ListOrderNo = 3,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "VknTckn",
Width = 100,
ListOrderNo = 4,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "TaxOffice",
Width = 150,
ListOrderNo = 5,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Address",
Width = 150,
ListOrderNo = 6,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Address2",
Width = 150,
ListOrderNo = 7,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "City",
Width = 100,
ListOrderNo = 8,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "District",
Width = 100,
ListOrderNo = 9,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "PostalCode",
Width = 100,
ListOrderNo = 10,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Email",
Width = 170,
ListOrderNo = 11,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Website",
Width = 170,
ListOrderNo = 12,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Mobile",
Width = 100,
ListOrderNo = 13,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Phone",
Width = 100,
ListOrderNo = 14,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Fax",
Width = 100,
ListOrderNo = 15,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormBranches.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Boolean,
FieldName = "IsActive",
Width = 100,
ListOrderNo = 16,
Visible = true,
IsActive = true,
IsDeleted = false,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Branches + ".Create",
R = AppCodes.Branches,
U = AppCodes.Branches + ".Update",
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
]);
#endregion
#endregion
} }
} }

View file

@ -87,7 +87,7 @@ public class MenuSeeder : IDataSeedContributor, ITransientDependency
{ {
Code = TenantManagementPermissions.Tenants.Default, Code = TenantManagementPermissions.Tenants.Default,
DisplayName = TenantManagementPermissions.Tenants.Default, DisplayName = TenantManagementPermissions.Tenants.Default,
Order = -1, Order = -2,
IsDisabled = false, IsDisabled = false,
ParentCode = menuAdministration.Code, ParentCode = menuAdministration.Code,
Icon = "FcDepartment", Icon = "FcDepartment",
@ -98,6 +98,22 @@ public class MenuSeeder : IDataSeedContributor, ITransientDependency
RequiredPermissionName = TenantManagementPermissions.Tenants.Default RequiredPermissionName = TenantManagementPermissions.Tenants.Default
}); });
//Branch Management
await _repository.InsertAsync(new Menu
{
Code = AppCodes.Branches,
DisplayName = AppCodes.Branches,
Order = -1,
IsDisabled = false,
ParentCode = menuAdministration.Code,
Icon = "FcShop",
Target = null,
ElementId = null,
CssClass = null,
Url = $"/list/{PlatformConsts.ListFormCodes.Branch}",
RequiredPermissionName = AppCodes.Branches
});
//Setting Management //Setting Management
var menuSettings = await _repository.InsertAsync(new Menu var menuSettings = await _repository.InsertAsync(new Menu
{ {

View file

@ -869,6 +869,39 @@ public class PermissionSeeder : IDataSeedContributor, ITransientDependency
)); ));
} }
#endregion #endregion
#region Branches
await repositoryGroup.InsertAsync(new PermissionGroupDefinitionRecord
{
Name = AppCodes.Branches,
DisplayName = AppCodes.Branches
});
var permBranches = await repository.InsertAsync(
GetNewPermission(
AppCodes.Branches,
AppCodes.Branches,
AppCodes.Branches,
null,
true,
MultiTenancySides.Host
));
foreach (var item in CUDE)
{
permissionName = AppCodes.Branches + "." + item;
await repository.InsertAsync(
GetNewPermission(
AppCodes.Branches,
permissionName,
item,
permBranches.Name,
true,
MultiTenancySides.Host
));
}
#endregion
} }
public static PermissionDefinitionRecord GetNewPermission( public static PermissionDefinitionRecord GetNewPermission(

View file

@ -642,6 +642,12 @@
"en": "Tenant Management", "en": "Tenant Management",
"tr": "Tenant Management" "tr": "Tenant Management"
}, },
{
"resourceName": "Platform",
"key": "App.Branches",
"en": "Branches",
"tr": "Şubeler"
},
{ {
"resourceName": "Platform", "resourceName": "Platform",
"key": "AbpTenantManagement.Tenants", "key": "AbpTenantManagement.Tenants",
@ -1956,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",
@ -2800,13 +2842,19 @@
"resourceName": "Platform", "resourceName": "Platform",
"key": "ListForms.ListFormEdit.IsTenant", "key": "ListForms.ListFormEdit.IsTenant",
"en": "Is Tenant", "en": "Is Tenant",
"tr": "Is Tenant" "tr": "Tenant mı?"
},
{
"resourceName": "Platform",
"key": "ListForms.ListFormEdit.IsBranch",
"en": "Is Branch",
"tr": "Şube mi?"
}, },
{ {
"resourceName": "Platform", "resourceName": "Platform",
"key": "ListForms.ListFormEdit.IsOrganizationUnit", "key": "ListForms.ListFormEdit.IsOrganizationUnit",
"en": "Is Organization Unit", "en": "Is Organization Unit",
"tr": "Is Organization Unit" "tr": "Organizasyon Şeması mı?"
}, },
{ {
"resourceName": "Platform", "resourceName": "Platform",

View file

@ -328,6 +328,7 @@ public static class PlatformConsts
public const string SecurityLog = "List-0019"; public const string SecurityLog = "List-0019";
public const string AuditLog = "List-0020"; public const string AuditLog = "List-0020";
public const string EntityChange = "List-0021"; public const string EntityChange = "List-0021";
public const string Branch = "List-0022";
public const string ListformField = "List-1000"; public const string ListformField = "List-1000";
public const string Order = "List-Order"; public const string Order = "List-Order";
public const string Complaint = "List-Complaint"; public const string Complaint = "List-Complaint";

View file

@ -363,6 +363,7 @@ public static class SeedConsts
public const string PublicApis = Prefix.App + ".PublicApis"; public const string PublicApis = Prefix.App + ".PublicApis";
public const string AuditLogs = Prefix.App + ".AuditLogs"; public const string AuditLogs = Prefix.App + ".AuditLogs";
public const string EntityChanges = Prefix.App + ".EntityChanges"; public const string EntityChanges = Prefix.App + ".EntityChanges";
public const string Branches = Prefix.App + ".Branches";
} }
public static class DataSources public static class DataSources

View file

@ -0,0 +1,26 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using System.Collections.Generic;
namespace Kurs.Platform.Entities;
public class Branch : FullAuditedEntity<Guid>
{
public Guid TenantId { get; set; }
public string Code { get; set; }
public string Name { get; set; }
public long VknTckn { get; set; }
public string TaxOffice { get; set; }
public string Address { get; set; }
public string Address2 { get; set; }
public string District { get; set; }
public string City { get; set; }
public string PostalCode { get; set; }
public long? Phone { get; set; }
public long Mobile { get; set; }
public long? Fax { get; set; }
public string Email { get; set; }
public string Website { get; set; }
public bool? IsActive { get; set; }
public ICollection<BranchUsers> BranchUsers { get; set; }
}

View file

@ -0,0 +1,14 @@
using System;
using Volo.Abp.MultiTenancy;
namespace Kurs.Platform.Entities;
using Volo.Abp.Domain.Entities;
public class BranchUsers : Entity<Guid>, IMultiTenant
{
public Guid UserId { get; set; }
public Guid BranchId { get; set; }
public Guid? TenantId { get; set; }
public Branch Branch { get; set; }
Guid? IMultiTenant.TenantId => TenantId;
}

View file

@ -119,6 +119,10 @@ public class Chart : FullAuditedEntity<Guid>
/// </summary> /// </summary>
public bool IsTenant { get; set; } = PlatformConsts.IsMultiTenant; public bool IsTenant { get; set; } = PlatformConsts.IsMultiTenant;
/// <summary>
/// Liste formların şubeli'lu çalışıp çalışmadığını ifade eder.
/// </summary>
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

@ -97,6 +97,11 @@ public class ListForm : FullAuditedEntity<Guid>
/// </summary> /// </summary>
public bool IsTenant { get; set; } = PlatformConsts.IsMultiTenant; public bool IsTenant { get; set; } = PlatformConsts.IsMultiTenant;
/// <summary>
/// Liste formların branch çalışıp çalışmadığını ifade eder.
/// </summary>
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

@ -37,6 +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 IRepository<BranchUsers, Guid> branchUsersRepository;
private readonly string cultureName; private readonly string cultureName;
private readonly string cultureNameDefault; private readonly string cultureNameDefault;
@ -48,12 +49,14 @@ public class ListFormManager : PlatformDomainService, IListFormManager
IListFormAuthorizationManager authManager, IListFormAuthorizationManager authManager,
IRepository<ListForm, Guid> listFormRepository, IRepository<ListForm, Guid> listFormRepository,
IDefaultValueManager defaultValueManager, IDefaultValueManager defaultValueManager,
IPlatformOuRepository ouRepository) IPlatformOuRepository ouRepository,
IRepository<BranchUsers, Guid> branchUsersRepository)
: base(settingProvider, localizer, currentUser, objectMapper, authManager) : base(settingProvider, localizer, currentUser, objectMapper, authManager)
{ {
this.listFormRepository = listFormRepository; this.listFormRepository = listFormRepository;
this.defaultValueManager = defaultValueManager; this.defaultValueManager = defaultValueManager;
this.ouRepository = ouRepository; this.ouRepository = ouRepository;
this.branchUsersRepository = branchUsersRepository;
cultureName = CultureInfo.CurrentUICulture.Name; cultureName = CultureInfo.CurrentUICulture.Name;
cultureNameDefault = PlatformConsts.DefaultLanguage; cultureNameDefault = PlatformConsts.DefaultLanguage;
} }
@ -127,6 +130,19 @@ public class ListFormManager : PlatformDomainService, IListFormManager
} }
} }
if (listForm.IsBranch)
{
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.BranchId}'"))})");
}
else
{
fields.Add("BranchId", $"IN ('{Guid.Empty}')");
}
}
if (listForm.IsOrganizationUnit) if (listForm.IsOrganizationUnit)
{ {
var ids = await ouRepository.GetOrganizationUnitIdsWithChildren(CurrentUser.Id.Value); var ids = await ouRepository.GetOrganizationUnitIdsWithChildren(CurrentUser.Id.Value);

View file

@ -12,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;
@ -103,6 +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 IRepository<BranchUsers, Guid> BranchUsersRepository { get; }
public SelectQueryManager( public SelectQueryManager(
ISettingProvider settingProvider, ISettingProvider settingProvider,
@ -110,7 +112,8 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
ICurrentUser currentUser, ICurrentUser currentUser,
IObjectMapper objectMapper, IObjectMapper objectMapper,
IListFormAuthorizationManager authManager, IListFormAuthorizationManager authManager,
IPlatformOuRepository ouRepository) IPlatformOuRepository ouRepository,
IRepository<BranchUsers, Guid> branchUsersRepository)
: base(settingProvider, localizer, currentUser, objectMapper, authManager) : base(settingProvider, localizer, currentUser, objectMapper, authManager)
{ {
SelectFields = []; SelectFields = [];
@ -119,6 +122,7 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
SortParts = []; SortParts = [];
SummaryQueries = []; SummaryQueries = [];
OuRepository = ouRepository; OuRepository = ouRepository;
BranchUsersRepository = branchUsersRepository;
} }
public void PrepareQueries(ListForm listform, public void PrepareQueries(ListForm listform,
@ -396,6 +400,24 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
} }
} }
if (listform.IsBranch)
{
if (whereParts.Any())
{
whereParts.Add("AND");
}
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.BranchId}'"))})");
}
else
{
whereParts.Add($"\"BranchId\" = '{Guid.Empty}'");
}
}
if (listform.IsOrganizationUnit) if (listform.IsOrganizationUnit)
{ {
if (whereParts.Any()) if (whereParts.Any())

View file

@ -24,11 +24,13 @@ namespace Kurs.Platform.EntityFrameworkCore;
[ReplaceDbContext(typeof(IIdentityDbContext))] [ReplaceDbContext(typeof(IIdentityDbContext))]
[ReplaceDbContext(typeof(ITenantManagementDbContext))] [ReplaceDbContext(typeof(ITenantManagementDbContext))]
[ConnectionStringName(DefaultDatabaseProvider)] [ConnectionStringName(DefaultDatabaseProvider)]
public class PlatformDbContext : public class PlatformDbContext :
AbpDbContext<PlatformDbContext>, AbpDbContext<PlatformDbContext>,
IIdentityDbContext, IIdentityDbContext,
ITenantManagementDbContext ITenantManagementDbContext
{ {
public DbSet<Branch> Branches { get; set; }
public DbSet<BranchUsers> BranchUsers { get; set; }
public DbSet<ListForm> ListForms { get; set; } public DbSet<ListForm> ListForms { get; set; }
public DbSet<ListFormField> ListFormFields { get; set; } public DbSet<ListFormField> ListFormFields { get; set; }
public DbSet<ListFormCustomization> ListFormCustomization { get; set; } public DbSet<ListFormCustomization> ListFormCustomization { get; set; }
@ -210,5 +212,26 @@ public class PlatformDbContext :
b.ToTable(PlatformConsts.DbTablePrefix + nameof(AiBot), PlatformConsts.DbSchema); b.ToTable(PlatformConsts.DbTablePrefix + nameof(AiBot), PlatformConsts.DbSchema);
b.ConfigureByConvention(); b.ConfigureByConvention();
}); });
builder.Entity<BranchUsers>(b =>
{
b.ToTable(PlatformConsts.DbTablePrefix + nameof(BranchUsers), PlatformConsts.DbSchema);
b.HasKey(x => new { x.UserId, x.BranchId });
});
builder.Entity<Branch>(b =>
{
b.ToTable(PlatformConsts.DbTablePrefix + nameof(Branch), PlatformConsts.DbSchema);
b.HasMany(x => x.BranchUsers)
.WithOne(x => x.Branch)
.HasForeignKey(x => x.BranchId)
.IsRequired(false)
.OnDelete(DeleteBehavior.Cascade);
b.HasOne<Tenant>()
.WithMany()
.HasForeignKey(x => x.TenantId)
.OnDelete(DeleteBehavior.Cascade);
});
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,117 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Kurs.Platform.Migrations
{
/// <inheritdoc />
public partial class BranchEntity : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsBranch",
table: "PListForm",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsBranch",
table: "PChart",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.CreateTable(
name: "PBranch",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Code = table.Column<string>(type: "nvarchar(max)", nullable: true),
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
VknTckn = table.Column<long>(type: "bigint", nullable: false),
TaxOffice = table.Column<string>(type: "nvarchar(max)", nullable: true),
Address = table.Column<string>(type: "nvarchar(max)", nullable: true),
Address2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
District = table.Column<string>(type: "nvarchar(max)", nullable: true),
City = table.Column<string>(type: "nvarchar(max)", nullable: true),
PostalCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
Phone = table.Column<long>(type: "bigint", nullable: true),
Mobile = table.Column<long>(type: "bigint", nullable: false),
Fax = table.Column<long>(type: "bigint", nullable: true),
Email = table.Column<string>(type: "nvarchar(max)", nullable: true),
Website = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsActive = table.Column<bool>(type: "bit", nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PBranch", x => x.Id);
table.ForeignKey(
name: "FK_PBranch_AbpTenants_TenantId",
column: x => x.TenantId,
principalTable: "AbpTenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PBranchUsers",
columns: table => new
{
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
BranchId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PBranchUsers", x => new { x.UserId, x.BranchId });
table.ForeignKey(
name: "FK_PBranchUsers_PBranch_BranchId",
column: x => x.BranchId,
principalTable: "PBranch",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_PBranch_TenantId",
table: "PBranch",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_PBranchUsers_BranchId",
table: "PBranchUsers",
column: "BranchId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PBranchUsers");
migrationBuilder.DropTable(
name: "PBranch");
migrationBuilder.DropColumn(
name: "IsBranch",
table: "PListForm");
migrationBuilder.DropColumn(
name: "IsBranch",
table: "PChart");
}
}
}

View file

@ -636,6 +636,118 @@ namespace Kurs.Platform.Migrations
b.ToTable("PBackgroundWorker", (string)null); b.ToTable("PBackgroundWorker", (string)null);
}); });
modelBuilder.Entity("Kurs.Platform.Entities.Branch", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("Address")
.HasColumnType("nvarchar(max)");
b.Property<string>("Address2")
.HasColumnType("nvarchar(max)");
b.Property<string>("City")
.HasColumnType("nvarchar(max)");
b.Property<string>("Code")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("District")
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<long?>("Fax")
.HasColumnType("bigint");
b.Property<bool?>("IsActive")
.HasColumnType("bit");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<long>("Mobile")
.HasColumnType("bigint");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<long?>("Phone")
.HasColumnType("bigint");
b.Property<string>("PostalCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("TaxOffice")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<long>("VknTckn")
.HasColumnType("bigint");
b.Property<string>("Website")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("TenantId");
b.ToTable("PBranch", (string)null);
});
modelBuilder.Entity("Kurs.Platform.Entities.BranchUsers", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BranchId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("UserId", "BranchId");
b.HasIndex("BranchId");
b.ToTable("PBranchUsers", (string)null);
});
modelBuilder.Entity("Kurs.Platform.Entities.Chart", b => modelBuilder.Entity("Kurs.Platform.Entities.Chart", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -707,6 +819,9 @@ namespace Kurs.Platform.Migrations
b.Property<string>("ExportJson") b.Property<string>("ExportJson")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<bool>("IsBranch")
.HasColumnType("bit");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("bit") .HasColumnType("bit")
@ -1002,6 +1117,9 @@ namespace Kurs.Platform.Migrations
b.Property<string>("InsertServiceAddress") b.Property<string>("InsertServiceAddress")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<bool>("IsBranch")
.HasColumnType("bit");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("bit") .HasColumnType("bit")
@ -3389,6 +3507,25 @@ namespace Kurs.Platform.Migrations
.OnDelete(DeleteBehavior.SetNull); .OnDelete(DeleteBehavior.SetNull);
}); });
modelBuilder.Entity("Kurs.Platform.Entities.Branch", b =>
{
b.HasOne("Volo.Abp.TenantManagement.Tenant", null)
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Kurs.Platform.Entities.BranchUsers", b =>
{
b.HasOne("Kurs.Platform.Entities.Branch", "Branch")
.WithMany("BranchUsers")
.HasForeignKey("BranchId")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("Branch");
});
modelBuilder.Entity("Kurs.Platform.Entities.ListFormCustomization", b => modelBuilder.Entity("Kurs.Platform.Entities.ListFormCustomization", b =>
{ {
b.HasOne("Kurs.Platform.Entities.ListForm", null) b.HasOne("Kurs.Platform.Entities.ListForm", null)
@ -3556,6 +3693,11 @@ namespace Kurs.Platform.Migrations
b.Navigation("Texts"); b.Navigation("Texts");
}); });
modelBuilder.Entity("Kurs.Platform.Entities.Branch", b =>
{
b.Navigation("BranchUsers");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>
{ {
b.Navigation("Actions"); b.Navigation("Actions");

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.j0e979frdf8" "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

@ -229,6 +229,7 @@ export interface ChartDto extends AuditedEntityDto<string> {
permissionJson?: string permissionJson?: string
permissionDto: PermissionCrudDto permissionDto: PermissionCrudDto
isTenant: boolean isTenant: boolean
isBranch: boolean
isOrganizationUnit: boolean isOrganizationUnit: boolean
} }

View file

@ -379,6 +379,7 @@ export interface GridEditingDto {
popup: GridEditingPopupDto popup: GridEditingPopupDto
sendOnlyChangedFormValuesUpdate: boolean sendOnlyChangedFormValuesUpdate: boolean
isTenant: boolean isTenant: boolean
isBranch: boolean
isOrganizationUnit: boolean isOrganizationUnit: boolean
} }
@ -471,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

@ -404,7 +404,17 @@ function ChartEdit() {
component={Checkbox} component={Checkbox}
/> />
</FormItem> </FormItem>
<FormItem
label={translate('::ListForms.ListFormEdit.IsBranch')}
invalid={errors.isBranch && touched.isBranch}
errorMessage={errors.isBranch}
>
<Field
name="isBranch"
placeholder={translate('::ListForms.ListFormEdit.IsBranch')}
component={Checkbox}
/>
</FormItem>
<FormItem <FormItem
label={translate('::ListForms.ListFormEdit.IsOrganizationUnit')} label={translate('::ListForms.ListFormEdit.IsOrganizationUnit')}
invalid={errors.isOrganizationUnit && touched.isOrganizationUnit} invalid={errors.isOrganizationUnit && touched.isOrganizationUnit}

View file

@ -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">

View file

@ -15,6 +15,7 @@ import { dbSourceTypeOptions, selectCommandTypeOptions } from './options'
const schema = Yup.object().shape({ const schema = Yup.object().shape({
isOrganizationUnit: Yup.bool(), isOrganizationUnit: Yup.bool(),
isTenant: Yup.bool(), isTenant: Yup.bool(),
isBranch: Yup.bool(),
dataSourceCode: Yup.string(), dataSourceCode: Yup.string(),
selectCommandType: Yup.number().oneOf(Object.values(SelectCommandTypeEnum) as number[]), selectCommandType: Yup.number().oneOf(Object.values(SelectCommandTypeEnum) as number[]),
selectCommand: Yup.string(), selectCommand: Yup.string(),
@ -70,6 +71,17 @@ function FormTabDatabaseDataSource(props: FormEditProps) {
component={Checkbox} component={Checkbox}
/> />
</FormItem> </FormItem>
<FormItem
label={translate('::ListForms.ListFormEdit.IsBranch')}
invalid={errors.editingOptionDto?.isBranch && touched.editingOptionDto?.isBranch}
errorMessage={errors.editingOptionDto?.isBranch}
>
<Field
name="isBranch"
placeholder={translate('::ListForms.ListFormEdit.IsBranch')}
component={Checkbox}
/>
</FormItem>
<FormItem <FormItem
label={translate('::ListForms.ListFormEdit.IsOrganizationUnit')} label={translate('::ListForms.ListFormEdit.IsOrganizationUnit')}
invalid={ invalid={