From e45885f5693176257e12ecc05d4ed51f87ef0120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96ZT=C3=9CRK?= <76204082+iamsedatozturk@users.noreply.github.com> Date: Wed, 8 Oct 2025 17:08:34 +0300 Subject: [PATCH] Public Order entity ve ListForm Seederlar --- .../Orders/OrderDto.cs | 5 +- .../Public/PublicAppService.cs | 7 +- .../Seeds/PlatformListFormsSeeder.cs | 147 +++++++++++------- .../Seeds/PlatformTenantDataSeeder.cs | 42 ++--- .../Entities/Tenant/Public/Order.cs | 5 +- .../EntityFrameworkCore/PlatformDbContext.cs | 2 - ....cs => 20251008124621_Initial.Designer.cs} | 14 +- ...2_Initial.cs => 20251008124621_Initial.cs} | 5 +- .../PlatformDbContextModelSnapshot.cs | 12 +- ui/src/components/orders/PaymentForm.tsx | 59 +++---- ui/src/proxy/order/models.ts | 10 +- ui/src/services/order.service.ts | 5 +- .../views/crm/components/SalesOrderForm.tsx | 3 - ui/src/views/public/Payment.tsx | 8 +- 14 files changed, 169 insertions(+), 155 deletions(-) rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20251008104142_Initial.Designer.cs => 20251008124621_Initial.Designer.cs} (99%) rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20251008104142_Initial.cs => 20251008124621_Initial.cs} (99%) diff --git a/api/src/Kurs.Platform.Application.Contracts/Orders/OrderDto.cs b/api/src/Kurs.Platform.Application.Contracts/Orders/OrderDto.cs index a73806f1..fa7b6f84 100644 --- a/api/src/Kurs.Platform.Application.Contracts/Orders/OrderDto.cs +++ b/api/src/Kurs.Platform.Application.Contracts/Orders/OrderDto.cs @@ -15,9 +15,8 @@ public class OrderDto : EntityDto public decimal Commission { get; set; } public decimal Total { get; set; } - public string PaymentMethod { get; set; } - public int? Installments { get; set; } - public string? InstallmentName { get; set; } + public Guid PaymentMethodId { get; set; } + public int? Installment { get; set; } public Dictionary PaymentData { get; set; } } diff --git a/api/src/Kurs.Platform.Application/Public/PublicAppService.cs b/api/src/Kurs.Platform.Application/Public/PublicAppService.cs index 0f1602e7..56762a44 100644 --- a/api/src/Kurs.Platform.Application/Public/PublicAppService.cs +++ b/api/src/Kurs.Platform.Application/Public/PublicAppService.cs @@ -247,9 +247,8 @@ public class PublicAppService : PlatformAppService Subtotal = input.Subtotal, Commission = input.Commission, Total = input.Total, - PaymentMethod = input.PaymentMethod, - Installments = input.Installments, - InstallmentName = input.InstallmentName, + PaymentMethodId = input.PaymentMethodId, + Installment = input.Installment, PaymentDataJson = JsonSerializer.Serialize(input.PaymentData), }; @@ -273,7 +272,7 @@ public class PublicAppService : PlatformAppService { Id = entity.Id, Total = entity.Total, - PaymentMethod = entity.PaymentMethod + PaymentMethodId = entity.PaymentMethodId }; } diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/PlatformListFormsSeeder.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/PlatformListFormsSeeder.cs index 15a3f988..0670effb 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/PlatformListFormsSeeder.cs +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/PlatformListFormsSeeder.cs @@ -155,6 +155,20 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc $"(\"{SelectCommandByTableName("ClassType", Prefix.DbTableDefinition)}\".\"BranchId\" = @param0 OR @param0 IS NULL) " + $"ORDER BY \"{SelectCommandByTableName("ClassType", Prefix.DbTableDefinition)}\".\"Name\";"; + var lookupQueryPaymentMethodValues = + $"SELECT " + + $"\"{SelectCommandByTableName("PaymentMethod", Prefix.DbTableWeb)}\".\"Id\" AS \"Key\", " + + $"\"{SelectCommandByTableName("PaymentMethod", Prefix.DbTableWeb)}\".\"Name\" AS \"Name\" " + + $"FROM \"{SelectCommandByTableName("PaymentMethod", Prefix.DbTableWeb)}\" " + + $"ORDER BY \"{SelectCommandByTableName("PaymentMethod", Prefix.DbTableWeb)}\".\"Name\";"; + + var lookupQueryInstallmentValues = + $"SELECT " + + $"\"{SelectCommandByTableName("InstallmentOption", Prefix.DbTableWeb)}\".\"Installment\" AS \"Key\", " + + $"\"{SelectCommandByTableName("InstallmentOption", Prefix.DbTableWeb)}\".\"Name\" AS \"Name\" " + + $"FROM \"{SelectCommandByTableName("InstallmentOption", Prefix.DbTableWeb)}\" " + + $"ORDER BY \"{SelectCommandByTableName("InstallmentOption", Prefix.DbTableWeb)}\".\"Installment\";"; + var htmlEditorOptions = "{\"toolbar\": {\"multiline\": true, \"items\": [{\"name\": \"undo\"},{\"name\": \"redo\"},{\"name\": \"separator\"},{\"name\": \"size\",\"acceptedValues\": [\"8pt\",\"10pt\",\"12pt\",\"14pt\",\"18pt\",\"24pt\",\"36pt\"],\"options\": {\"inputAttr\": {\"aria-label\": \"Font size\"}}},{\"name\": \"font\",\"acceptedValues\": [\"Arial\",\"Courier New\",\"Georgia\",\"Impact\",\"Lucida Console\",\"Tahoma\",\"Times New Roman\",\"Verdana\"],\"options\": {\"inputAttr\": {\"aria-label\": \"Font family\"}}},{\"name\": \"separator\"},{\"name\": \"bold\"},{\"name\": \"italic\"},{\"name\": \"strike\"},{\"name\": \"underline\"},{\"name\": \"separator\"},{\"name\": \"alignLeft\"},{\"name\": \"alignCenter\"},{\"name\": \"alignRight\"},{\"name\": \"alignJustify\"},{\"name\": \"separator\"},{\"name\": \"orderedList\"},{\"name\": \"bulletList\"},{\"name\": \"separator\"},{\"name\": \"header\",\"acceptedValues\": [false,1,2,3,4,5],\"options\": {\"inputAttr\": {\"aria-label\": \"Font family\"}}},{\"name\": \"separator\"},{\"name\": \"color\"},{\"name\": \"background\"},{\"name\": \"separator\"},{\"name\": \"link\"},{\"name\": \"image\"},{\"name\": \"separator\"},{\"name\": \"clear\"},{\"name\": \"codeBlock\"},{\"name\": \"blockquote\"},{\"name\": \"separator\"},{\"name\": \"insertTable\"},{\"name\": \"deleteTable\"},{\"name\": \"insertRowAbove\"},{\"name\": \"insertRowBelow\"},{\"name\": \"deleteRow\"},{\"name\": \"insertColumnLeft\"},{\"name\": \"insertColumnRight\"},{\"name\": \"deleteColumn\"}]}}"; var showClearButton = "{ \"showClearButton\" : true }"; @@ -12149,10 +12163,9 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc ItemType = "group", Items = [ - new EditingFormItemDto { Order = 1, DataField = "Id", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Commission", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 4, DataField = "Logo", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Commission", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 3, DataField = "Logo", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, ] } }), @@ -12525,7 +12538,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc Name = AppCodes.Orders.PurchaseOrders, Title = AppCodes.Orders.PurchaseOrders, DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, + IsTenant = false, IsBranch = false, IsOrganizationUnit = false, Description = AppCodes.Orders.PurchaseOrders, @@ -12593,8 +12606,8 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc Popup = new GridEditingPopupDto { Title = "Purchase Order Form", - Width = 500, - Height = 800 + Width = 1000, + Height = 500 }, AllowDeleting = true, AllowAdding = true, @@ -12606,32 +12619,31 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc new() { Order = 1, - ColCount = 1, + ColCount = 2, ColSpan = 2, ItemType = "group", Items = [ - new EditingFormItemDto { Order = 1, DataField = "OrganizationName", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Founder", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "VknTckn", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 4, DataField = "TaxOffice", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "Address", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 6, DataField = "Address2", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 7, DataField = "Country", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton }, - new EditingFormItemDto { Order = 8, DataField = "City", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 9, DataField = "District", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 10, DataField = "PostalCode", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 11, DataField = "Phone", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 12, DataField = "Mobile", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 13, DataField = "Fax", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 14, DataField = "Email", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 15, DataField = "Website", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 16, DataField = "Subtotal", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 17, DataField = "Commission", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 18, DataField = "Total", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 19, DataField = "PaymentMethod", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 20, DataField = "Installments", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 21, DataField = "InstallmentName", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 1, DataField = "OrganizationName", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Founder", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "VknTckn", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 4, DataField = "TaxOffice", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 7, DataField = "Country", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton }, + new EditingFormItemDto { Order = 8, DataField = "City", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton }, + new EditingFormItemDto { Order = 9, DataField = "District", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton }, + new EditingFormItemDto { Order = 5, DataField = "Address", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 6, DataField = "Address2", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 10, DataField = "PostalCode", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 11, DataField = "Phone", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 12, DataField = "Mobile", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 13, DataField = "Fax", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 14, DataField = "Email", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 15, DataField = "Website", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 16, DataField = "Subtotal", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 17, DataField = "Commission", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 18, DataField = "Total", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 19, DataField = "PaymentMethodId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton }, + new EditingFormItemDto { Order = 20, DataField = "Installment", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton }, ] } }), @@ -12694,7 +12706,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc CultureName = LanguageCodes.En, SourceDbType = DbType.String, FieldName = "OrganizationName", - Width = 300, + Width = 200, ListOrderNo = 2, Visible = true, IsActive = true, @@ -12840,6 +12852,14 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc IsActive = true, IsDeleted = false, AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = lookupQueryCountryValues, + CascadeEmptyFields = "City,District" + }), PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto { C = AppCodes.Orders.PurchaseOrders + ".Create", @@ -12862,6 +12882,17 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc IsActive = true, IsDeleted = false, AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = lookupQueryCityValues, + CascadeRelationField = "Country", + CascadeFilterOperator="=", + CascadeParentFields = "Country", + CascadeEmptyFields = "District" + }), PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto { C = AppCodes.Orders.PurchaseOrders + ".Create", @@ -12884,6 +12915,16 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc IsActive = true, IsDeleted = false, AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = lookupQueryDistrictValues, + CascadeRelationField = "City", + CascadeFilterOperator="=", + CascadeParentFields = "Country,City", + }), PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto { C = AppCodes.Orders.PurchaseOrders + ".Create", @@ -13052,14 +13093,21 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc { ListFormCode = listFormPurchaseOrder.ListFormCode, CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "PaymentMethod", + SourceDbType = DbType.Guid, + FieldName = "PaymentMethodId", Width = 100, ListOrderNo = 18, Visible = true, IsActive = true, IsDeleted = false, AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = lookupQueryPaymentMethodValues + }), PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto { C = AppCodes.Orders.PurchaseOrders + ".Create", @@ -13075,13 +13123,20 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc ListFormCode = listFormPurchaseOrder.ListFormCode, CultureName = LanguageCodes.En, SourceDbType = DbType.Int32, - FieldName = "Installments", + FieldName = "Installment", Width = 100, ListOrderNo = 19, Visible = true, IsActive = true, IsDeleted = false, AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = lookupQueryInstallmentValues + }), PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto { C = AppCodes.Orders.PurchaseOrders + ".Create", @@ -13091,29 +13146,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc I = true, Deny = false }) - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "InstallmentName", - Width = 100, - ListOrderNo = 20, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto - { - C = AppCodes.Orders.PurchaseOrders + ".Create", - R = AppCodes.Orders.PurchaseOrders, - U = AppCodes.Orders.PurchaseOrders + ".Update", - E = true, - I = true, - Deny = false - }) - }, + } ]); #endregion } @@ -13542,7 +13575,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc Popup = new GridEditingPopupDto { Title = "Blog Post Form", - Width = 600, + Width = 1000, Height = 600 }, AllowDeleting = true, diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/PlatformTenantDataSeeder.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/PlatformTenantDataSeeder.cs index 0a0ee710..e95a77ed 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/PlatformTenantDataSeeder.cs +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/PlatformTenantDataSeeder.cs @@ -589,28 +589,28 @@ public class PlatformTenantDataSeeder : IDataSeedContributor, ITransientDependen } } - foreach (var item in items.NotificationRules) - { - var exists = await _notificationRuleRepository.AnyAsync(x => - x.NotificationType == item.NotificationType && - x.RecipientType == item.RecipientType && - x.RecipientId == item.RecipientId && - x.Channel == item.Channel); + // foreach (var item in items.NotificationRules) + // { + // var exists = await _notificationRuleRepository.AnyAsync(x => + // x.NotificationType == item.NotificationType && + // x.RecipientType == item.RecipientType && + // x.RecipientId == item.RecipientId && + // x.Channel == item.Channel); - if (!exists) - { - await _notificationRuleRepository.InsertAsync(new NotificationRule - { - NotificationType = item.NotificationType, - RecipientType = item.RecipientType, - RecipientId = item.RecipientId, - Channel = item.Channel, - IsActive = item.IsActive, - IsFixed = item.IsFixed, - IsCustomized = item.IsCustomized - }); - } - } + // if (!exists) + // { + // await _notificationRuleRepository.InsertAsync(new NotificationRule + // { + // NotificationType = item.NotificationType, + // RecipientType = item.RecipientType, + // RecipientId = item.RecipientId, + // Channel = item.Channel, + // IsActive = item.IsActive, + // IsFixed = item.IsFixed, + // IsCustomized = item.IsCustomized + // }); + // } + // } foreach (var item in items.Menus) { diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Public/Order.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Public/Order.cs index 2c2403f2..6c2a7ca0 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Tenant/Public/Order.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/Public/Order.cs @@ -30,9 +30,8 @@ public class Order : FullAuditedEntity, IMultiTenant public decimal Commission { get; set; } public decimal Total { get; set; } - public string PaymentMethod { get; set; } - public int? Installments { get; set; } - public string? InstallmentName { get; set; } + public Guid PaymentMethodId { get; set; } + public int? Installment { get; set; } public string PaymentDataJson { get; set; } // JSON olarak saklanacak diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index 0136c8d8..7f637ad1 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -1395,8 +1395,6 @@ public class PlatformDbContext : b.Property(o => o.Commission).IsRequired().HasPrecision(18, 2); b.Property(o => o.Total).IsRequired().HasPrecision(18, 2); - b.Property(o => o.PaymentMethod).IsRequired().HasMaxLength(64); - b.Property(o => o.InstallmentName).HasMaxLength(128); b.Property(o => o.PaymentDataJson).HasMaxLength(4000); b.HasMany(o => o.Items) diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008104142_Initial.Designer.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008124621_Initial.Designer.cs similarity index 99% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008104142_Initial.Designer.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008124621_Initial.Designer.cs index d6af052a..b11b1bbd 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008104142_Initial.Designer.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008124621_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Kurs.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251008104142_Initial")] + [Migration("20251008124621_Initial")] partial class Initial { /// @@ -4625,11 +4625,7 @@ namespace Kurs.Platform.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); - b.Property("InstallmentName") - .HasMaxLength(128) - .HasColumnType("nvarchar(128)"); - - b.Property("Installments") + b.Property("Installment") .HasColumnType("int"); b.Property("IsDeleted") @@ -4657,10 +4653,8 @@ namespace Kurs.Platform.Migrations .HasMaxLength(4000) .HasColumnType("nvarchar(4000)"); - b.Property("PaymentMethod") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); + b.Property("PaymentMethodId") + .HasColumnType("uniqueidentifier"); b.Property("Phone") .HasColumnType("bigint"); diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008104142_Initial.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008124621_Initial.cs similarity index 99% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008104142_Initial.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008124621_Initial.cs index 07a010d7..d2a18997 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008104142_Initial.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008124621_Initial.cs @@ -1932,9 +1932,8 @@ namespace Kurs.Platform.Migrations Subtotal = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), Commission = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), Total = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), - PaymentMethod = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), - Installments = table.Column(type: "int", nullable: true), - InstallmentName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + PaymentMethodId = table.Column(type: "uniqueidentifier", nullable: false), + Installment = table.Column(type: "int", nullable: true), PaymentDataJson = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: true), CreationTime = table.Column(type: "datetime2", nullable: false), CreatorId = table.Column(type: "uniqueidentifier", nullable: true), diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index e566032c..d11b2df3 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -4622,11 +4622,7 @@ namespace Kurs.Platform.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); - b.Property("InstallmentName") - .HasMaxLength(128) - .HasColumnType("nvarchar(128)"); - - b.Property("Installments") + b.Property("Installment") .HasColumnType("int"); b.Property("IsDeleted") @@ -4654,10 +4650,8 @@ namespace Kurs.Platform.Migrations .HasMaxLength(4000) .HasColumnType("nvarchar(4000)"); - b.Property("PaymentMethod") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); + b.Property("PaymentMethodId") + .HasColumnType("uniqueidentifier"); b.Property("Phone") .HasColumnType("bigint"); diff --git a/ui/src/components/orders/PaymentForm.tsx b/ui/src/components/orders/PaymentForm.tsx index 8526546e..e3a6eb19 100644 --- a/ui/src/components/orders/PaymentForm.tsx +++ b/ui/src/components/orders/PaymentForm.tsx @@ -44,7 +44,8 @@ export const PaymentForm: React.FC = ({ onComplete, cartState, }) => { - const [selectedPaymentMethod, setSelectedPaymentMethod] = useState('credit-card') + const defaultPaymentMethod = 'Kredi Kartı' + const [selectedPaymentMethod, setSelectedPaymentMethod] = useState(defaultPaymentMethod) const [selectedInstallment, setSelectedInstallment] = useState() const [paymentData, setPaymentData] = useState({ cardNumber: '', @@ -65,7 +66,7 @@ export const PaymentForm: React.FC = ({ const paymentResponse = await orderService.getPaymentMethodList() setPaymentMethods(paymentResponse.data) if (paymentResponse.data.length > 0) { - setSelectedPaymentMethod(paymentResponse.data[1].id) + setSelectedPaymentMethod(paymentResponse.data[1].name) } const installmentResponse = await orderService.getInstallmentOptionList() @@ -80,10 +81,10 @@ export const PaymentForm: React.FC = ({ fetchData() }, []) - const selectedMethod = paymentMethods.find((m) => m.id === selectedPaymentMethod) + const selectedMethod = paymentMethods.find((m) => m.name === selectedPaymentMethod) let commission = 0 - if (selectedPaymentMethod === 'credit-card' && selectedInstallment) { + if (selectedPaymentMethod === defaultPaymentMethod && selectedInstallment) { commission = cartState.total * selectedInstallment.commission } else if (selectedMethod) { commission = cartState.total * selectedMethod.commission @@ -102,10 +103,11 @@ export const PaymentForm: React.FC = ({ e.preventDefault() onComplete({ ...paymentData, - paymentMethod: selectedMethod?.name ?? '', - installments: selectedPaymentMethod === 'credit-card' ? (selectedInstallment?.id ?? 1) : 1, - installmentName: - selectedPaymentMethod === 'credit-card' ? (selectedInstallment?.name ?? '') : 'Tek Ödeme', + paymentMethodId: selectedMethod?.id, + installment: + selectedPaymentMethod === defaultPaymentMethod + ? (selectedInstallment?.installment ?? 1) + : 1, commission, total: finalTotal, }) @@ -260,24 +262,26 @@ export const PaymentForm: React.FC = ({ @@ -338,7 +343,7 @@ export const PaymentForm: React.FC = ({ {/* 3. Sütun: Kart Bilgileri + Sipariş Özeti ve Butonlar */}
{/* Kart Bilgileri */} - {selectedPaymentMethod !== 'bank-transfer' && ( + {selectedPaymentMethod !== defaultPaymentMethod && (

{translate('::Public.payment.card.title')} @@ -419,14 +424,14 @@ export const PaymentForm: React.FC = ({ {translate('::Public.payment.summary.commission')} {formatPrice(commission)}

- {selectedPaymentMethod === 'credit-card' && - selectedInstallment?.id && - selectedInstallment.id > 1 && ( + {selectedPaymentMethod === defaultPaymentMethod && + selectedInstallment?.installment && + selectedInstallment.installment > 1 && (
{translate('::Public.payment.summary.monthlyInstallment')}: - {formatPrice(finalTotal / selectedInstallment.id)} x{' '} - {selectedInstallment.id} + {formatPrice(finalTotal / selectedInstallment.installment)} x{' '} + {selectedInstallment.installment}
)} diff --git a/ui/src/proxy/order/models.ts b/ui/src/proxy/order/models.ts index 68438719..22de4d83 100644 --- a/ui/src/proxy/order/models.ts +++ b/ui/src/proxy/order/models.ts @@ -1,4 +1,4 @@ -import { CustomTenantDto } from "../config/models" +import { CustomTenantDto } from '../config/models' export type BillingCycle = 'monthly' | 'yearly' @@ -52,6 +52,7 @@ export interface PaymentMethodDto { export interface InstallmentOptionDto { id: number + installment: number name: string commission: number } @@ -62,8 +63,7 @@ export interface OrderDto { subtotal: number commission: number total: number - paymentMethod: string - installments?: number - installmentName?: string + paymentMethodId: string + installment: number paymentData: Record -} \ No newline at end of file +} diff --git a/ui/src/services/order.service.ts b/ui/src/services/order.service.ts index a4adf3c1..1735d1c5 100644 --- a/ui/src/services/order.service.ts +++ b/ui/src/services/order.service.ts @@ -47,9 +47,8 @@ export class OrderService { subtotal: orderData.subtotal, commission: orderData.commission, total: orderData.total, - paymentMethod: orderData.paymentMethod, - installments: orderData.installments, - installmentName: orderData.installmentName, + paymentMethodId: orderData.paymentMethodId, + installment: orderData.installment, paymentData: orderData.paymentData, }, }, diff --git a/ui/src/views/crm/components/SalesOrderForm.tsx b/ui/src/views/crm/components/SalesOrderForm.tsx index 82915353..e232f267 100644 --- a/ui/src/views/crm/components/SalesOrderForm.tsx +++ b/ui/src/views/crm/components/SalesOrderForm.tsx @@ -96,9 +96,6 @@ const SalesOrderForm: React.FC = () => { if (existingOrder) { setFormData(existingOrder) } - // Load existing sales order data - // This would typically come from an API call - console.log('Loading sales order:', id) } }, [id, isEdit]) diff --git a/ui/src/views/public/Payment.tsx b/ui/src/views/public/Payment.tsx index 0f2b8ea8..efebe4f2 100644 --- a/ui/src/views/public/Payment.tsx +++ b/ui/src/views/public/Payment.tsx @@ -71,16 +71,14 @@ const Payment: React.FC = () => { subtotal: cartState.total, commission: paymentData.commission, total: paymentData.total, - paymentMethod: paymentData.paymentMethod, - installments: paymentData.installments, - installmentName: paymentData.installmentName, + paymentMethodId: paymentData.paymentMethodId, + installment: paymentData.installment, paymentData: { cardNumber: paymentData.cardNumber ? `****${(paymentData.cardNumber as string).slice(-4)}` : null, cardName: paymentData.cardName, - installments: paymentData.installments, - installmentName: paymentData.installmentName, + installment: paymentData.installment, }, } as OrderDto