From ef8f830810324d4ab8f833f912dcf652172ade58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96ZT=C3=9CRK?= <76204082+iamsedatozturk@users.noreply.github.com> Date: Tue, 4 Nov 2025 11:15:42 +0300 Subject: [PATCH] =?UTF-8?q?Mobile,=20Phone,=20Fax=20g=C3=BCncellemesi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tenants/CustomTenantDto.cs | 4 +- .../Seeds/ListFormSeeder_Saas.cs | 6 +- .../Enums/LookUpQueryValues.cs | 2 +- .../Branch/BranchSeedManager.cs | 421 +++++++++++------- .../Branch/Administration/BranchUsers.cs | 1 + .../Entities/Branch/Coordinator/Class.cs | 2 +- .../Entities/Branch/Coordinator/ClassType.cs | 2 +- .../Branch/Coordinator/LessonPeriod.cs | 2 +- .../Entities/Branch/Coordinator/Level.cs | 2 +- .../Branch/Coordinator/RegistrationMethod.cs | 2 +- .../Branch/Coordinator/RegistrationType.cs | 2 +- .../Entities/Branch/Coordinator/Schedule.cs | 2 +- .../Entities/Branch/Intranet/Meal.cs | 2 +- .../Entities/Tenant/Administration/Order.cs | 4 +- .../Entities/Tenant/Saas/Branch.cs | 12 + .../Extensions/AbpTenantExtensions.cs | 26 +- .../EntityFrameworkCore/PlatformDbContext.cs | 45 ++ .../PlatformEfCoreEntityExtensionMappings.cs | 8 +- ....cs => 20251104061839_Initial.Designer.cs} | 10 +- ...0_Initial.cs => 20251104061839_Initial.cs} | 8 +- .../PlatformDbContextModelSnapshot.cs | 8 +- ui/src/views/branch/BranchSeed.tsx | 140 +++--- 22 files changed, 426 insertions(+), 285 deletions(-) rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20251103202730_Initial.Designer.cs => 20251104061839_Initial.Designer.cs} (99%) rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20251103202730_Initial.cs => 20251104061839_Initial.cs} (99%) diff --git a/api/src/Kurs.Platform.Application.Contracts/Tenants/CustomTenantDto.cs b/api/src/Kurs.Platform.Application.Contracts/Tenants/CustomTenantDto.cs index 9c3197f5..7b5bf234 100644 --- a/api/src/Kurs.Platform.Application.Contracts/Tenants/CustomTenantDto.cs +++ b/api/src/Kurs.Platform.Application.Contracts/Tenants/CustomTenantDto.cs @@ -10,7 +10,7 @@ public class CustomTenantDto public Guid? Id { get; set; } public string OrganizationName { get; set; } public string Founder { get; set; } - public long VknTckn { get; set; } + public long? VknTckn { get; set; } public string TaxOffice { get; set; } public string Country { get; set; } public string City { get; set; } @@ -19,7 +19,7 @@ public class CustomTenantDto public string Address1 { get; set; } public string Address2 { get; set; } public string PostalCode { get; set; } - public long MobileNumber { get; set; } + public long? MobileNumber { get; set; } public long? PhoneNumber { get; set; } public long? FaxNumber { get; set; } public string Email { get; set; } diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Saas.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Saas.cs index e95291cd..12f217ad 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Saas.cs +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Saas.cs @@ -1244,9 +1244,9 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency Text = "Seed", AuthName = AppCodes.Branches + ".Update", DialogName = "BranchSeed", - DialogParameters = JsonSerializer.Serialize(new { - name = "@Id", - }) + DialogParameters = JsonSerializer.Serialize( + new { id = "@Id", name = "@Name"} + ) }, }), } diff --git a/api/src/Kurs.Platform.Domain.Shared/Enums/LookUpQueryValues.cs b/api/src/Kurs.Platform.Domain.Shared/Enums/LookUpQueryValues.cs index 68379a50..af264901 100644 --- a/api/src/Kurs.Platform.Domain.Shared/Enums/LookUpQueryValues.cs +++ b/api/src/Kurs.Platform.Domain.Shared/Enums/LookUpQueryValues.cs @@ -314,7 +314,7 @@ public static class LookupQueryValues $"SELECT \"Name\" AS \"Key\", " + $"CONCAT(\"Name\", ' (', \"DisplayName\", ')') AS \"Name\" " + $"FROM \"AbpPermissions\" " + - $"WHERE \"IsEnabled\" = 'false' " + + $"WHERE \"IsEnabled\" = 'true' " + $"ORDER BY \"Name\";"; public static string MenuCodeValues = diff --git a/api/src/Kurs.Platform.Domain/Branch/BranchSeedManager.cs b/api/src/Kurs.Platform.Domain/Branch/BranchSeedManager.cs index 365b077f..b3126eb3 100644 --- a/api/src/Kurs.Platform.Domain/Branch/BranchSeedManager.cs +++ b/api/src/Kurs.Platform.Domain/Branch/BranchSeedManager.cs @@ -78,220 +78,307 @@ public class BranchSeedManager : DomainService InsertedItems = [] }; - - var registrationTypeLog = CreateLog(nameof(RegistrationType)); - foreach (var item in items.RegistrationTypes) + if (items.RegistrationTypes.Count > 0) { - var exists = await _registrationTypeRepository.AnyAsync(x => x.Name == item.Name && x.BranchId == branchId); - - if (!exists) + var registrationTypeLog = CreateLog(nameof(RegistrationType)); + foreach (var item in items.RegistrationTypes) { - await _registrationTypeRepository.InsertAsync(new RegistrationType + var exists = await _registrationTypeRepository.AnyAsync(x => x.Name == item.Name && x.BranchId == branchId); + + if (!exists) { - TenantId = tenantId, - BranchId = branchId, - Name = item.Name, - Status = item.Status - }, autoSave: true); - - registrationTypeLog.InsertedCount++; - registrationTypeLog.InsertedItems.Add(item.Name); - } - } - result.Details.Add(registrationTypeLog); - - var registrationMethodLog = CreateLog(nameof(RegistrationMethod)); - foreach (var item in items.RegistrationMethods) - { - var exists = await _registrationMethodRepository.AnyAsync(x => x.Name == item.Name && x.BranchId == branchId); - - if (!exists) - { - var registrationType = await _registrationTypeRepository.FirstOrDefaultAsync(x => x.Name == item.RegistrationTypeName); - if (registrationType != null) - { - await _registrationMethodRepository.InsertAsync(new RegistrationMethod + await _registrationTypeRepository.InsertAsync(new RegistrationType { TenantId = tenantId, BranchId = branchId, - RegistrationTypeId = registrationType.Id, Name = item.Name, Status = item.Status - }); - - registrationMethodLog.InsertedCount++; - registrationMethodLog.InsertedItems.Add(item.Name); - } - } - } - result.Details.Add(registrationMethodLog); - - var classTypeLog = CreateLog(nameof(ClassType)); - foreach (var item in items.ClassTypes) - { - var exists = await _classTypeRepository.AnyAsync(x => x.Name == item.Name); - - if (!exists) - { - var registrationType = await _registrationTypeRepository.FirstOrDefaultAsync(x => x.Name == item.RegistrationTypeName && x.BranchId == branchId); - if (registrationType != null) - { - await _classTypeRepository.InsertAsync(new ClassType - { - TenantId = tenantId, - BranchId = branchId, - RegistrationTypeId = registrationType.Id, - Name = item.Name, - MinStudentCount = item.MinStudentCount, - MaxStudentCount = item.MaxStudentCount, - Status = item.Status }, autoSave: true); - classTypeLog.InsertedCount++; - classTypeLog.InsertedItems.Add(item.Name); + registrationTypeLog.InsertedCount++; + registrationTypeLog.InsertedItems.Add( + $"{{ " + + $"\"name\": \"{item.Name}\", " + + $"\"status\": \"{item.Status}\" " + + $"}}" + ); } } + result.Details.Add(registrationTypeLog); } - result.Details.Add(classTypeLog); - var classLog = CreateLog(nameof(Class)); - foreach (var item in items.Classes) + if (items.RegistrationMethods.Count > 0) { - var exists = await _classRepository.AnyAsync(x => x.Name == item.Name && x.BranchId == branchId); - - if (!exists) + var registrationMethodLog = CreateLog(nameof(RegistrationMethod)); + foreach (var item in items.RegistrationMethods) { - var classType = await _classTypeRepository.FirstOrDefaultAsync(x => x.Name == item.ClassTypeName); - if (classType != null) + var exists = await _registrationMethodRepository.AnyAsync(x => x.Name == item.Name && x.BranchId == branchId); + + if (!exists) { - await _classRepository.InsertAsync(new() + var registrationType = await _registrationTypeRepository.FirstOrDefaultAsync(x => x.Name == item.RegistrationTypeName); + if (registrationType != null) + { + await _registrationMethodRepository.InsertAsync(new RegistrationMethod + { + TenantId = tenantId, + BranchId = branchId, + RegistrationTypeId = registrationType.Id, + Name = item.Name, + Status = item.Status + }); + + registrationMethodLog.InsertedCount++; + registrationMethodLog.InsertedItems.Add( + $"{{ " + + $"\"name\": \"{item.Name}\", " + + $"\"status\": \"{item.Status}\", " + + $"\"registrationType\": \"{item.RegistrationTypeName}\" " + + $"}}" + ); + } + } + } + result.Details.Add(registrationMethodLog); + } + + if (items.ClassTypes.Count > 0) + { + var classTypeLog = CreateLog(nameof(ClassType)); + foreach (var item in items.ClassTypes) + { + var exists = await _classTypeRepository.AnyAsync(x => x.Name == item.Name); + + if (!exists) + { + var registrationType = await _registrationTypeRepository.FirstOrDefaultAsync(x => x.Name == item.RegistrationTypeName && x.BranchId == branchId); + if (registrationType != null) + { + await _classTypeRepository.InsertAsync(new ClassType + { + TenantId = tenantId, + BranchId = branchId, + RegistrationTypeId = registrationType.Id, + Name = item.Name, + MinStudentCount = item.MinStudentCount, + MaxStudentCount = item.MaxStudentCount, + Status = item.Status + }, autoSave: true); + + classTypeLog.InsertedCount++; + classTypeLog.InsertedItems.Add( + $"{{ " + + $"\"name\": \"{item.Name}\", " + + $"\"status\": \"{item.Status}\", " + + $"\"registrationType\": \"{item.RegistrationTypeName}\", " + + $"\"minStudentCount\": {item.MinStudentCount}, " + + $"\"maxStudentCount\": {item.MaxStudentCount} " + + $"}}" + ); + } + } + } + result.Details.Add(classTypeLog); + } + + if (items.Classes.Count > 0) + { + var classLog = CreateLog(nameof(Class)); + foreach (var item in items.Classes) + { + var exists = await _classRepository.AnyAsync(x => x.Name == item.Name && x.BranchId == branchId); + + if (!exists) + { + var classType = await _classTypeRepository.FirstOrDefaultAsync(x => x.Name == item.ClassTypeName); + if (classType != null) + { + await _classRepository.InsertAsync(new() + { + TenantId = tenantId, + BranchId = branchId, + ClassTypeId = classType.Id, + Name = item.Name, + Status = item.Status, + }); + + classLog.InsertedCount++; + classLog.InsertedItems.Add( + $"{{ " + + $"\"name\": \"{item.Name}\", " + + $"\"status\": \"{item.Status}\", " + + $"\"classType\": \"{item.ClassTypeName}\" " + + $"}}" + ); + } + } + } + result.Details.Add(classLog); + } + + if (items.Levels.Count > 0) + { + var levelLog = CreateLog(nameof(Level)); + foreach (var item in items.Levels) + { + var exists = await _levelRepository.AnyAsync(x => x.Name == item.Name && x.BranchId == branchId); + + if (!exists) + { + var classType = await _classTypeRepository.FirstOrDefaultAsync(x => x.Name == item.ClassTypeName); + if (classType != null) + { + await _levelRepository.InsertAsync(new Level + { + TenantId = tenantId, + BranchId = branchId, + ClassTypeId = classType.Id, + LevelType = item.LevelType, + Name = item.Name, + Order = item.Order, + LessonCount = item.LessonCount, + LessonDuration = item.LessonDuration, + Status = item.Status, + MonthlyPaymentRate = item.MonthlyPaymentRate + }); + + levelLog.InsertedCount++; + levelLog.InsertedItems.Add( + $"{{ " + + $"\"name\": \"{item.Name}\", " + + $"\"status\": \"{item.Status}\", " + + $"\"classType\": \"{item.ClassTypeName}\", " + + $"\"levelType\": \"{item.LevelType}\", " + + $"\"order\": {item.Order}, " + + $"\"lessonCount\": {item.LessonCount}, " + + $"\"lessonDuration\": {item.LessonDuration}, " + + $"\"monthlyPaymentRate\": {item.MonthlyPaymentRate} " + + $"}}" + ); + } + } + } + result.Details.Add(levelLog); + } + + if (items.LessonPeriods.Count > 0) + { + var lessonPeriodLog = CreateLog(nameof(LessonPeriod)); + foreach (var item in items.LessonPeriods) + { + var exists = await _lessonPeriodRepository.AnyAsync(x => x.Name == item.Name && x.BranchId == branchId); + + if (!exists) + { + await _lessonPeriodRepository.InsertAsync(new() { TenantId = tenantId, BranchId = branchId, - ClassTypeId = classType.Id, Name = item.Name, - Status = item.Status, + Day = item.Day, + Lesson1 = item.Lesson1, + Lesson2 = item.Lesson2, + Lesson3 = item.Lesson3, + Lesson4 = item.Lesson4, }); - classLog.InsertedCount++; - classLog.InsertedItems.Add(item.Name); + lessonPeriodLog.InsertedCount++; + lessonPeriodLog.InsertedItems.Add( + $"{{ " + + $"\"name\": \"{item.Name}\", " + + $"\"day\": \"{item.Day}\", " + + $"\"lesson1\": \"{item.Lesson1}\", " + + $"\"lesson2\": \"{item.Lesson2}\", " + + $"\"lesson3\": \"{item.Lesson3}\", " + + $"\"lesson4\": \"{item.Lesson4}\" " + + $"}}" + ); } } + result.Details.Add(lessonPeriodLog); } - result.Details.Add(classLog); - var levelLog = CreateLog(nameof(Level)); - foreach (var item in items.Levels) + if (items.Schedules.Count > 0) { - var exists = await _levelRepository.AnyAsync(x => x.Name == item.Name && x.BranchId == branchId); - - if (!exists) + var scheduleLog = CreateLog(nameof(Schedule)); + foreach (var item in items.Schedules) { - var classType = await _classTypeRepository.FirstOrDefaultAsync(x => x.Name == item.ClassTypeName); - if (classType != null) + var exists = await _scheduleRepository.AnyAsync(x => x.Name == item.Name && x.BranchId == branchId); + + if (!exists) { - await _levelRepository.InsertAsync(new Level + await _scheduleRepository.InsertAsync(new() { TenantId = tenantId, BranchId = branchId, - ClassTypeId = classType.Id, - LevelType = item.LevelType, Name = item.Name, - Order = item.Order, + Status = item.Status, + StartTime = item.StartTime, + EndTime = item.EndTime, + LessonMinute = item.LessonMinute, + LessonBreakMinute = item.LessonBreakMinute, LessonCount = item.LessonCount, - LessonDuration = item.LessonDuration, - Status = item.Status, - MonthlyPaymentRate = item.MonthlyPaymentRate + LunchTime = item.LunchTime, + LunchMinute = item.LunchMinute, + IncludeLunch = item.IncludeLunch, + Monday = item.Monday, + Tuesday = item.Tuesday, + Wednesday = item.Wednesday, + Thursday = item.Thursday, + Friday = item.Friday, + Saturday = item.Saturday, + Sunday = item.Sunday, }); - levelLog.InsertedCount++; - levelLog.InsertedItems.Add(item.Name); + scheduleLog.InsertedCount++; + scheduleLog.InsertedItems.Add( + $"{{ \"name\": \"{item.Name}\", " + + $"\"status\": \"{item.Status}\", " + + $"\"startTime\": \"{item.StartTime:HH\\:mm}\", " + + $"\"endTime\": \"{item.EndTime:HH\\:mm}\", " + + $"\"lessonMinute\": {item.LessonMinute}, " + + $"\"lessonBreakMinute\": {item.LessonBreakMinute}, " + + $"\"lessonCount\": {item.LessonCount}, " + + $"\"lunchTime\": \"{item.LunchTime:HH\\:mm}\", " + + $"\"lunchMinute\": {item.LunchMinute}, " + + $"\"includeLunch\": {item.IncludeLunch.ToString().ToLower()}, " + + $"\"monday\": {item.Monday.ToString().ToLower()}, " + + $"\"tuesday\": {item.Tuesday.ToString().ToLower()}, " + + $"\"wednesday\": {item.Wednesday.ToString().ToLower()}, " + + $"\"thursday\": {item.Thursday.ToString().ToLower()}, " + + $"\"friday\": {item.Friday.ToString().ToLower()}, " + + $"\"saturday\": {item.Saturday.ToString().ToLower()}, " + + $"\"sunday\": {item.Sunday.ToString().ToLower()} }}" + ); } } + result.Details.Add(scheduleLog); } - result.Details.Add(levelLog); - var lessonPeriodLog = CreateLog(nameof(LessonPeriod)); - foreach (var item in items.LessonPeriods) + if (items.Meals.Count > 0) { - var exists = await _lessonPeriodRepository.AnyAsync(x => x.Name == item.Name && x.BranchId == branchId); - - if (!exists) + var mealLog = CreateLog(nameof(Meal)); + foreach (var item in items.Meals) { - await _lessonPeriodRepository.InsertAsync(new() + var exists = await _mealRepository.AnyAsync(x => x.Date == item.Date && x.BranchId == branchId); + if (!exists) { - TenantId = tenantId, - BranchId = branchId, - Name = item.Name, - Day = item.Day, - Lesson1 = item.Lesson1, - Lesson2 = item.Lesson2, - Lesson3 = item.Lesson3, - Lesson4 = item.Lesson4, - }); + await _mealRepository.InsertAsync(new() + { + TenantId = tenantId, + BranchId = branchId, + Date = item.Date, + TotalCalorie = item.TotalCalorie, + Materials = item.Materials, + }, autoSave: true); - lessonPeriodLog.InsertedCount++; - lessonPeriodLog.InsertedItems.Add(item.Name); + mealLog.InsertedCount++; + + mealLog.InsertedItems.Add($"{{ \"date\": \"{item.Date:yyyy-MM-dd}\", \"type\": \"{item.Type}\", \"materials\": \"{item.Materials.Replace("|", ", ")}\" }}"); + } } + result.Details.Add(mealLog); } - result.Details.Add(lessonPeriodLog); - - var scheduleLog = CreateLog(nameof(Schedule)); - foreach (var item in items.Schedules) - { - var exists = await _scheduleRepository.AnyAsync(x => x.Name == item.Name && x.BranchId == branchId); - - if (!exists) - { - await _scheduleRepository.InsertAsync(new() - { - TenantId = tenantId, - BranchId = branchId, - Name = item.Name, - Status = item.Status, - StartTime = item.StartTime, - EndTime = item.EndTime, - LessonMinute = item.LessonMinute, - LessonBreakMinute = item.LessonBreakMinute, - LessonCount = item.LessonCount, - LunchTime = item.LunchTime, - LunchMinute = item.LunchMinute, - IncludeLunch = item.IncludeLunch, - Monday = item.Monday, - Tuesday = item.Tuesday, - Wednesday = item.Wednesday, - Thursday = item.Thursday, - Friday = item.Friday, - Saturday = item.Saturday, - Sunday = item.Sunday, - }); - - scheduleLog.InsertedCount++; - scheduleLog.InsertedItems.Add(item.Name); - } - } - result.Details.Add(scheduleLog); - - var mealLog = CreateLog(nameof(Meal)); - foreach (var item in items.Meals) - { - var exists = await _mealRepository.AnyAsync(x => x.Date == item.Date && x.BranchId == branchId); - if (!exists) - { - await _mealRepository.InsertAsync(new() - { - TenantId = tenantId, - BranchId = branchId, - Date = item.Date, - TotalCalorie = item.TotalCalorie, - Materials = item.Materials - }, autoSave: true); - - mealLog.InsertedCount++; - mealLog.InsertedItems.Add(string.Format("{0} {1} {2}", item.Date, item.Type, item.Materials)); - } - } - result.Details.Add(mealLog); result.Success = true; result.Message = $"Seed işlemi başarıyla tamamlandı. Toplam {result.TotalInsertedCount} kayıt eklendi."; diff --git a/api/src/Kurs.Platform.Domain/Entities/Branch/Administration/BranchUsers.cs b/api/src/Kurs.Platform.Domain/Entities/Branch/Administration/BranchUsers.cs index cf5ede25..1a1e04e0 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Branch/Administration/BranchUsers.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Branch/Administration/BranchUsers.cs @@ -9,6 +9,7 @@ public class BranchUsers : Entity, IMultiTenant { public Guid? TenantId { get; set; } public Guid BranchId { get; set; } + public Branch Branch { get; set; } public Guid UserId { get; set; } Guid? IMultiTenant.TenantId => TenantId; diff --git a/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/Class.cs b/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/Class.cs index 4d1dba63..6819fa40 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/Class.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/Class.cs @@ -8,7 +8,7 @@ public class Class : FullAuditedEntity, IMultiTenant { public Guid? TenantId { get; set; } public Guid? BranchId { get; set; } - + public Branch Branch { get; set; } public Guid ClassTypeId { get; set; } public string Name { get; set; } public string Status { get; set; } diff --git a/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/ClassType.cs b/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/ClassType.cs index 500b7650..191c2081 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/ClassType.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/ClassType.cs @@ -9,7 +9,7 @@ public class ClassType : FullAuditedEntity, IMultiTenant { public Guid? TenantId { get; set; } public Guid? BranchId { get; set; } - + public Branch Branch { get; set; } public Guid RegistrationTypeId { get; set; } public string Name { get; set; } diff --git a/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/LessonPeriod.cs b/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/LessonPeriod.cs index 5ef51a69..555fc8f3 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/LessonPeriod.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/LessonPeriod.cs @@ -8,7 +8,7 @@ public class LessonPeriod : FullAuditedEntity, IMultiTenant { public Guid? TenantId { get; set; } public Guid? BranchId { get; set; } - + public Branch Branch { get; set; } public string Name { get; set; } public string Day { get; set; } diff --git a/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/Level.cs b/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/Level.cs index e110f4ed..1394118a 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/Level.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/Level.cs @@ -8,7 +8,7 @@ public class Level : FullAuditedEntity, IMultiTenant { public Guid? TenantId { get; set; } public Guid? BranchId { get; set; } - + public Branch Branch { get; set; } public Guid ClassTypeId { get; set; } // SinifTipiID (FK) public string LevelType { get; set; } // SeviyeTipi public string Name { get; set; } // SeviyeKodu diff --git a/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/RegistrationMethod.cs b/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/RegistrationMethod.cs index 5ac55777..ccd80858 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/RegistrationMethod.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/RegistrationMethod.cs @@ -8,7 +8,7 @@ public class RegistrationMethod : FullAuditedEntity, IMultiTenant { public Guid? TenantId { get; set; } public Guid? BranchId { get; set; } // SubeID - + public Branch Branch { get; set; } public Guid RegistrationTypeId { get; set; } // KayitTipiID public string Name { get; set; } // KayitSekli public string Status { get; set; } // Durum diff --git a/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/RegistrationType.cs b/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/RegistrationType.cs index 20fdc095..28108c10 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/RegistrationType.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/RegistrationType.cs @@ -9,7 +9,7 @@ public class RegistrationType : FullAuditedEntity, IMultiTenant { public Guid? TenantId { get; set; } public Guid? BranchId { get; set; } // SubeID - + public Branch Branch { get; set; } public string Name { get; set; } // KayitTipi public string Status { get; set; } // Durum diff --git a/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/Schedule.cs b/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/Schedule.cs index 7710e061..6c49540c 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/Schedule.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Branch/Coordinator/Schedule.cs @@ -9,7 +9,7 @@ public class Schedule : FullAuditedEntity, IMultiTenant { public Guid? TenantId { get; set; } public Guid? BranchId { get; set; } - + public Branch Branch { get; set; } public string Name { get; set; } public string Status { get; set; } diff --git a/api/src/Kurs.Platform.Domain/Entities/Branch/Intranet/Meal.cs b/api/src/Kurs.Platform.Domain/Entities/Branch/Intranet/Meal.cs index 663b43ef..28b377a3 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Branch/Intranet/Meal.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Branch/Intranet/Meal.cs @@ -8,7 +8,7 @@ public class Meal : FullAuditedEntity, IMultiTenant { public Guid? TenantId { get; set; } public Guid? BranchId { get; set; } - + public Branch Branch { get; set; } public DateTime Date { get; set; } public string Type { get; set; } public decimal TotalCalorie { get; set; } diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Administration/Order.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Administration/Order.cs index 7ff38d8d..d725085e 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Tenant/Administration/Order.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/Administration/Order.cs @@ -14,7 +14,7 @@ public class Order : FullAuditedEntity, IMultiTenant public string OrganizationName { get; set; } public string Founder { get; set; } - public long VknTckn { get; set; } + public long? VknTckn { get; set; } public string TaxOffice { get; set; } public string Address1 { get; set; } public string Address2 { get; set; } @@ -22,7 +22,7 @@ public class Order : FullAuditedEntity, IMultiTenant public string Country { get; set; } public string City { get; set; } public string PostalCode { get; set; } - public long MobileNumber { get; set; } + public long? MobileNumber { get; set; } public long? PhoneNumber { get; set; } public long? FaxNumber { get; set; } public string Email { get; set; } diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Saas/Branch.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Saas/Branch.cs index 796f9f51..17775a7a 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Tenant/Saas/Branch.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/Saas/Branch.cs @@ -1,4 +1,6 @@ using System; +using System.Collections; +using System.Collections.Generic; using Volo.Abp.Domain.Entities.Auditing; namespace Kurs.Platform.Entities; @@ -24,4 +26,14 @@ public class Branch : FullAuditedEntity public string Email { get; set; } public string Website { get; set; } public bool? IsActive { get; set; } + + public ICollection UserBranches { get; set; } + public ICollection RegistrationTypes { get; set; } + public ICollection RegistrationMethods { get; set; } + public ICollection ClassTypes { get; set; } + public ICollection Classes { get; set; } + public ICollection Levels { get; set; } + public ICollection LessonPeriods { get; set; } + public ICollection Schedules { get; set; } + public ICollection Meals { get; set; } } diff --git a/api/src/Kurs.Platform.Domain/Extensions/AbpTenantExtensions.cs b/api/src/Kurs.Platform.Domain/Extensions/AbpTenantExtensions.cs index 26f232cd..60d9f7af 100644 --- a/api/src/Kurs.Platform.Domain/Extensions/AbpTenantExtensions.cs +++ b/api/src/Kurs.Platform.Domain/Extensions/AbpTenantExtensions.cs @@ -34,13 +34,13 @@ public static class AbpTenantExtensions return tenant.GetProperty(PlatformConsts.Tenants.Founder); } - public static void SetVknTckn(this Tenant tenant, long vknTckn) + public static void SetVknTckn(this Tenant tenant, long? vknTckn) { - tenant.SetProperty(PlatformConsts.Tenants.VknTckn, vknTckn); + tenant.SetProperty(PlatformConsts.Tenants.VknTckn, vknTckn.HasValue ? vknTckn : null); } - public static long GetVknTckn(this Tenant tenant) + public static long? GetVknTckn(this Tenant tenant) { - return tenant.GetProperty(PlatformConsts.Tenants.VknTckn); + return tenant.GetProperty(PlatformConsts.Tenants.VknTckn); } public static void SetTaxOffice(this Tenant tenant, string taxOffice) @@ -114,29 +114,29 @@ public static class AbpTenantExtensions public static void SetPhoneNumber(this Tenant tenant, long? phoneNumber) { - tenant.SetProperty(PlatformConsts.Tenants.PhoneNumber, phoneNumber); + tenant.SetProperty(PlatformConsts.Tenants.PhoneNumber, phoneNumber.HasValue ? phoneNumber : null); } - public static long GetPhoneNumber(this Tenant tenant) + public static long? GetPhoneNumber(this Tenant tenant) { - return tenant.GetProperty(PlatformConsts.Tenants.PhoneNumber); + return tenant.GetProperty(PlatformConsts.Tenants.PhoneNumber); } public static void SetMobileNumber(this Tenant tenant, long? mobileNumber) { - tenant.SetProperty(PlatformConsts.Tenants.MobileNumber, mobileNumber); + tenant.SetProperty(PlatformConsts.Tenants.MobileNumber, mobileNumber.HasValue ? mobileNumber : null); } - public static long GetMobileNumber(this Tenant tenant) + public static long? GetMobileNumber(this Tenant tenant) { - return tenant.GetProperty(PlatformConsts.Tenants.MobileNumber); + return tenant.GetProperty(PlatformConsts.Tenants.MobileNumber); } public static void SetFaxNumber(this Tenant tenant, long? faxNumber) { - tenant.SetProperty(PlatformConsts.Tenants.FaxNumber, faxNumber); + tenant.SetProperty(PlatformConsts.Tenants.FaxNumber, faxNumber.HasValue ? faxNumber : null); } - public static long GetFaxNumber(this Tenant tenant) + public static long? GetFaxNumber(this Tenant tenant) { - return tenant.GetProperty(PlatformConsts.Tenants.FaxNumber); + return tenant.GetProperty(PlatformConsts.Tenants.FaxNumber); } public static void SetEmail(this Tenant tenant, string email) diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index 741810fa..0c1fc8d8 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -292,6 +292,11 @@ public class PlatformDbContext : b.Property(a => a.UserId).IsRequired(); b.Property(a => a.BranchId).IsRequired(); b.Property(a => a.TenantId); + + b.HasOne(x => x.Branch) + .WithMany(x => x.UserBranches) + .HasForeignKey(x => x.BranchId) + .OnDelete(DeleteBehavior.Restrict); }); builder.Entity(b => @@ -964,6 +969,11 @@ public class PlatformDbContext : .WithOne(x => x.Schedule) .HasForeignKey(x => x.ScheduleId) .OnDelete(DeleteBehavior.Cascade); + + b.HasOne(x => x.Branch) + .WithMany(x => x.Schedules) + .HasForeignKey(x => x.BranchId) + .OnDelete(DeleteBehavior.Restrict); }); builder.Entity(b => @@ -1005,6 +1015,11 @@ public class PlatformDbContext : .WithOne(x => x.RegistrationType) .HasForeignKey(x => x.RegistrationTypeId) .OnDelete(DeleteBehavior.Cascade); + + b.HasOne(x => x.Branch) + .WithMany(x => x.RegistrationTypes) + .HasForeignKey(x => x.BranchId) + .OnDelete(DeleteBehavior.Restrict); }); builder.Entity(b => @@ -1014,6 +1029,11 @@ public class PlatformDbContext : b.Property(x => x.Name).HasMaxLength(50); b.Property(x => x.Status).HasMaxLength(10); + + b.HasOne(x => x.Branch) + .WithMany(x => x.RegistrationMethods) + .HasForeignKey(x => x.BranchId) + .OnDelete(DeleteBehavior.Restrict); }); builder.Entity(b => @@ -1035,6 +1055,11 @@ public class PlatformDbContext : .WithOne(x => x.ClassType) .HasForeignKey(x => x.ClassTypeId) .OnDelete(DeleteBehavior.Cascade); + + b.HasOne(x => x.Branch) + .WithMany(x => x.ClassTypes) + .HasForeignKey(x => x.BranchId) + .OnDelete(DeleteBehavior.Restrict); }); builder.Entity(b => @@ -1044,6 +1069,11 @@ public class PlatformDbContext : b.Property(x => x.Name).IsRequired().HasMaxLength(64); b.Property(x => x.Status).HasMaxLength(20); + + b.HasOne(x => x.Branch) + .WithMany(x => x.Classes) + .HasForeignKey(x => x.BranchId) + .OnDelete(DeleteBehavior.Restrict); }); builder.Entity(b => @@ -1055,6 +1085,11 @@ public class PlatformDbContext : b.Property(x => x.Name).HasMaxLength(50).IsRequired(); b.Property(x => x.Status).HasMaxLength(10); b.Property(x => x.MonthlyPaymentRate).HasPrecision(18, 4); + + b.HasOne(x => x.Branch) + .WithMany(x => x.Levels) + .HasForeignKey(x => x.BranchId) + .OnDelete(DeleteBehavior.Restrict); }); builder.Entity(b => @@ -1199,6 +1234,11 @@ public class PlatformDbContext : b.Property(x => x.Lesson2).HasMaxLength(10); b.Property(x => x.Lesson3).HasMaxLength(10); b.Property(x => x.Lesson4).HasMaxLength(10); + + b.HasOne(x => x.Branch) + .WithMany(x => x.LessonPeriods) + .HasForeignKey(x => x.BranchId) + .OnDelete(DeleteBehavior.Restrict); }); builder.Entity(b => @@ -1277,6 +1317,11 @@ public class PlatformDbContext : b.Property(x => x.Type).HasMaxLength(20); b.Property(x => x.TotalCalorie).HasPrecision(9, 2); b.Property(x => x.Materials).HasMaxLength(500); + + b.HasOne(x => x.Branch) + .WithMany(x => x.Meals) + .HasForeignKey(x => x.BranchId) + .OnDelete(DeleteBehavior.Restrict); }); builder.Entity(b => diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformEfCoreEntityExtensionMappings.cs b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformEfCoreEntityExtensionMappings.cs index 5d391a54..dbad45af 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformEfCoreEntityExtensionMappings.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformEfCoreEntityExtensionMappings.cs @@ -74,7 +74,7 @@ public static class PlatformEfCoreEntityExtensionMappings ); ObjectExtensionManager.Instance - .MapEfCoreProperty( + .MapEfCoreProperty( PlatformConsts.Tenants.VknTckn, (entityBuilder, propertyBuilder) => { @@ -155,7 +155,7 @@ public static class PlatformEfCoreEntityExtensionMappings ); ObjectExtensionManager.Instance - .MapEfCoreProperty( + .MapEfCoreProperty( PlatformConsts.Tenants.PhoneNumber, (entityBuilder, propertyBuilder) => { @@ -164,7 +164,7 @@ public static class PlatformEfCoreEntityExtensionMappings ); ObjectExtensionManager.Instance - .MapEfCoreProperty( + .MapEfCoreProperty( PlatformConsts.Tenants.MobileNumber, (entityBuilder, propertyBuilder) => { @@ -173,7 +173,7 @@ public static class PlatformEfCoreEntityExtensionMappings ); ObjectExtensionManager.Instance - .MapEfCoreProperty( + .MapEfCoreProperty( PlatformConsts.Tenants.FaxNumber, (entityBuilder, propertyBuilder) => { diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251103202730_Initial.Designer.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251104061839_Initial.Designer.cs similarity index 99% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251103202730_Initial.Designer.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251104061839_Initial.Designer.cs index fe7f6455..17706dd1 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251103202730_Initial.Designer.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251104061839_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Kurs.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251103202730_Initial")] + [Migration("20251104061839_Initial")] partial class Initial { /// @@ -12198,7 +12198,7 @@ namespace Kurs.Platform.Migrations .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); - b.Property("FaxNumber") + b.Property("FaxNumber") .HasColumnType("bigint"); b.Property("Founder") @@ -12227,7 +12227,7 @@ namespace Kurs.Platform.Migrations .HasMaxLength(64) .HasColumnType("nvarchar(64)"); - b.Property("MobileNumber") + b.Property("MobileNumber") .HasColumnType("bigint"); b.Property("Name") @@ -12244,7 +12244,7 @@ namespace Kurs.Platform.Migrations .HasMaxLength(64) .HasColumnType("nvarchar(64)"); - b.Property("PhoneNumber") + b.Property("PhoneNumber") .HasColumnType("bigint"); b.Property("PostalCode") @@ -12259,7 +12259,7 @@ namespace Kurs.Platform.Migrations .HasMaxLength(64) .HasColumnType("nvarchar(64)"); - b.Property("VknTckn") + b.Property("VknTckn") .HasColumnType("bigint"); b.Property("Website") diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251103202730_Initial.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251104061839_Initial.cs similarity index 99% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251103202730_Initial.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251104061839_Initial.cs index 99f76116..da52402b 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251103202730_Initial.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251104061839_Initial.cs @@ -347,17 +347,17 @@ namespace Kurs.Platform.Migrations Country = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), District = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - FaxNumber = table.Column(type: "bigint", nullable: false), + FaxNumber = table.Column(type: "bigint", nullable: true), Founder = table.Column(type: "nvarchar(max)", nullable: true), IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), MenuGroup = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), - MobileNumber = table.Column(type: "bigint", nullable: false), + MobileNumber = table.Column(type: "bigint", nullable: true), OrganizationName = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), - PhoneNumber = table.Column(type: "bigint", nullable: false), + PhoneNumber = table.Column(type: "bigint", nullable: true), PostalCode = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: true), Street = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), TaxOffice = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), - VknTckn = table.Column(type: "bigint", nullable: false), + VknTckn = table.Column(type: "bigint", nullable: true), Website = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false), ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index 9fc80ebd..9af2f406 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -12195,7 +12195,7 @@ namespace Kurs.Platform.Migrations .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); - b.Property("FaxNumber") + b.Property("FaxNumber") .HasColumnType("bigint"); b.Property("Founder") @@ -12224,7 +12224,7 @@ namespace Kurs.Platform.Migrations .HasMaxLength(64) .HasColumnType("nvarchar(64)"); - b.Property("MobileNumber") + b.Property("MobileNumber") .HasColumnType("bigint"); b.Property("Name") @@ -12241,7 +12241,7 @@ namespace Kurs.Platform.Migrations .HasMaxLength(64) .HasColumnType("nvarchar(64)"); - b.Property("PhoneNumber") + b.Property("PhoneNumber") .HasColumnType("bigint"); b.Property("PostalCode") @@ -12256,7 +12256,7 @@ namespace Kurs.Platform.Migrations .HasMaxLength(64) .HasColumnType("nvarchar(64)"); - b.Property("VknTckn") + b.Property("VknTckn") .HasColumnType("bigint"); b.Property("Website") diff --git a/ui/src/views/branch/BranchSeed.tsx b/ui/src/views/branch/BranchSeed.tsx index 36cf6644..c51904d3 100644 --- a/ui/src/views/branch/BranchSeed.tsx +++ b/ui/src/views/branch/BranchSeed.tsx @@ -1,5 +1,5 @@ import { useState } from 'react' -import { Button } from '@/components/ui' +import { Badge, Button } from '@/components/ui' import { Container } from '@/components/shared' import { Dialog, Notification, toast } from '@/components/ui' import type { BranchSeedResultDto } from '@/proxy/branch/seed' @@ -63,80 +63,76 @@ function BranchSeed({
Branch Seed - {name}

- {/* Başlat butonu */} -
- -
- - {/* Sonuç */} - {result && ( -
+
+ {/* Başlık ve buton aynı satırda */} +
- {result.success ? ( - ✅ Seed İşlemi Başarılı - ) : ( - ❌ Seed İşlemi Başarısız - )} + {result && + (result.success ? ( + ✅ Seed İşlemi Başarılı + ) : ( + ❌ Seed İşlemi Başarısız + ))} +
+
+
- -

{result.message}

- -

- Toplam eklenen kayıt:{' '} - {result.totalInsertedCount} -

- - {/* Detay Tablosu */} - {result.details.length > 0 && ( -
- - - - - - - - - - - {result.details.map((d) => ( - - - - {/* Eklenen kolonunu tek satır formatında göster */} - - - - - - - ))} - -
EntityEklenenUyarılarHatalar
- {d.entityName} - - {d.insertedCount > 0 - ? `${d.insertedCount} - { ${d.insertedItems.join(', ')} }` - : '—'} - - {d.warnings.length > 0 - ? `${d.warnings.length} - { ${d.warnings.join(', ')} }` - : '—'} - - {d.errors.length > 0 - ? `${d.errors.length} - { ${d.errors.join(', ')} }` - : '—'} -
-
- )} - - {!result.details.length && ( -

Hiç detay bilgisi bulunamadı.

- )}
- )} + + {/* Sonuç Detayları */} + {result && ( + <> +

{result.message}

+ +

+ Toplam eklenen kayıt:{' '} + {result.totalInsertedCount} +

+ + {/* Detay Tablosu */} + {result.details.length > 0 && ( +
+ + + + + + + + + + + {result.details.map((d) => ( + + + {/* Eklenen kolonunu tek satır formatında göster */} + + + + + + + ))} + +
EntityEklenenUyarılarHatalar
+
+ {d.entityName} + +
+
{d.insertedItems.join(', ')} + {d.warnings.join(', ')} + {d.errors.join(', ')}
+
+ )} + + {!result.details.length && ( +

Hiç detay bilgisi bulunamadı.

+ )} + + )} +
)