Branch Entity ve Seeder Güncellemeleri

This commit is contained in:
Sedat Öztürk 2025-06-15 11:55:10 +03:00
parent 83be43b4f2
commit 594bf2da0c
28 changed files with 4901 additions and 25 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

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

@ -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 = listFormTenants.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",
@ -2800,13 +2806,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

@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Kurs.Platform.Branches;
public interface IPlatformBranchesRepository
{
Task<List<Guid>> GetBranchIdsWithUserId(Guid userId);
}

View file

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

@ -1,4 +1,5 @@
using Kurs.Platform.Entities; using Kurs.Platform.Branches;
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;
@ -37,6 +38,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 string cultureName; private readonly string cultureName;
private readonly string cultureNameDefault; private readonly string cultureNameDefault;
@ -48,12 +50,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,
IPlatformBranchesRepository 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 +131,19 @@ public class ListFormManager : PlatformDomainService, IListFormManager
} }
} }
if (listForm.IsBranch)
{
var ids = await branchUsersRepository.GetBranchIdsWithUserId(CurrentUser.Id.Value);
if (ids.Count > 0)
{
fields.Add("BranchId", $"IN ({string.Join(",", ids.Select(a => $"'{a}'"))})");
}
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

@ -5,6 +5,7 @@ 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;
@ -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 IPlatformBranchesRepository BranchesRepository { 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,
IPlatformBranchesRepository branchesRepository)
: 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;
BranchesRepository = branchesRepository;
} }
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 = BranchesRepository.GetBranchIdsWithUserId(CurrentUser.Id.Value).Result;
if (ids.Count > 0)
{
whereParts.Add($"\"BranchId\" IN ({string.Join(",", ids.Select(a => $"'{a}'"))})");
}
else
{
whereParts.Add($"\"BranchId\" = '{Guid.Empty}'");
}
}
if (listform.IsOrganizationUnit) if (listform.IsOrganizationUnit)
{ {
if (whereParts.Any()) if (whereParts.Any())

View file

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using Kurs.Platform.Entities;
using Kurs.Platform.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity;
namespace Kurs.Platform.Branches
{
public class PlatformBranchRepository : EfCoreRepository<PlatformDbContext, IdentityUser, Guid>, IPlatformBranchesRepository
{
public PlatformBranchRepository(IDbContextProvider<PlatformDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public async Task<List<Guid>> GetBranchIdsWithUserId(Guid userId)
{
var query = await GetQueryableAsync(userId);
var organizationUnitCodes = await query.Select(ou => ou.Code).ToListAsync();
var dbContext = await GetDbContextAsync();
return await dbContext.OrganizationUnits
.Where(a => organizationUnitCodes.Any(b => a.Code.StartsWith(b)))
.Select(a => a.Id)
.ToListAsync();
}
//Get IQueryable
private async Task<IQueryable<Branch>> GetQueryableAsync(Guid userId)
{
var dbContext = await GetDbContextAsync();
var query = from userBranch in dbContext.Set<BranchUsers>()
join branch in dbContext.Branches on userBranch.BranchId equals branch.Id
where userBranch.UserId == userId
select branch;
return query;
}
}
}

View file

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

@ -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.5oedcrigdno"
}], {}); }], {});
workbox.cleanupOutdatedCaches(); workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {

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

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

@ -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={