diff --git a/api/src/Sozsoft.Platform.Application.Contracts/ListForms/Wizard/IListFormWizardAppService.cs b/api/src/Sozsoft.Platform.Application.Contracts/ListForms/Wizard/IListFormWizardAppService.cs index 9176ec7..bbab7e2 100644 --- a/api/src/Sozsoft.Platform.Application.Contracts/ListForms/Wizard/IListFormWizardAppService.cs +++ b/api/src/Sozsoft.Platform.Application.Contracts/ListForms/Wizard/IListFormWizardAppService.cs @@ -4,6 +4,6 @@ namespace Sozsoft.Platform.ListForms; public interface IListFormWizardAppService { - Task Create(WizardCreateInputDto input); + Task Create(ListFormWizardDto input); } diff --git a/api/src/Sozsoft.Platform.Application.Contracts/ListForms/Wizard/WizardCreateInputDto.cs b/api/src/Sozsoft.Platform.Application.Contracts/ListForms/Wizard/ListFormWizardDto.cs similarity index 88% rename from api/src/Sozsoft.Platform.Application.Contracts/ListForms/Wizard/WizardCreateInputDto.cs rename to api/src/Sozsoft.Platform.Application.Contracts/ListForms/Wizard/ListFormWizardDto.cs index 6e2f0bf..379d649 100644 --- a/api/src/Sozsoft.Platform.Application.Contracts/ListForms/Wizard/WizardCreateInputDto.cs +++ b/api/src/Sozsoft.Platform.Application.Contracts/ListForms/Wizard/ListFormWizardDto.cs @@ -4,11 +4,15 @@ using System.Data; namespace Sozsoft.Platform.ListForms; -public class WizardCreateInputDto +public class ListFormWizardDto { + public string WizardName { get; set; } public string ListFormCode { get; set; } public string MenuCode { get; set; } + public bool IsTenant { get; set; } + public bool IsBranch { get; set; } + public string LanguageTextMenuEn { get; set; } public string LanguageTextMenuTr { get; set; } public string LanguageTextTitleEn { get; set; } diff --git a/api/src/Sozsoft.Platform.Application.Contracts/Menus/MenuDto.cs b/api/src/Sozsoft.Platform.Application.Contracts/Menus/MenuDto.cs index 5997c53..ce42f94 100644 --- a/api/src/Sozsoft.Platform.Application.Contracts/Menus/MenuDto.cs +++ b/api/src/Sozsoft.Platform.Application.Contracts/Menus/MenuDto.cs @@ -22,5 +22,8 @@ public class MenuDto : FullAuditedEntityDto public string UserId { get; set; } // External kullanici id (orn: ali.akman. ihtiyaca gore guid veya int de olabilir) public string RoleId { get; set; } // External role id (orn: ihracat) public string CultureName { get; set; } // Bu tanim hangi dil icin "en", "tr" + + public string MenuTextTr { get; set; } + public string MenuTextEn { get; set; } } diff --git a/api/src/Sozsoft.Platform.Application/ListForms/ListFormWizardAppService.cs b/api/src/Sozsoft.Platform.Application/ListForms/ListFormWizardAppService.cs index 07488d7..2d78c64 100644 --- a/api/src/Sozsoft.Platform.Application/ListForms/ListFormWizardAppService.cs +++ b/api/src/Sozsoft.Platform.Application/ListForms/ListFormWizardAppService.cs @@ -15,7 +15,6 @@ using Volo.Abp.PermissionManagement; using Volo.Abp.Uow; using static Sozsoft.Platform.PlatformConsts; using System.Data; -using Sozsoft.Platform.Data.Seeds; namespace Sozsoft.Platform.ListForms; @@ -49,17 +48,19 @@ public class ListFormWizardAppService( private readonly string cultureNameDefault = PlatformConsts.DefaultLanguage; [UnitOfWork] - public async Task Create(WizardCreateInputDto input) + public async Task Create(ListFormWizardDto input) { - var listFormCode = input.ListFormCode; - var nameLangKey = PlatformConsts.Wizard.WizardKey(listFormCode); - var titleLangKey = PlatformConsts.Wizard.WizardKeyTitle(listFormCode); - var code = PlatformConsts.Wizard.WizardKey(listFormCode); + var wizardName = input.WizardName.Trim(); + var titleLangKey = PlatformConsts.Wizard.WizardKeyTitle(wizardName); + var nameLangKey = PlatformConsts.Wizard.WizardKey(wizardName); + var descLangKey = PlatformConsts.Wizard.WizardKeyDesc(wizardName); + + var code = PlatformConsts.Wizard.WizardKey(wizardName); //Dil - Language Keys await CreateLangKey(nameLangKey, input.LanguageTextMenuEn, input.LanguageTextMenuTr); await CreateLangKey(titleLangKey, input.LanguageTextTitleEn, input.LanguageTextTitleTr); - await CreateLangKey(PlatformConsts.Wizard.WizardKeyDesc(listFormCode), input.LanguageTextDescEn, input.LanguageTextDescTr); + await CreateLangKey(descLangKey, input.LanguageTextDescEn, input.LanguageTextDescTr); //Permission Group var groupName = input.PermissionGroupName ?? PlatformConsts.AppName; @@ -78,23 +79,23 @@ public class ListFormWizardAppService( var permRead = existingPerms.FirstOrDefault(a => a.Name == code) ?? await repoPerm.InsertAsync(new PermissionDefinitionRecord(Guid.NewGuid(), groupName, code, null, nameLangKey, true, MultiTenancySides.Both), autoSave: false); - var permCreate = existingPerms.FirstOrDefault(a => a.Name == PlatformConsts.Wizard.PermCreate(listFormCode)) ?? - await repoPerm.InsertAsync(new PermissionDefinitionRecord(Guid.NewGuid(), groupName, PlatformConsts.Wizard.PermCreate(listFormCode), permRead.Name, PlatformConsts.Wizard.LangKeyCreate, true, MultiTenancySides.Both), autoSave: false); + var permCreate = existingPerms.FirstOrDefault(a => a.Name == PlatformConsts.Wizard.PermCreate(wizardName)) ?? + await repoPerm.InsertAsync(new PermissionDefinitionRecord(Guid.NewGuid(), groupName, PlatformConsts.Wizard.PermCreate(wizardName), permRead.Name, PlatformConsts.Wizard.LangKeyCreate, true, MultiTenancySides.Both), autoSave: false); - var permUpdate = existingPerms.FirstOrDefault(a => a.Name == PlatformConsts.Wizard.PermUpdate(listFormCode)) ?? - await repoPerm.InsertAsync(new PermissionDefinitionRecord(Guid.NewGuid(), groupName, PlatformConsts.Wizard.PermUpdate(listFormCode), permRead.Name, PlatformConsts.Wizard.LangKeyUpdate, true, MultiTenancySides.Both), autoSave: false); + var permUpdate = existingPerms.FirstOrDefault(a => a.Name == PlatformConsts.Wizard.PermUpdate(wizardName)) ?? + await repoPerm.InsertAsync(new PermissionDefinitionRecord(Guid.NewGuid(), groupName, PlatformConsts.Wizard.PermUpdate(wizardName), permRead.Name, PlatformConsts.Wizard.LangKeyUpdate, true, MultiTenancySides.Both), autoSave: false); - var permDelete = existingPerms.FirstOrDefault(a => a.Name == PlatformConsts.Wizard.PermDelete(listFormCode)) ?? - await repoPerm.InsertAsync(new PermissionDefinitionRecord(Guid.NewGuid(), groupName, PlatformConsts.Wizard.PermDelete(listFormCode), permRead.Name, PlatformConsts.Wizard.LangKeyDelete, true, MultiTenancySides.Both), autoSave: false); + var permDelete = existingPerms.FirstOrDefault(a => a.Name == PlatformConsts.Wizard.PermDelete(wizardName)) ?? + await repoPerm.InsertAsync(new PermissionDefinitionRecord(Guid.NewGuid(), groupName, PlatformConsts.Wizard.PermDelete(wizardName), permRead.Name, PlatformConsts.Wizard.LangKeyDelete, true, MultiTenancySides.Both), autoSave: false); - var permExport = existingPerms.FirstOrDefault(a => a.Name == PlatformConsts.Wizard.PermExport(listFormCode)) ?? - await repoPerm.InsertAsync(new PermissionDefinitionRecord(Guid.NewGuid(), groupName, PlatformConsts.Wizard.PermExport(listFormCode), permRead.Name, PlatformConsts.Wizard.LangKeyExport, true, MultiTenancySides.Both), autoSave: false); + var permExport = existingPerms.FirstOrDefault(a => a.Name == PlatformConsts.Wizard.PermExport(wizardName)) ?? + await repoPerm.InsertAsync(new PermissionDefinitionRecord(Guid.NewGuid(), groupName, PlatformConsts.Wizard.PermExport(wizardName), permRead.Name, PlatformConsts.Wizard.LangKeyExport, true, MultiTenancySides.Both), autoSave: false); - var permImport = existingPerms.FirstOrDefault(a => a.Name == PlatformConsts.Wizard.PermImport(listFormCode)) ?? - await repoPerm.InsertAsync(new PermissionDefinitionRecord(Guid.NewGuid(), groupName, PlatformConsts.Wizard.PermImport(listFormCode), permRead.Name, PlatformConsts.Wizard.LangKeyImport, true, MultiTenancySides.Both), autoSave: false); + var permImport = existingPerms.FirstOrDefault(a => a.Name == PlatformConsts.Wizard.PermImport(wizardName)) ?? + await repoPerm.InsertAsync(new PermissionDefinitionRecord(Guid.NewGuid(), groupName, PlatformConsts.Wizard.PermImport(wizardName), permRead.Name, PlatformConsts.Wizard.LangKeyImport, true, MultiTenancySides.Both), autoSave: false); - var PermNote = existingPerms.FirstOrDefault(a => a.Name == PlatformConsts.Wizard.PermNote(listFormCode)) ?? - await repoPerm.InsertAsync(new PermissionDefinitionRecord(Guid.NewGuid(), groupName, PlatformConsts.Wizard.PermNote(listFormCode), permRead.Name, PlatformConsts.Wizard.LangKeyNote, true, MultiTenancySides.Both), autoSave: false); + var permNote = existingPerms.FirstOrDefault(a => a.Name == PlatformConsts.Wizard.PermNote(wizardName)) ?? + await repoPerm.InsertAsync(new PermissionDefinitionRecord(Guid.NewGuid(), groupName, PlatformConsts.Wizard.PermNote(wizardName), permRead.Name, PlatformConsts.Wizard.LangKeyNote, true, MultiTenancySides.Both), autoSave: false); // Permission Grants - Bulk Insert var adminUserName = PlatformConsts.AbpIdentity.User.AdminEmailDefaultValue; @@ -108,6 +109,8 @@ public class ListFormWizardAppService( new PermissionGrant(Guid.NewGuid(), permUpdate.Name, "R", PlatformConsts.AbpIdentity.User.AdminRoleName), new PermissionGrant(Guid.NewGuid(), permDelete.Name, "R", PlatformConsts.AbpIdentity.User.AdminRoleName), new PermissionGrant(Guid.NewGuid(), permExport.Name, "R", PlatformConsts.AbpIdentity.User.AdminRoleName), + new PermissionGrant(Guid.NewGuid(), permImport.Name, "R", PlatformConsts.AbpIdentity.User.AdminRoleName), + new PermissionGrant(Guid.NewGuid(), permNote.Name, "R", PlatformConsts.AbpIdentity.User.AdminRoleName), ], autoSave: false); //Menu Parent @@ -115,11 +118,11 @@ public class ListFormWizardAppService( var menuParent = await AsyncExecuter.FirstOrDefaultAsync(menuQueryable.Where(a => a.Code == input.MenuParentCode)); if (menuParent == null) { - await CreateLangKey(PlatformConsts.Wizard.WizardKeyParent(listFormCode), input.LanguageTextMenuParentEn, input.LanguageTextMenuParentTr); + await CreateLangKey(PlatformConsts.Wizard.WizardKeyParent(wizardName), input.LanguageTextMenuParentEn, input.LanguageTextMenuParentTr); menuParent = await repoMenu.InsertAsync(new Menu { Code = input.MenuParentCode, - DisplayName = PlatformConsts.Wizard.WizardKeyParent(listFormCode), + DisplayName = PlatformConsts.Wizard.WizardKeyParent(wizardName), IsDisabled = false, }, autoSave: false); } @@ -136,7 +139,7 @@ public class ListFormWizardAppService( Target = null, ElementId = null, CssClass = null, - Url = PlatformConsts.Wizard.MenuUrl(listFormCode), + Url = PlatformConsts.Wizard.MenuUrl(code), RequiredPermissionName = permRead.Name }, autoSave: false); @@ -187,14 +190,14 @@ public class ListFormWizardAppService( ShowNote = true, LayoutJson = Wizard.DefaultLayoutJson(), CultureName = LanguageCodes.En, - ListFormCode = listFormCode, + ListFormCode = input.ListFormCode, Name = nameLangKey, Title = titleLangKey, + Description = descLangKey, DataSourceCode = input.DataSourceCode, - IsTenant = false, - IsBranch = false, + IsTenant = input.IsTenant, + IsBranch = input.IsBranch, IsOrganizationUnit = false, - Description = Wizard.WizardKeyDesc(listFormCode), SelectCommandType = input.SelectCommandType, SelectCommand = input.SelectCommand, KeyFieldName = input.KeyFieldName, @@ -207,11 +210,11 @@ public class ListFormWizardAppService( GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), SelectionJson = Wizard.DefaultSelectionSingleJson, ColumnOptionJson = Wizard.DefaultColumnOptionJson(), - PermissionJson = Wizard.DefaultPermissionJson(listFormCode), + PermissionJson = Wizard.DefaultPermissionJson(code), DeleteCommand = Wizard.DefaultDeleteCommand(nameof(TableNameEnum.Country)), - DeleteFieldsDefaultValueJson = Wizard.DefaultDeleteFieldsDefaultValueJson(), + DeleteFieldsDefaultValueJson = Wizard.DefaultDeleteFieldsDefaultValueJson(input.KeyFieldDbSourceType), PagerOptionJson = Wizard.DefaultPagerOptionJson, - EditingOptionJson = Wizard.DefaultEditingOptionJson(listFormCode, 600, 500, true, true, true, true, false), + EditingOptionJson = Wizard.DefaultEditingOptionJson(titleLangKey, 600, 500, true, true, true, true, false), EditingFormJson = editingFormDtos.Count > 0 ? JsonSerializer.Serialize(editingFormDtos) : null, }, autoSave: true); @@ -224,7 +227,7 @@ public class ListFormWizardAppService( fieldOrder++; await repoListFormField.InsertAsync(new ListFormField { - ListFormCode = listFormCode, + ListFormCode = input.ListFormCode, FieldName = item.DataField, CaptionName = item.DataField, Visible = true, diff --git a/api/src/Sozsoft.Platform.Application/Menu/MenuAppService.cs b/api/src/Sozsoft.Platform.Application/Menu/MenuAppService.cs index 3b6dab3..ddfc6fc 100644 --- a/api/src/Sozsoft.Platform.Application/Menu/MenuAppService.cs +++ b/api/src/Sozsoft.Platform.Application/Menu/MenuAppService.cs @@ -14,6 +14,7 @@ using Volo.Abp.Domain.Repositories; using Volo.Abp.PermissionManagement; using Volo.Abp.TenantManagement; using static Sozsoft.Platform.Data.Seeds.SeedConsts; +using Sozsoft.Languages; namespace Sozsoft.Platform.Menus; @@ -26,18 +27,21 @@ public class MenuAppService : CrudAppService< { private readonly IRepository _menuRepository; private readonly IRepository _repositoryKey; + private readonly IRepository _repositoryText; private readonly ITenantRepository _tenantRepository; private readonly IPermissionDefinitionRecordRepository _permissionRepository; public MenuAppService( IRepository menuRepository, IRepository languageKeyRepository, + IRepository languageTextRepository, ITenantRepository tenantRepository, IPermissionDefinitionRecordRepository permissionRepository ) : base(menuRepository) { _menuRepository = menuRepository; _repositoryKey = languageKeyRepository; + _repositoryText = languageTextRepository; _tenantRepository = tenantRepository; _permissionRepository = permissionRepository; @@ -88,7 +92,7 @@ public class MenuAppService : CrudAppService< query = ApplyPaging(query, input); var items = await AsyncExecuter.ToListAsync(query); - + // Tüm unique permission'ları topla var uniquePermissions = items .Where(x => !string.IsNullOrWhiteSpace(x.RequiredPermissionName)) @@ -115,7 +119,7 @@ public class MenuAppService : CrudAppService< // Sadece yetkili menüleri filtrele entities = items - .Where(item => string.IsNullOrWhiteSpace(item.RequiredPermissionName) || + .Where(item => string.IsNullOrWhiteSpace(item.RequiredPermissionName) || grantedPermissions.Contains(item.RequiredPermissionName)) .ToList(); @@ -183,12 +187,12 @@ public class MenuAppService : CrudAppService< // Tüm DisplayName'leri topla var displayNames = inputs.Select(x => x.DisplayName).Distinct().ToList(); - + // Mevcut key'leri tek sorguda getir var existingKeys = await AsyncExecuter.ToListAsync( (await _repositoryKey.GetQueryableAsync()) .Where(a => displayNames.Contains(a.Key) && a.ResourceName == PlatformConsts.AppName)); - + var existingKeyNames = existingKeys.Select(x => x.Key).ToHashSet(); // Eksik key'leri toplu ekle @@ -244,4 +248,68 @@ public class MenuAppService : CrudAppService< return entityDtos; } + + public async Task CreateWithLanguageKeyTextAsync(MenuDto input) + { + await CheckCreatePolicyAsync(); + + //Dil Key oluşturuluyor. + var keyExists = await _repositoryKey.AnyAsync( + a => a.Key == input.Code && + a.ResourceName == PlatformConsts.AppName); + if (!keyExists) + { + await _repositoryKey.InsertAsync(new LanguageKey + { + Key = input.Code, + ResourceName = PlatformConsts.AppName + }, autoSave: true); + } + + // English text oluşturuluyor veya güncelleniyor. + var existingEnText = await _repositoryText.FirstOrDefaultAsync( + a => a.CultureName == "en" && + a.Key == input.Code && + a.ResourceName == PlatformConsts.AppName); + + if (existingEnText != null) + { + existingEnText.Value = input.MenuTextEn; + await _repositoryText.UpdateAsync(existingEnText); + } + else + { + await _repositoryText.InsertAsync(new LanguageText + { + Key = input.Code, + CultureName = "en", + Value = input.MenuTextEn, + ResourceName = PlatformConsts.AppName + }); + } + + // Türkçe text oluşturuluyor veya güncelleniyor. + var existingTrText = await _repositoryText.FirstOrDefaultAsync( + a => a.CultureName == "tr" && + a.Key == input.Code && + a.ResourceName == PlatformConsts.AppName); + + if (existingTrText != null) + { + existingTrText.Value = input.MenuTextTr; + await _repositoryText.UpdateAsync(existingTrText); + } + else + { + await _repositoryText.InsertAsync(new LanguageText + { + Key = input.Code, + CultureName = "tr", + Value = input.MenuTextTr, + ResourceName = PlatformConsts.AppName + }); + } + + return await base.CreateAsync(input); + } } diff --git a/api/src/Sozsoft.Platform.DbMigrator/Seeds/HostData.json b/api/src/Sozsoft.Platform.DbMigrator/Seeds/HostData.json index 0c510b9..1aafd9e 100644 --- a/api/src/Sozsoft.Platform.DbMigrator/Seeds/HostData.json +++ b/api/src/Sozsoft.Platform.DbMigrator/Seeds/HostData.json @@ -450,7 +450,7 @@ "code": "Abp.Mailing.DefaultFromDisplayName", "nameKey": "Abp.Mailing.DefaultFromDisplayName", "descriptionKey": "Abp.Mailing.DefaultFromDisplayName.Description", - "defaultValue": "Sozsoft", + "defaultValue": "Sözsoft", "isVisibleToClients": false, "providers": "T|G|D", "isInherited": false, diff --git a/api/src/Sozsoft.Platform.Domain.Shared/PlatformConsts.cs b/api/src/Sozsoft.Platform.Domain.Shared/PlatformConsts.cs index 94510b0..6cdcf58 100644 --- a/api/src/Sozsoft.Platform.Domain.Shared/PlatformConsts.cs +++ b/api/src/Sozsoft.Platform.Domain.Shared/PlatformConsts.cs @@ -407,7 +407,7 @@ public static class PlatformConsts public static class Wizard { - public static string WizardKey(string code) => $"{Prefix.App}.{AppName}.{code}"; + public static string WizardKey(string code) => $"{Prefix.App}.Wizard.{code}"; public static string WizardKeyTitle(string code) => $"{WizardKey(code)}.Title"; public static string WizardKeyDesc(string code) => $"{WizardKey(code)}.Desc"; public static string WizardKeyParent(string code) => $"{WizardKey(code)}.Parent"; @@ -418,12 +418,12 @@ public static class PlatformConsts public static string PermExport(string code) => $"{WizardKey(code)}.Export"; public static string PermImport(string code) => $"{WizardKey(code)}.Import"; public static string PermNote(string code) => $"{WizardKey(code)}.Note"; - public static string LangKeyCreate => $"{Prefix.App}.Create"; - public static string LangKeyUpdate => $"{Prefix.App}.Update"; - public static string LangKeyDelete => $"{Prefix.App}.Delete"; - public static string LangKeyExport => $"{Prefix.App}.Export"; - public static string LangKeyImport => $"{Prefix.App}.Import"; - public static string LangKeyNote => $"{Prefix.App}.Note"; + public static string LangKeyCreate => "Create"; + public static string LangKeyUpdate => "Update"; + public static string LangKeyDelete => "Delete"; + public static string LangKeyExport => "Export"; + public static string LangKeyImport => "Import"; + public static string LangKeyNote => "Note"; public static string MenuUrl(string code) => $"/admin/list/{code}"; public static string MenuIcon => "FcList"; @@ -494,8 +494,8 @@ public static class PlatformConsts { return JsonSerializer.Serialize(new[] { - new { FieldName = "DeleterId", FieldDbType = DbType.Guid.ToString(), Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new { FieldName = "Id", FieldDbType = dbType.ToString(), Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + new { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new { FieldName = "Id", FieldDbType = dbType, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } }); } diff --git a/ui/src/components/layouts/PublicLayout.tsx b/ui/src/components/layouts/PublicLayout.tsx index 21769f0..5503bc3 100644 --- a/ui/src/components/layouts/PublicLayout.tsx +++ b/ui/src/components/layouts/PublicLayout.tsx @@ -401,7 +401,7 @@ const PublicLayout = () => {

- © {currentYear} Sozsoft Platform. {translate('::Public.footer.copyright')} + © {currentYear} Sözsoft Platform. {translate('::Public.footer.copyright')}

    diff --git a/ui/src/proxy/admin/list-form/models.ts b/ui/src/proxy/admin/list-form/models.ts index 5cac877..a6a1d5e 100644 --- a/ui/src/proxy/admin/list-form/models.ts +++ b/ui/src/proxy/admin/list-form/models.ts @@ -32,8 +32,11 @@ export interface ListFormWizardColumnGroupDto { } export interface ListFormWizardDto { + wizardName: string listFormCode: string menuCode: string + isTenant: boolean + isBranch: boolean languageTextMenuEn: string languageTextMenuTr: string languageTextTitleEn: string diff --git a/ui/src/proxy/menus/models.ts b/ui/src/proxy/menus/models.ts index edba4c5..729dd98 100644 --- a/ui/src/proxy/menus/models.ts +++ b/ui/src/proxy/menus/models.ts @@ -17,4 +17,6 @@ export interface MenuDto extends FullAuditedEntityDto { cultureName?: string group?: string shortName?: string + menuTextTr?: string + menuTextEn?: string } diff --git a/ui/src/services/menu.service.ts b/ui/src/services/menu.service.ts index 598b026..40294b7 100644 --- a/ui/src/services/menu.service.ts +++ b/ui/src/services/menu.service.ts @@ -25,6 +25,16 @@ export class MenuService { { apiName: this.apiName }, ) + createWithLanguageKeyText = (input: MenuDto) => + apiService.fetchData( + { + method: 'POST', + url: '/api/app/menu/with-language-key-text', + data: input, + }, + { apiName: this.apiName }, + ) + delete = (id: string) => apiService.fetchData( { @@ -51,7 +61,7 @@ export class MenuService { params: { sorting: input.sorting, skipCount: input.skipCount, - maxResultCount: input.maxResultCount + maxResultCount: input.maxResultCount, }, }, { apiName: this.apiName }, @@ -80,11 +90,9 @@ export class MenuService { export const getMenus = async (skipCount = 0, maxResultCount = 1000, sorting = 'order') => { const menuService = new MenuService() - return await menuService.getList( - { - sorting, - skipCount, - maxResultCount, - } - ) + return await menuService.getList({ + sorting, + skipCount, + maxResultCount, + }) } diff --git a/ui/src/views/admin/listForm/Wizard.tsx b/ui/src/views/admin/listForm/Wizard.tsx index 68c7b64..c13c880 100644 --- a/ui/src/views/admin/listForm/Wizard.tsx +++ b/ui/src/views/admin/listForm/Wizard.tsx @@ -28,11 +28,15 @@ import WizardStep3, { WizardGroup } from './WizardStep3' import WizardStep4 from './WizardStep4' import { Container } from '@/components/shared' import { sqlDataTypeToDbType } from './edit/options' +import { useStoreActions } from '@/store/store' // ─── Formik initial values & validation ────────────────────────────────────── const initialValues: ListFormWizardDto = { + wizardName: '', listFormCode: '', menuCode: '', + isTenant: false, + isBranch: false, languageTextMenuEn: '', languageTextMenuTr: '', languageTextTitleEn: '', @@ -53,6 +57,7 @@ const initialValues: ListFormWizardDto = { } const step1ValidationSchema = Yup.object().shape({ + wizardName: Yup.string().required(), menuCode: Yup.string().required(), permissionGroupName: Yup.string().required(), menuParentCode: Yup.string().required(), @@ -62,16 +67,18 @@ const step1ValidationSchema = Yup.object().shape({ const step2ValidationSchema = Yup.object().shape({ listFormCode: Yup.string().required(), - languageTextTitleEn: Yup.string(), - languageTextTitleTr: Yup.string(), - languageTextDescEn: Yup.string(), - languageTextDescTr: Yup.string(), + languageTextTitleEn: Yup.string().required(), + languageTextTitleTr: Yup.string().required(), + languageTextDescEn: Yup.string().required(), + languageTextDescTr: Yup.string().required(), dataSourceCode: Yup.string().required(), dataSourceConnectionString: Yup.string(), selectCommandType: Yup.string().required(), selectCommand: Yup.string().required(), keyFieldName: Yup.string().required(), - keyFieldDbSourceType: Yup.string().required(), + keyFieldDbSourceType: Yup.number().required(), + isTenant: Yup.boolean(), + isBranch: Yup.boolean(), }) const listFormValidationSchema = step1ValidationSchema.concat(step2ValidationSchema) @@ -80,7 +87,6 @@ const listFormValidationSchema = step1ValidationSchema.concat(step2ValidationSch const Wizard = () => { const [currentStep, setCurrentStep] = useState(0) - const [wizardName, setWizardName] = useState('') // ── Data Source ── const [isLoadingDataSource, setIsLoadingDataSource] = useState(false) @@ -214,12 +220,12 @@ const Wizard = () => { // Auto-derive listFormCode from wizardName const deriveListFormCode = (name: string) => { - const sanitized = name.replace(/[^a-zA-Z0-9]/g, '') - return sanitized ? `App.${sanitized}` : '' + const sanitized = name.replace(/\s/g, '') + return sanitized ? `App.Wizard.${sanitized}` : '' } const handleWizardNameChange = (name: string) => { - setWizardName(name) + formikRef.current?.setFieldValue('wizardName', name) const derived = deriveListFormCode(name) formikRef.current?.setFieldValue('listFormCode', derived) formikRef.current?.setFieldValue('menuCode', derived) @@ -274,11 +280,12 @@ const Wizard = () => { await formikRef.current.setTouched({ ...formikRef.current.touched, ...touchedStep1 }) // Also require wizardName - if (!wizardName.trim() || hasStep1Errors) return + if (hasStep1Errors) return setCurrentStep(1) } const handleBack = () => setCurrentStep(0) + const { getConfig } = useStoreActions((a) => a.abpConfig) const handleNext2 = async () => { if (!formikRef.current) return @@ -322,13 +329,10 @@ const Wizard = () => { , { placement: 'top-end' }, ) + getConfig(true) + setTimeout(() => { - navigate( - ROUTES_ENUM.protected.saas.listFormManagement.edit.replace( - ':listFormCode', - values.listFormCode, - ), - ) + navigate(ROUTES_ENUM.protected.admin.list.replace(':listFormCode', values.listFormCode)) }, 1500) } @@ -368,14 +372,13 @@ const Wizard = () => { { placement: 'top-end' }, ) setSubmitting(false) + getConfig(true) + setTimeout(() => { navigate( - ROUTES_ENUM.protected.saas.listFormManagement.edit.replace( - ':listFormCode', - values.listFormCode, - ), + ROUTES_ENUM.protected.admin.list.replace(':listFormCode', values.listFormCode), ) - }, 500) + }, 1500) } catch (error: any) { toast.push(, { placement: 'top-end', @@ -385,14 +388,16 @@ const Wizard = () => { > {({ touched, errors, isSubmitting, values }) => (
    - + {/* ─── Step 1: Basic Info ─────────────────────────────── */} {currentStep === 0 && ( { {currentStep === 3 && ( -
    +
    {isLoading ? (
    Loading…
    ) : enrichedNodes.length === 0 ? ( @@ -498,8 +498,10 @@ function MenuAddDialog({ onSaved, }: MenuAddDialogProps) { const [form, setForm] = useState({ + name: '', code: '', - displayName: '', + menuTextEn: '', + menuTextTr: '', parentCode: initialParentCode, icon: '', shortName: '', @@ -510,8 +512,10 @@ function MenuAddDialog({ useEffect(() => { if (isOpen) setForm({ + name: '', code: '', - displayName: '', + menuTextEn: '', + menuTextTr: '', parentCode: initialParentCode, icon: '', shortName: '', @@ -520,18 +524,22 @@ function MenuAddDialog({ }, [isOpen, initialParentCode, initialOrder]) const handleSave = async () => { - if (!form.code.trim() || !form.displayName.trim()) return + if (!form.code.trim() || !form.menuTextEn.trim()) return setSaving(true) try { - await menuService.create({ + // Menü oluşturuluyor + await menuService.createWithLanguageKeyText({ code: form.code.trim(), - displayName: form.displayName.trim(), + displayName: form.code.trim(), parentCode: form.parentCode.trim() || undefined, icon: form.icon || undefined, shortName: form.shortName.trim() || undefined, order: form.order, isDisabled: false, + menuTextTr: form.menuTextTr.trim(), + menuTextEn: form.menuTextEn.trim(), } as MenuDto) + onSaved() onClose() } catch (e: any) { @@ -544,74 +552,125 @@ function MenuAddDialog({ // suppress unused warning — rawItems kept for future use void rawItems + const fieldCls = + 'h-11 px-3 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-sm text-gray-700 dark:text-gray-200 outline-none focus:border-indigo-400 w-full' + const disabledCls = + 'h-11 px-3 py-2 rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-700 text-sm text-gray-400 dark:text-gray-500 cursor-not-allowed w-full' + const labelCls = 'text-xs font-medium text-gray-500 dark:text-gray-400 mb-1' + return ( - -
    -
    Yeni Menü Ekle
    -
    -
    -