From ac7784c030825158641e9042c50dede2067c0486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Wed, 18 Mar 2026 22:47:39 +0300 Subject: [PATCH] =?UTF-8?q?Wizard=20G=C3=BCncellemeleri?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Wizard/WizardColumnItemInputDto.cs | 2 + .../ListForms/ListFormWizardAppService.cs | 11 ++- .../Seeds/LanguagesData.json | 12 ++++ .../WizardConsts.cs | 70 +++++++++++++++++++ ui/src/views/admin/listForm/Wizard.tsx | 3 +- ui/src/views/admin/listForm/WizardStep3.tsx | 47 ++++++++++++- ui/src/views/admin/listForm/WizardStep4.tsx | 6 +- 7 files changed, 143 insertions(+), 8 deletions(-) diff --git a/api/src/Sozsoft.Platform.Application.Contracts/ListForms/Wizard/WizardColumnItemInputDto.cs b/api/src/Sozsoft.Platform.Application.Contracts/ListForms/Wizard/WizardColumnItemInputDto.cs index 231b527..c2635d9 100644 --- a/api/src/Sozsoft.Platform.Application.Contracts/ListForms/Wizard/WizardColumnItemInputDto.cs +++ b/api/src/Sozsoft.Platform.Application.Contracts/ListForms/Wizard/WizardColumnItemInputDto.cs @@ -11,4 +11,6 @@ public class WizardColumnItemInputDto public int ColSpan { get; set; } = 1; public bool IsRequired { get; set; } public DbType DbSourceType { get; set; } = DbType.String; + public string TurkishCaption { get; set; } + public string EnglishCaption { get; set; } } diff --git a/api/src/Sozsoft.Platform.Application/ListForms/ListFormWizardAppService.cs b/api/src/Sozsoft.Platform.Application/ListForms/ListFormWizardAppService.cs index 2a8d126..f6c0be9 100644 --- a/api/src/Sozsoft.Platform.Application/ListForms/ListFormWizardAppService.cs +++ b/api/src/Sozsoft.Platform.Application/ListForms/ListFormWizardAppService.cs @@ -229,22 +229,31 @@ public class ListFormWizardAppService( // ListFormField - each item in each group becomes a visible field record var fieldOrder = 0; + var captionName = string.Empty; foreach (var group in input.Groups) { foreach (var item in group.Items) { fieldOrder++; + captionName = $"App.Listform.ListformField.{item.DataField}"; await repoListFormField.InsertAsync(new ListFormField { ListFormCode = input.ListFormCode, FieldName = item.DataField, - CaptionName = item.DataField, + CaptionName = captionName, Visible = item.DataField != input.KeyFieldName, IsActive = true, + AllowSearch = true, ListOrderNo = fieldOrder, SourceDbType = item.DbSourceType, CultureName = PlatformConsts.DefaultLanguage, + PermissionJson = WizardConsts.DefaultFieldPermissionJson(code), + ColumnCustomizationJson = WizardConsts.DefaultColumnCustomizationJson, + ColumnFilterJson = WizardConsts.DefaultColumnFilteringJson, + PivotSettingsJson = WizardConsts.DefaultPivotSettingsJson, }, autoSave: false); + + await CreateLangKey(captionName, item.EnglishCaption, item.TurkishCaption); } } } diff --git a/api/src/Sozsoft.Platform.DbMigrator/Seeds/LanguagesData.json b/api/src/Sozsoft.Platform.DbMigrator/Seeds/LanguagesData.json index 9c02be4..c2aeea6 100644 --- a/api/src/Sozsoft.Platform.DbMigrator/Seeds/LanguagesData.json +++ b/api/src/Sozsoft.Platform.DbMigrator/Seeds/LanguagesData.json @@ -16304,6 +16304,18 @@ "en": "Columns load after selecting a Select Command", "tr": "Select Command seçince sütunlar yüklenir" }, + { + "resourceName": "Platform", + "key": "ListForms.Wizard.Step3.TurkishCaption", + "en": "Turkish Caption", + "tr": "Türkçe Başlık" + }, + { + "resourceName": "Platform", + "key": "ListForms.Wizard.Step3.EnglishCaption", + "en": "English Caption", + "tr": "İngilizce Başlık" + }, { "resourceName": "Platform", "key": "ListForms.Wizard.Step3.EditorOptions", diff --git a/api/src/Sozsoft.Platform.Domain.Shared/WizardConsts.cs b/api/src/Sozsoft.Platform.Domain.Shared/WizardConsts.cs index ae476e8..c08857d 100644 --- a/api/src/Sozsoft.Platform.Domain.Shared/WizardConsts.cs +++ b/api/src/Sozsoft.Platform.Domain.Shared/WizardConsts.cs @@ -2,6 +2,11 @@ using System.Data; using System.Text.Json; using Sozsoft.Platform.Enums; using static Sozsoft.Platform.PlatformConsts; +using System.Linq; +using System.Reflection; +using System.ComponentModel.DataAnnotations; +using System.Text.RegularExpressions; +using System.Globalization; public static class WizardConsts { @@ -26,6 +31,44 @@ public static class WizardConsts public static string MenuUrl(string code) => $"/admin/list/{code}"; public static string MenuIcon => "FcList"; + public static class LabelHelper + { + public static string GetCamelCaseLabel(string propertyName) + { + var prop = typeof(T).GetProperty(propertyName); + if (prop == null) + return propertyName; + + // 1. Display varsa direkt onu kullan + var displayAttr = prop.GetCustomAttribute(); + if (displayAttr != null && !string.IsNullOrWhiteSpace(displayAttr.Name)) + return displayAttr.Name; + + // 2. CamelCase → kelimelere ayır + var words = Regex + .Split(propertyName, "(?=[A-Z])") + .Where(x => !string.IsNullOrWhiteSpace(x)) + .ToList(); + + // 3. Türkçe karakter dönüşümü + düzgün büyük harf + var culture = new CultureInfo("tr-TR"); + + words = words.Select(w => + { + w = w.ToLower(culture); + + // Türkçe karakter normalize (genel yaklaşım) + w = w + .Replace("i", "i") // bilinçli bırakıyoruz + .Replace("ı", "ı"); // zaten doğru + + return culture.TextInfo.ToTitleCase(w); + }).ToList(); + + return string.Join(" ", words); + } + } + public static readonly string DefaultExportJson = JsonSerializer.Serialize(new { Enabled = true, @@ -83,6 +126,33 @@ public static class WizardConsts }); } + public static string DefaultFieldPermissionJson(string permissionName) + { + return JsonSerializer.Serialize(new + { + C = permissionName + ".Create", + R = permissionName, + U = permissionName + ".Update", + E = true, + I = false, + Deny = false + }); + } + + public static readonly string DefaultColumnCustomizationJson = JsonSerializer.Serialize(new + { + AllowReordering = true, + }); + + public static readonly string DefaultColumnFilteringJson = JsonSerializer.Serialize(new + { + AllowFiltering = true, + }); + public static readonly string DefaultPivotSettingsJson = JsonSerializer.Serialize(new + { + IsPivot = true + }); + public static string DefaultDeleteCommand(string tableName) { return $"UPDATE \"{tableName}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id"; diff --git a/ui/src/views/admin/listForm/Wizard.tsx b/ui/src/views/admin/listForm/Wizard.tsx index f8426ed..d4c6921 100644 --- a/ui/src/views/admin/listForm/Wizard.tsx +++ b/ui/src/views/admin/listForm/Wizard.tsx @@ -324,13 +324,14 @@ const Wizard = () => { const col = selectCommandColumns.find((c) => c.columnName === item.dataField) return { dataField: item.dataField, - captionName: `App.Listform.ListformField.${item.dataField}`, editorType: item.editorType, editorOptions: item.editorOptions ?? '', editorScript: item.editorScript ?? '', colSpan: item.colSpan, isRequired: item.isRequired, dbSourceType: col ? sqlDataTypeToDbType(col.dataType) : 12, // 12 = DbType.String + turkishCaption: item.turkishCaption, + englishCaption: item.englishCaption, } }), })), diff --git a/ui/src/views/admin/listForm/WizardStep3.tsx b/ui/src/views/admin/listForm/WizardStep3.tsx index 35b17d2..2721dff 100644 --- a/ui/src/views/admin/listForm/WizardStep3.tsx +++ b/ui/src/views/admin/listForm/WizardStep3.tsx @@ -27,6 +27,8 @@ export interface WizardGroupItem { editorScript: string colSpan: number isRequired: boolean + turkishCaption?: string + englishCaption?: string } export interface WizardGroup { @@ -70,6 +72,18 @@ function inferEditorType(sqlType: string): string { return 'dxTextBox' } +const formatLabel = (text: string) => { + return text + // CamelCase → kelimelere ayır + .split(/(?=[A-Z])/) + .filter(Boolean) + .map(word => + word.charAt(0).toUpperCase() + + word.slice(1).toLowerCase() + ) + .join(" "); +}; + function newGroupItem(colName: string, sqlType = ''): WizardGroupItem { return { id: `${colName}_${Date.now()}`, @@ -79,6 +93,8 @@ function newGroupItem(colName: string, sqlType = ''): WizardGroupItem { editorScript: '', colSpan: 1, isRequired: false, + turkishCaption: formatLabel(colName), + englishCaption: formatLabel(colName), } } @@ -123,6 +139,8 @@ function AvailableColumnChip({ colName }: { colName: string }) { interface SortableItemProps { item: WizardGroupItem groupColCount: number + onTurkishCaptionChange: (val: string) => void + onEnglishCaptionChange: (val: string) => void onEditorTypeChange: (val: string) => void onEditorOptionsChange: (val: string) => void onEditorScriptChange: (val: string) => void @@ -134,6 +152,8 @@ interface SortableItemProps { function SortableItem({ item, groupColCount, + onTurkishCaptionChange, + onEnglishCaptionChange, onEditorTypeChange, onEditorOptionsChange, onEditorScriptChange, @@ -198,14 +218,33 @@ function SortableItem({ ))} + {/* Turkish Caption */} +
+ {translate('::ListForms.Wizard.Step3.TurkishCaption')} + onTurkishCaptionChange(e.target.value)} + className="w-full text-xs px-1.5 py-1 rounded border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:border-indigo-400 resize-none font-mono" + /> +
+ + {/* English Caption */} +
+ {translate('::ListForms.Wizard.Step3.EnglishCaption')} + onEnglishCaptionChange(e.target.value)} + className="w-full text-xs px-1.5 py-1 rounded border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700 text-gray-700 dark:text-gray-200 focus:outline-none focus:border-indigo-400 resize-none font-mono" + /> +
+ {/* Editor Options */}
{translate('::ListForms.Wizard.Step3.EditorOptions')} -