diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/FormSeeder.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/FormSeeder.cs deleted file mode 100644 index a660e5a0..00000000 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/FormSeeder.cs +++ /dev/null @@ -1,1557 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Text.Json; -using System.Threading.Tasks; -using Kurs.Languages.Languages; -using Kurs.Platform.Entities; -using Kurs.Platform.Enums; -using Kurs.Platform.ListForms; -using Kurs.Platform.Queries; -using Microsoft.Extensions.Configuration; -using Volo.Abp.Data; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Repositories; -using Volo.Abp.Identity; -using Volo.Abp.TenantManagement; -using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes; -using static Kurs.Platform.PlatformConsts; -using static Kurs.Platform.PlatformSeeder.SeederDefaults; - -namespace Kurs.Platform.Data.Seeds; - -public class FormSeeder : IDataSeedContributor, ITransientDependency -{ - private readonly IRepository _listFormRepository; - private readonly IRepository _listFormFieldRepository; - private readonly IdentityUserManager _identityUserManager; - private readonly IdentityRoleManager _identityRoleManager; - private readonly IConfiguration _configuration; - - public FormSeeder( - IRepository listFormRepository, - IRepository listFormFieldRepository, - IdentityUserManager userManager, - IdentityRoleManager roleManager, - IConfiguration configuration) - { - _listFormRepository = listFormRepository; - _listFormFieldRepository = listFormFieldRepository; - _identityUserManager = userManager; - _identityRoleManager = roleManager; - _configuration = configuration; - } - - public async Task SeedAsync(DataSeedContext context) - { - #region Language - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormLanguage)) - { - var formLanguage = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.Form, - IsSubForm = false, - ShowActivity = true, - LayoutJson = DefaultLayoutJson, - SubFormsJson = JsonSerializer.Serialize(new List() { - new { - TabTitle = "Language Texts", - TabType = ListFormTabTypeEnum.List, - Code = ListFormCodes.Lists.LanguageText, - Relation = new List() { - new { - ParentFieldName = "CultureName", - ChildFieldName = "CultureName" - } - } - } - }), - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Forms.FormLanguage, - Name = AppCodes.Languages.Language, - Title = AppCodes.Languages.Language, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Languages.Language, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Language)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - PermissionJson = DefaultPermissionJson(AppCodes.Languages.Language), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Language))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - EditingOptionJson = DefaultEditingOptionJson, - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = [ - new() { Order = 1, DataField = "CultureName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new() { Order = 2, DataField = "UiCultureName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new() { Order = 3, DataField = "DisplayName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new() { Order = 4, DataField = "IsEnabled", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsEnabled", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - } - ); - - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = formLanguage.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 0, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), - }, - new() { - ListFormCode = formLanguage.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "CultureName", - Width = 150, - ListOrderNo = 1, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), - }, - new() - { - ListFormCode = formLanguage.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "UiCultureName", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), - }, - new() - { - ListFormCode = formLanguage.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DisplayName", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), - }, - new() - { - ListFormCode = formLanguage.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsEnabled", - Width = 125, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), - }, - new() - { - ListFormCode = formLanguage.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, - FieldName = "CreationTime", - Width = 125, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), - }, - ]); - } - #endregion - - #region Skill Type - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormSkillType)) - { - var formSkillType = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.Form, - IsSubForm = false, - ShowActivity = true, - LayoutJson = DefaultLayoutJson, - SubFormsJson = JsonSerializer.Serialize(new List() { - new { - TabTitle = "Skill Levels", - TabType = ListFormTabTypeEnum.List, - Code = ListFormCodes.Lists.SkillLevel, - Relation = new List() { - new { - ParentFieldName = "Id", - ChildFieldName = "SkillTypeId" - } - } - }, - new { - TabTitle = "Skills", - TabType = ListFormTabTypeEnum.List, - Code = ListFormCodes.Lists.Skill, - Relation = new List() { - new { - ParentFieldName = "Id", - ChildFieldName = "SkillTypeId" - } - } - } - }), - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Forms.FormSkillType, - Name = AppCodes.Definitions.SkillType, - Title = AppCodes.Definitions.SkillType, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.SkillType, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SkillType)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.SkillType), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.SkillType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - EditingOptionJson = DefaultEditingOptionJson, - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = [ - new() { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsEnabled", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - } - ); - - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = formSkillType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 0, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillType), - }, - new() { - ListFormCode = formSkillType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 150, - ListOrderNo = 1, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillType), - }, - ]); - } - #endregion - - #region Uom Category - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormUomCategory)) - { - var formUomCategory = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.Form, - IsSubForm = false, - ShowActivity = true, - LayoutJson = DefaultLayoutJson, - SubFormsJson = JsonSerializer.Serialize(new List() { - new { - TabTitle = "Uoms", - TabType = ListFormTabTypeEnum.List, - Code = ListFormCodes.Lists.Uom, - Relation = new List() { - new { - ParentFieldName = "Id", - ChildFieldName = "UomCategoryId" - } - } - }, - }), - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Forms.FormUomCategory, - Name = AppCodes.Definitions.UomCategory, - Title = AppCodes.Definitions.UomCategory, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.UomCategory, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.UomCategory)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.UomCategory), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.UomCategory))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - EditingOptionJson = DefaultEditingOptionJson, - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = [ - new() { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsEnabled", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - } - ); - - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = formUomCategory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 0, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.UomCategory), - }, - new() { - ListFormCode = formUomCategory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 150, - ListOrderNo = 1, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.UomCategory), - }, - ]); - } - #endregion - - #region Bank - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormBank)) - { - var formBank = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.Form, - IsSubForm = false, - ShowActivity = true, - LayoutJson = DefaultLayoutJson, - SubFormsJson = JsonSerializer.Serialize(new List() { - new { - TabTitle = "Bank Accounts", - TabType = ListFormTabTypeEnum.List, - Code = ListFormCodes.Lists.BankAccount, - Relation = new List() { - new { - ParentFieldName = "Id", - ChildFieldName = "BankId" - }, - new { - ParentFieldName = "BranchId", - ChildFieldName = "BranchId" - }, - } - }, - }), - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Forms.FormBank, - Name = AppCodes.Accounting.Bank, - Title = AppCodes.Accounting.Bank, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Accounting.Bank, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Bank)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - PermissionJson = DefaultPermissionJson(AppCodes.Accounting.Bank), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Bank))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - EditingOptionJson = DefaultEditingOptionJson, - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { - Order = 1, - ColCount = 2, - ColSpan = 2, - ItemType = "group", - Items = [ - new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "IdentifierCode", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox}, - new EditingFormItemDto { Order = 4, DataField = "Address1", ColSpan = 1, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "Address2", ColSpan = 1, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 6, DataField = "Country", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 7, DataField = "City", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 8, DataField = "District", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 9, DataField = "PostalCode", ColSpan = 1, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 10, DataField = "Phone", ColSpan = 1, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order = 11, DataField = "Email", ColSpan = 1, EditorType2=EditorTypes.dxTextBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - } - ); - - #region Bank Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = formBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - // BranchId - new() - { - ListFormCode = formBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "BranchId", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.BranchValues, - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] { - new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required)} - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "IdentifierCode", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] { - new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required)} - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address1", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address2", - Width = 150, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Country", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CountryValues, - CascadeEmptyFields = "City,District,Street" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "City", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CityValues, - CascadeRelationField = "Country", - CascadeFilterOperator="=", - CascadeParentFields = "Country", - CascadeEmptyFields = "District,Street" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "District", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.DistrictValues, - CascadeRelationField = "City", - CascadeFilterOperator="=", - CascadeParentFields = "Country,City", - CascadeEmptyFields = "Street", - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "PostalCode", - Width = 150, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Phone", - Width = 150, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Email", - Width = 150, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleEmailJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - }); - #endregion - } - #endregion - - #region Tenant - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormTenant)) - { - var formTenant = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.Form, - IsSubForm = false, - ShowActivity = true, - LayoutJson = DefaultLayoutJson, - SubFormsJson = JsonSerializer.Serialize(new List() { - new { - TabTitle = "Branches", - TabType = ListFormTabTypeEnum.List, - Code = ListFormCodes.Lists.Branch, - Relation = new List() { - new { - ParentFieldName = "Id", - ChildFieldName = "TenantId" - } - } - } - }), - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Forms.FormTenant, - Name = TenantManagementPermissions.Tenants.Default, - Title = TenantManagementPermissions.Tenants.Default, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = TenantManagementPermissions.Tenants.Default, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = "AbpTenants", - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, TenantManagementPermissions.Tenants.Delete, TenantManagementPermissions.Tenants.Default + ".Export", TenantManagementPermissions.Tenants.Default + ".Import", TenantManagementPermissions.Tenants.Default + ".Activity"), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.QuestionPool, Width = 900, Height = 450 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { Order=1, ColCount=2, ColSpan=1, ItemType="group", Items =[ - new EditingFormItemDto { Order=1, DataField = "Name", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=2, DataField = "OrganizationName", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=3, DataField = "Founder", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=4, DataField = "VknTckn", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order=5, DataField = "TaxOffice", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=6, DataField = "Mobile", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order=7, DataField = "Phone", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order=8, DataField = "Fax", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order=9, DataField = "IsActive", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, - ]}, - new() { Order=2, ColCount=2, ColSpan=1, ItemType="group", Items = [ - new EditingFormItemDto { Order=1, DataField = "Country", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=2, DataField = "City", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=3, DataField = "District", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=4, DataField = "Street", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=5, DataField = "PostalCode", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=6, DataField = "Address1", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=7, DataField = "Address2", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=8, DataField = "Email", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=9, DataField = "Website", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - ]} - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Seed", - Text = "Seed", - AuthName = TenantManagementPermissions.Tenants.ManageConnectionStrings, - DialogName = "TenantsConnectionString", - DialogParameters = JsonSerializer.Serialize(new { - name = "@Name", - id = "@Id" - }) - }, - }), - InsertServiceAddress = "list-form-dynamic-api/tenant-insert", - UpdateServiceAddress = "list-form-dynamic-api/tenant-update", - DeleteCommand = "DELETE FROM \"AbpTenants\" WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - - } - ); - - #region Tenants Fields - await _listFormFieldRepository.InsertManyAsync( - [ - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 500, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "OrganizationName", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Founder", - Width = 200, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "VknTckn", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "TaxOffice", - Width = 150, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Country", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CountryValues, - CascadeEmptyFields = "City,District,Street" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "City", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CityValues, - CascadeRelationField = "Country", - CascadeFilterOperator="=", - CascadeParentFields = "Country", - CascadeEmptyFields = "District,Street" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "District", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.DistrictValues, - CascadeRelationField = "City", - CascadeFilterOperator="=", - CascadeParentFields = "Country,City", - CascadeEmptyFields = "Street", - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Street", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.StreetValues, - CascadeRelationField = "District", - CascadeFilterOperator="=", - CascadeParentFields = "Country,City,District" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address1", - Width = 150, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address2", - Width = 150, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "PostalCode", - Width = 100, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Email", - Width = 170, - ListOrderNo = 14, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] - { - new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.email) } - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Website", - Width = 170, - ListOrderNo = 15, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Mobile", - Width = 100, - ListOrderNo = 16, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Phone", - Width = 100, - ListOrderNo = 17, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Fax", - Width = 100, - ListOrderNo = 18, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new ListFormField - { - ListFormCode = formTenant.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - Width = 100, - ListOrderNo = 19, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - ]); - #endregion - - } - #endregion - - #region Question Pool - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormQuestionPool)) - { - var formQuestionPool = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.Form, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - SubFormsJson = JsonSerializer.Serialize(new List() { - new { - TabTitle = "Questions", - TabType = ListFormTabTypeEnum.List, - Code = ListFormCodes.Lists.Question, - Relation = new List() { - new { - ParentFieldName = "Id", - ChildFieldName = "QuestionPoolId" - } - } - } - }), - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Forms.FormQuestionPool, - Name = AppCodes.Definitions.QuestionPool, - Title = AppCodes.Definitions.QuestionPool, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.QuestionPool, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.QuestionPool)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.QuestionPool), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.QuestionPool))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.QuestionPool, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Tags", ColSpan = 2, EditorType2=EditorTypes.dxTagBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region Question Pool Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = formQuestionPool.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formQuestionPool.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formQuestionPool.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 400, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formQuestionPool.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Tags", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.QuestionTagValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), - PivotSettingsJson = DefaultPivotSettingsJson, - } - }); - #endregion - } - #endregion - - #region Survey - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormSurvey)) - { - var formSurvey = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.Form, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - SubFormsJson = JsonSerializer.Serialize(new List() { - new { - TabTitle = "Questions", - TabType = ListFormTabTypeEnum.List, - Code = ListFormCodes.Lists.SurveyQuestion, - Relation = new List() { - new { - ParentFieldName = "Id", - ChildFieldName = "SurveyId" - } - } - }, - new { - TabTitle = "Responses", - TabType = ListFormTabTypeEnum.List, - Code = ListFormCodes.Lists.SurveyResponse, - Relation = new List() { - new { - ParentFieldName = "Id", - ChildFieldName = "SurveyId" - } - } - } - }), - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Forms.FormSurvey, - Name = AppCodes.Hr.Survey, - Title = AppCodes.Hr.Survey, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.Survey, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Survey)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.Survey), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Survey))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Survey, Width = 500, Height = 450 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField = "Title", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Description", IsRequired = true, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 3, DataField = "Deadline", IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 4, DataField = "Status", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 5, DataField = "IsAnonymous", IsRequired = true, EditorType2 = EditorTypes.dxCheckBox }, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "IsAnonymous", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "draft", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region Survey Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = formSurvey.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formSurvey.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Title", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formSurvey.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "Deadline", - Width = 100, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formSurvey.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Responses", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formSurvey.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "draft", Name= "Draft" }, - new () { Key= "active", Name= "Active" }, - new () { Key= "closed", Name= "Closed" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - new() { - ListFormCode = formSurvey.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsAnonymous", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), - PivotSettingsJson = DefaultPivotSettingsJson, - }, - ]); - #endregion - } - #endregion - } -} diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/LanguagesData.json b/api/src/Kurs.Platform.DbMigrator/Seeds/LanguagesData.json index be05e331..3d8a52b6 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/LanguagesData.json +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/LanguagesData.json @@ -11135,7 +11135,7 @@ "resourceName": "Platform", "key": "App.Hr.Employee", "tr": "Çalışanlar", - "en": "Employee" + "en": "Employees" }, { "resourceName": "Platform", diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Accounting.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Accounting.cs new file mode 100644 index 00000000..3be91fbe --- /dev/null +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Accounting.cs @@ -0,0 +1,854 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Text.Json; +using System.Threading.Tasks; +using Kurs.Languages.Languages; +using Kurs.Platform.Entities; +using Kurs.Platform.Enums; +using Kurs.Platform.ListForms; +using Kurs.Platform.Queries; +using Microsoft.Extensions.Configuration; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; +using Volo.Abp.TenantManagement; +using AbpIdentity = Kurs.Platform.Data.Seeds.SeedConsts.AbpIdentity; +using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes; +using static Kurs.Platform.PlatformConsts; +using static Kurs.Platform.PlatformSeeder.SeederDefaults; + +namespace Kurs.Platform.Data.Seeds; + +public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDependency +{ + private readonly IRepository _listFormRepository; + private readonly IRepository _listFormFieldRepository; + private readonly IdentityUserManager _identityUserManager; + private readonly IdentityRoleManager _identityRoleManager; + private readonly IConfiguration _configuration; + + public ListFormSeeder_Accounting( + IRepository listFormRepository, + IRepository listFormFieldRepository, + IdentityUserManager userManager, + IdentityRoleManager roleManager, + IConfiguration configuration) + { + _listFormRepository = listFormRepository; + _listFormFieldRepository = listFormFieldRepository; + _identityUserManager = userManager; + _identityRoleManager = roleManager; + _configuration = configuration; + } + + public async Task SeedAsync(DataSeedContext context) + { + #region FormBank + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormBank)) + { + var formBank = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.Form, + IsSubForm = false, + ShowActivity = true, + LayoutJson = DefaultLayoutJson, + SubFormsJson = JsonSerializer.Serialize(new List() { + new { + TabTitle = "Bank Accounts", + TabType = ListFormTabTypeEnum.List, + Code = ListFormCodes.Lists.BankAccount, + Relation = new List() { + new { + ParentFieldName = "Id", + ChildFieldName = "BankId" + }, + new { + ParentFieldName = "BranchId", + ChildFieldName = "BranchId" + }, + } + }, + }), + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Forms.FormBank, + Name = AppCodes.Accounting.Bank, + Title = AppCodes.Accounting.Bank, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Accounting.Bank, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Bank)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + PermissionJson = DefaultPermissionJson(AppCodes.Accounting.Bank), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Bank))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + EditingOptionJson = DefaultEditingOptionJson, + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order = 1, + ColCount = 2, + ColSpan = 2, + ItemType = "group", + Items = [ + new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "IdentifierCode", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox}, + new EditingFormItemDto { Order = 4, DataField = "Address1", ColSpan = 1, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "Address2", ColSpan = 1, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 6, DataField = "Country", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 7, DataField = "City", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 8, DataField = "District", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 9, DataField = "PostalCode", ColSpan = 1, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 10, DataField = "Phone", ColSpan = 1, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order = 11, DataField = "Email", ColSpan = 1, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + } + ); + + #region Bank Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = formBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + // BranchId + new() + { + ListFormCode = formBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "BranchId", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.BranchValues, + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] { + new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required)} + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "IdentifierCode", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] { + new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required)} + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address1", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address2", + Width = 150, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Country", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CountryValues, + CascadeEmptyFields = "City,District,Street" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "City", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CityValues, + CascadeRelationField = "Country", + CascadeFilterOperator="=", + CascadeParentFields = "Country", + CascadeEmptyFields = "District,Street" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "District", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.DistrictValues, + CascadeRelationField = "City", + CascadeFilterOperator="=", + CascadeParentFields = "Country,City", + CascadeEmptyFields = "Street", + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "PostalCode", + Width = 150, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Phone", + Width = 150, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Email", + Width = 150, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleEmailJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + }); + #endregion + } + #endregion + + #region Bank + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Bank)) + { + var listFormBank = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Bank, + Name = AppCodes.Accounting.Bank, + Title = AppCodes.Accounting.Bank, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = true, + IsOrganizationUnit = false, + Description = AppCodes.Accounting.Bank, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Bank)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Accounting.Bank), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Bank))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Accounting.Bank, Width = 600, Height = 600 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "IdentifierCode", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox}, + new EditingFormItemDto { Order = 5, DataField = "Address1", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 6, DataField = "Address2", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 7, DataField = "Country", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 8, DataField = "City", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 9, DataField = "District", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 10, DataField = "PostalCode", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 11, DataField = "Phone", ColSpan = 2, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order = 12, DataField = "Email", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Manage", + Text ="Manage", + UrlTarget="_blank", + AuthName = AppCodes.Accounting.BankAccount, + Url=$"/admin/form/{ListFormCodes.Forms.FormBank}/@Id" + }, + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + } + ); + + #region Bank Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 0, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // BranchId + new() + { + ListFormCode = listFormBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "BranchId", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.BranchValues, + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "IdentifierCode", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address1", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address2", + Width = 150, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Country", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CountryValues, + CascadeEmptyFields = "City,District,Street" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "City", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CityValues, + CascadeRelationField = "Country", + CascadeFilterOperator="=", + CascadeParentFields = "Country", + CascadeEmptyFields = "District,Street" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "District", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.DistrictValues, + CascadeRelationField = "City", + CascadeFilterOperator="=", + CascadeParentFields = "Country,City", + CascadeEmptyFields = "Street", + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "PostalCode", + Width = 150, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Phone", + Width = 150, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBank.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Email", + Width = 150, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleEmailJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), + PivotSettingsJson = DefaultPivotSettingsJson + }, + }); + #endregion + } + #endregion + + #region BankAccount + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.BankAccount)) + { + var listFormBankAccount = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.BankAccount, + Name = AppCodes.Accounting.BankAccount, + Title = AppCodes.Accounting.BankAccount, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = true, + IsOrganizationUnit = false, + Description = AppCodes.Accounting.BankAccount, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.BankAccount)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Accounting.BankAccount), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.BankAccount))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Accounting.BankAccount, Width = 600, Height = 300 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "BankId", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "AccountNumber", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "AccountOwner", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "CurrencyId", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 5, DataField = "CanTransferMoney", ColSpan = 2, EditorType2=EditorTypes.dxCheckBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CanTransferMoney", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Bank Account Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormBankAccount.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.BankAccount), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBankAccount.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "BankId", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.BankValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.BankAccount), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBankAccount.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "AccountNumber", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.BankAccount), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBankAccount.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "AccountOwner", + Width = 250, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.BankAccount), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBankAccount.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "CurrencyId", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CurrencyValues, + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.BankAccount), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBankAccount.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "CanTransferMoney", + Width = 50, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.BankAccount), + PivotSettingsJson = DefaultPivotSettingsJson + }, + }); + #endregion + } + #endregion + } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Administration.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Administration.cs new file mode 100644 index 00000000..c6a76e81 --- /dev/null +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Administration.cs @@ -0,0 +1,6492 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Text.Json; +using System.Threading.Tasks; +using Kurs.Languages.Languages; +using Kurs.Platform.Entities; +using Kurs.Platform.Enums; +using Kurs.Platform.ListForms; +using Kurs.Platform.Queries; +using Microsoft.Extensions.Configuration; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; +using Volo.Abp.TenantManagement; +using AbpIdentity = Kurs.Platform.Data.Seeds.SeedConsts.AbpIdentity; +using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes; +using static Kurs.Platform.PlatformConsts; +using static Kurs.Platform.PlatformSeeder.SeederDefaults; + +namespace Kurs.Platform.Data.Seeds; + +public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDependency +{ + private readonly IRepository _listFormRepository; + private readonly IRepository _listFormFieldRepository; + private readonly IdentityUserManager _identityUserManager; + private readonly IdentityRoleManager _identityRoleManager; + private readonly IConfiguration _configuration; + + public ListFormSeeder_Administration( + IRepository listFormRepository, + IRepository listFormFieldRepository, + IdentityUserManager userManager, + IdentityRoleManager roleManager, + IConfiguration configuration) + { + _listFormRepository = listFormRepository; + _listFormFieldRepository = listFormFieldRepository; + _identityUserManager = userManager; + _identityRoleManager = roleManager; + _configuration = configuration; + } + + public async Task SeedAsync(DataSeedContext context) + { + var configurationSection = _configuration.GetSection("OpenIddict:Applications"); + var swaggerRootUrl = configurationSection["Platform_Swagger:RootUrl"]?.TrimEnd('/'); + + #region FormSkillType + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormSkillType)) + { + var formSkillType = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.Form, + IsSubForm = false, + ShowActivity = true, + LayoutJson = DefaultLayoutJson, + SubFormsJson = JsonSerializer.Serialize(new List() { + new { + TabTitle = "Skill Levels", + TabType = ListFormTabTypeEnum.List, + Code = ListFormCodes.Lists.SkillLevel, + Relation = new List() { + new { + ParentFieldName = "Id", + ChildFieldName = "SkillTypeId" + } + } + }, + new { + TabTitle = "Skills", + TabType = ListFormTabTypeEnum.List, + Code = ListFormCodes.Lists.Skill, + Relation = new List() { + new { + ParentFieldName = "Id", + ChildFieldName = "SkillTypeId" + } + } + } + }), + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Forms.FormSkillType, + Name = AppCodes.Definitions.SkillType, + Title = AppCodes.Definitions.SkillType, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.SkillType, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SkillType)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.SkillType), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.SkillType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + EditingOptionJson = DefaultEditingOptionJson, + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = [ + new() { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsEnabled", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + } + ); + + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = formSkillType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 0, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillType), + }, + new() { + ListFormCode = formSkillType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 150, + ListOrderNo = 1, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillType), + }, + ]); + } + #endregion + + #region FormUomCategory + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormUomCategory)) + { + var formUomCategory = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.Form, + IsSubForm = false, + ShowActivity = true, + LayoutJson = DefaultLayoutJson, + SubFormsJson = JsonSerializer.Serialize(new List() { + new { + TabTitle = "Uoms", + TabType = ListFormTabTypeEnum.List, + Code = ListFormCodes.Lists.Uom, + Relation = new List() { + new { + ParentFieldName = "Id", + ChildFieldName = "UomCategoryId" + } + } + }, + }), + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Forms.FormUomCategory, + Name = AppCodes.Definitions.UomCategory, + Title = AppCodes.Definitions.UomCategory, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.UomCategory, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.UomCategory)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.UomCategory), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.UomCategory))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + EditingOptionJson = DefaultEditingOptionJson, + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = [ + new() { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsEnabled", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + } + ); + + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = formUomCategory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 0, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.UomCategory), + }, + new() { + ListFormCode = formUomCategory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 150, + ListOrderNo = 1, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.UomCategory), + }, + ]); + } + #endregion + + #region Permission Group + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.PermissionGroup)) + { + var listFormPermissionGroups = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.PermissionGroup, + Name = AbpIdentity.PermissionGroups.Default, + Title = AbpIdentity.PermissionGroups.Default, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AbpIdentity.PermissionGroups.Default, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = "AbpPermissionGroups", + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AbpIdentity.PermissionGroups.Create, AbpIdentity.PermissionGroups.Default, AbpIdentity.PermissionGroups.Update, AbpIdentity.PermissionGroups.Delete, AbpIdentity.PermissionGroups.Export, AbpIdentity.PermissionGroups.Import, AbpIdentity.PermissionGroups.Activity), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AbpIdentity.PermissionGroups.Default, Width = 800, Height = 350 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { Order=1, ColCount=1, ColSpan=2, ItemType="group", Items = + [ + new EditingFormItemDto { Order=1, DataField="Name", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=2, DataField="DisplayName", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=3, DataField="ExtraProperties", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + ] + } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "ExtraProperties", FieldDbType = DbType.String, Value = "{}", CustomValueType = FieldCustomValueTypeEnum.Value }, + }) + } + ); + + #region Permission Groups Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + new() { + ListFormCode = listFormPermissionGroups.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AbpIdentity.PermissionGroups.Create, AbpIdentity.PermissionGroups.Default, AbpIdentity.PermissionGroups.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPermissionGroups.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 300, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AbpIdentity.PermissionGroups.Create, AbpIdentity.PermissionGroups.Default, AbpIdentity.PermissionGroups.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPermissionGroups.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DisplayName", + Width = 300, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AbpIdentity.PermissionGroups.Create, AbpIdentity.PermissionGroups.Default, AbpIdentity.PermissionGroups.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPermissionGroups.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ExtraProperties", + Width = 300, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AbpIdentity.PermissionGroups.Create, AbpIdentity.PermissionGroups.Default, AbpIdentity.PermissionGroups.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + }); + #endregion + } + #endregion + + #region Permission + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Permission)) + { + var listFormPermissions = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Permission, + Name = AbpIdentity.Permissions.Default, + Title = AbpIdentity.Permissions.Default, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AbpIdentity.Permissions.Default, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = "AbpPermissions", + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, AbpIdentity.Permissions.Delete, AbpIdentity.Permissions.Export, AbpIdentity.Permissions.Import, AbpIdentity.Permissions.Activity), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AbpIdentity.Permissions.Default, Width = 800, Height = 350 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order=1, DataField="GroupName", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=2, DataField="Name", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=3, DataField="DisplayName", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=4, DataField="IsEnabled", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order=5, DataField="MultiTenancySide", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=6, DataField="MenuGroup", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTagBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsEnabled", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "MultiTenancySide", FieldDbType = DbType.Int16, Value = "3", CustomValueType = FieldCustomValueTypeEnum.Value }, + }) + } + ); + + #region Permission Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + new() { + ListFormCode = listFormPermissions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPermissions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "GroupName", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = $"SELECT \"AbpPermissions\".\"GroupName\" AS \"Key\", \"AbpPermissions\".\"GroupName\" as \"Name\" FROM \"AbpPermissions\" GROUP BY \"AbpPermissions\".\"GroupName\" ORDER BY \"AbpPermissions\".\"GroupName\"", + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPermissions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ParentName", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormPermissions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormPermissions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DisplayName", + Width = 250, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormPermissions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsEnabled", + Width = 85, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormPermissions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int16, + FieldName = "MultiTenancySide", + Width = 85, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key=1,Name="Tenant" }, + new () { Key=2,Name="Host" }, + new () { Key=3,Name="Both" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormPermissions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "MenuGroup", + Width = 85, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Kurs",Name="Kurs" }, + new () { Key="Erp",Name="Erp" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region ClaimType + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ClaimType)) + { + var listFormClaimTypes = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.ClaimType, + Name = AppCodes.IdentityManagement.ClaimTypes, + Title = AppCodes.IdentityManagement.ClaimTypes, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.IdentityManagement.ClaimTypes, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = "AbpClaimTypes", + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.IdentityManagement.ClaimTypes), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.IdentityManagement.ClaimTypes, Width = 500, Height = 550 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order=1, DataField="Name", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=2, DataField="ValueType", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions = EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=3, DataField="Required", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order=4, DataField="IsStatic", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order=5, DataField="Regex", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=6, DataField="RegexDescription", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=7, DataField="Description", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + DeleteCommand = "DELETE FROM \"AbpClaimTypes\" WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + InsertCommand = "INSERT INTO \"AbpClaimTypes\" (\"Id\",\"ValueType\",\"Required\",\"IsStatic\",\"Name\",\"ConcurrencyStamp\",\"ExtraProperties\") OUTPUT Inserted.Id VALUES (@Id,@ValueType,@Required,@IsStatic,@Name,@ConcurrencyStamp,@ExtraProperties)", + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "ConcurrencyStamp", FieldDbType = DbType.Guid, Value = Guid.NewGuid().ToString(), CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "ExtraProperties", FieldDbType = DbType.String, Value = "{}", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Required", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "IsStatic", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "ValueType", FieldDbType = DbType.Int16, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + } + ); + + #region ClaimTypes Fields + await _listFormFieldRepository.InsertManyAsync( + [ + new ListFormField + { + ListFormCode = listFormClaimTypes.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 500, + ListOrderNo = 0, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormClaimTypes.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 1, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormClaimTypes.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int16, + FieldName = "ValueType", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key=0,Name="String" }, + new () { Key=1,Name="Number" }, + new () { Key=2,Name="Boolean" }, + new () { Key=3,Name="DateTime" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormClaimTypes.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "Required", + Width = 100, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormClaimTypes.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsStatic", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormClaimTypes.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Regex", + Width = 250, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormClaimTypes.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "RegexDescription", + Width = 250, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormClaimTypes.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 250, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), + PivotSettingsJson = DefaultPivotSettingsJson + } + ]); + #endregion + } + #endregion + + #region Role + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Role)) + { + var listFormRoles = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Role, + Name = PlatformConsts.IdentityPermissions.Roles.Default, + Title = PlatformConsts.IdentityPermissions.Roles.Default, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + Description = PlatformConsts.IdentityPermissions.Roles.Default, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = "AbpRoles", + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(PlatformConsts.IdentityPermissions.Roles.Create, PlatformConsts.IdentityPermissions.Roles.Default, PlatformConsts.IdentityPermissions.Roles.Update, PlatformConsts.IdentityPermissions.Roles.Delete, PlatformConsts.IdentityPermissions.Roles.Export, PlatformConsts.IdentityPermissions.Roles.Import, PlatformConsts.IdentityPermissions.Roles.Activity), + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = PlatformConsts.IdentityPermissions.Roles.Default, Width = 500, Height = 300 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1, ColCount=1, ColSpan=2, ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "IsDefault", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 3, DataField = "IsPublic", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + ]} + }), + DeleteCommand = "DELETE FROM \"AbpRoles\" WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new FieldsDefaultValue() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + InsertServiceAddress = "list-form-dynamic-api/role-insert", + UpdateServiceAddress = "list-form-dynamic-api/role-update", + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Permission", + Text = "Permission", + AuthName = PlatformConsts.IdentityPermissions.Roles.ManagePermissions, + DialogName = "RolesPermission", + DialogParameters = JsonSerializer.Serialize(new { + name = "@Name", + }) + }, + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { + FieldName = "IsDefault", + FieldDbType = DbType.Boolean, + Value = "false", + CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { + FieldName = "IsPublic", + FieldDbType = DbType.Boolean, + Value = "true", + CustomValueType = FieldCustomValueTypeEnum.Value }, + }) + } + ); + + #region Roles Fields + await _listFormFieldRepository.InsertManyAsync( + [ + new() { + ListFormCode = listFormRoles.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 400, + ListOrderNo = 1, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Roles.Create, PlatformConsts.IdentityPermissions.Roles.Default, PlatformConsts.IdentityPermissions.Roles.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormRoles.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsDefault", + Width = 85, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Roles.Create, PlatformConsts.IdentityPermissions.Roles.Default, PlatformConsts.IdentityPermissions.Roles.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormRoles.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsPublic", + Width = 85, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Roles.Create, PlatformConsts.IdentityPermissions.Roles.Default, PlatformConsts.IdentityPermissions.Roles.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region User + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.User)) + { + var listFormUsers = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.User, + Name = PlatformConsts.IdentityPermissions.Users.Default, + Title = PlatformConsts.IdentityPermissions.Users.Default, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + Description = PlatformConsts.IdentityPermissions.Users.Default, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = "AbpUsers", + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, PlatformConsts.IdentityPermissions.Users.Delete, PlatformConsts.IdentityPermissions.Users.Export, PlatformConsts.IdentityPermissions.Users.Import, PlatformConsts.IdentityPermissions.Users.Activity), + DeleteCommand = $"UPDATE \"AbpUsers\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = PlatformConsts.IdentityPermissions.Users.Default, Width = 500, Height = 400 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new () { Order=1,ColCount=1,ColSpan=2,ItemType="group",Items=[ + new EditingFormItemDto { Order=1, DataField="Email", 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="Surname", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=4, DataField="PhoneNumber", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=5, DataField="Password", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=6, DataField="IsActive", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, + ]} + }), + InsertServiceAddress = "list-form-dynamic-api/user-insert", + UpdateServiceAddress = "list-form-dynamic-api/user-update", + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new CommandColumnDto() { + Hint = "Detail", + Text ="Detail", + UrlTarget="_blank", + AuthName=PlatformConsts.IdentityPermissions.Users.Update, + Url="/admin/users/detail/@Id" + }, + new CommandColumnDto() { + Hint = "Permission", + Text = "Permission", + AuthName = PlatformConsts.IdentityPermissions.Users.ManagePermissions, + DialogName = "UsersPermission", + DialogParameters = JsonSerializer.Serialize(new { + name = "@Email", + id = "@Id" + }) + }, + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new FieldsDefaultValue() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + }); + + #region Users Fields + await _listFormFieldRepository.InsertManyAsync( + [ + new ListFormField + { + ListFormCode = listFormUsers.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 125, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormUsers.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Email", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] + { + new() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.email) }, + new() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) } + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormUsers.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormUsers.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Surname", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormUsers.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "PhoneNumber", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormUsers.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormUsers.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Password", + Width = 100, + ListOrderNo = 7, + Visible = false, + IsActive = false, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Ip Restriction + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.IpRestriction)) + { + var listFormIpRestrictions = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.IpRestriction, + Name = AppCodes.IdentityManagement.IpRestrictions, + Title = AppCodes.IdentityManagement.IpRestrictions, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.IdentityManagement.IpRestrictions, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.IpRestriction)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.IdentityManagement.IpRestrictions), + DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.IpRestriction)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = ListFormCodes.Lists.IpRestriction, Width = 800, Height = 500 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "ResourceType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "ResourceId", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "IP", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + } + ); + + #region Ip Restriction Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormIpRestrictions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.IpRestrictions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormIpRestrictions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ResourceType", + Width = 300, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="User",Name="User" }, + new () { Key="Role",Name="Role" }, + new () { Key="Global",Name="Global" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.IpRestrictions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormIpRestrictions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ResourceId", + Width = 300, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = $"SELECT \"UserName\" AS \"Key\", \"UserName\" AS \"Name\" FROM \"AbpUsers\" UNION SELECT \"Name\" AS \"Key\", \"Name\" AS \"Name\" FROM \"AbpRoles\"", + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.IpRestrictions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormIpRestrictions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "IP", + Width = 85, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.IpRestrictions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Audit Logs + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.AuditLog)) + { + var listFormAuditLog = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.AuditLog, + Name = AppCodes.AuditLogs, + Title = AppCodes.AuditLogs, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.AuditLogs, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = "AbpAuditLogs", + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.AuditLogs), + PagerOptionJson = DefaultPagerOptionJson, + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new CommandColumnDto() { + Hint = "Details", + Text = "Details", + AuthName = AppCodes.AuditLogs, + DialogName = "AuditLogDetail", + DialogParameters = JsonSerializer.Serialize(new { + id = "@Id", + }) + }, + }), + } + ); + + #region Audit Logs Fields + await _listFormFieldRepository.InsertManyAsync( + [ + new() { + ListFormCode = listFormAuditLog.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAuditLog.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "HttpStatusCode", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAuditLog.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "HttpMethod", + Width = 100, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAuditLog.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Url", + Width = 450, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAuditLog.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "UserName", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAuditLog.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ClientIpAddress", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAuditLog.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "ExecutionTime", + Width = 130, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAuditLog.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "ExecutionDuration", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAuditLog.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ApplicationName", + Width = 200, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Custom Endpoint + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.CustomEndpoint)) + { + var listFormCustomEndpoints = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.CustomEndpoint, + Name = AppCodes.DeveloperKits.CustomEndpoints, + Title = AppCodes.DeveloperKits.CustomEndpoints, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.DeveloperKits.CustomEndpoints, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.CustomEndpoint)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), + DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.CustomEndpoint)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.DeveloperKits.CustomEndpoints, Width = 800, Height = 500 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Url", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Method", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 4, DataField = "DataSourceCode", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 5, DataField = "Sql", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextArea, EditorOptions="{ \"height\" : 60 }" }, + new EditingFormItemDto { Order = 6, DataField = "ParametersJson", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextArea, EditorOptions="{ \"height\" : 60 }" }, + new EditingFormItemDto { Order = 7, DataField = "PermissionsJson", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextArea, EditorOptions="{ \"height\" : 60 }" }, + new EditingFormItemDto { Order = 8, DataField = "Description", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":200}" }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + ButtonPosition= UiCommandButtonPositionTypeEnum.Toolbar, + Hint = "Swagger", + Text = "Swagger", + AuthName=AppCodes.DeveloperKits.CustomEndpoints, + Url= swaggerRootUrl + "/swagger/index.html", + }, + }), + } + ); + + #region Custom Endpoint Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormCustomEndpoints.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCustomEndpoints.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCustomEndpoints.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 350, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCustomEndpoints.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Url", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCustomEndpoints.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Method", + Width = 80, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="GET",Name="GET" }, + new () { Key="POSt",Name="POST" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCustomEndpoints.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DataSourceCode", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.DataSourceValues, + }), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCustomEndpoints.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Sql", + Width = 200, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCustomEndpoints.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ParametersJson", + Width = 200, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCustomEndpoints.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "PermissionsJson", + Width = 200, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Report Categories + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ReportCategory)) + { + var listFormReportCatory = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.ReportCategory, + Name = AppCodes.Reports.Categories, + Title = AppCodes.Reports.Categories, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Reports.Categories, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ReportCategory)), + KeyFieldName = "Id", + DefaultFilter = DefaultFilterJson, + KeyFieldDbSourceType = DbType.Int32, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Reports.Categories), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Reports.Categories, Width = 500, Height = 300 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = [ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 3, DataField = "Icon", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextBox }, + ]} + }), + DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.ReportCategory)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }) + }); + + #region Report Categories Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormReportCatory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Reports.Categories), + }, + new() + { + ListFormCode = listFormReportCatory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Reports.Categories), + }, + new() + { + ListFormCode = listFormReportCatory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 500, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Reports.Categories), + }, + new() + { + ListFormCode = listFormReportCatory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Icon", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Reports.Categories), + }, + ]); + #endregion + } + #endregion + + #region About Us + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.About)) + { + var listFormAbout = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.About, + Name = AppCodes.About, + Title = AppCodes.About, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.About, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.About)), + KeyFieldName = "Id", + DefaultFilter = DefaultFilterJson, + KeyFieldDbSourceType = DbType.Guid, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.About), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.About, Width = 800, Height = 720 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "StatsJson", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":200}" }, + new EditingFormItemDto { Order = 2, DataField = "DescriptionsJson", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":200}" }, + new EditingFormItemDto { Order = 3, DataField = "SectionsJson", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":200}" }, + ] + } + }), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.About))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }) + }); + + #region About Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormAbout.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.About), + }, + new() + { + ListFormCode = listFormAbout.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "StatsJson", + Width = 400, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.About), + }, + new() + { + ListFormCode = listFormAbout.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DescriptionsJson", + Width = 400, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.About), + }, + new() + { + ListFormCode = listFormAbout.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "SectionsJson", + Width = 400, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.About), + }, + ]); + #endregion + } + #endregion + + #region Services + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Service)) + { + var listFormService = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Service, + Name = AppCodes.Services, + Title = AppCodes.Services, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Services, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Service)), + KeyFieldName = "Id", + DefaultFilter = DefaultFilterJson, + KeyFieldDbSourceType = DbType.Guid, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Services), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Services, Width = 500, Height = 450 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "Title", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "Icon", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 4, DataField = "Type", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 5, DataField = "Features", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextArea, EditorOptions="{\"height\":200}" }, + ] + } + }), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Service))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + }); + + #region Services Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormService.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Services), + }, + new() + { + ListFormCode = listFormService.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Title", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Services), + }, + new() + { + ListFormCode = listFormService.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Icon", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Services), + }, + new() + { + ListFormCode = listFormService.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Services), + }, + new() + { + ListFormCode = listFormService.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Type", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="service",Name="Service" }, + new () { Key="support",Name="Support" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Services), + }, + new() + { + ListFormCode = listFormService.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Features", + Width = 200, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Services), + } + ]); + #endregion + } + #endregion + + #region Products + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Product)) + { + var listFormProduct = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Product, + Name = AppCodes.Orders.Products, + Title = AppCodes.Orders.Products, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Orders.Products, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Product)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Orders.Products), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Product))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Orders.Products, Width = 500, Height = 400 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "Category", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 4, DataField = "Order", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 5, DataField = "MonthlyPrice", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 6, DataField = "YearlyPrice", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 7, DataField = "IsQuantityBased", ColSpan = 2, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 8, DataField = "ImageUrl", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox }, + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsQuantityBased", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + }); + + #region Product Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormProduct.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), + }, + new() + { + ListFormCode = listFormProduct.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 300, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + }, + new() + { + ListFormCode = listFormProduct.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 300, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + }, + new() + { + ListFormCode = listFormProduct.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Category", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Public.products.categories.Üyelik",Name="Üyelik" }, + new () { Key="Public.products.categories.Lisans",Name="Lisans" }, + new () { Key="Public.products.categories.Ek Hizmetler",Name="Ek Hizmetler" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), + }, + new() + { + ListFormCode = listFormProduct.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "MonthlyPrice", + Format = "fixedPoint", + Alignment = "right", + Width = 120, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), + }, + new() + { + ListFormCode = listFormProduct.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "YearlyPrice", + Format = "fixedPoint", + Alignment = "right", + Width = 120, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), + }, + new() + { + ListFormCode = listFormProduct.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsQuantityBased", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), + }, + new() + { + ListFormCode = listFormProduct.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ImageUrl", + Width = 300, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), + }, + ]); + #endregion + } + #endregion + + #region PaymentMethods + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.PaymentMethod)) + { + var listFormPaymentMethod = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.PaymentMethod, + Name = AppCodes.Orders.PaymentMethods, + Title = AppCodes.Orders.PaymentMethods, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Orders.PaymentMethods, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.PaymentMethod)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.String, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Orders.PaymentMethods), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Orders.PaymentMethods, Width = 500, Height = 300 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + 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 }, + ] + } + }), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.PaymentMethod))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + }); + + #region PaymentMethod Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormPaymentMethod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PaymentMethods), + }, + new() + { + ListFormCode = listFormPaymentMethod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 300, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PaymentMethods), + }, + new() + { + ListFormCode = listFormPaymentMethod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Commission", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PaymentMethods), + }, + new() + { + ListFormCode = listFormPaymentMethod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Logo", + Width = 300, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PaymentMethods), + }, + ]); + #endregion + } + #endregion + + #region InstallmentOptions + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.InstallmentOption)) + { + var listFormInstallmentOption = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.InstallmentOption, + Name = AppCodes.Orders.InstallmentOptions, + Title = AppCodes.Orders.InstallmentOptions, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Orders.InstallmentOptions, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.InstallmentOption)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Orders.InstallmentOptions), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Orders.InstallmentOptions, Width = 500, Height = 300 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "Installment", 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 }, + ] + } + }), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.InstallmentOption))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + }); + + #region PaymentMethod Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormInstallmentOption.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.InstallmentOptions), + }, + new() + { + ListFormCode = listFormInstallmentOption.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Installment", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.InstallmentOptions), + }, + new() + { + ListFormCode = listFormInstallmentOption.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.InstallmentOptions), + }, + new() + { + ListFormCode = listFormInstallmentOption.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Commission", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.InstallmentOptions), + }, + ]); + #endregion + } + #endregion + + #region Purchase Orders + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.PurchaseOrder)) + { + var listFormPurchaseOrder = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.PurchaseOrder, + Name = AppCodes.Orders.PurchaseOrders, + Title = AppCodes.Orders.PurchaseOrders, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Orders.PurchaseOrders, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Order)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Orders.PurchaseOrders), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Order))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Orders.PurchaseOrders, Width = 1000, Height = 500 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items = + [ + 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 = 5, DataField = "Address1", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 6, DataField = "Address2", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 7, DataField = "Country", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 8, DataField = "City", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 9, DataField = "District", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 10, DataField = "PostalCode", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + ] + }, + new() { Order=2, ColCount=1, ColSpan=1, ItemType="group", Items = + [ + new EditingFormItemDto { Order = 11, DataField = "Phone", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order = 12, DataField = "Mobile", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order = 13, DataField = "Fax", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + 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=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 20, DataField = "Installment", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + }); + + #region Purchase Order Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders) + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "OrganizationName", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Founder", + Width = 100, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int64, + FieldName = "VknTckn", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "TaxOffice", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address1", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address2", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Country", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CountryValues, + CascadeEmptyFields = "City,District" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "City", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CityValues, + CascadeRelationField = "Country", + CascadeFilterOperator="=", + CascadeParentFields = "Country", + CascadeEmptyFields = "District" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "District", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.DistrictValues, + CascadeRelationField = "City", + CascadeFilterOperator="=", + CascadeParentFields = "Country,City", + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Phone", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int64, + FieldName = "Mobile", + Width = 100, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int64, + FieldName = "Fax", + Width = 100, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Website", + Width = 100, + ListOrderNo = 14, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Subtotal", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 15, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Commission", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 16, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Total", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 17, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + 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 = LookupQueryValues.PaymentMethodValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + }, + new() + { + ListFormCode = listFormPurchaseOrder.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + 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 = LookupQueryValues.InstallmentValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), + } + ]); + #endregion + } + #endregion + + #region BlogCategory + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.BlogCategory)) + { + var listFormBlogCategory = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.BlogCategory, + Name = AppCodes.BlogManagement.BlogCategory, + Title = AppCodes.BlogManagement.BlogCategory, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.BlogManagement.BlogCategory, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.BlogCategory)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.BlogManagement.BlogCategory), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.BlogCategory))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.BlogManagement.BlogCategory, Width = 600, Height = 400 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "Slug", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 4, DataField = "Icon", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "DisplayOrder", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 6, DataField = "IsActive", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxCheckBox } + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + }); + + #region BlogCategory Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormBlogCategory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogCategory), + }, + new() + { + ListFormCode = listFormBlogCategory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 400, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogCategory), + }, + new() + { + ListFormCode = listFormBlogCategory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Slug", + Width = 330, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogCategory), + }, + new() + { + ListFormCode = listFormBlogCategory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 400, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogCategory), + }, + new() + { + ListFormCode = listFormBlogCategory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Icon", + Width = 200, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogCategory), + }, + new() + { + ListFormCode = listFormBlogCategory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "DisplayOrder", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogCategory), + }, + new() + { + ListFormCode = listFormBlogCategory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogCategory), + } + ]); + #endregion + } + #endregion + + #region BlogPost + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.BlogPost)) + { + var listFormBlogPosts = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.BlogPost, + Name = AppCodes.BlogManagement.BlogPosts, + Title = AppCodes.BlogManagement.BlogPosts, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.BlogManagement.BlogPosts, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.BlogPost)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.BlogManagement.BlogPosts), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.BlogPost))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.BlogManagement.BlogPosts, Width = 1000, Height = 600 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "Title", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "Slug", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Summary", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 4, DataField = "CoverImage", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "ReadTime", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 6, DataField = "CategoryId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 7, DataField = "ViewCount", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 8, DataField = "LikeCount", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 9, DataField = "CommentCount", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 10, DataField = "IsPublished", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 11, DataField = "PublishedAt", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 12, DataField = "ContentTr", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxHtmlEditor, EditorOptions=EditorOptionValues.HtmlEditorOptions }, + new EditingFormItemDto { Order = 13, DataField = "ContentEn", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxHtmlEditor, EditorOptions=EditorOptionValues.HtmlEditorOptions } + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsPublished", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "PublishedAt", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }) + }); + + #region BlogPosts Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormBlogPosts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), + }, + new() + { + ListFormCode = listFormBlogPosts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Title", + Width = 400, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), + }, + new() + { + ListFormCode = listFormBlogPosts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Slug", + Width = 350, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), + }, + new() + { + ListFormCode = listFormBlogPosts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Summary", + Width = 400, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), + }, + new() + { + ListFormCode = listFormBlogPosts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "CoverImage", + Width = 200, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), + }, + new() + { + ListFormCode = listFormBlogPosts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ReadTime", + Width = 80, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), + }, + new() + { + ListFormCode = listFormBlogPosts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "CategoryId", + Width = 200, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.BlogCategoryValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), + }, + new() + { + ListFormCode = listFormBlogPosts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "ViewCount", + Width = 80, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), + }, + new() + { + ListFormCode = listFormBlogPosts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "LikeCount", + Width = 80, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), + }, + new() + { + ListFormCode = listFormBlogPosts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "CommentCount", + Width = 80, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), + }, + new() + { + ListFormCode = listFormBlogPosts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsPublished", + Width = 80, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), + }, + new() + { + ListFormCode = listFormBlogPosts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "PublishedAt", + Width = 120, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), + }, + new() + { + ListFormCode = listFormBlogPosts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "ContentTr", + Width = 120, + ListOrderNo = 11, + Visible = false, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), + }, + new() + { + ListFormCode = listFormBlogPosts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "ContentEn", + Width = 120, + ListOrderNo = 12, + Visible = false, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), + } + ]); + #endregion + } + #endregion + + #region Demos + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Demo)) + { + var listFormDemo = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Demo, + Name = AppCodes.Demos, + Title = AppCodes.Demos, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Demos, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Demo)), + KeyFieldName = "Id", + DefaultFilter = DefaultFilterJson, + KeyFieldDbSourceType = DbType.Guid, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Demos), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Demos, Width = 500, Height = 500 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "OrganizationName", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "FullName", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Email", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "Phone", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order = 5, DataField = "Address", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 6, DataField = "NumberOfBranches", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 7, DataField = "NumberOfUsers", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 8, DataField = "Message", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextArea }, + ] + } + }), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Demo))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }) + }); + + #region Demos Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormDemo.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), + }, + new() + { + ListFormCode = listFormDemo.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "OrganizationName", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), + }, + new() + { + ListFormCode = listFormDemo.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "FullName", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), + }, + new() + { + ListFormCode = listFormDemo.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Email", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] + { + new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.email) }, + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), + }, + new() + { + ListFormCode = listFormDemo.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Phone", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), + }, + new() + { + ListFormCode = listFormDemo.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address", + Width = 200, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), + }, + new() + { + ListFormCode = listFormDemo.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "NumberOfBranches", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), + }, + new() + { + ListFormCode = listFormDemo.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "NumberOfUsers", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), + }, + new() + { + ListFormCode = listFormDemo.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Message", + Width = 300, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), + }, + ]); + #endregion + + } + #endregion + + #region Contact + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Contact)) + { + var listFormContact = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Contact, + Name = AppCodes.Contact, + Title = AppCodes.Contact, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Contact, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Contact)), + KeyFieldName = "Id", + DefaultFilter = DefaultFilterJson, + KeyFieldDbSourceType = DbType.Guid, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Contact), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Contact, Width = 800, Height = 600 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "Address", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "Phone", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order = 3, DataField = "Email", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "Location", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "TaxNumber", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 6, DataField = "BankJson", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":100}" }, + new EditingFormItemDto { Order = 7, DataField = "WorkHoursJson", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":100}" }, + new EditingFormItemDto { Order = 8, DataField = "MapJson", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":100}" }, + ] + } + }), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Contact))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }) + }); + + #region Contact Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormContact.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), + }, + new() + { + ListFormCode = listFormContact.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), + }, + new() + { + ListFormCode = listFormContact.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Phone", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), + }, + new() + { + ListFormCode = listFormContact.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Email", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] + { + new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) }, + new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.email) }, + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), + }, + new() + { + ListFormCode = listFormContact.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Location", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), + }, + new() + { + ListFormCode = listFormContact.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "TaxNumber", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), + }, + new() + { + ListFormCode = listFormContact.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "BankJson", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), + }, + new() + { + ListFormCode = listFormContact.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "WorkHoursJson", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), + }, + new() + { + ListFormCode = listFormContact.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "MapJson", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), + }, + ]); + #endregion + } + #endregion + + #region WorkHour + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.WorkHour)) + { + var listFormWorkHour = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.WorkHour, + Name = AppCodes.Definitions.WorkHour, + Title = AppCodes.Definitions.WorkHour, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.WorkHour, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.WorkHour)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.WorkHour), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.WorkHour))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.WorkHour, Width = 600, Height = 500 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order = 1, ColCount = 2, ColSpan = 2, ItemType = "group", + Items =[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "StartHour", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "EndHour", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "Monday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 5, DataField = "Tuesday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 6, DataField = "Wednesday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 7, DataField = "Thursday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 8, DataField = "Friday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 9, DataField = "Saturday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 10, DataField = "Sunday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Monday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Tuesday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Wednesday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Thursday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Friday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Saturday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Sunday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + }) + } + ); + + #region WorkHour Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + new() { + ListFormCode = listFormWorkHour.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormWorkHour.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Saat alanları + new() { + ListFormCode = listFormWorkHour.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "StartHour", + Width = 120, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormWorkHour.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "EndHour", + Width = 120, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Günlük kolonlar + new() + { + ListFormCode = listFormWorkHour.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "Monday", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormWorkHour.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "Tuesday", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormWorkHour.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "Wednesday", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormWorkHour.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "Thursday", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormWorkHour.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "Friday", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormWorkHour.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "Saturday", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormWorkHour.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "Sunday", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), + PivotSettingsJson = DefaultPivotSettingsJson + }, + }); + #endregion + } + #endregion + + #region Sector + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Sector)) + { + var listFormSector = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Sector, + Name = AppCodes.Definitions.Sector, + Title = AppCodes.Definitions.Sector, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Sector, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Sector)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = false }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Sector), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Sector))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Definitions.Sector, Width = 400, Height = 150 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items =[ + new EditingFormItemDto + { + Order = 1, + DataField = "Name", + ColSpan = 2, + IsRequired = true, + EditorType2 = EditorTypes.dxTextBox + } + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }) + }); + + #region Sector Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormSector.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Sector), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormSector.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Sector), + PivotSettingsJson = DefaultPivotSettingsJson + } + ]); + #endregion + } + #endregion + + #region SkillType + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SkillType)) + { + var listFormSkillType = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.SkillType, + Name = AppCodes.Definitions.SkillType, + Title = AppCodes.Definitions.SkillType, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.SkillType, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SkillType)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.SkillType), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.SkillType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Definitions.SkillType, Width = 400, Height = 200 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox } + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Manage", + Text ="Manage", + UrlTarget="_blank", + AuthName = AppCodes.Definitions.Skill, + Url=$"/admin/form/{ListFormCodes.Forms.FormSkillType}/@Id" + }, + }), + }); + + #region SkillType Fields + await _listFormFieldRepository.InsertManyAsync([ + new () + { + ListFormCode = listFormSkillType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillType), + }, + new() + { + ListFormCode = listFormSkillType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillType), + } + ]); + #endregion + } + #endregion + + #region Skill Level + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SkillLevel)) + { + var listFormSkillLevel = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.SkillLevel, + Name = AppCodes.Definitions.SkillLevel, + Title = AppCodes.Definitions.SkillLevel, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.SkillLevel, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SkillLevel)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.SkillLevel), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.SkillLevel))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = ListFormCodes.Lists.SkillLevel, Width = 600, Height = 300 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= + [ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Progress", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 3, DataField = "IsDefault", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 4, DataField = "SkillTypeId", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsDefault", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Skill Level Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormSkillLevel.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillLevel), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSkillLevel.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillLevel), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSkillLevel.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Progress", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillLevel), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSkillLevel.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsDefault", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillLevel), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSkillLevel.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "SkillTypeId", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.SkillTypeValues, + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillLevel), + PivotSettingsJson = DefaultPivotSettingsJson + }, + }); + #endregion + } + #endregion + + #region Skill + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Skill)) + { + var listFormSkill = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Skill, + Name = AppCodes.Definitions.Skill, + Title = AppCodes.Definitions.Skill, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Skill, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Skill)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Skill), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Skill))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new FieldsDefaultValue() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Skill, Width = 600, Height = 300 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "SkillTypeId", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Skill Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new ListFormField + { + ListFormCode = listFormSkill.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Skill), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSkill.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Skill), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSkill.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "SkillTypeId", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.SkillTypeValues, + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillLevel), + PivotSettingsJson = DefaultPivotSettingsJson + }, + }); + #endregion + } + #endregion + + #region UomCategory + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.UomCategory)) + { + var listFormUomCategory = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.UomCategory, + Name = AppCodes.Definitions.UomCategory, + Title = AppCodes.Definitions.UomCategory, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.UomCategory, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.UomCategory)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.UomCategory), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.UomCategory))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Definitions.UomCategory, Width = 400, Height = 200 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox } + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Manage", + Text ="Manage", + UrlTarget="_blank", + AuthName = AppCodes.Definitions.Uom, + Url=$"/admin/form/{ListFormCodes.Forms.FormUomCategory}/@Id" + }, + }), + }); + + #region UomCategory Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormUomCategory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.UomCategory), + }, + new() + { + ListFormCode = listFormUomCategory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.UomCategory), + } + ]); + #endregion + } + #endregion + + #region Uom + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Uom)) + { + var listFormUom = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Uom, + Name = AppCodes.Definitions.Uom, + Title = AppCodes.Definitions.Uom, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Uom, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Uom)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Uom), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Uom))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Uom, Width = 600, Height = 300 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Type", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "Ratio", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 4, DataField = "Rounding", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 5, DataField = "IsActive", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 6, DataField = "UomCategoryId", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Uom Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new ListFormField + { + ListFormCode = listFormUom.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Uom), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormUom.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Uom), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormUom.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Type", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Reference",Name="Reference" }, + new () { Key="SmallerThanReference",Name="Smaller Than Reference" }, + new () { Key="BiggerThanReference",Name="Bigger Than Reference" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Uom), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormUom.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Ratio", + Format = "fixedPoint", + Alignment = "right", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Uom), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormUom.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Rounding", + Format = "fixedPoint", + Alignment = "right", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Uom), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormUom.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "UomCategoryId", + Width = 150, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.UomCategoryValues, + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Uom), + PivotSettingsJson = DefaultPivotSettingsJson + }, + }); + #endregion + } + #endregion + + #region Behavior + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Behavior)) + { + var listFormBehavior = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Behavior, + Name = AppCodes.Definitions.Behavior, + Title = AppCodes.Definitions.Behavior, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Behavior, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Behavior)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Behavior), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Behavior))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Behavior, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + }); + + #region Behavior Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormBehavior.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Behavior), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBehavior.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Behavior), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Disease + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Disease)) + { + var listFormDisease = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Disease, + Name = AppCodes.Definitions.Disease, + Title = AppCodes.Definitions.Disease, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Disease, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Disease)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Disease), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Disease))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Disease, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= + [ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Disease Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormDisease.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Disease), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormDisease.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Disease), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Document + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Document)) + { + var listFormDocument = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Document, + Name = AppCodes.Definitions.Document, + Title = AppCodes.Definitions.Document, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Document, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Document)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Document), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Document))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Document, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= + [ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Document Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormDocument.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Document), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormDocument.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Document), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region EducationStatus + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.EducationStatus)) + { + var listFormEducationStatus = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.EducationStatus, + Name = AppCodes.Definitions.EducationStatus, + Title = AppCodes.Definitions.EducationStatus, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.EducationStatus, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.EducationStatus)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.EducationStatus), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.EducationStatus))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.EducationStatus, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= + [ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Order", ColSpan = 2, EditorType2=EditorTypes.dxNumberBox }, + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region EducationStatus Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormEducationStatus.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.EducationStatus), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEducationStatus.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.EducationStatus), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEducationStatus.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Order", + Width = 100, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.EducationStatus), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Vaccine + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Vaccine)) + { + var listFormVaccine = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Vaccine, + Name = AppCodes.Definitions.Vaccine, + Title = AppCodes.Definitions.Vaccine, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Vaccine, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Vaccine)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Vaccine), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Vaccine))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Vaccine, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Vaccine Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormVaccine.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vaccine), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVaccine.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vaccine), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Vehicle + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Vehicle)) + { + var listFormVehicle = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Vehicle, + Name = AppCodes.Definitions.Vehicle, + Title = AppCodes.Definitions.Vehicle, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Vehicle, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Vehicle)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Vehicle), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Vehicle))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Vehicle, Width = 700, Height = 600 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order = 1, ColCount = 1, ColSpan = 2, ItemType = "group", + Items=[ + new EditingFormItemDto { Order = 1, DataField = "Plate", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Brand", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "ModelYear", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 4, DataField = "DriverNationalId", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "DriverName", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 6, DataField = "DriverPhone1", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 7, DataField = "DriverPhone2", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 8, DataField = "AssistantDriverNationalId", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 9, DataField = "AssistantDriverName", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 10, DataField = "AssistantDriverPhone1", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 11, DataField = "AssistantDriverPhone2", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 12, DataField = "Status", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region Vehicle Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + new() { + ListFormCode = listFormVehicle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVehicle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Plate", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVehicle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Brand", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVehicle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "ModelYear", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Driver bilgileri + new() { + ListFormCode = listFormVehicle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DriverNationalId", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVehicle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DriverName", + Width = 200, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVehicle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DriverPhone1", + Width = 150, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVehicle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DriverPhone2", + Width = 150, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), + PivotSettingsJson = DefaultPivotSettingsJson + }, + + // Assistant Driver bilgileri + new() { + ListFormCode = listFormVehicle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "AssistantDriverNationalId", + Width = 150, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVehicle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "AssistantDriverName", + Width = 200, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVehicle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "AssistantDriverPhone1", + Width = 150, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVehicle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "AssistantDriverPhone2", + Width = 150, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Status + new() { + ListFormCode = listFormVehicle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", Width = 120, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto{ C = AppCodes.Definitions.Vehicle + ".Create", R = AppCodes.Definitions.Vehicle, U = AppCodes.Definitions.Vehicle + ".Update", E = true, I = true, Deny = false}), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto{ IsPivot = true}) + }, + }); + #endregion + } + #endregion + + #region Psychologist + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Psychologist)) + { + var listFormPsychologist = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Psychologist, + Name = AppCodes.Definitions.Psychologist, + Title = AppCodes.Definitions.Psychologist, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Psychologist, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Psychologist)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Psychologist), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Psychologist))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Psychologist, Width = 650, Height = 500 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items =[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Phone", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order = 3, DataField = "Email", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "Address", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 5, DataField = "Status", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region Psychologist Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + // Id + new() + { + ListFormCode = listFormPsychologist.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Psychologist), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Name + new() + { + ListFormCode = listFormPsychologist.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 2, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Psychologist), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Phone + new() + { + ListFormCode = listFormPsychologist.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Phone", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Psychologist), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Email + new() + { + ListFormCode = listFormPsychologist.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Email", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleEmailJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Psychologist), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Address + new() + { + ListFormCode = listFormPsychologist.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address", + Width = 300, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Psychologist), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Status + new() + { + ListFormCode = listFormPsychologist.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 150, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Psychologist), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Lawyer + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Lawyer)) + { + var listFormLawyer = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Lawyer, + Name = AppCodes.Definitions.Lawyer, + Title = AppCodes.Definitions.Lawyer, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Lawyer, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Lawyer)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Lawyer), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Lawyer))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = ListFormCodes.Lists.Lawyer, Width = 700, Height = 700 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items =[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "ContactPerson", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Email", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "Address", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 5, DataField = "TaxOffice", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 6, DataField = "TaxNumber", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 7, DataField = "Phone1", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 8, DataField = "Phone2", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 9, DataField = "Phone3", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 10, DataField = "Phone4", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 11, DataField = "Fax", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 12, DataField = "Description", ColSpan = 1, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 13, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region Lawyer Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + // Id + new() + { + ListFormCode = listFormLawyer.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // String alanlar + new() + { + ListFormCode = listFormLawyer.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormLawyer.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ContactPerson", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormLawyer.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Email", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleEmailJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormLawyer.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address", + Width = 300, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormLawyer.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "TaxOffice", + Width = 150, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormLawyer.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "TaxNumber", + Width = 150, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Telefon ve Fax alanları + new() + { + ListFormCode = listFormLawyer.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Phone1", + Width = 150, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormLawyer.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Phone2", + Width = 150, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormLawyer.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Phone3", + Width = 150, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormLawyer.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Phone4", + Width = 150, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormLawyer.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Fax", + Width = 150, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Description ve Status + new() + { + ListFormCode = listFormLawyer.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 300, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormLawyer.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 120, + ListOrderNo = 14, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto{ C = AppCodes.Definitions.Lawyer + ".Create", R = AppCodes.Definitions.Lawyer, U = AppCodes.Definitions.Lawyer + ".Update", E = true, I = true, Deny = false }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto{ IsPivot = true }) + }, + }); + #endregion + } + #endregion + } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Coordinator.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Coordinator.cs new file mode 100644 index 00000000..f3401f60 --- /dev/null +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Coordinator.cs @@ -0,0 +1,2774 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Text.Json; +using System.Threading.Tasks; +using Kurs.Languages.Languages; +using Kurs.Platform.Entities; +using Kurs.Platform.Enums; +using Kurs.Platform.ListForms; +using Kurs.Platform.Queries; +using Microsoft.Extensions.Configuration; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; +using Volo.Abp.TenantManagement; +using AbpIdentity = Kurs.Platform.Data.Seeds.SeedConsts.AbpIdentity; +using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes; +using static Kurs.Platform.PlatformConsts; +using static Kurs.Platform.PlatformSeeder.SeederDefaults; + +namespace Kurs.Platform.Data.Seeds; + +public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDependency +{ + private readonly IRepository _listFormRepository; + private readonly IRepository _listFormFieldRepository; + private readonly IdentityUserManager _identityUserManager; + private readonly IdentityRoleManager _identityRoleManager; + private readonly IConfiguration _configuration; + + public ListFormSeeder_Coordinator( + IRepository listFormRepository, + IRepository listFormFieldRepository, + IdentityUserManager userManager, + IdentityRoleManager roleManager, + IConfiguration configuration) + { + _listFormRepository = listFormRepository; + _listFormFieldRepository = listFormFieldRepository; + _identityUserManager = userManager; + _identityRoleManager = roleManager; + _configuration = configuration; + } + + public async Task SeedAsync(DataSeedContext context) + { + #region FormQuestionPool + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormQuestionPool)) + { + var formQuestionPool = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.Form, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + SubFormsJson = JsonSerializer.Serialize(new List() { + new { + TabTitle = "Questions", + TabType = ListFormTabTypeEnum.List, + Code = ListFormCodes.Lists.Question, + Relation = new List() { + new { + ParentFieldName = "Id", + ChildFieldName = "QuestionPoolId" + } + } + } + }), + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Forms.FormQuestionPool, + Name = AppCodes.Definitions.QuestionPool, + Title = AppCodes.Definitions.QuestionPool, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.QuestionPool, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.QuestionPool)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.QuestionPool), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.QuestionPool))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.QuestionPool, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Tags", ColSpan = 2, EditorType2=EditorTypes.dxTagBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Question Pool Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = formQuestionPool.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formQuestionPool.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formQuestionPool.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 400, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formQuestionPool.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Tags", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.QuestionTagValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), + PivotSettingsJson = DefaultPivotSettingsJson, + } + }); + #endregion + } + #endregion + + #region Program + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Program)) + { + var listFormProgram = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Program, + Name = AppCodes.Definitions.Program, + Title = AppCodes.Definitions.Program, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Program, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Program)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Program), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Program))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Program, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region Program Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormProgram.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Program), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormProgram.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Program), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormProgram.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 250, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Program), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Schedule + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Schedule)) + { + var listFormSchedule = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Schedule, + Name = AppCodes.Definitions.Schedule, + Title = AppCodes.Definitions.Schedule, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = true, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Schedule, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Schedule)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Schedule), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Schedule))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Schedule, Width = 750, Height = 700 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order = 1, ColCount = 2, ColSpan = 2, ItemType = "group", + Items = [ + new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "StartTime", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "EndTime", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 6, DataField = "LessonMinute", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 7, DataField = "LessonBreakMinute", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 8, DataField = "LessonCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 9, DataField = "IncludeLunch", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 10, DataField = "LunchTime", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 11, DataField = "LunchMinute", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 12, DataField = "Monday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 13, DataField = "Tuesday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 14, DataField = "Wednesday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 15, DataField = "Thursday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 16, DataField = "Friday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 17, DataField = "Saturday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 18, DataField = "Sunday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 19, DataField = "Status", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IncludeLunch", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Monday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Tuesday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Wednesday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Thursday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Friday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Saturday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Sunday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region Schedule Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + // Id + new() { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 0, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // BranchId + new() { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "BranchId", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.BranchValues, + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Name + new() { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 2, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Status + new() { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto{ C = AppCodes.Definitions.Schedule + ".Create", R = AppCodes.Definitions.Schedule, U = AppCodes.Definitions.Schedule + ".Update", E = true, I = true, Deny = false}), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto{ IsPivot = true}) + }, + // Ders Saatleri + new() + { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "StartTime", + Width = 120, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "EndTime", + Width = 120, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "LessonMinute", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "LessonBreakMinute", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "LessonCount", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + + // Öğle Arası + new() + { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "LunchTime", + Width = 120, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "LunchMinute", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IncludeLunch", + Width = 100, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + + // Günler + new() + { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "Monday", + Width = 100, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "Tuesday", + Width = 100, + ListOrderNo = 14, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "Wednesday", + Width = 100, + ListOrderNo = 15, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "Thursday", + Width = 100, + ListOrderNo = 16, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "Friday", + Width = 100, + ListOrderNo = 17, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "Saturday", + Width = 100, + ListOrderNo = 18, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormSchedule.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "Sunday", + Width = 100, + ListOrderNo = 19, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), + PivotSettingsJson = DefaultPivotSettingsJson + }, + + }); + #endregion + } + #endregion + + #region RegistrationType + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.RegistrationType)) + { + var listFormRegistrationType = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.RegistrationType, + Name = AppCodes.Definitions.RegistrationType, + Title = AppCodes.Definitions.RegistrationType, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = true, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.RegistrationType, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.RegistrationType)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.RegistrationType), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.RegistrationType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.RegistrationType, Width = 500, Height = 300 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = [ + new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region RegistrationType Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + new() + { + ListFormCode = listFormRegistrationType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 0, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // BranchId + new() + { + ListFormCode = listFormRegistrationType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "BranchId", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.BranchValues, + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Name + new() + { + ListFormCode = listFormRegistrationType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Status + new() + { + ListFormCode = listFormRegistrationType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationType), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region RegistrationMethod + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.RegistrationMethod)) + { + var listFormRegistrationMethod = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.RegistrationMethod, + Name = AppCodes.Definitions.RegistrationMethod, + Title = AppCodes.Definitions.RegistrationMethod, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = true, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.RegistrationMethod, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.RegistrationMethod)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.RegistrationMethod), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.RegistrationMethod))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.RegistrationMethod, Width = 550, Height = 350 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = [ + new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "RegistrationTypeId", IsRequired = true, ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 4, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region RegistrationMethod Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + // Id + new() + { + ListFormCode = listFormRegistrationMethod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 0, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationMethod), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // BranchId + new() + { + ListFormCode = listFormRegistrationMethod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "BranchId", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.BranchValues, + CascadeEmptyFields = "RegistrationTypeId" + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationMethod), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // RegistrationTypeId + new() + { + ListFormCode = listFormRegistrationMethod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "RegistrationTypeId", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.RegistrationTypeValues, + CascadeRelationField = "BranchId", + CascadeFilterOperator="=", + CascadeParentFields = "BranchId", + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationMethod), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Name + new() + { + ListFormCode = listFormRegistrationMethod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationMethod), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Status + new() + { + ListFormCode = listFormRegistrationMethod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationMethod), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region ClassType + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ClassType)) + { + var listFormClassType = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.ClassType, + Name = AppCodes.Definitions.ClassType, + Title = AppCodes.Definitions.ClassType, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = true, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.ClassType, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ClassType)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.ClassType), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.ClassType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.ClassType, Width = 600, Height = 400 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = [ + new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "RegistrationTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 4, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "MinStudentCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 6, DataField = "MaxStudentCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 7, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region ClassType Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + // Id + new() + { + ListFormCode = listFormClassType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 0, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // BranchId + new() + { + ListFormCode = listFormClassType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "BranchId", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.BranchValues, + CascadeEmptyFields = "RegistrationTypeId" + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // RegistrationTypeId + new() + { + ListFormCode = listFormClassType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "RegistrationTypeId", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.RegistrationTypeValues, + CascadeRelationField = "BranchId", + CascadeFilterOperator="=", + CascadeParentFields = "BranchId", + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Name + new() + { + ListFormCode = listFormClassType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // MinStudentCount + new() + { + ListFormCode = listFormClassType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "MinStudentCount", + Width = 120, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // MaxStudentCount + new() + { + ListFormCode = listFormClassType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "MaxStudentCount", + Width = 120, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Status + new() + { + ListFormCode = listFormClassType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 150, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassType), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Class + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Class)) + { + var listFormClass = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Class, + Name = AppCodes.Definitions.Class, + Title = AppCodes.Definitions.Class, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = true, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Class, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Class)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Class), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Class))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Class, Width = 550, Height = 300 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = [ + new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "ClassTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 4, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region Class Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + // Id + new() + { + ListFormCode = listFormClass.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 0, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Class), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // BranchId + new() + { + ListFormCode = listFormClass.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "BranchId", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.BranchValues, + CascadeEmptyFields = "ClassTypeId" + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Class), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // ClassTypeId + new() + { + ListFormCode = listFormClass.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "ClassTypeId", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.ClassTypeValues, + CascadeRelationField = "BranchId", + CascadeFilterOperator="=", + CascadeParentFields = "BranchId", + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Class), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Name + new() + { + ListFormCode = listFormClass.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Class), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Status + new() + { + ListFormCode = listFormClass.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Class), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Level + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Level)) + { + var listFormLevel = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Level, + Name = AppCodes.Definitions.Level, + Title = AppCodes.Definitions.Level, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = true, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Level, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Level)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Level), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Level))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = ListFormCodes.Lists.Level, Width = 650, Height = 450 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = [ + new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "ClassTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "LevelType", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 4, DataField = "Order", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox}, + new EditingFormItemDto { Order = 5, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 6, DataField = "LessonCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 7, DataField = "LessonDuration", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 8, DataField = "MonthlyPaymentRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 9, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region Level Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + // Id + new() + { + ListFormCode = listFormLevel.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 0, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // BranchId + new() + { + ListFormCode = listFormLevel.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "BranchId", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.BranchValues, + CascadeEmptyFields = "ClassTypeId" + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // ClassTypeId + new() + { + ListFormCode = listFormLevel.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "ClassTypeId", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.ClassTypeValues, + CascadeRelationField = "BranchId", + CascadeFilterOperator="=", + CascadeParentFields = "BranchId", + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // LevelType + new() + { + ListFormCode = listFormLevel.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "LevelType", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Seviye",Name="Seviye" }, + new () { Key="Sınav Eğitimi",Name="Sınav Eğitimi" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Order + new() + { + ListFormCode = listFormLevel.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Order", + Width = 180, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Name + new() + { + ListFormCode = listFormLevel.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 180, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // LessonCount + new() + { + ListFormCode = listFormLevel.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "LessonCount", + Width = 120, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // LessonDuration + new() + { + ListFormCode = listFormLevel.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "LessonDuration", + Width = 120, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // MonthlyPaymentRate + new() + { + ListFormCode = listFormLevel.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "MonthlyPaymentRate", + Format = "fixedPoint", + Alignment = "right", + Width = 150, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Status + new() + { + ListFormCode = listFormLevel.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 150, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region ClassCancellationReason + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ClassCancellationReason)) + { + var listFormClassCancellationReason = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.ClassCancellationReason, + Name = AppCodes.Definitions.ClassCancellationReason, + Title = AppCodes.Definitions.ClassCancellationReason, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.ClassCancellationReason, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ClassCancellationReason)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.ClassCancellationReason), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.ClassCancellationReason))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.ClassCancellationReason, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region ClassCancellationReason Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormClassCancellationReason.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassCancellationReason), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormClassCancellationReason.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassCancellationReason), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormClassCancellationReason.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 250, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassCancellationReason), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region LessonPeriod + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.LessonPeriod)) + { + var listFormLessonPeriod = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.LessonPeriod, + Name = AppCodes.Definitions.LessonPeriod, + Title = AppCodes.Definitions.LessonPeriod, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = true, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.LessonPeriod, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.LessonPeriod)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.LessonPeriod), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.LessonPeriod))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.LessonPeriod, Width = 600, Height = 500 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = [ + new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "Day", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "Lesson1", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 6, DataField = "Lesson2", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 7, DataField = "Lesson3", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 8, DataField = "Lesson4", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region LessonPeriod Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + // Id + new() + { + ListFormCode = listFormLessonPeriod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 0, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // BranchId + new() + { + ListFormCode = listFormLessonPeriod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "BranchId", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.BranchValues, + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Name + new() + { + ListFormCode = listFormLessonPeriod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 2, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Day + new() + { + ListFormCode = listFormLessonPeriod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Day", + Width = 120, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 3, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Lesson1-4 + new() + { + ListFormCode = listFormLessonPeriod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Lesson1", + Width = 200, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Ana",Name="Ana Öğretmen" }, + new () { Key="Ek",Name="Ek Öğretmen" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormLessonPeriod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Lesson2", + Width = 200, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Ana",Name="Ana Öğretmen" }, + new () { Key="Ek",Name="Ek Öğretmen" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormLessonPeriod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Lesson3", + Width = 200, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Ana",Name="Ana Öğretmen" }, + new () { Key="Ek",Name="Ek Öğretmen" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormLessonPeriod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Lesson4", + Width = 200, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Ana",Name="Ana Öğretmen" }, + new () { Key="Ek",Name="Ek Öğretmen" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), + PivotSettingsJson = DefaultPivotSettingsJson + }, + }); + #endregion + } + #endregion + + #region QuestionTag + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.QuestionTag)) + { + var listFormTag = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.QuestionTag, + Name = AppCodes.Definitions.QuestionTag, + Title = AppCodes.Definitions.QuestionTag, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.QuestionTag, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.QuestionTag)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.QuestionTag), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.QuestionTag))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.QuestionTag, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Color", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxColorBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Tag Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormTag.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionTag), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTag.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionTag), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTag.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 400, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionTag), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTag.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Color", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionTag), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Question Pool + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.QuestionPool)) + { + var listFormQuestionPool = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.QuestionPool, + Name = AppCodes.Definitions.QuestionPool, + Title = AppCodes.Definitions.QuestionPool, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.QuestionPool, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.QuestionPool)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.QuestionPool), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.QuestionPool))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.QuestionPool, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Tags", ColSpan = 2, EditorType2=EditorTypes.dxTagBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Questions", + Text ="Questions", + UrlTarget="_blank", + AuthName = AppCodes.Definitions.Question, + Url=$"/admin/form/{ListFormCodes.Forms.FormQuestionPool}/@Id" + }, + }), + + } + ); + + #region Question Pool Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormQuestionPool.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormQuestionPool.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormQuestionPool.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 400, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormQuestionPool.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Tags", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.QuestionTagValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Question + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Question)) + { + var listFormQuestion = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Question, + Name = AppCodes.Definitions.Question, + Title = AppCodes.Definitions.Question, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Question, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Question)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Question), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Question))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Question, Width = 500, Height = 520 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Answers", + Text = "Answers", + AuthName = AppCodes.Definitions.Question, + DialogName = "QuestionAnswers", + DialogParameters = JsonSerializer.Serialize(new { + id = "@Id" + }) + }, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= [ + new EditingFormItemDto { Order = 1, DataField = "QuestionPoolId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 2, DataField = "QuestionType", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 3, DataField = "Points", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 4, DataField = "Title", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "Content", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 6, DataField = "Difficulty", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 7, DataField = "MediaType", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 8, DataField = "MediaUrl", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 9, DataField = "CorrectAnswer", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox, EditorOptions="{\"disabled\": true}" }, + new EditingFormItemDto { Order = 10, DataField = "TimeLimit", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 11, DataField = "Explanation", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "MediaType", FieldDbType = DbType.String, Value = "image", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Difficulty", FieldDbType = DbType.String, Value = "easy", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + } + ); + + #region Question Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "QuestionPoolId", + Width = 100, + ListOrderNo = 2, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.QuestionPoolValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "QuestionType", + Width = 120, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "multiple-choice", Name= "Çoktan Seçmeli" }, + new () { Key= "fill-blank", Name= "Boşluk Doldurma" }, + new () { Key= "multiple-answer", Name= "Çok Yanıtlı"}, + new () { Key= "matching", Name= "Eşleştirme" }, + new () { Key= "ordering", Name= "Sıralama" }, + new () { Key= "open-ended", Name= "Açık Uçlu" }, + new () { Key= "true-false", Name= "Doğru-Yanlış" }, + new () { Key= "calculation", Name="Hesaplama" } + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Points", + Format = "fixedPoint", + Alignment = "right", + Width = 60, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Title", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Content", + Width = 350, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "MediaType", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "image", Name= "Image" }, + new () { Key= "video", Name= "Video" }, + }), + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "MediaUrl", + Width = 170, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "CorrectAnswer", + Width = 150, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Difficulty", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "easy", Name= "Easy" }, + new () { Key= "medium", Name= "Medium" }, + new () { Key= "hard", Name= "Hard" }, + }), + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "TimeLimit", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Explanation", + Width = 100, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Crm.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Crm.cs new file mode 100644 index 00000000..483d7687 --- /dev/null +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Crm.cs @@ -0,0 +1,199 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Text.Json; +using System.Threading.Tasks; +using Kurs.Languages.Languages; +using Kurs.Platform.Entities; +using Kurs.Platform.Enums; +using Kurs.Platform.ListForms; +using Kurs.Platform.Queries; +using Microsoft.Extensions.Configuration; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; +using Volo.Abp.TenantManagement; +using AbpIdentity = Kurs.Platform.Data.Seeds.SeedConsts.AbpIdentity; +using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes; +using static Kurs.Platform.PlatformConsts; +using static Kurs.Platform.PlatformSeeder.SeederDefaults; + +namespace Kurs.Platform.Data.Seeds; + +public class ListFormSeeder_Crm : IDataSeedContributor, ITransientDependency +{ + private readonly IRepository _listFormRepository; + private readonly IRepository _listFormFieldRepository; + private readonly IdentityUserManager _identityUserManager; + private readonly IdentityRoleManager _identityRoleManager; + private readonly IConfiguration _configuration; + + public ListFormSeeder_Crm( + IRepository listFormRepository, + IRepository listFormFieldRepository, + IdentityUserManager userManager, + IdentityRoleManager roleManager, + IConfiguration configuration) + { + _listFormRepository = listFormRepository; + _listFormFieldRepository = listFormFieldRepository; + _identityUserManager = userManager; + _identityRoleManager = roleManager; + _configuration = configuration; + } + + public async Task SeedAsync(DataSeedContext context) + { + // #region Material Type + // if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MaterialType)) + // { + // var listFormMaterialType = await _listFormRepository.InsertAsync( + // new ListForm() + // { + // ListFormType = ListFormTypeEnum.List, + // IsSubForm = false, + // LayoutJson = DefaultLayoutJson, + // CultureName = LanguageCodes.En, + // ListFormCode = ListFormCodes.Lists.MaterialType, + // Name = AppCodes.SupplyChain.MaterialType, + // Title = AppCodes.SupplyChain.MaterialType, + // DataSourceCode = SeedConsts.DataSources.DefaultCode, + // IsTenant = true, + // IsBranch = false, + // IsOrganizationUnit = false, + // Description = AppCodes.SupplyChain.MaterialType, + // SelectCommandType = SelectCommandTypeEnum.Table, + // SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialType)), + // KeyFieldName = "Id", + // KeyFieldDbSourceType = DbType.Guid, + // DefaultFilter = DefaultFilterJson, + // SortMode = GridOptions.SortModeSingle, + // FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + // HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + // SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + // GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + // SelectionJson = DefaultSelectionSingleJson, + // ColumnOptionJson = DefaultColumnOptionJson, + // PermissionJson = DefaultPermissionJson(AppCodes.SupplyChain.MaterialType), + // DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + // DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + // new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + // new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + // }), + // PagerOptionJson = DefaultPagerOptionJson, + // EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + // { + // Popup = new GridEditingPopupDto() { Title = AppCodes.SupplyChain.MaterialType, Width = 500, Height = 250 }, + // AllowDeleting = true, + // AllowAdding = true, + // AllowUpdating = true, + // SendOnlyChangedFormValuesUpdate = false, + // }), + // EditingFormJson = JsonSerializer.Serialize(new List() { + // new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + // new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + // new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + // new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextArea }, + // new EditingFormItemDto { Order = 4, DataField = "IsActive", ColSpan = 2, EditorType2=EditorTypes.dxCheckBox }, + // ]} + // }), + // InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + // new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + // new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + // new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + // }), + // FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + // new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + // }), + // } + // ); + + // #region MaterialType Fields + // await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.Guid, + // FieldName = "Id", + // Width = 100, + // ListOrderNo = 1, + // Visible = false, + // IsActive = true, + // IsDeleted = false, + // ValidationRuleJson = DefaultValidationRuleRequiredJson, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.String, + // FieldName = "Code", + // Width = 150, + // ListOrderNo = 2, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // AllowSearch = true, + // ValidationRuleJson = DefaultValidationRuleRequiredJson, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.String, + // FieldName = "Name", + // Width = 350, + // ListOrderNo = 3, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // SortIndex = 1, + // SortDirection = GridColumnOptions.SortOrderAsc, + // AllowSearch = true, + // ValidationRuleJson = DefaultValidationRuleRequiredJson, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.String, + // FieldName = "Description", + // Width = 500, + // ListOrderNo = 4, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // AllowSearch = true, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.Boolean, + // FieldName = "IsActive", + // Width = 100, + // ListOrderNo = 5, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // AllowSearch = true, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // } + // }); + // #endregion + // } + // #endregion + } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Hr.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Hr.cs new file mode 100644 index 00000000..297e09b2 --- /dev/null +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Hr.cs @@ -0,0 +1,5043 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Text.Json; +using System.Threading.Tasks; +using Kurs.Languages.Languages; +using Kurs.Platform.Entities; +using Kurs.Platform.Enums; +using Kurs.Platform.ListForms; +using Kurs.Platform.Queries; +using Microsoft.Extensions.Configuration; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; +using Volo.Abp.TenantManagement; +using AbpIdentity = Kurs.Platform.Data.Seeds.SeedConsts.AbpIdentity; +using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes; +using static Kurs.Platform.PlatformConsts; +using static Kurs.Platform.PlatformSeeder.SeederDefaults; + +namespace Kurs.Platform.Data.Seeds; + +public class ListFormSeeder_Hr : IDataSeedContributor, ITransientDependency +{ + private readonly IRepository _listFormRepository; + private readonly IRepository _listFormFieldRepository; + private readonly IdentityUserManager _identityUserManager; + private readonly IdentityRoleManager _identityRoleManager; + private readonly IConfiguration _configuration; + + public ListFormSeeder_Hr( + IRepository listFormRepository, + IRepository listFormFieldRepository, + IdentityUserManager userManager, + IdentityRoleManager roleManager, + IConfiguration configuration) + { + _listFormRepository = listFormRepository; + _listFormFieldRepository = listFormFieldRepository; + _identityUserManager = userManager; + _identityRoleManager = roleManager; + _configuration = configuration; + } + + public async Task SeedAsync(DataSeedContext context) + { + #region FormSurvey + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormSurvey)) + { + var formSurvey = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.Form, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + SubFormsJson = JsonSerializer.Serialize(new List() { + new { + TabTitle = "Questions", + TabType = ListFormTabTypeEnum.List, + Code = ListFormCodes.Lists.SurveyQuestion, + Relation = new List() { + new { + ParentFieldName = "Id", + ChildFieldName = "SurveyId" + } + } + }, + new { + TabTitle = "Responses", + TabType = ListFormTabTypeEnum.List, + Code = ListFormCodes.Lists.SurveyResponse, + Relation = new List() { + new { + ParentFieldName = "Id", + ChildFieldName = "SurveyId" + } + } + } + }), + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Forms.FormSurvey, + Name = AppCodes.Hr.Survey, + Title = AppCodes.Hr.Survey, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.Survey, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Survey)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.Survey), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Survey))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Survey, Width = 500, Height = 450 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField = "Title", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Description", IsRequired = true, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 3, DataField = "Deadline", IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 4, DataField = "Status", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 5, DataField = "IsAnonymous", IsRequired = true, EditorType2 = EditorTypes.dxCheckBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "IsAnonymous", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "draft", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Survey Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = formSurvey.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formSurvey.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Title", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formSurvey.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "Deadline", + Width = 100, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formSurvey.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Responses", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formSurvey.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "draft", Name= "Draft" }, + new () { Key= "active", Name= "Active" }, + new () { Key= "closed", Name= "Closed" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new() { + ListFormCode = formSurvey.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsAnonymous", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + ]); + #endregion + } + #endregion + + #region EmploymentType + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.EmploymentType)) + { + var listFormEmploymentType = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.EmploymentType, + Name = AppCodes.Hr.EmploymentType, + Title = AppCodes.Hr.EmploymentType, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.EmploymentType, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.EmploymentType)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.EmploymentType), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.EmploymentType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.EmploymentType, Width = 500, Height = 200 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField="Name", ColSpan = 2, IsRequired =true, EditorType2 = EditorTypes.dxTextBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new CommandColumnDto() { + Hint = "Personel Listesi", + Text ="Personel Listesi", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Employee, + Url="/admin/list/list-employees/@Id" + }, + }), + } + ); + + #region Employment Type Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormEmploymentType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.EmploymentType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmploymentType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.EmploymentType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region JobPosition + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.JobPosition)) + { + var listFormJobPosition = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.JobPosition, + Name = AppCodes.Hr.JobPosition, + Title = AppCodes.Hr.JobPosition, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.JobPosition, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.JobPosition)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.JobPosition), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.JobPosition))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.JobPosition, Width = 500, Height = 600 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField="Code", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField="Name", ColSpan = 2, IsRequired =true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField="Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 4, DataField="DepartmentId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 5, DataField="Level", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 6, DataField="MinSalary", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 7, DataField="MaxSalary", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 8, DataField="CurrencyId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 9, DataField="RequiredSkills", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 10, DataField="Responsibilities", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 11, DataField="Qualifications", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 12, DataField="IsActive", ColSpan = 2, EditorType2 = EditorTypes.dxCheckBox} + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new CommandColumnDto() { + Hint = "Personel Listesi", + Text ="Personel Listesi", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Employee, + Url="/admin/list/list-employees/@Id" + }, + }), + } + ); + + #region Job Position Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormJobPosition.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormJobPosition.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormJobPosition.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormJobPosition.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 400, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormJobPosition.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "DepartmentId", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.DepartmentValues + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormJobPosition.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Level", + Width = 80, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "Entry", Name= "Entry" }, + new () { Key= "Junior", Name= "Junior" }, + new () { Key= "Mid", Name= "Mid"}, + new () { Key= "Senior", Name= "Senior" }, + new () { Key= "Lead", Name= "Lead" }, + new () { Key= "Manager", Name= "Manager" }, + new () { Key= "Director", Name= "Director" }, + new () { Key= "Executive", Name= "Executive" }, + }), + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormJobPosition.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "MinSalary", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormJobPosition.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "MaxSalary", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormJobPosition.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "CurrencyId", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.CurrencyValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormJobPosition.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "RequiredSkills", + Width = 400, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormJobPosition.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Responsibilities", + Width = 400, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormJobPosition.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Qualifications", + Width = 400, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormJobPosition.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Department + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Department)) + { + var listFormDepartment = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Department, + Name = AppCodes.Hr.Department, + Title = AppCodes.Hr.Department, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.Department, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Department)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.Department), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Department))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Department, Width = 500, Height = 520 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField="Code", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField="Name", ColSpan = 2, IsRequired =true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField="Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 4, DataField="ParentDepartmentId", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 5, DataField="ManagerId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 6, DataField="CostCenterId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 7, DataField="Budget", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 8, DataField="IsActive", ColSpan = 2, EditorType2 = EditorTypes.dxCheckBox} + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new CommandColumnDto() { + Hint = "Personel Listesi", + Text ="Personel Listesi", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Employee, + Url="/admin/list/list-employees/@Id" + }, + }), + } + ); + + #region Department Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormDepartment.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormDepartment.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormDepartment.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormDepartment.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 300, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormDepartment.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "ParentDepartmentId", + Width = 200, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.DepartmentValues + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormDepartment.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "ManagerId", + Width = 200, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmployeeValues + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormDepartment.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "CostCenterId", + Width = 200, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.CostCenterValues + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormDepartment.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Budget", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormDepartment.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Badge + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Badge)) + { + var listFormBadge = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Badge, + Name = AppCodes.Hr.Badge, + Title = AppCodes.Hr.Badge, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.Badge, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Badge)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.Badge), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Badge))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Badge, Width = 500, Height = 520 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items = [ + new EditingFormItemDto { Order = 1, DataField="Code", ColSpan = 2, IsRequired =true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField="Name", ColSpan = 2, IsRequired =true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField="Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 4, DataField="Icon", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 5, DataField="Color", ColSpan = 2, EditorType2 = EditorTypes.dxColorBox }, + new EditingFormItemDto { Order = 6, DataField="BackgroundColor", ColSpan = 2, EditorType2 = EditorTypes.dxColorBox }, + new EditingFormItemDto { Order = 7, DataField="Category", ColSpan = 2, IsRequired =true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 8, DataField="Criteria", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 9, DataField="Points", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 10, DataField="Rarity", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 11, DataField="IsActive", ColSpan = 2, EditorType2 = EditorTypes.dxCheckBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Badge Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormBadge.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBadge.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBadge.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBadge.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 400, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBadge.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Icon", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "⭐", Name= "⭐ Yıldız" }, + new () { Key= "🏆", Name= "🏆 Kupa" }, + new () { Key= "🥇", Name= "🥇 Altın Madalya" }, + new () { Key= "🥈", Name= "🥈 Gümüş Madalya" }, + new () { Key= "🥉", Name= "🥉 Bronz Madalya" }, + new () { Key= "👑", Name= "👑 Taç" }, + new () { Key= "💎", Name= "💎 Elmas" }, + new () { Key= "💡", Name= "💡 Ampul" }, + new () { Key= "🔥", Name= "🔥 Ateş" }, + new () { Key= "⚡", Name= "⚡ Şimşek" }, + new () { Key= "🎯", Name= "🎯 Hedef" }, + new () { Key= "📈", Name= "📈 Grafik" }, + new () { Key= "🚀", Name= "🚀 Roket" }, + new () { Key= "💪", Name= "💪 Güç" }, + new () { Key= "❤️", Name= "❤️ Kalp" } + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBadge.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Color", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBadge.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "BackgroundColor", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBadge.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Category", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "Performance", Name= "Performance" }, + new () { Key= "Leadership", Name= "Leadership" }, + new () { Key= "Innovation", Name= "Innovation" }, + new () { Key= "Teamwork", Name= "Teamwork" }, + new () { Key= "Customer", Name= "Customer" }, + new () { Key= "Safety", Name= "Safety" }, + new () { Key= "Attendance", Name= "Attendance" }, + new () { Key= "Training", Name= "Training" }, + new () { Key= "Project", Name= "Project" }, + new () { Key= "Special", Name= "Special" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBadge.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Criteria", + Width = 400, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBadge.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Points", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBadge.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Rarity", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "Common", Name= "Common" }, + new () { Key= "Uncommon", Name= "Uncommon" }, + new () { Key= "Rare", Name= "Rare" }, + new () { Key= "Epic", Name= "Epic" }, + new () { Key= "Legendary", Name= "Legendary" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBadge.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Cost Centers + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.CostCenter)) + { + var listFormCostCenter = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.CostCenter, + Name = AppCodes.Hr.CostCenter, + Title = AppCodes.Hr.CostCenter, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.CostCenter, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.CostCenter)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.CostCenter), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.CostCenter))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.CostCenter, Width = 500, Height = 520 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField="Code", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField="Name", ColSpan = 2, IsRequired =true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField="Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 4, DataField="ParentCostCenterId", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 5, DataField="ResponsibleEmployeeId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 6, DataField="DepartmentId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 7, DataField="CostCenterType", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 8, DataField="BudgetedAmount", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 9, DataField="ActualAmount", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 10, DataField="CurrencyId", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 11, DataField="FiscalYear", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 12, DataField="IsActive", ColSpan = 2, EditorType2 = EditorTypes.dxCheckBox} + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Cost Center Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormCostCenter.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCostCenter.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCostCenter.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCostCenter.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 300, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCostCenter.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "ParentCostCenterId", + Width = 200, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.CostCenterValues + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCostCenter.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "ResponsibleEmployeeId", + Width = 200, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmployeeValues + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCostCenter.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "DepartmentId", + Width = 200, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.DepartmentValues + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCostCenter.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "CostCenterType", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "Revenue", Name= "Revenue" }, + new () { Key= "Standard", Name= "Standard" }, + new () { Key= "Discretionary", Name= "Discretionary"}, + new () { Key= "Investment", Name= "Investment" }, + new () { Key= "Service", Name= "Service" }, + new () { Key= "Production", Name= "Production" }, + new () { Key= "Support", Name= "Support" }, + new () { Key= "Administrative", Name="Administrative" } + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCostCenter.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "BudgetedAmount", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCostCenter.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "ActualAmount", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCostCenter.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "CurrencyId", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.CurrencyValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCostCenter.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "FiscalYear", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormCostCenter.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Employees + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Employee)) + { + var listFormEmployee = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Employee, + Name = AppCodes.Hr.Employee, + Title = AppCodes.Hr.Employee, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.Employee, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Employee)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.Employee), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Employee))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Employee, Width = 1000, Height = 520 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, Caption="General", ColCount=1, ColSpan=1, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField="Code", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField="FullName", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField="NationalId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField="BirthDate", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 5, DataField="Gender", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 6, DataField="MaritalStatus", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 7, DataField="EmployeeStatus", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 8, DataField="IsActive", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + ]}, + new() { + Order=2, Caption="Contact", ColCount=1, ColSpan=1, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField="Country", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 2, DataField="City", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 3, DataField="District", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 4, DataField="Street", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 5, DataField="PostalCode", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 6, DataField="Phone", ColSpan = 1, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order = 7, DataField="PersonalPhone", ColSpan = 1, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order = 8, DataField="Email", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 9, DataField="Address1", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 10, DataField="Address2", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + ]}, + new() { + Order=3, Caption="Job", ColCount=1, ColSpan=1, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField="HireDate", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 2, DataField="TerminationDate", ColSpan = 1, EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 3, DataField="EmploymentTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 4, DataField="JobPositionId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 5, DataField="DepartmentId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 6, DataField="WorkLocation", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 7, DataField="ManagerId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 8, DataField="BaseSalary", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, + new EditingFormItemDto { Order = 9, DataField="CurrencyId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 10, DataField="PayrollGroup", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 11, DataField="BankAccountId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 12, DataField="BadgeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + ]}, + new() { + Order=4, Caption="Emergency", ColCount=1, ColSpan=1, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField="EmergencyContactName", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField="EmergencyContactRelationship", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField="EmergencyContactPhone", ColSpan = 1, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + ]}, + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Employee Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "FullName", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "NationalId", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "BirthDate", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Gender", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "Male", Name= "Male"}, + new () { Key= "Female", Name= "Female" }, + new () { Key= "Other", Name= "Other" }, + }), + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "MaritalStatus", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "Single", Name= "Single"}, + new () { Key= "Married", Name= "Married" }, + new () { Key= "Divorced", Name= "Divorced" }, + new () { Key= "Widowed", Name= "Widowed" }, + }), + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "EmployeeStatus", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "Active", Name= "Active"}, + new () { Key= "Inactive", Name= "Inactive" }, + new () { Key= "OnLeave", Name= "OnLeave" }, + new () { Key= "Suspended", Name= "Suspended" }, + new () { Key= "Terminated", Name= "Terminated" }, + }), + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address1", + Width = 200, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address2", + Width = 200, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Country", + Width = 100, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CountryValues, + CascadeEmptyFields = "City,District,Street" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "City", + Width = 100, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CityValues, + CascadeRelationField = "Country", + CascadeFilterOperator="=", + CascadeParentFields = "Country", + CascadeEmptyFields = "District,Street" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "District", + Width = 100, + ListOrderNo = 14, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.DistrictValues, + CascadeRelationField = "City", + CascadeFilterOperator="=", + CascadeParentFields = "Country,City", + CascadeEmptyFields = "Street", + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "PostalCode", + Width = 100, + ListOrderNo = 15, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Phone", + Width = 100, + ListOrderNo = 16, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "PersonalPhone", + Width = 100, + ListOrderNo = 17, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Email", + Width = 200, + ListOrderNo = 18, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleEmailJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "EmergencyContactName", + Width = 100, + ListOrderNo = 19, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "EmergencyContactRelationship", + Width = 100, + ListOrderNo = 20, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "EmergencyContactPhone", + Width = 150, + ListOrderNo = 21, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "HireDate", + Width = 100, + ListOrderNo = 22, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "TerminationDate", + Width = 100, + ListOrderNo = 23, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "EmploymentTypeId", + Width = 200, + ListOrderNo = 24, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmploymentTypeValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "JobPositionId", + Width = 100, + ListOrderNo = 25, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.JobPositionValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "DepartmentId", + Width = 100, + ListOrderNo = 26, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.DepartmentValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "WorkLocation", + Width = 150, + ListOrderNo = 27, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "ManagerId", + Width = 100, + ListOrderNo = 28, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmployeeValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "BaseSalary", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 29, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "CurrencyId", + Width = 100, + ListOrderNo = 30, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.CurrencyValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "PayrollGroup", + Width = 100, + ListOrderNo = 31, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "Hours", Name= "Hours" }, + new () { Key= "Weeks", Name= "Weeks" }, + new () { Key= "Months", Name= "Months" } + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "BankAccountId", + Width = 100, + ListOrderNo = 32, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.BankAccountValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEmployee.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "BadgeId", + Width = 100, + ListOrderNo = 33, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.BadgeValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Leave + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Leave)) + { + var listFormLeave = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Leave, + Name = AppCodes.Hr.Leave, + Title = AppCodes.Hr.Leave, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.Leave, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Leave)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.Leave), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Leave))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Leave, Width = 500, Height = 520 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField = "AppliedDate", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox}, + new EditingFormItemDto { Order = 2, DataField = "EmployeeId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 3, DataField = "LeaveType", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 4, DataField = "StartDate", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox, EditorScript = EditorScriptValues.CalcTotalDaysFromDates}, + new EditingFormItemDto { Order = 5, DataField = "EndDate", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox, EditorScript = EditorScriptValues.CalcTotalDaysFromDates}, + new EditingFormItemDto { Order = 6, DataField = "TotalDays", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.Disabled}, + new EditingFormItemDto { Order = 7, DataField = "IsHalfDay", ColSpan = 2, EditorType2 = EditorTypes.dxCheckBox}, + new EditingFormItemDto { Order = 8, DataField = "Reason", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextArea}, + new EditingFormItemDto { Order = 9, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox}, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Pending", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "AppliedDate", FieldDbType = DbType.Date, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsHalfDay", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + ButtonPosition = UiCommandButtonPositionTypeEnum.Toolbar, + Hint = "Toplu İzin", + Text ="Toplu İzin", + AuthName = AppCodes.Hr.Leave + ".Update", + DialogName = "CollectiveLeave", + DialogParameters = JsonSerializer.Serialize(new { + name = "@Name", + id = "@Id" + }) + }, + new() { + Hint = "Accept", + Text ="Accept", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Leave + ".Update", + Url="/admin/list/list-employees/@Id" + }, + new() { + Hint = "Reject", + Text ="Reject", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Leave + ".Update", + Url="/admin/list/list-employees/@Id" + }, + }), + } + ); + + #region Leave Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormLeave.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormLeave.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "EmployeeId", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmployeeValues + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormLeave.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "LeaveType", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "Annual", Name= "Annual" }, + new () { Key= "Sick", Name= "Sick" }, + new () { Key= "Maternity", Name= "Maternity"}, + new () { Key= "Paternity", Name= "Paternity" }, + new () { Key= "Personal", Name= "Personal" }, + new () { Key= "Emergency", Name= "Emergency" }, + new () { Key= "Study", Name= "Study" }, + new () { Key= "Unpaid", Name="Unpaid" } + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormLeave.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "StartDate", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormLeave.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "EndDate", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormLeave.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "TotalDays", + Alignment = "right", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormLeave.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsHalfDay", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormLeave.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Reason", + Width = 250, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormLeave.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "Pending", Name= "Pending" }, + new () { Key= "Approved", Name= "Approved" }, + new () { Key= "Rejected", Name= "Rejected"}, + new () { Key= "Cancelled", Name= "Cancelled" }, + }), + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormLeave.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "AppliedDate", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormLeave.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "ApprovedById", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmployeeValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormLeave.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "ApprovedDate", + Width = 100, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormLeave.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "RejectionReason", + Width = 250, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Overtime + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Overtime)) + { + var listFormOvertime = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Overtime, + Name = AppCodes.Hr.Overtime, + Title = AppCodes.Hr.Overtime, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.Overtime, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Overtime)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.Overtime), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Overtime))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Overtime, Width = 500, Height = 520 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField = "Date", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox}, + new EditingFormItemDto { Order = 2, DataField = "EmployeeId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 4, DataField = "StartTime", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox, EditorOptions = EditorOptionValues.TimeSpanOptions, EditorScript = EditorScriptValues.CalcTotalHoursFromTimes}, + new EditingFormItemDto { Order = 5, DataField = "EndTime", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox, EditorOptions = EditorOptionValues.TimeSpanOptions, EditorScript = EditorScriptValues.CalcTotalHoursFromTimes}, + new EditingFormItemDto { Order = 6, DataField = "TotalHours", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.Disabled}, + new EditingFormItemDto { Order = 7, DataField = "Reason", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextArea}, + new EditingFormItemDto { Order = 8, DataField = "Rate", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox}, + new EditingFormItemDto { Order = 9, DataField = "Amount", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.Disabled}, + new EditingFormItemDto { Order = 10, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox}, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Pending", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Date", FieldDbType = DbType.Date, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + ButtonPosition = UiCommandButtonPositionTypeEnum.Toolbar, + Hint = "Toplu Mesai", + Text ="Toplu Mesai", + AuthName = AppCodes.Hr.Overtime + ".Update", + DialogName = "CollectiveOvertime", + DialogParameters = JsonSerializer.Serialize(new { + name = "@Name", + id = "@Id" + }) + }, + new() { + Hint = "Accept", + Text ="Accept", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Overtime + ".Update", + Url="/admin/list/list-employees/@Id" + }, + new() { + Hint = "Reject", + Text ="Reject", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Overtime + ".Update", + Url="/admin/list/list-employees/@Id" + }, + }), + } + ); + + #region Overtime Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormOvertime.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormOvertime.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "EmployeeId", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmployeeValues + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormOvertime.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "StartTime", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormOvertime.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "EndTime", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormOvertime.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "TotalHours", + Alignment = "right", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormOvertime.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Reason", + Width = 250, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormOvertime.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Rate", + Width = 150, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= 1.5, Name= "x1.5 (Normal Mesai)" }, + new () { Key= 2.0, Name= "x2.0 (Hafta Sonu/Tatil)" }, + new () { Key= 2.5, Name= "x2.5 (Resmi Tatil)"}, + }), + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormOvertime.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Amount", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormOvertime.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "Pending", Name= "Pending" }, + new () { Key= "Approved", Name= "Approved" }, + new () { Key= "Rejected", Name= "Rejected"}, + new () { Key= "Cancelled", Name= "Cancelled" }, + }), + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormOvertime.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "Date", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormOvertime.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "ApprovedById", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmployeeValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormOvertime.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "ApprovedDate", + Width = 100, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormOvertime.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "RejectionReason", + Width = 250, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Expense Request + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Expense)) + { + var listFormExpense = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Expense, + Name = AppCodes.Hr.Expense, + Title = AppCodes.Hr.Expense, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.Expense, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Expense)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.Expense), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Expense))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Expense, Width = 500, Height = 450 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField = "EmployeeId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 2, DataField = "Category", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 3, DataField = "Amount", IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 4, DataField = "CurrencyId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 5, DataField = "RequestDate", IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 6, DataField = "Description", EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 7, DataField = "Project", EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 8, DataField = "Status", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 9, DataField = "Notes", EditorType2 = EditorTypes.dxTextArea }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "RequestDate", FieldDbType = DbType.Date, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Accept", + Text ="Accept", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Expense + ".Update", + Url="/admin/list/list-employees/@Id" + }, + new() { + Hint = "Reject", + Text ="Reject", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Expense + ".Update", + Url="/admin/list/list-employees/@Id" + }, + }), + } + ); + + #region Expense Request Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormExpense.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormExpense.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "EmployeeId", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmployeeValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormExpense.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Category", + Width = 100, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "travel", Name= "Travel" }, + new () { Key= "meal", Name= "Meal" }, + new () { Key= "accommodation", Name= "Accommodation" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormExpense.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Amount", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormExpense.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "CurrencyId", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.CurrencyValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormExpense.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "RequestDate", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormExpense.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 250, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormExpense.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Project", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormExpense.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "pending", Name= "Pending" }, + new () { Key= "approved", Name= "Approved" }, + new () { Key= "rejected", Name= "Rejected" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormExpense.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Notes", + Width = 200, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormExpense.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "RejectionReason", + Width = 200, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Payroll + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Payroll)) + { + var listFormPayroll = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Payroll, + Name = AppCodes.Hr.Payroll, + Title = AppCodes.Hr.Payroll, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.Payroll, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Payroll)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.Payroll), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Payroll))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Payroll, Width = 400, Height = 520 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items = [ + new EditingFormItemDto { Order = 1, DataField = "EmployeeId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 2, DataField = "PeriodYear", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 3, DataField = "PeriodMonth", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 4, DataField = "PaymentDate", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 5, DataField = "BaseSalary", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, + new EditingFormItemDto { Order = 6, DataField = "Overtime", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, + new EditingFormItemDto { Order = 7, DataField = "Bonus", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, + new EditingFormItemDto { Order = 8, DataField = "GrossSalary", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, + new EditingFormItemDto { Order = 9, DataField = "NetSalary", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, + new EditingFormItemDto { Order = 10, DataField = "Tax", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, + new EditingFormItemDto { Order = 11, DataField = "SocialSecurity", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, + new EditingFormItemDto { Order = 12, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox}, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Draft", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "PeriodYear", FieldDbType = DbType.Int32, Value = "@YEAR", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "PeriodMonth", FieldDbType = DbType.Int32, Value = "@MONTH", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "PaymentDate", FieldDbType = DbType.Date, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "BaseSalary", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Overtime", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Bonus", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "GrossSalary", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "NetSalary", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Tax", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "SocialSecurity", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + ButtonPosition = UiCommandButtonPositionTypeEnum.Toolbar, + Hint = "Toplu Bordro", + Text ="Toplu Bordro", + AuthName = AppCodes.Hr.Payroll + ".Update", + DialogName = "CollectivePayroll", + DialogParameters = JsonSerializer.Serialize(new { + name = "@Name", + id = "@Id" + }) + }, + new() { + Hint = "Ödeme & Kesinti", + Text ="Ödeme & Kesinti", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Payroll + ".Update", + Url="/admin/list/list-employees/@Id" + }, + new() { + Hint = "Accept", + Text ="Accept", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Payroll + ".Update", + Url="/admin/list/list-employees/@Id" + }, + new() { + Hint = "Reject", + Text ="Reject", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Payroll + ".Update", + Url="/admin/list/list-employees/@Id" + }, + }), + } + ); + + #region Payroll Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormPayroll.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPayroll.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "EmployeeId", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmployeeValues + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPayroll.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "PeriodYear", + Width = 100, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPayroll.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "PeriodMonth", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= 1, Name= "01-Ocak" }, + new () { Key= 2, Name= "02-Şubat" }, + new () { Key= 3, Name= "03-Mart"}, + new () { Key= 4, Name= "04-Nisan" }, + new () { Key= 5, Name= "05-Mayıs" }, + new () { Key= 6, Name= "06-Haziran" }, + new () { Key= 7, Name= "07-Temmuz" }, + new () { Key= 8, Name= "08-Ağustos" }, + new () { Key= 9, Name= "09-Eylül" }, + new () { Key=10, Name= "10-Ekim" }, + new () { Key=11, Name= "11-Kasım" }, + new () { Key=12, Name= "12-Aralık" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPayroll.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "PaymentDate", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPayroll.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "BaseSalary", + Format = "fixedPoint", + Alignment = "right", + Width = 150, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPayroll.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Overtime", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPayroll.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Bonus", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPayroll.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "GrossSalary", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPayroll.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "NetSalary", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPayroll.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Tax", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPayroll.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "SocialSecurity", + Alignment = "right", + Format = "fixedPoint", + Width = 100, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), + PivotSettingsJson = DefaultPivotSettingsJson + }, + + new() { + ListFormCode = listFormPayroll.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 100, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "Draft", Name= "Draft" }, + new () { Key= "Calculated", Name= "Calculated" }, + new () { Key= "Approved", Name= "Approved"}, + new () { Key= "Paid", Name= "Paid" }, + new () { Key= "Cancelled", Name= "Cancelled" }, + }), + }), + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Template 360 + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Payroll)) + { + var listFormTemplate360 = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Template360, + Name = AppCodes.Hr.Template360, + Title = AppCodes.Hr.Template360, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.Template360, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Template360)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.Template360), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Template360))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Template360, Width = 400, Height = 520 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 4, DataField = "AssessorTypes", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxTagBox }, + new EditingFormItemDto { Order = 3, DataField = "IsActive", ColSpan = 2, EditorType2 = EditorTypes.dxCheckBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Questions", + Text = "Questions", + AuthName = TenantManagementPermissions.Tenants.ManageConnectionStrings, + DialogName = "Template360Questions", + DialogParameters = JsonSerializer.Serialize(new { + name = "@Name", + id = "@Id" + }) + }, + }), + } + ); + + #region Template 360 Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormTemplate360.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Template360), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTemplate360.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Template360), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTemplate360.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 450, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Template360), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTemplate360.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "AssessorTypes", + Width = 500, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "self", Name= "Self" }, + new () { Key= "manager", Name= "Manager" }, + new () { Key= "peer", Name= "Peer"}, + new () { Key= "subordinate", Name= "Subordinate" }, + new () { Key= "customer", Name= "Customer" }, + new () { Key= "otherDepartment", Name= "OtherDepartment" }, + new () { Key= "hrUpperManagement", Name= "HRUpperManagement" }, + new () { Key= "external", Name= "External" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Template360), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Performans 360 + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Performance360)) + { + var listFormPerformans360 = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Performance360, + Name = AppCodes.Hr.Performance360, + Title = AppCodes.Hr.Performance360, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.Performance360, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Performance360)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.Performance360), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Performance360))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Performance360, Width = 500, Height = 520 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 3, DataField = "TemplateId", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 4, DataField = "StartDate", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 5, DataField = "EndDate", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 6, DataField = "Status", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 7, DataField = "DepartmentId", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 8, DataField = "TargetEmployees", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxTagBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Draft", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Evaluations", + Text = "Evaluations", + AuthName = TenantManagementPermissions.Tenants.ManageConnectionStrings, + DialogName = "Evaluation360", + DialogParameters = JsonSerializer.Serialize(new { + name = "@Name", + id = "@Id" + }) + }, + }), + } + ); + + #region Performans 360 Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormPerformans360.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPerformans360.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPerformans360.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 450, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPerformans360.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "TemplateId", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.Template360Values + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPerformans360.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "StartDate", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPerformans360.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "EndDate", + Width = 150, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPerformans360.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "Draft", Name= "Draft" }, + new () { Key= "Active", Name= "Active" }, + new () { Key= "Completed", Name= "Completed"}, + new () { Key= "Cancelled", Name= "Cancelled" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPerformans360.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "DepartmentId", + Width = 150, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.DepartmentValues, + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormPerformans360.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "TargetEmployees", + Width = 300, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmployeeValues, + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Trainings + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Training)) + { + var listFormTraining = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Training, + Name = AppCodes.Hr.Training, + Title = AppCodes.Hr.Training, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.Training, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Training)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.Training), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Training))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Training, Width = 500, Height = 600 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField = "Title", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Description", EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 3, DataField = "Instructor", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "Category", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 5, DataField = "Type", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 6, DataField = "Location", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 7, DataField = "Thumbnail", EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 8, DataField = "Duration", IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 9, DataField = "StartDate", IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 10, DataField = "EndDate", IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 11, DataField = "MaxParticipants", EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 12, DataField = "Status", EditorType2 = EditorTypes.dxSelectBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "upcoming", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "MaxParticipants", FieldDbType = DbType.Int32, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new CommandColumnDto() { + Hint = "Sertifikalar", + Text = "Sertifikalar", + AuthName = AppCodes.Hr.Training + ".Update", + DialogName = "TrainingCertificates", + DialogParameters = JsonSerializer.Serialize(new { + name = "@Email", + id = "@Id" + }) + }, + }), + } + ); + + #region Training Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormTraining.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTraining.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Title", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTraining.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 650, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTraining.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Instructor", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTraining.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Category", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "technical", Name= "Technical" }, + new () { Key= "soft-skills", Name= "Soft Skills" }, + new () { Key= "management", Name="Management" }, + new () { Key= "compliance", Name="Compliance" }, + new () { Key= "other", Name="Other" } + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTraining.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Type", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "online", Name= "Online" }, + new () { Key= "classroom", Name= "Classroom" }, + new () { Key= "hybrid", Name="Hybrid" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTraining.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Location", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTraining.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Thumbnail", + Width = 550, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTraining.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Duration", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTraining.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "StartDate", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTraining.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "EndDate", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTraining.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "MaxParticipants", + Width = 100, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTraining.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Enrolled", + Width = 100, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormTraining.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 100, + ListOrderNo = 17, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "upcoming", Name= "Upcoming" }, + new () { Key= "ongoing", Name= "Ongoing" }, + new () { Key= "completed", Name="Completed" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Survey + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Survey)) + { + var listFormSurvey = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Survey, + Name = AppCodes.Hr.Survey, + Title = AppCodes.Hr.Survey, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.Survey, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Survey)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.Survey), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Survey))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Survey, Width = 500, Height = 450 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField = "Title", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Description", IsRequired = true, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 3, DataField = "Deadline", IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 4, DataField = "Status", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 5, DataField = "IsAnonymous", IsRequired = true, EditorType2 = EditorTypes.dxCheckBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "IsAnonymous", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "draft", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Manage", + Text ="Manage", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Survey + ".Update", + Url="/admin/form/form-survey/@Id" + } + }), + } + ); + + #region Survey Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormSurvey.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSurvey.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Title", + Width = 400, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSurvey.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "Deadline", + Width = 100, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSurvey.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Responses", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSurvey.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "draft", Name= "Draft" }, + new () { Key= "active", Name= "Active" }, + new () { Key= "closed", Name= "Closed" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSurvey.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsAnonymous", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Survey Question + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SurveyQuestion)) + { + var listFormSurveyQuestion = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.SurveyQuestion, + Name = AppCodes.Hr.SurveyQuestion, + Title = AppCodes.Hr.SurveyQuestion, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.SurveyQuestion, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SurveyQuestion)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.SurveyQuestion), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.SurveyQuestion))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.SurveyQuestion, Width = 500, Height = 400 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField = "SurveyId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 2, DataField = "QuestionText", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Type", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 4, DataField = "IsRequired", IsRequired = true, EditorType2 = EditorTypes.dxCheckBox } + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "IsRequired", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Options", + Text ="Options", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Survey + ".Update", + Url="/admin/list/list-employees/@Id" + }, + }), + } + ); + + #region Survey Question Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormSurveyQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyQuestion), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSurveyQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "SurveyId", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.SurveyValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyQuestion), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSurveyQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Order", + Width = 100, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyQuestion), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSurveyQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "QuestionText", + Width = 300, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyQuestion), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSurveyQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Type", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "rating", Name= "Rating" }, + new () { Key= "multiple-choice", Name= "Multiple Choice" }, + new () { Key= "text", Name= "Text" }, + new () { Key= "textarea", Name= "Textarea" }, + new () { Key= "yes-no", Name= "Yes/No" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyQuestion), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSurveyQuestion.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsRequired", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyQuestion), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Survey Response + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SurveyResponse)) + { + var listFormSurveyResponse = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.SurveyResponse, + Name = AppCodes.Hr.SurveyResponse, + Title = AppCodes.Hr.SurveyResponse, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Hr.SurveyResponse, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SurveyResponse)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Hr.SurveyResponse), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.SurveyResponse))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.SurveyResponse, Width = 500, Height = 400 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField = "SurveyId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 2, DataField = "EmployeeId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 3, DataField = "SubmissionTime", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "CreationTime", IsRequired = true, EditorType2 = EditorTypes.dxDateBox } + ]} + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Answers", + Text ="Answers", + UrlTarget="_blank", + AuthName = AppCodes.Hr.SurveyResponse + ".Update", + Url="/admin/list/list-employees/@Id" + }, + }), + } + ); + + #region Survey Response Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormSurveyResponse.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyResponse), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSurveyResponse.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "SurveyId", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.SurveyValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyQuestion), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSurveyResponse.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "EmployeeId", + Width = 100, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmployeeValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyResponse), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSurveyResponse.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "SubmissionTime", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyResponse), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSurveyResponse.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "CreationTime", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyResponse), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Intranet.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Intranet.cs new file mode 100644 index 00000000..7a8b8012 --- /dev/null +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Intranet.cs @@ -0,0 +1,1974 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Text.Json; +using System.Threading.Tasks; +using Kurs.Languages.Languages; +using Kurs.Platform.Entities; +using Kurs.Platform.Enums; +using Kurs.Platform.ListForms; +using Kurs.Platform.Queries; +using Microsoft.Extensions.Configuration; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; +using Volo.Abp.TenantManagement; +using AbpIdentity = Kurs.Platform.Data.Seeds.SeedConsts.AbpIdentity; +using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes; +using static Kurs.Platform.PlatformConsts; +using static Kurs.Platform.PlatformSeeder.SeederDefaults; + +namespace Kurs.Platform.Data.Seeds; + +public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependency +{ + private readonly IRepository _listFormRepository; + private readonly IRepository _listFormFieldRepository; + private readonly IdentityUserManager _identityUserManager; + private readonly IdentityRoleManager _identityRoleManager; + private readonly IConfiguration _configuration; + + public ListFormSeeder_Intranet( + IRepository listFormRepository, + IRepository listFormFieldRepository, + IdentityUserManager userManager, + IdentityRoleManager roleManager, + IConfiguration configuration) + { + _listFormRepository = listFormRepository; + _listFormFieldRepository = listFormFieldRepository; + _identityUserManager = userManager; + _identityRoleManager = roleManager; + _configuration = configuration; + } + + public async Task SeedAsync(DataSeedContext context) + { + #region EventType + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.EventType)) + { + var listFormEventType = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.EventType, + Name = AppCodes.Intranet.EventType, + Title = AppCodes.Intranet.EventType, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Intranet.EventType, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.EventType)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Intranet.EventType), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.EventType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.EventType, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region EventType Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormEventType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.EventType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEventType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.EventType), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region EventCategory + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.EventCategory)) + { + var listFormEventCategory = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.EventCategory, + Name = AppCodes.Intranet.EventCategory, + Title = AppCodes.Intranet.EventCategory, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Intranet.EventCategory, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.EventCategory)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Intranet.EventCategory), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.EventCategory))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.EventCategory, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region EventCategory Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormEventCategory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.EventCategory), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormEventCategory.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.EventCategory), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Event + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Event)) + { + var listFormEvent = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Event, + Name = AppCodes.Intranet.Event, + Title = AppCodes.Intranet.Event, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Intranet.Event, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Event)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Intranet.Event), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Event))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.Event, Width = 650, Height = 550 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items =[ + new EditingFormItemDto { Order = 1, DataField = "CategoryId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "TypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "Place", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "EmployeeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 6, DataField = "Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 7, DataField = "Status", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 8, DataField = "ParticipantsCount", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 9, DataField = "Likes", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region Event Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + // Id + new() + { + ListFormCode = listFormEvent.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // CategoryId + new() + { + ListFormCode = listFormEvent.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "CategoryId", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.EventCategoryValues, + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // TypeId + new() + { + ListFormCode = listFormEvent.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "TypeId", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.EventTypeValues, + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Name + new() + { + ListFormCode = listFormEvent.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Place + new() + { + ListFormCode = listFormEvent.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Place", + Width = 200, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Description + new() + { + ListFormCode = listFormEvent.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 400, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // OrganizerId + new() + { + ListFormCode = listFormEvent.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "EmployeeId", + Width = 150, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.UserValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // ParticipantsCount + new() + { + ListFormCode = listFormEvent.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "ParticipantsCount", + Width = 80, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // ParticipantsCount + new() + { + ListFormCode = listFormEvent.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Likes", + Width = 80, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Status + new() + { + ListFormCode = listFormEvent.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 120, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Published",Name="Published" }, + new () { Key="Draft",Name="Draft" }, + new () { Key="Cancelled",Name="Cancelled" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Meal + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Meal)) + { + var listFormMeal = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Meal, + Name = AppCodes.Intranet.Meal, + Title = AppCodes.Intranet.Meal, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = true, + IsOrganizationUnit = false, + Description = AppCodes.Intranet.Meal, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Meal)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Intranet.Meal), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Meal))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.Meal, Width = 600, Height = 450 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items =[ + new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "Date", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 3, DataField = "Type", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 4, DataField = "Materials", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTagBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Meal Menu Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + // Id + new() + { + ListFormCode = listFormMeal.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Meal), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // BranchId + new() + { + ListFormCode = listFormMeal.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "BranchId", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.BranchValues, + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Meal), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Date + new() + { + ListFormCode = listFormMeal.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "Date", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 2, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Meal), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Type + new() + { + ListFormCode = listFormMeal.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Type", + Width = 300, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "breakfast", Name= "Breakfast" }, + new () { Key= "lunch", Name= "Lunch" }, + new () { Key= "dinner", Name="Dinner" } + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Meal), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Materials + new() + { + ListFormCode = listFormMeal.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Materials", + Width = 300, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + //TODO: Materials kısmında Query olarak getirmeli + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Mercimek Çorbası", Name="Mercimek Çorbası" }, + new () { Key="Tavuk Şinitzel", Name="Tavuk Şinitzel" }, + new () { Key="Bulgur Pilavı", Name="Bulgur Pilavı" }, + new () { Key="Salata", Name="Salata" }, + new () { Key="Meyve", Name="Meyve" }, + new () { Key="Domates Çorbası", Name="Domates Çorbası" }, + new () { Key="Etli Kuru Fasulye", Name="Etli Kuru Fasulye" }, + new () { Key="Pilav", Name="Pilav" }, + new () { Key="Turşu", Name="Turşu" }, + new () { Key="Komposto", Name="Komposto" }, + new () { Key="Tarator", Name="Tarator" }, + new () { Key="Köfte", Name="Köfte" }, + new () { Key="Patates Püresi", Name="Patates Püresi" }, + new () { Key="Yoğurtlu Kabak Salatası", Name="Yoğurtlu Kabak Salatası" }, + new () { Key="Fırında Levrek", Name="Fırında Levrek" }, + new () { Key="Kuskus", Name="Kuskus" }, + new () { Key="Roka Salatası", Name="Roka Salatası" } + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Meal), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Reservations + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Reservation)) + { + var listFormReservation = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Reservation, + Name = AppCodes.Intranet.Reservation, + Title = AppCodes.Intranet.Reservation, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Intranet.Reservation, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Reservation)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Intranet.Reservation), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Reservation))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.Reservation, Width = 500, Height = 600 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto {Order=1,DataField="Type", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox}, + new EditingFormItemDto {Order=2,DataField="ResourceName", IsRequired = true, EditorType2 = EditorTypes.dxTextBox}, + new EditingFormItemDto {Order=3,DataField="EmployeeId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox}, + new EditingFormItemDto {Order=4,DataField="StartDate", IsRequired = true, EditorType2 = EditorTypes.dxDateBox}, + new EditingFormItemDto {Order=5,DataField="EndDate", IsRequired = true, EditorType2 = EditorTypes.dxDateBox}, + new EditingFormItemDto {Order=6,DataField="Purpose", IsRequired = true, EditorType2 = EditorTypes.dxTextBox}, + new EditingFormItemDto {Order=8,DataField="Participants", EditorType2 = EditorTypes.dxNumberBox}, + new EditingFormItemDto {Order=9,DataField="Notes", EditorType2 = EditorTypes.dxTextArea}, + new EditingFormItemDto {Order=7,DataField="Status", IsRequired = true, EditorType2 = EditorTypes.dxTextBox}, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Pending", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Participants", FieldDbType = DbType.Int32, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + } + ); + + #region Reservation Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormReservation.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormReservation.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Type", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "room", Name= "Room" }, + new () { Key= "vehicle", Name= "Vehicle" }, + new () { Key= "equipment", Name="Equipment" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormReservation.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ResourceName", + Width = 300, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormReservation.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "EmployeeId", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmployeeValues, + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormReservation.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "StartDate", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormReservation.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "EndDate", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormReservation.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Purpose", + Width = 200, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormReservation.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Participants", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormReservation.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Notes", + Width = 300, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormReservation.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "pending", Name= "Pending" }, + new () { Key= "approved", Name= "Approved" }, + new () { Key= "rejected", Name="Rejected" }, + new () { Key= "completed", Name="Completed" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Shuttle Routes + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ShuttleRoute)) + { + var listFormShuttleRoute = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.ShuttleRoute, + Name = AppCodes.Intranet.ShuttleRoute, + Title = AppCodes.Intranet.ShuttleRoute, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Intranet.ShuttleRoute, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ShuttleRoute)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Intranet.ShuttleRoute), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.ShuttleRoute))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.ShuttleRoute, Width = 500, Height = 600 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items = + [ + new EditingFormItemDto { Order = 1, DataField = "Name", IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Type", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 3, DataField = "DepartureTime", IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions = EditorOptionValues.TimeSpanOptions }, + new EditingFormItemDto { Order = 4, DataField = "ArrivalTime", IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions = EditorOptionValues.TimeSpanOptions }, + new EditingFormItemDto { Order = 5, DataField = "Capacity", EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 6, DataField = "Route", IsRequired = true, EditorType2 = EditorTypes.dxTagBox } + ] + } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "Capacity", FieldDbType = DbType.Int32, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Type", FieldDbType = DbType.String, Value = "morning", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + } + ); + + #region Shuttle Route Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormShuttleRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormShuttleRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormShuttleRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Type", + Width = 100, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "morning", Name= "Morning" }, + new () { Key= "evening", Name= "Evening" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormShuttleRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DepartureTime", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormShuttleRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ArrivalTime", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormShuttleRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Capacity", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormShuttleRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Available", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormShuttleRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Route", + Width = 300, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "Kadıköy İskele", Name= "Kadıköy İskele" }, + new () { Key= "Bostancı", Name= "Bostancı" }, + new () { Key= "Acıbadem", Name="Acıbadem" }, + new () { Key= "Kozyatağı", Name="Kozyatağı" }, + new () { Key= "Ofis", Name="Ofis" }, + new () { Key= "Üsküdar Meydanı", Name="Üsküdar Meydanı" }, + new () { Key= "Kısıklı", Name="Kısıklı" }, + new () { Key= "Bulgurlu", Name="Bulgurlu" }, + new () { Key= "Ümraniye", Name="Ümraniye" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Announncements + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Announcement)) + { + var listFormAnnouncement = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Announcement, + Name = AppCodes.Intranet.Announcement, + Title = AppCodes.Intranet.Announcement, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Intranet.Announcement, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Announcement)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Intranet.Announcement), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Announcement))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.Announcement, Width = 500, Height = 600 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField = "Title", IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Excerpt", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Content", IsRequired = true, EditorType2 = EditorTypes.dxHtmlEditor, EditorOptions = EditorOptionValues.HtmlEditorOptions }, + new EditingFormItemDto { Order = 4, DataField = "ImageUrl", EditorType2 = EditorTypes.dxTagBox }, + new EditingFormItemDto { Order = 5, DataField = "Category", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 6, DataField = "EmployeeId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 7, DataField = "PublishDate", EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 8, DataField = "ExpiryDate", IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 9, DataField = "IsPinned", EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 10, DataField = "Departments", EditorType2 = EditorTypes.dxTagBox }, + new EditingFormItemDto { Order = 11, DataField = "Attachments", EditorType2 = EditorTypes.dxTagBox } + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "IsPinned", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "PublishDate", FieldDbType = DbType.Date, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }) + } + ); + + #region Announcement Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormAnnouncement.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAnnouncement.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Title", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAnnouncement.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Excerpt", + Width = 300, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAnnouncement.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Content", + Width = 400, + ListOrderNo = 4, + Visible = false, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAnnouncement.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ImageUrl", + Width = 200, + ListOrderNo = 5, + Visible = false, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAnnouncement.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Category", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "general", Name= "General" }, + new () { Key= "event", Name= "Event" }, + new () { Key= "urgent", Name= "Urgent" }, + new () { Key= "announcement", Name= "Announcement" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAnnouncement.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "EmployeeId", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmployeeValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAnnouncement.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "PublishDate", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAnnouncement.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "ExpiryDate", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAnnouncement.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsPinned", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAnnouncement.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Departments", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.DepartmentValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormAnnouncement.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Attachments", + Width = 100, + ListOrderNo = 12, + Visible = false, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Visitors + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Visitor)) + { + var listFormVisitor = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Visitor, + Name = AppCodes.Intranet.Visitor, + Title = AppCodes.Intranet.Visitor, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Intranet.Visitor, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Visitor)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Intranet.Visitor), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Visitor))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.Visitor, Width = 500, Height = 450 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField = "FullName", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "CompanyName", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Email", EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "Phone", IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions = EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order = 5, DataField = "Purpose", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 6, DataField = "VisitDate", IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 7, DataField = "CheckIn", EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 8, DataField = "CheckOut", EditorType2 = EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 9, DataField = "EmployeeId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 10, DataField = "Status", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "VisitDate", FieldDbType = DbType.Date, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CheckIn", FieldDbType = DbType.Date, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "checked-in", CustomValueType = FieldCustomValueTypeEnum.Value }, + }) + } + ); + + #region Visitor Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormVisitor.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVisitor.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "FullName", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVisitor.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "CompanyName", + Width = 300, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVisitor.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Email", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleEmailJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVisitor.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Phone", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleEmailJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVisitor.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Purpose", + Width = 200, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleEmailJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVisitor.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "VisitDate", + Width = 150, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVisitor.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "CheckIn", + Width = 150, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVisitor.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "CheckOut", + Width = 150, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVisitor.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "EmployeeId", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmployeeValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormVisitor.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key= "checked-in", Name= "Checked-in" }, + new () { Key= "checked-out", Name= "Checked-out" }, + new () { Key= "scheduled", Name= "Scheduled" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Social Post + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SocialPost)) + { + var listFormSocialPost = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.SocialPost, + Name = AppCodes.Intranet.SocialPost, + Title = AppCodes.Intranet.SocialPost, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Intranet.SocialPost, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SocialPost)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Intranet.SocialPost), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.SocialPost))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.SocialPost, Width = 500, Height = 400 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=2, ItemType="group", Items = [ + new EditingFormItemDto { Order = 1, DataField = "EmployeeId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 2, DataField = "Content", IsRequired = true, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 3, DataField = "LikeCount", IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 4, DataField = "IsLiked", IsRequired = true, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 5, DataField = "IsOwnPost", IsRequired = true, EditorType2 = EditorTypes.dxCheckBox } + ]} + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Comments", + Text ="Comments", + UrlTarget="_blank", + AuthName = AppCodes.Hr.SurveyResponse + ".Update", + Url="/admin/list/list-employees/@Id" + }, + }), + } + ); + + #region Social Post Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormSocialPost.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.SocialPost), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSocialPost.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "EmployeeId", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.EmployeeValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.SocialPost), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSocialPost.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Content", + Width = 800, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.SocialPost), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSocialPost.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "LikeCount", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.SocialPost), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSocialPost.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsLiked", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.SocialPost), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSocialPost.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsOwnPost", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.SocialPost), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Maintenance.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Maintenance.cs new file mode 100644 index 00000000..36314bf3 --- /dev/null +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Maintenance.cs @@ -0,0 +1,200 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Text.Json; +using System.Threading.Tasks; +using Kurs.Languages.Languages; +using Kurs.Platform.Entities; +using Kurs.Platform.Enums; +using Kurs.Platform.ListForms; +using Kurs.Platform.Queries; +using Microsoft.Extensions.Configuration; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; +using Volo.Abp.TenantManagement; +using AbpIdentity = Kurs.Platform.Data.Seeds.SeedConsts.AbpIdentity; +using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes; +using static Kurs.Platform.PlatformConsts; +using static Kurs.Platform.PlatformSeeder.SeederDefaults; + +namespace Kurs.Platform.Data.Seeds; + +public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDependency +{ + private readonly IRepository _listFormRepository; + private readonly IRepository _listFormFieldRepository; + private readonly IdentityUserManager _identityUserManager; + private readonly IdentityRoleManager _identityRoleManager; + private readonly IConfiguration _configuration; + + public ListFormSeeder_Maintenance( + IRepository listFormRepository, + IRepository listFormFieldRepository, + IdentityUserManager userManager, + IdentityRoleManager roleManager, + IConfiguration configuration) + { + _listFormRepository = listFormRepository; + _listFormFieldRepository = listFormFieldRepository; + _identityUserManager = userManager; + _identityRoleManager = roleManager; + _configuration = configuration; + } + + public async Task SeedAsync(DataSeedContext context) + { + // #region Material Type + // if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MaterialType)) + // { + // var listFormMaterialType = await _listFormRepository.InsertAsync( + // new ListForm() + // { + // ListFormType = ListFormTypeEnum.List, + // IsSubForm = false, + // LayoutJson = DefaultLayoutJson, + // CultureName = LanguageCodes.En, + // ListFormCode = ListFormCodes.Lists.MaterialType, + // Name = AppCodes.SupplyChain.MaterialType, + // Title = AppCodes.SupplyChain.MaterialType, + // DataSourceCode = SeedConsts.DataSources.DefaultCode, + // IsTenant = true, + // IsBranch = false, + // IsOrganizationUnit = false, + // Description = AppCodes.SupplyChain.MaterialType, + // SelectCommandType = SelectCommandTypeEnum.Table, + // SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialType)), + // KeyFieldName = "Id", + // KeyFieldDbSourceType = DbType.Guid, + // DefaultFilter = DefaultFilterJson, + // SortMode = GridOptions.SortModeSingle, + // FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + // HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + // SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + // GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + // SelectionJson = DefaultSelectionSingleJson, + // ColumnOptionJson = DefaultColumnOptionJson, + // PermissionJson = DefaultPermissionJson(AppCodes.SupplyChain.MaterialType), + // DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + // DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + // new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + // new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + // }), + // PagerOptionJson = DefaultPagerOptionJson, + // EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + // { + // Popup = new GridEditingPopupDto() { Title = AppCodes.SupplyChain.MaterialType, Width = 500, Height = 250 }, + // AllowDeleting = true, + // AllowAdding = true, + // AllowUpdating = true, + // SendOnlyChangedFormValuesUpdate = false, + // }), + // EditingFormJson = JsonSerializer.Serialize(new List() { + // new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + // new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + // new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + // new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextArea }, + // new EditingFormItemDto { Order = 4, DataField = "IsActive", ColSpan = 2, EditorType2=EditorTypes.dxCheckBox }, + // ]} + // }), + // InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + // new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + // new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + // new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + // }), + // FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + // new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + // }), + // } + // ); + + // #region MaterialType Fields + // await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.Guid, + // FieldName = "Id", + // Width = 100, + // ListOrderNo = 1, + // Visible = false, + // IsActive = true, + // IsDeleted = false, + // ValidationRuleJson = DefaultValidationRuleRequiredJson, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.String, + // FieldName = "Code", + // Width = 150, + // ListOrderNo = 2, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // AllowSearch = true, + // ValidationRuleJson = DefaultValidationRuleRequiredJson, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.String, + // FieldName = "Name", + // Width = 350, + // ListOrderNo = 3, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // SortIndex = 1, + // SortDirection = GridColumnOptions.SortOrderAsc, + // AllowSearch = true, + // ValidationRuleJson = DefaultValidationRuleRequiredJson, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.String, + // FieldName = "Description", + // Width = 500, + // ListOrderNo = 4, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // AllowSearch = true, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.Boolean, + // FieldName = "IsActive", + // Width = 100, + // ListOrderNo = 5, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // AllowSearch = true, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // } + // }); + // #endregion + // } + // #endregion + + } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Mrp.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Mrp.cs new file mode 100644 index 00000000..676be809 --- /dev/null +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Mrp.cs @@ -0,0 +1,200 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Text.Json; +using System.Threading.Tasks; +using Kurs.Languages.Languages; +using Kurs.Platform.Entities; +using Kurs.Platform.Enums; +using Kurs.Platform.ListForms; +using Kurs.Platform.Queries; +using Microsoft.Extensions.Configuration; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; +using Volo.Abp.TenantManagement; +using AbpIdentity = Kurs.Platform.Data.Seeds.SeedConsts.AbpIdentity; +using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes; +using static Kurs.Platform.PlatformConsts; +using static Kurs.Platform.PlatformSeeder.SeederDefaults; + +namespace Kurs.Platform.Data.Seeds; + +public class ListFormSeeder_Mrp : IDataSeedContributor, ITransientDependency +{ + private readonly IRepository _listFormRepository; + private readonly IRepository _listFormFieldRepository; + private readonly IdentityUserManager _identityUserManager; + private readonly IdentityRoleManager _identityRoleManager; + private readonly IConfiguration _configuration; + + public ListFormSeeder_Mrp( + IRepository listFormRepository, + IRepository listFormFieldRepository, + IdentityUserManager userManager, + IdentityRoleManager roleManager, + IConfiguration configuration) + { + _listFormRepository = listFormRepository; + _listFormFieldRepository = listFormFieldRepository; + _identityUserManager = userManager; + _identityRoleManager = roleManager; + _configuration = configuration; + } + + public async Task SeedAsync(DataSeedContext context) + { + // #region Material Type + // if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MaterialType)) + // { + // var listFormMaterialType = await _listFormRepository.InsertAsync( + // new ListForm() + // { + // ListFormType = ListFormTypeEnum.List, + // IsSubForm = false, + // LayoutJson = DefaultLayoutJson, + // CultureName = LanguageCodes.En, + // ListFormCode = ListFormCodes.Lists.MaterialType, + // Name = AppCodes.SupplyChain.MaterialType, + // Title = AppCodes.SupplyChain.MaterialType, + // DataSourceCode = SeedConsts.DataSources.DefaultCode, + // IsTenant = true, + // IsBranch = false, + // IsOrganizationUnit = false, + // Description = AppCodes.SupplyChain.MaterialType, + // SelectCommandType = SelectCommandTypeEnum.Table, + // SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialType)), + // KeyFieldName = "Id", + // KeyFieldDbSourceType = DbType.Guid, + // DefaultFilter = DefaultFilterJson, + // SortMode = GridOptions.SortModeSingle, + // FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + // HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + // SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + // GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + // SelectionJson = DefaultSelectionSingleJson, + // ColumnOptionJson = DefaultColumnOptionJson, + // PermissionJson = DefaultPermissionJson(AppCodes.SupplyChain.MaterialType), + // DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + // DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + // new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + // new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + // }), + // PagerOptionJson = DefaultPagerOptionJson, + // EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + // { + // Popup = new GridEditingPopupDto() { Title = AppCodes.SupplyChain.MaterialType, Width = 500, Height = 250 }, + // AllowDeleting = true, + // AllowAdding = true, + // AllowUpdating = true, + // SendOnlyChangedFormValuesUpdate = false, + // }), + // EditingFormJson = JsonSerializer.Serialize(new List() { + // new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + // new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + // new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + // new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextArea }, + // new EditingFormItemDto { Order = 4, DataField = "IsActive", ColSpan = 2, EditorType2=EditorTypes.dxCheckBox }, + // ]} + // }), + // InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + // new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + // new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + // new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + // }), + // FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + // new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + // }), + // } + // ); + + // #region MaterialType Fields + // await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.Guid, + // FieldName = "Id", + // Width = 100, + // ListOrderNo = 1, + // Visible = false, + // IsActive = true, + // IsDeleted = false, + // ValidationRuleJson = DefaultValidationRuleRequiredJson, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.String, + // FieldName = "Code", + // Width = 150, + // ListOrderNo = 2, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // AllowSearch = true, + // ValidationRuleJson = DefaultValidationRuleRequiredJson, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.String, + // FieldName = "Name", + // Width = 350, + // ListOrderNo = 3, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // SortIndex = 1, + // SortDirection = GridColumnOptions.SortOrderAsc, + // AllowSearch = true, + // ValidationRuleJson = DefaultValidationRuleRequiredJson, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.String, + // FieldName = "Description", + // Width = 500, + // ListOrderNo = 4, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // AllowSearch = true, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.Boolean, + // FieldName = "IsActive", + // Width = 100, + // ListOrderNo = 5, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // AllowSearch = true, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // } + // }); + // #endregion + // } + // #endregion + + } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Participant.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Participant.cs new file mode 100644 index 00000000..45c82fd5 --- /dev/null +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Participant.cs @@ -0,0 +1,861 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Text.Json; +using System.Threading.Tasks; +using Kurs.Languages.Languages; +using Kurs.Platform.Entities; +using Kurs.Platform.Enums; +using Kurs.Platform.ListForms; +using Kurs.Platform.Queries; +using Microsoft.Extensions.Configuration; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; +using Volo.Abp.TenantManagement; +using AbpIdentity = Kurs.Platform.Data.Seeds.SeedConsts.AbpIdentity; +using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes; +using static Kurs.Platform.PlatformConsts; +using static Kurs.Platform.PlatformSeeder.SeederDefaults; + +namespace Kurs.Platform.Data.Seeds; + +public class ListFormSeeder_Participant : IDataSeedContributor, ITransientDependency +{ + private readonly IRepository _listFormRepository; + private readonly IRepository _listFormFieldRepository; + private readonly IdentityUserManager _identityUserManager; + private readonly IdentityRoleManager _identityRoleManager; + private readonly IConfiguration _configuration; + + public ListFormSeeder_Participant( + IRepository listFormRepository, + IRepository listFormFieldRepository, + IdentityUserManager userManager, + IdentityRoleManager roleManager, + IConfiguration configuration) + { + _listFormRepository = listFormRepository; + _listFormFieldRepository = listFormFieldRepository; + _identityUserManager = userManager; + _identityRoleManager = roleManager; + _configuration = configuration; + } + + public async Task SeedAsync(DataSeedContext context) + { + #region MeetingMethod + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MeetingMethod)) + { + var listFormMeetingMethod = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.MeetingMethod, + Name = AppCodes.Definitions.MeetingMethod, + Title = AppCodes.Definitions.MeetingMethod, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.MeetingMethod, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MeetingMethod)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.MeetingMethod), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.MeetingMethod))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.MeetingMethod, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Type", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 3, DataField = "Status", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region MeetingMethod Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormMeetingMethod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingMethod), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormMeetingMethod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingMethod), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormMeetingMethod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Type", + Width = 250, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Dijital",Name="Dijital" }, + new () { Key="Telefon",Name="Telefon" }, + new () { Key="Fiziksel",Name="Fiziksel" }, + new () { Key="Hibrit",Name="Hibrit" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingMethod), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Status + new() + { + ListFormCode = listFormMeetingMethod.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 120, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingMethod), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region MeetingResult + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MeetingResult)) + { + var listFormMeetingResult = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.MeetingResult, + Name = AppCodes.Definitions.MeetingResult, + Title = AppCodes.Definitions.MeetingResult, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.MeetingResult, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MeetingResult)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.MeetingResult), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.MeetingResult))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.MeetingResult, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Order", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 3, DataField = "Status", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region MeetingResult Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormMeetingResult.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingResult), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormMeetingResult.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingResult), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormMeetingResult.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Order", + Width = 250, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingResult), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Status + new() + { + ListFormCode = listFormMeetingResult.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 120, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingResult), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Source + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Source)) + { + var listFormSource = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Source, + Name = AppCodes.Definitions.Source, + Title = AppCodes.Definitions.Source, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Source, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Source)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Source), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Source))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Source, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region Source Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormSource.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Source), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSource.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Source), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSource.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 250, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Source), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Interesting + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Interesting)) + { + var listFormInteresting = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Interesting, + Name = AppCodes.Definitions.Interesting, + Title = AppCodes.Definitions.Interesting, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.Interesting, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Interesting)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Interesting), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Interesting))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Interesting, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region Interesting Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormInteresting.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Interesting), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormInteresting.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Interesting), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormInteresting.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 250, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Interesting), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region SalesRejectionReason + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SalesRejectionReason)) + { + var listFormSalesRejectionReason = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.SalesRejectionReason, + Name = AppCodes.Definitions.SalesRejectionReason, + Title = AppCodes.Definitions.SalesRejectionReason, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.SalesRejectionReason, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SalesRejectionReason)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.SalesRejectionReason), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.SalesRejectionReason))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.SalesRejectionReason, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Category", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 3, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region SalesRejectionReason Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormSalesRejectionReason.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SalesRejectionReason), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSalesRejectionReason.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 500, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SalesRejectionReason), + PivotSettingsJson = DefaultPivotSettingsJson + }, + // Status + new() + { + ListFormCode = listFormSalesRejectionReason.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Category", + Width = 300, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Kişisel",Name="Kişisel" }, + new () { Key="Fiyat / Bütçe",Name="Fiyat / Bütçe" }, + new () { Key="Ürün / Hizmet",Name="Ürün / Hizmet" }, + new () { Key="Rekabet",Name="Rekabet" }, + new () { Key="Zamanlama",Name="Zamanlama" }, + new () { Key="Lokasyon",Name="Lokasyon" }, + new () { Key="İletişim",Name="İletişim" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SalesRejectionReason), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormSalesRejectionReason.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Aktif",Name="Aktif" }, + new () { Key="Pasif",Name="Pasif" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SalesRejectionReason), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region NoteType + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.NoteType)) + { + var listFormNoteType = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.NoteType, + Name = AppCodes.Definitions.NoteType, + Title = AppCodes.Definitions.NoteType, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Definitions.NoteType, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.NoteType)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Definitions.NoteType), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.NoteType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.NoteType, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region NoteType Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormNoteType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.NoteType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormNoteType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.NoteType), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Project.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Project.cs new file mode 100644 index 00000000..fc1122bd --- /dev/null +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Project.cs @@ -0,0 +1,200 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Text.Json; +using System.Threading.Tasks; +using Kurs.Languages.Languages; +using Kurs.Platform.Entities; +using Kurs.Platform.Enums; +using Kurs.Platform.ListForms; +using Kurs.Platform.Queries; +using Microsoft.Extensions.Configuration; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; +using Volo.Abp.TenantManagement; +using AbpIdentity = Kurs.Platform.Data.Seeds.SeedConsts.AbpIdentity; +using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes; +using static Kurs.Platform.PlatformConsts; +using static Kurs.Platform.PlatformSeeder.SeederDefaults; + +namespace Kurs.Platform.Data.Seeds; + +public class ListFormSeeder_Project : IDataSeedContributor, ITransientDependency +{ + private readonly IRepository _listFormRepository; + private readonly IRepository _listFormFieldRepository; + private readonly IdentityUserManager _identityUserManager; + private readonly IdentityRoleManager _identityRoleManager; + private readonly IConfiguration _configuration; + + public ListFormSeeder_Project( + IRepository listFormRepository, + IRepository listFormFieldRepository, + IdentityUserManager userManager, + IdentityRoleManager roleManager, + IConfiguration configuration) + { + _listFormRepository = listFormRepository; + _listFormFieldRepository = listFormFieldRepository; + _identityUserManager = userManager; + _identityRoleManager = roleManager; + _configuration = configuration; + } + + public async Task SeedAsync(DataSeedContext context) + { + // #region Material Type + // if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MaterialType)) + // { + // var listFormMaterialType = await _listFormRepository.InsertAsync( + // new ListForm() + // { + // ListFormType = ListFormTypeEnum.List, + // IsSubForm = false, + // LayoutJson = DefaultLayoutJson, + // CultureName = LanguageCodes.En, + // ListFormCode = ListFormCodes.Lists.MaterialType, + // Name = AppCodes.SupplyChain.MaterialType, + // Title = AppCodes.SupplyChain.MaterialType, + // DataSourceCode = SeedConsts.DataSources.DefaultCode, + // IsTenant = true, + // IsBranch = false, + // IsOrganizationUnit = false, + // Description = AppCodes.SupplyChain.MaterialType, + // SelectCommandType = SelectCommandTypeEnum.Table, + // SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialType)), + // KeyFieldName = "Id", + // KeyFieldDbSourceType = DbType.Guid, + // DefaultFilter = DefaultFilterJson, + // SortMode = GridOptions.SortModeSingle, + // FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + // HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + // SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + // GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + // SelectionJson = DefaultSelectionSingleJson, + // ColumnOptionJson = DefaultColumnOptionJson, + // PermissionJson = DefaultPermissionJson(AppCodes.SupplyChain.MaterialType), + // DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + // DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + // new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + // new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + // }), + // PagerOptionJson = DefaultPagerOptionJson, + // EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + // { + // Popup = new GridEditingPopupDto() { Title = AppCodes.SupplyChain.MaterialType, Width = 500, Height = 250 }, + // AllowDeleting = true, + // AllowAdding = true, + // AllowUpdating = true, + // SendOnlyChangedFormValuesUpdate = false, + // }), + // EditingFormJson = JsonSerializer.Serialize(new List() { + // new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + // new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + // new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + // new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextArea }, + // new EditingFormItemDto { Order = 4, DataField = "IsActive", ColSpan = 2, EditorType2=EditorTypes.dxCheckBox }, + // ]} + // }), + // InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + // new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + // new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + // new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + // }), + // FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + // new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + // }), + // } + // ); + + // #region MaterialType Fields + // await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.Guid, + // FieldName = "Id", + // Width = 100, + // ListOrderNo = 1, + // Visible = false, + // IsActive = true, + // IsDeleted = false, + // ValidationRuleJson = DefaultValidationRuleRequiredJson, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.String, + // FieldName = "Code", + // Width = 150, + // ListOrderNo = 2, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // AllowSearch = true, + // ValidationRuleJson = DefaultValidationRuleRequiredJson, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.String, + // FieldName = "Name", + // Width = 350, + // ListOrderNo = 3, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // SortIndex = 1, + // SortDirection = GridColumnOptions.SortOrderAsc, + // AllowSearch = true, + // ValidationRuleJson = DefaultValidationRuleRequiredJson, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.String, + // FieldName = "Description", + // Width = 500, + // ListOrderNo = 4, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // AllowSearch = true, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.Boolean, + // FieldName = "IsActive", + // Width = 100, + // ListOrderNo = 5, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // AllowSearch = true, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // } + // }); + // #endregion + // } + // #endregion + + } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Saas.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Saas.cs new file mode 100644 index 00000000..f4450a9b --- /dev/null +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Saas.cs @@ -0,0 +1,5532 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Text.Json; +using System.Threading.Tasks; +using Kurs.Languages.Languages; +using Kurs.Platform.Entities; +using Kurs.Platform.Enums; +using Kurs.Platform.ListForms; +using Kurs.Platform.Queries; +using Microsoft.Extensions.Configuration; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; +using Volo.Abp.TenantManagement; +using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes; +using static Kurs.Platform.PlatformConsts; +using static Kurs.Platform.PlatformSeeder.SeederDefaults; + +namespace Kurs.Platform.Data.Seeds; + +public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency +{ + private readonly IRepository _listFormRepository; + private readonly IRepository _listFormFieldRepository; + private readonly IdentityUserManager _identityUserManager; + private readonly IdentityRoleManager _identityRoleManager; + private readonly IConfiguration _configuration; + + public ListFormSeeder_Saas( + IRepository listFormRepository, + IRepository listFormFieldRepository, + IdentityUserManager userManager, + IdentityRoleManager roleManager, + IConfiguration configuration) + { + _listFormRepository = listFormRepository; + _listFormFieldRepository = listFormFieldRepository; + _identityUserManager = userManager; + _identityRoleManager = roleManager; + _configuration = configuration; + } + + public async Task SeedAsync(DataSeedContext context) + { + var configurationSection = _configuration.GetSection("OpenIddict:Applications"); + var swaggerRootUrl = configurationSection["Platform_Swagger:RootUrl"]?.TrimEnd('/'); + + #region FormTenant + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormTenant)) + { + var formTenant = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.Form, + IsSubForm = false, + ShowActivity = true, + LayoutJson = DefaultLayoutJson, + SubFormsJson = JsonSerializer.Serialize(new List() { + new { + TabTitle = "Branches", + TabType = ListFormTabTypeEnum.List, + Code = ListFormCodes.Lists.Branch, + Relation = new List() { + new { + ParentFieldName = "Id", + ChildFieldName = "TenantId" + } + } + } + }), + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Forms.FormTenant, + Name = TenantManagementPermissions.Tenants.Default, + Title = TenantManagementPermissions.Tenants.Default, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = TenantManagementPermissions.Tenants.Default, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = "AbpTenants", + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, TenantManagementPermissions.Tenants.Delete, TenantManagementPermissions.Tenants.Default + ".Export", TenantManagementPermissions.Tenants.Default + ".Import", TenantManagementPermissions.Tenants.Default + ".Activity"), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.QuestionPool, Width = 900, Height = 450 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { Order=1, ColCount=2, ColSpan=1, ItemType="group", Items =[ + new EditingFormItemDto { Order=1, DataField = "Name", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=2, DataField = "OrganizationName", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=3, DataField = "Founder", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=4, DataField = "VknTckn", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order=5, DataField = "TaxOffice", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=6, DataField = "Mobile", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order=7, DataField = "Phone", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order=8, DataField = "Fax", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order=9, DataField = "IsActive", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, + ]}, + new() { Order=2, ColCount=2, ColSpan=1, ItemType="group", Items = [ + new EditingFormItemDto { Order=1, DataField = "Country", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=2, DataField = "City", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=3, DataField = "District", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=4, DataField = "Street", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=5, DataField = "PostalCode", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=6, DataField = "Address1", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=7, DataField = "Address2", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=8, DataField = "Email", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=9, DataField = "Website", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Seed", + Text = "Seed", + AuthName = TenantManagementPermissions.Tenants.ManageConnectionStrings, + DialogName = "TenantsConnectionString", + DialogParameters = JsonSerializer.Serialize(new { + name = "@Name", + id = "@Id" + }) + }, + }), + InsertServiceAddress = "list-form-dynamic-api/tenant-insert", + UpdateServiceAddress = "list-form-dynamic-api/tenant-update", + DeleteCommand = "DELETE FROM \"AbpTenants\" WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + + } + ); + + #region Tenants Fields + await _listFormFieldRepository.InsertManyAsync( + [ + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 500, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "OrganizationName", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Founder", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "VknTckn", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "TaxOffice", + Width = 150, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Country", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CountryValues, + CascadeEmptyFields = "City,District,Street" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "City", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CityValues, + CascadeRelationField = "Country", + CascadeFilterOperator="=", + CascadeParentFields = "Country", + CascadeEmptyFields = "District,Street" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "District", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.DistrictValues, + CascadeRelationField = "City", + CascadeFilterOperator="=", + CascadeParentFields = "Country,City", + CascadeEmptyFields = "Street", + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Street", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.StreetValues, + CascadeRelationField = "District", + CascadeFilterOperator="=", + CascadeParentFields = "Country,City,District" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address1", + Width = 150, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address2", + Width = 150, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "PostalCode", + Width = 100, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Email", + Width = 170, + ListOrderNo = 14, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] + { + new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.email) } + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Website", + Width = 170, + ListOrderNo = 15, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Mobile", + Width = 100, + ListOrderNo = 16, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Phone", + Width = 100, + ListOrderNo = 17, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Fax", + Width = 100, + ListOrderNo = 18, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + new ListFormField + { + ListFormCode = formTenant.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 19, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Default), + PivotSettingsJson = DefaultPivotSettingsJson, + }, + ]); + #endregion + + } + #endregion + + #region FormLanguage + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormLanguage)) + { + var formLanguage = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.Form, + IsSubForm = false, + ShowActivity = true, + LayoutJson = DefaultLayoutJson, + SubFormsJson = JsonSerializer.Serialize(new List() { + new { + TabTitle = "Language Texts", + TabType = ListFormTabTypeEnum.List, + Code = ListFormCodes.Lists.LanguageText, + Relation = new List() { + new { + ParentFieldName = "CultureName", + ChildFieldName = "CultureName" + } + } + } + }), + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Forms.FormLanguage, + Name = AppCodes.Languages.Language, + Title = AppCodes.Languages.Language, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Languages.Language, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Language)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + PermissionJson = DefaultPermissionJson(AppCodes.Languages.Language), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Language))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + EditingOptionJson = DefaultEditingOptionJson, + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = [ + new() { Order = 1, DataField = "CultureName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new() { Order = 2, DataField = "UiCultureName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new() { Order = 3, DataField = "DisplayName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new() { Order = 4, DataField = "IsEnabled", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsEnabled", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + } + ); + + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = formLanguage.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 0, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), + }, + new() { + ListFormCode = formLanguage.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "CultureName", + Width = 150, + ListOrderNo = 1, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), + }, + new() + { + ListFormCode = formLanguage.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "UiCultureName", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), + }, + new() + { + ListFormCode = formLanguage.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DisplayName", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), + }, + new() + { + ListFormCode = formLanguage.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsEnabled", + Width = 125, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), + }, + new() + { + ListFormCode = formLanguage.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "CreationTime", + Width = 125, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), + }, + ]); + } + #endregion + + #region Tenant + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Tenant)) + { + var listFormTenants = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Tenant, + Name = TenantManagementPermissions.Tenants.Default, + Title = TenantManagementPermissions.Tenants.Default, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = TenantManagementPermissions.Tenants.Default, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = "AbpTenants", + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, TenantManagementPermissions.Tenants.Delete, TenantManagementPermissions.Tenants.Default + ".Export", TenantManagementPermissions.Tenants.Default + ".Import", TenantManagementPermissions.Tenants.Default + ".Activity"), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = TenantManagementPermissions.Tenants.Default, Width = 900, Height = 450 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items = + [ + new EditingFormItemDto { Order=1, DataField = "Name", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=2, DataField = "OrganizationName", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=3, DataField = "Founder", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=4, DataField = "VknTckn", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order=5, DataField = "TaxOffice", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=6, DataField = "Mobile", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order=7, DataField = "Phone", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order=8, DataField = "Fax", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order=9, DataField = "IsActive", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, + ] + }, + new() { Order=2, ColCount=1, ColSpan=1, ItemType="group", Items = + [ + new EditingFormItemDto { Order=1, DataField = "Country", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=2, DataField = "City", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=3, DataField = "District", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=4, DataField = "Street", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=5, DataField = "PostalCode", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=6, DataField = "Address1", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=7, DataField = "Address2", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=8, DataField = "Email", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=9, DataField = "Website", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=10, DataField = "MenuGroup", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox }, + ] + } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Seed", + Text = "Seed", + AuthName = TenantManagementPermissions.Tenants.ManageConnectionStrings, + DialogName = "TenantsConnectionString", + DialogParameters = JsonSerializer.Serialize(new { + name = "@Name", + id = "@Id" + }) + }, + new() { + Hint = "Branches", + Text = "Branches", + AuthName = AppCodes.Branches, + Url = "/admin/form/form-tenant/@Id", + }, + }), + InsertServiceAddress = "list-form-dynamic-api/tenant-insert", + UpdateServiceAddress = "list-form-dynamic-api/tenant-update", + DeleteCommand = "DELETE FROM \"AbpTenants\" WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + + } + ); + + #region Tenants Fields + await _listFormFieldRepository.InsertManyAsync( + [ + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 500, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "OrganizationName", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Founder", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "VknTckn", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "TaxOffice", + Width = 150, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Country", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CountryValues, + CascadeEmptyFields = "City,District,Street" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "City", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CityValues, + CascadeRelationField = "Country", + CascadeFilterOperator="=", + CascadeParentFields = "Country", + CascadeEmptyFields = "District,Street" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "District", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.DistrictValues, + CascadeRelationField = "City", + CascadeFilterOperator="=", + CascadeParentFields = "Country,City", + CascadeEmptyFields = "Street", + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Street", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.StreetValues, + CascadeRelationField = "District", + CascadeFilterOperator="=", + CascadeParentFields = "Country,City,District" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address1", + Width = 150, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address2", + Width = 150, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "PostalCode", + Width = 100, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Email", + Width = 170, + ListOrderNo = 14, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleEmailJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Website", + Width = 170, + ListOrderNo = 15, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Mobile", + Width = 100, + ListOrderNo = 16, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Phone", + Width = 100, + ListOrderNo = 17, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Fax", + Width = 100, + ListOrderNo = 18, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 19, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormTenants.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "MenuGroup", + Width = 100, + ListOrderNo = 20, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Kurs", Name="Kurs" }, + new () { Key="Erp", Name="Erp" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + + } + #endregion + + #region Branche + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Branch)) + { + var listFormBranches = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Branch, + Name = AppCodes.Branches, + Title = AppCodes.Branches, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Branches, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Branch)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Branches), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Branches, Width = 900, Height = 450 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items = + [ + new EditingFormItemDto { Order=1, DataField = "TenantId", ColSpan=2, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=2, DataField = "Code", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=3, DataField = "Name", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=4, DataField = "VknTckn", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order=5, DataField = "TaxOffice", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=6, DataField = "Mobile", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order=7, DataField = "Phone", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order=8, DataField = "Fax", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, + new EditingFormItemDto { Order=9, DataField = "IsActive", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, + ] + }, + new() { Order=2, ColCount=1, ColSpan=1, ItemType="group", Items = + [ + new EditingFormItemDto { Order=1, DataField = "Country", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=2, DataField = "City", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=3, DataField = "District", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=4, DataField = "Street", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order=5, DataField = "Address1", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=6, DataField = "Address2", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=7, DataField = "PostalCode", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=8, DataField = "Email", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=9, DataField = "Website", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + ] + } + }), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Branch))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Seed", + Text = "Seed", + AuthName = AppCodes.Branches + ".Update", + DialogName = "BranchSeed", + DialogParameters = JsonSerializer.Serialize(new { + name = "@Id", + }) + }, + }), + } + ); + + #region Branches Fields + await _listFormFieldRepository.InsertManyAsync( + [ + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 500, + ListOrderNo = 0, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "TenantId", + Width = 200, + ListOrderNo = 1, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.TenantValues, + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "VknTckn", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "TaxOffice", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Country", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CountryValues, + CascadeEmptyFields = "City,District,Street" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "City", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CityValues, + CascadeRelationField = "Country", + CascadeFilterOperator="=", + CascadeParentFields = "Country", + CascadeEmptyFields = "District,Street" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "District", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.DistrictValues, + CascadeRelationField = "City", + CascadeFilterOperator="=", + CascadeParentFields = "Country,City", + CascadeEmptyFields = "Street", + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Street", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.StreetValues, + CascadeRelationField = "District", + CascadeFilterOperator="=", + CascadeParentFields = "Country,City,District" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address1", + Width = 150, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Address2", + Width = 150, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "PostalCode", + Width = 100, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Email", + Width = 170, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleEmailJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Website", + Width = 170, + ListOrderNo = 14, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Mobile", + Width = 100, + ListOrderNo = 15, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Phone", + Width = 100, + ListOrderNo = 16, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Fax", + Width = 100, + ListOrderNo = 17, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormBranches.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 18, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region SettingDefinition + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SettingDefinition)) + { + var listFormSettingDefinitions = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.SettingDefinition, + Name = AppCodes.Settings.SettingDefinitions, + Title = AppCodes.Settings.SettingDefinitions, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Settings.SettingDefinitions, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SettingDefinition)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Settings.SettingDefinitions), + DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.SettingDefinition)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new FieldsDefaultValue() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Settings.SettingDefinitions, Width = 800, Height = 400 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= [ + new EditingFormItemDto { Order = 1, DataField = "MainGroupKey", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "SubGroupKey", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "NameKey", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 5, DataField = "DescriptionKey", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 6, DataField = "DefaultValue", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 7, DataField = "IsVisibleToClients", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 8, DataField = "Providers", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 9, DataField = "IsInherited", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 10, DataField = "IsEncrypted", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 11, DataField = "RequiredPermissionName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 12, DataField = "DataType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 13, DataField = "SelectOptions", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 14, DataField = "Order", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsVisibleToClients", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "IsInherited", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "IsEncrypted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region SettingDefinition Fields + await _listFormFieldRepository.InsertManyAsync([ + new ListFormField + { + ListFormCode = listFormSettingDefinitions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSettingDefinitions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 400, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSettingDefinitions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "MainGroupKey", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSettingDefinitions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "SubGroupKey", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSettingDefinitions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Order", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSettingDefinitions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "NameKey", + Width = 250, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSettingDefinitions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DescriptionKey", + Width = 250, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSettingDefinitions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "RequiredPermissionName", + Width = 400, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.PermissionNameValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSettingDefinitions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Providers", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new() { Key="U", Name="User" }, + new() { Key="T", Name="Tenant"}, + new() { Key="G", Name="Global"}, + new() { Key="C", Name="Configuration"}, + new() { Key="D", Name="Default"}, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSettingDefinitions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DefaultValue", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSettingDefinitions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DataType", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new() { Key="Bool", Name="Bool" }, + new() { Key="Number", Name="Number"}, + new() { Key="Text", Name="Text"}, + new() { Key="Memo", Name="Memo"}, + new() { Key="List", Name="List"}, + }) + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSettingDefinitions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "SelectOptions", + Width = 100, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSettingDefinitions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsVisibleToClients", + Width = 150, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSettingDefinitions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsInherited", + Width = 100, + ListOrderNo = 14, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormSettingDefinitions.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsEncrypted", + Width = 100, + ListOrderNo = 15, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Global Search + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.GlobalSearch)) + { + var listFormGlobalSearch = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.GlobalSearch, + Name = AppCodes.Settings.GlobalSearch, + Title = AppCodes.Settings.GlobalSearch, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Settings.GlobalSearch, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.GlobalSearch)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Int32, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Settings.GlobalSearch), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Settings.GlobalSearch, Width = 500, Height = 350 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { Order=1, ColCount=1, ColSpan=2, ItemType="group", Items = [ + new EditingFormItemDto { Order=1, DataField="System", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=2, DataField="Group", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=3, DataField="Term", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=4, DataField="Url", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=5, DataField="Weight", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxNumberBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "System", FieldDbType = DbType.String, Value = "Platform", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Weight", FieldDbType = DbType.Single, Value = "1.0", CustomValueType = FieldCustomValueTypeEnum.Value }, + }) + } + ); + + #region Global Search Fields + await _listFormFieldRepository.InsertManyAsync( + [ + new() { + ListFormCode = listFormGlobalSearch.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.GlobalSearch), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormGlobalSearch.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "System", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.GlobalSearch), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormGlobalSearch.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Group", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.GlobalSearch), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormGlobalSearch.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Term", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.GlobalSearch), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormGlobalSearch.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Url", + Width = 300, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.GlobalSearch), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormGlobalSearch.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Single, + FieldName = "Weight", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.GlobalSearch), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Language + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Language)) + { + var listFormLanguages = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Language, + Name = AppCodes.Languages.Language, + Title = AppCodes.Languages.Language, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Languages.Language, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Language)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Languages.Language), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Language))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Languages.Language, Width = 600, Height = 300 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= + [ + new EditingFormItemDto { Order = 1, DataField = "CultureName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "UiCultureName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "DisplayName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "IsEnabled", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsEnabled", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Manage", + Text ="Manage", + UrlTarget="_blank", + AuthName = AppCodes.Languages.LanguageText, + Url=$"/admin/form/{ListFormCodes.Forms.FormLanguage}/@Id" + }, + }), + } + ); + + #region Language Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new ListFormField + { + ListFormCode = listFormLanguages.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormLanguages.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "CultureName", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormLanguages.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "UiCultureName", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormLanguages.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DisplayName", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormLanguages.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsEnabled", + Width = 125, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), + PivotSettingsJson = DefaultPivotSettingsJson + }, + }); + + #endregion + } + #endregion + + #region LanguageText + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.LanguageText)) + { + var listFormLanguageTexts = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.LanguageText, + Name = AppCodes.Languages.LanguageText, + Title = AppCodes.Languages.LanguageText, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Languages.LanguageText, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.LanguageText)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Languages.LanguageText), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.LanguageText))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Languages.LanguageText, Width = 800, Height = 300 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= + [ + new EditingFormItemDto { Order = 1, DataField = "CultureName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "ResourceName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "Key", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 4, DataField = "Value", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region LanguageText Fields + await _listFormFieldRepository.InsertManyAsync([ + new ListFormField + { + ListFormCode = listFormLanguageTexts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.LanguageText), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormLanguageTexts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "CultureName", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CultureValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.LanguageText), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormLanguageTexts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ResourceName", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new() { Key="AbpAccount",Name="AbpAccount" }, + new() { Key="Platform",Name="Platform" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.LanguageText), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormLanguageTexts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Key", + Width = 350, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.LanguageText), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormLanguageTexts.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Value", + Width = 350, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.LanguageText), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + + #endregion + } + #endregion + + #region Route + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Route)) + { + var listFormRoute = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Route, + Name = AppCodes.Routes, + Title = AppCodes.Routes, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Routes, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Route)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Routes), + DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.Route)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Routes, Width = 500, Height = 300 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "Key", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Path", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "ComponentPath", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "RouteType", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 5, DataField = "Authority", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox } + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }) + }); + + #region Route Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Routes), + }, + new() + { + ListFormCode = listFormRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Key", + Width = 300, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Routes), + }, + new() + { + ListFormCode = listFormRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Path", + Width = 300, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Routes), + }, + new() + { + ListFormCode = listFormRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ComponentPath", + Width = 300, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Routes), + }, + new() + { + ListFormCode = listFormRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "RouteType", + Width = 120, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="public",Name="Public" }, + new () { Key="protected",Name="Protected" }, + new () { Key="authenticated",Name="Authenticated" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Routes), + }, + new() + { + ListFormCode = listFormRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Authority", + Width = 120, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Routes), + } + ]); + #endregion + } + #endregion + + #region Menu + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Menu)) + { + var listFormMenus = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Menu, + Name = AppCodes.Menus.Menu, + Title = AppCodes.Menus.Menu, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Menus.Menu, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Menu)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Menus.Menu), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Menu))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { + FieldName = "DeleterId", + FieldDbType = DbType.Guid, + Value = "@USERID", + CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { + FieldName = "Id", + FieldDbType = DbType.Guid, + Value = "@ID", + CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Menus.Menu, Width = 800, Height = 500 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= + [ + new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "DisplayName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "Order", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 4, DataField = "Url", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "Icon", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 6, DataField = "ParentCode", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 7, DataField = "CssClass", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 8, DataField = "RequiredPermissionName", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 9, DataField = "Target", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 10, DataField = "IsDisabled", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 11, DataField = "ElementId", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDisabled", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new FieldsDefaultValue() { FieldName = "IsDisabled", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + } + ); + + #region Menu Fields + await _listFormFieldRepository.InsertManyAsync([ + new ListFormField + { + ListFormCode = listFormMenus.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormMenus.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 300, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormMenus.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DisplayName", + Width = 300, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LanguageKeyValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormMenus.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Order", + Width = 50, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormMenus.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Url", + Width = 250, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormMenus.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Icon", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormMenus.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ParentCode", + Width = 200, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.MenuCodeValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormMenus.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "CssClass", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormMenus.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "RequiredPermissionName", + Width = 200, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.PermissionNameValues + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormMenus.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Target", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormMenus.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsDisabled", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormMenus.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ElementId", + Width = 100, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + + #endregion + } + #endregion + + #region Data Source + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.DataSource)) + { + var listFormDataSources = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.DataSource, + Name = AppCodes.Listforms.DataSource, + Title = AppCodes.Listforms.DataSource, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Listforms.DataSource, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.DataSource)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Listforms.DataSource), + DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.DataSource)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new FieldsDefaultValue() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Listforms.DataSource, Width = 800, Height = 500 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= + [ + new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "DataSourceType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "ConnectionString", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":200}" }, + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + } + ); + + #region Data Source Fields + await _listFormFieldRepository.InsertManyAsync([ + new ListFormField + { + ListFormCode = listFormDataSources.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.DataSource), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormDataSources.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 300, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.DataSource), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listFormDataSources.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "DataSourceType", + Width = 300, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new() { Key = 1, Name = "Mssql" }, + new() { Key = 2, Name = "Postgresql" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.DataSource), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormDataSources.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ConnectionString", + Width = 250, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.DataSource), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region ListForm + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Listform)) + { + var listForms = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Listform, + Name = AppCodes.Listforms.Listform, + Title = AppCodes.Listforms.Listform, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Listforms.Listform, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ListForm)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeMultiple, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true, ApplyFilter = GridOptions.FilterRowApplyFilterAuto }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionMultipleJson, + ColumnOptionJson = DefaultColumnOptionJson, + DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.ListForm)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new FieldsDefaultValue() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PermissionJson = DefaultPermissionJson(AppCodes.Listforms.Listform), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Listforms.Listform, Width = 800, Height = 500 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "CultureName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "ListFormCode", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "ListFormType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 5, DataField = "SelectCommandType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 6, DataField = "SelectCommand", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 7, DataField = "TableName", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 8, DataField = "KeyFieldName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 9, DataField = "KeyFieldDbSourceType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 10, DataField = "Description", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 11, DataField = "Title", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 12, DataField = "SortMode", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 13, DataField = "DeleteServiceAddress", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 14, DataField = "InsertServiceAddress", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 15, DataField = "UpdateServiceAddress", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 16, DataField = "IsTenant", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 17, DataField = "IsOrganizationUnit", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 18, DataField = "IsSubForm", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + ]}, + new() { + Order=2,ColCount=1,ColSpan=2,ItemType="group", Items= [ + new EditingFormItemDto { Order = 1, DataField = "PermissionJson:C", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "PermissionJson:R", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "PermissionJson:U", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "PermissionJson:D", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new FieldsDefaultValue() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Manage Listform", + Text ="Manage", + UrlTarget="_blank", + AuthName=AppCodes.Listforms.Listform + ".Update", + Url="/admin/listform/edit/@ListFormCode" + }, + new() { + Hint = "Göster", + Text ="Göster", + UrlTarget="_blank", + AuthName=AppCodes.Listforms.Listform, + Url="/admin/list/@ListFormCode" + } + }), + StateStoringJson = JsonSerializer.Serialize(new StateStoringDto { Enabled = true, StorageKey = "listFormGridStorage", Type = "custom" }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new FieldsDefaultValue() { + FieldName = "ListFormType", + FieldDbType = DbType.String, + Value = ListFormTypeEnum.List, + CustomValueType = FieldCustomValueTypeEnum.Value }, + new FieldsDefaultValue() { + FieldName = "InsertServiceAddress", + FieldDbType = DbType.String, + Value = "list-form-data/insert", + CustomValueType = FieldCustomValueTypeEnum.Value }, + new FieldsDefaultValue() { + FieldName = "DeleteServiceAddress", + FieldDbType = DbType.String, + Value = "list-form-data/delete", + CustomValueType = FieldCustomValueTypeEnum.Value }, + new FieldsDefaultValue() { + FieldName = "UpdateServiceAddress", + FieldDbType = DbType.String, + Value = "list-form-data/update", + CustomValueType = FieldCustomValueTypeEnum.Value }, + new FieldsDefaultValue() { + FieldName = "IsDisabled", + FieldDbType = DbType.Boolean, + Value = "false", + CustomValueType = FieldCustomValueTypeEnum.Value }, + new FieldsDefaultValue() { + FieldName = "IsTenant", + FieldDbType = DbType.Boolean, + Value = "false", + CustomValueType = FieldCustomValueTypeEnum.Value }, + new FieldsDefaultValue() { + FieldName = "IsOrganizationUnit", + FieldDbType = DbType.Boolean, + Value = "false", + CustomValueType = FieldCustomValueTypeEnum.Value }, + new FieldsDefaultValue() { + FieldName = "IsSubForm", + FieldDbType = DbType.Boolean, + Value = "false", + CustomValueType = FieldCustomValueTypeEnum.Value }, + new FieldsDefaultValue() { + FieldName = "SortMode", + FieldDbType = DbType.String, + Value = GridOptions.SortModeNone, + CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region ListForms Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] + { + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "CultureName", + Width = 90, + ListOrderNo = 1, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnHeaderJson = JsonSerializer.Serialize(new ColumnHeaderDto + { + AllowHeaderFiltering = true, + DataSource = new List + { + new ColumnsHeaderDataSourceDto { Text = LanguageNames.Ar, Value = new List { "CultureName", "=", LanguageCodes.Ar } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.Cs, Value = new List { "CultureName", "=", LanguageCodes.Cs } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.De, Value = new List { "CultureName", "=", LanguageCodes.De } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.En, Value = new List { "CultureName", "=", LanguageCodes.En } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.Es, Value = new List { "CultureName", "=", LanguageCodes.Es } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.Fi, Value = new List { "CultureName", "=", LanguageCodes.Fi } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.Fr, Value = new List { "CultureName", "=", LanguageCodes.Fr } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.Hi, Value = new List { "CultureName", "=", LanguageCodes.Hi } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.Hr, Value = new List { "CultureName", "=", LanguageCodes.Hr } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.Hu, Value = new List { "CultureName", "=", LanguageCodes.Hu } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.It, Value = new List { "CultureName", "=", LanguageCodes.It } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.Pt, Value = new List { "CultureName", "=", LanguageCodes.Pt } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.Ru, Value = new List { "CultureName", "=", LanguageCodes.Ru } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.Sk, Value = new List { "CultureName", "=", LanguageCodes.Sk } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.Sl, Value = new List { "CultureName", "=", LanguageCodes.Sl } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.Tr, Value = new List { "CultureName", "=", LanguageCodes.Tr } }, + new ColumnsHeaderDataSourceDto { Text = LanguageNames.Zh, Value = new List { "CultureName", "=", LanguageCodes.Zh } }, + } + }), + AllowSearch = true, + ColumnFilterJson = JsonSerializer.Serialize(new ColumnFilterDto { SelectedFilterOperation = "=", FilterValue = "en" }), + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CultureValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 180, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 180, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ListFormCode", + Width = 120, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ListFormType", + Width = 75, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto{ + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new() { Key=ListFormTypeEnum.Form, Name=ListFormTypeEnum.Form.ToString() }, + new() { Key=ListFormTypeEnum.List, Name=ListFormTypeEnum.List.ToString() }, + new() { Key=ListFormTypeEnum.Chart, Name=ListFormTypeEnum.Chart.ToString() }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "SelectCommandType", + Width = 150, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new() { Key=SelectCommandTypeEnum.Table,Name=SelectCommandTypeEnum.Table.ToString() }, + new() { Key=SelectCommandTypeEnum.View,Name=SelectCommandTypeEnum.View.ToString() }, + new() { Key=SelectCommandTypeEnum.TableValuedFunction,Name=SelectCommandTypeEnum.TableValuedFunction.ToString() }, + new() { Key=SelectCommandTypeEnum.Query,Name=SelectCommandTypeEnum.Query.ToString() }, + new() { Key=SelectCommandTypeEnum.StoredProcedure,Name=SelectCommandTypeEnum.StoredProcedure.ToString() }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "SelectCommand", + Width = 150, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "TableName", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "KeyFieldName", + Width = 120, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "KeyFieldDbSourceType", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new() { Key=DbType.AnsiString,Name=DbType.AnsiString.ToString() }, + new() { Key=DbType.Binary,Name=DbType.Binary.ToString() }, + new() { Key=DbType.Byte,Name=DbType.Byte.ToString() }, + new() { Key=DbType.Boolean,Name=DbType.Boolean.ToString() }, + new() { Key=DbType.Currency,Name=DbType.Currency.ToString() }, + new() { Key=DbType.Date,Name=DbType.Date.ToString() }, + new() { Key=DbType.DateTime,Name=DbType.DateTime.ToString() }, + new() { Key=DbType.Decimal,Name=DbType.Decimal.ToString() }, + new() { Key=DbType.Double,Name=DbType.Double.ToString() }, + new() { Key=DbType.Guid,Name=DbType.Guid.ToString() }, + new() { Key=DbType.Int16,Name=DbType.Int16.ToString() }, + new() { Key=DbType.Int32,Name=DbType.Int32.ToString() }, + new() { Key=DbType.Int64,Name=DbType.Int64.ToString() }, + new() { Key=DbType.Object,Name=DbType.Object.ToString() }, + new() { Key=DbType.SByte,Name=DbType.SByte.ToString() }, + new() { Key=DbType.Single,Name=DbType.Single.ToString() }, + new() { Key=DbType.String,Name=DbType.String.ToString() }, + new() { Key=DbType.Time,Name=DbType.Time.ToString() }, + new() { Key=DbType.UInt16,Name=DbType.UInt16.ToString() }, + new() { Key=DbType.UInt32,Name=DbType.UInt32.ToString() }, + new() { Key=DbType.UInt64,Name=DbType.UInt64.ToString() }, + new() { Key=DbType.VarNumeric,Name=DbType.VarNumeric.ToString() }, + new() { Key=DbType.AnsiStringFixedLength,Name=DbType.AnsiStringFixedLength.ToString() }, + new() { Key=DbType.StringFixedLength,Name=DbType.StringFixedLength.ToString() }, + new() { Key=DbType.Xml,Name=DbType.Xml.ToString() }, + new() { Key=DbType.DateTime2,Name=DbType.DateTime2.ToString() }, + new() { Key=DbType.DateTimeOffset,Name=DbType.DateTimeOffset.ToString() }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Title", + Width = 150, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "SortMode", + Width = 100, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new() { Key=GridOptions.SortModeNone,Name=GridOptions.SortModeNone }, + new() { Key=GridOptions.SortModeSingle,Name=GridOptions.SortModeSingle }, + new() { Key=GridOptions.SortModeMultiple,Name=GridOptions.SortModeMultiple }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsTenant", + Width = 85, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsOrganizationUnit", + Width = 85, + ListOrderNo = 14, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsSubForm", + Width = 85, + ListOrderNo = 15, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "PermissionJson", + Width = 250, + ListOrderNo = 16, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "DeleteServiceAddress", + Width = 120, + ListOrderNo = 17, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "InsertServiceAddress", + Width = 120, + ListOrderNo = 18, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new ListFormField + { + ListFormCode = listForms.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "UpdateServiceAddress", + Width = 120, + ListOrderNo = 19, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), + PivotSettingsJson = DefaultPivotSettingsJson + }, + }); + #endregion + } + #endregion + + #region Notification Rule + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.NotificationRule)) + { + var listFormNotificationRules = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.NotificationRule, + Name = AppCodes.Notifications.NotificationRules, + Title = AppCodes.Notifications.NotificationRules, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Notifications.NotificationRules, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.NotificationRule)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Notifications.NotificationRules), + DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.NotificationRule)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.Notifications.NotificationRules, Width = 800, Height = 500 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "NotificationType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "RecipientType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "RecipientId", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "Channel", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 5, DataField = "IsActive", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 6, DataField = "IsFixed", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 7, DataField = "IsCustomized", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "IsFixed", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "IsCustomized", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new CommandColumnDto() { + Hint = "Create", + Text = "Create", + AuthName = AppCodes.Notifications.NotificationRules, + DialogName = "CreateNotification", + DialogParameters = JsonSerializer.Serialize(new { + name = "id", + id = "@Id" + }) + }, + }), + } + ); + + #region Notification Rule Fields + await _listFormFieldRepository.InsertManyAsync([ + new ListFormField + { + ListFormCode = listFormNotificationRules.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormNotificationRules.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "NotificationType", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.WebService, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = "GET;notification-rule/notification-types;{};a;a;null", + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormNotificationRules.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "RecipientType", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="All",Name="All" }, + new () { Key="User",Name="User" }, + new () { Key="Role",Name="Role" }, + new () { Key="OrganizationUnit",Name="OrganizationUnit" }, + new () { Key="Custom",Name="Custom" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormNotificationRules.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "RecipientId", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormNotificationRules.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Channel", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Sms",Name="Sms" }, + new () { Key="Mail",Name="Mail" }, + new () { Key="Rocket",Name="Rocket" }, + new () { Key="Desktop",Name="Desktop" }, + new () { Key="UiActivity",Name="UiActivity" }, + new () { Key="UiToast",Name="UiToast" }, + new () { Key="WhatsApp",Name="WhatsApp" }, + new () { Key="Telegram",Name="Telegram" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormNotificationRules.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 85, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormNotificationRules.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsFixed", + Width = 85, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormNotificationRules.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsCustomized", + Width = 85, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Notification + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Notification)) + { + var listFormNotifications = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Notification, + Name = AppCodes.Notifications.Notification, + Title = AppCodes.Notifications.Notification, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Notifications.Notification, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Notification)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Notifications.Notification), + DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.Notification)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + AllowDeleting = false, + AllowAdding = false, + AllowUpdating = false, + SendOnlyChangedFormValuesUpdate = false, + }) + } + ); + + #region Notification Fields + await _listFormFieldRepository.InsertManyAsync([ + new ListFormField + { + ListFormCode = listFormNotifications.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormNotifications.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "NotificationChannel", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Sms",Name="Sms" }, + new () { Key="Mail",Name="Mail" }, + new () { Key="Rocket",Name="Rocket" }, + new () { Key="Desktop",Name="Desktop" }, + new () { Key="UiActivity",Name="UiActivity" }, + new () { Key="UiToast",Name="UiToast" }, + new () { Key="WhatsApp",Name="WhatsApp" }, + new () { Key="Telegram",Name="Telegram" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormNotifications.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "NotificationType", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.WebService, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = "GET;notification-rule/notification-types;{};a;a;null", + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormNotifications.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Identifier", + Width = 250, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormNotifications.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Message", + Width = 200, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormNotifications.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsSent", + Width = 85, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormNotifications.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsRead", + Width = 85, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormNotifications.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "ReadTime", + Width = 85, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Background Worker + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.BackgroundWorker)) + { + var listFormBackgroundWorkers = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.BackgroundWorker, + Name = AppCodes.BackgroundWorkers, + Title = AppCodes.BackgroundWorkers, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.BackgroundWorkers, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.BackgroundWorker)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + ButtonPosition= UiCommandButtonPositionTypeEnum.Toolbar, + Hint = "Hangfire Login", + Text = "Hangfire Login", + AuthName=AppCodes.BackgroundWorkers, + Url= swaggerRootUrl + "/Account/Login", + }, + new() { + ButtonPosition= UiCommandButtonPositionTypeEnum.Toolbar, + Hint = "Hangfire Aç", + Text = "Hangfire Aç", + AuthName=AppCodes.BackgroundWorkers, + Url= swaggerRootUrl + "/hangfire", + }, + new() { + ButtonPosition= UiCommandButtonPositionTypeEnum.Toolbar, + Hint = "Hangfire Tazele", + Text = "Hangfire Tazele", + AuthName=AppCodes.BackgroundWorkers, + OnClick="UiEvalService.ApiGenerateBackgroundWorkers();" + }, + }), + PermissionJson = DefaultPermissionJson(AppCodes.BackgroundWorkers), + DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.BackgroundWorker)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.BackgroundWorkers, Width = 800, Height = 500 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group",Items=[ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Cron", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "WorkerType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 4, DataField = "BeforeSp", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "AfterSp", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 6, DataField = "IsActive", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, + ] + }, + new() { Order=2,ColCount=1,ColSpan=2,ItemType="group",Items= [ + new EditingFormItemDto { Order = 1, DataField = "Options:MailType", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Options:MailSubject", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Options:MailTemplate", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":200}" }, + new EditingFormItemDto { Order = 4, DataField = "Options:Tablo", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + } + ); + + #region Background Worker Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormBackgroundWorkers.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBackgroundWorkers.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBackgroundWorkers.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Cron", + Width = 100, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBackgroundWorkers.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "WorkerType", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new() { Key=1,Name="MailQueueWorker" }, + new() { Key=2,Name="SqlWorker" }, + new() { Key=3,Name="NotificationWorker" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBackgroundWorkers.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "BeforeSp", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBackgroundWorkers.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "AfterSp", + Width = 150, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBackgroundWorkers.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Options", + Width = 200, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormBackgroundWorkers.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 50, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region ContactTag + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ContactTag)) + { + var listFormContactTag = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.ContactTag, + Name = AppCodes.Parameters.ContactTag, + Title = AppCodes.Parameters.ContactTag, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Parameters.ContactTag, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ContactTag)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = false }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Parameters.ContactTag), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.ContactTag))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Parameters.ContactTag, Width = 400, Height = 200 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto + { + Order = 1, + DataField = "Name", + ColSpan = 2, + IsRequired = true, + EditorType2 = EditorTypes.dxTextBox + }, + new EditingFormItemDto + { + Order = 2, + DataField = "Category", + ColSpan = 2, + IsRequired = true, + EditorType2 = EditorTypes.dxTextBox + } + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() + { + FieldName = "CreationTime", + FieldDbType = DbType.DateTime, + Value = "@NOW", + CustomValueType = FieldCustomValueTypeEnum.CustomKey + }, + new() + { + FieldName = "CreatorId", + FieldDbType = DbType.Guid, + Value = "@USERID", + CustomValueType = FieldCustomValueTypeEnum.CustomKey + } + }) + }); + + #region ContactTag Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormContactTag.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.ContactTag), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormContactTag.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.ContactTag), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormContactTag.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Category", + Width = 250, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.ContactTag), + PivotSettingsJson = DefaultPivotSettingsJson + } + ]); + #endregion + } + #endregion + + #region ContactTitle + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ContactTitle)) + { + var listFormContactTitle = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.ContactTitle, + Name = AppCodes.Parameters.ContactTitle, + Title = AppCodes.Parameters.ContactTitle, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Parameters.ContactTitle, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ContactTitle)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = false }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Parameters.ContactTitle), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.ContactTitle))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Parameters.ContactTitle, Width = 400, Height = 200 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "Title", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Abbreviation", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox } + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] + { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }) + }); + + #region ContactTitle Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormContactTitle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.ContactTitle), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormContactTitle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Title", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.ContactTitle), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() + { + ListFormCode = listFormContactTitle.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Abbreviation", + Width = 100, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.ContactTitle), + PivotSettingsJson = DefaultPivotSettingsJson + } + ]); + #endregion + } + #endregion + + #region Currency + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Currency)) + { + var listFormCurrency = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Currency, + Name = AppCodes.Parameters.Currency, + Title = AppCodes.Parameters.Currency, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Parameters.Currency, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Currency)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Parameters.Currency), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Currency))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Parameters.Currency, Width = 500, Height = 350 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() + { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto + { + Order = 1, + DataField = "Code", + ColSpan = 2, + IsRequired = true, + EditorType2 = EditorTypes.dxTextBox + }, + new EditingFormItemDto + { + Order = 2, + DataField = "Symbol", + ColSpan = 2, + IsRequired = false, + EditorType2 = EditorTypes.dxTextBox + }, + new EditingFormItemDto + { + Order = 3, + DataField = "Name", + ColSpan = 2, + IsRequired = true, + EditorType2 = EditorTypes.dxTextBox + }, + new EditingFormItemDto + { + Order = 4, + DataField = "Rate", + ColSpan = 2, + IsRequired = true, + EditorType2 = EditorTypes.dxNumberBox + }, + new EditingFormItemDto + { + Order = 5, + DataField = "IsActive", + ColSpan = 2, + IsRequired = false, + EditorType2 = EditorTypes.dxCheckBox + } + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }) + }); + + #region Currency Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormCurrency.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Currency), + }, + new() + { + ListFormCode = listFormCurrency.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 120, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Currency), + }, + new() + { + ListFormCode = listFormCurrency.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Symbol", + Width = 100, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Currency), + }, + new() + { + ListFormCode = listFormCurrency.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Currency), + }, + new() + { + ListFormCode = listFormCurrency.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Rate", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Currency), + }, + new() + { + ListFormCode = listFormCurrency.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 80, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Currency), + } + ]); + #endregion + } + #endregion + + #region CountryGroup + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.CountryGroup)) + { + var listFormCountryGroup = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.CountryGroup, + Name = AppCodes.Parameters.CountryGroup, + Title = AppCodes.Parameters.CountryGroup, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Parameters.CountryGroup, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.CountryGroup)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Parameters.CountryGroup), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.CountryGroup))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Parameters.CountryGroup, Width = 400, Height = 200 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto + { + Order = 1, + DataField = "Name", + ColSpan = 2, + IsRequired = true, + EditorType2 = EditorTypes.dxTextBox + } + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }) + }); + + #region CountryGroup Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormCountryGroup.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.CountryGroup), + }, + new() + { + ListFormCode = listFormCountryGroup.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.CountryGroup), + } + ]); + #endregion + } + #endregion + + #region Country + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Country)) + { + var listFormCountry = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Country, + Name = AppCodes.Parameters.Country, + Title = AppCodes.Parameters.Country, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Parameters.Country, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Country)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Parameters.Country), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Country))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Parameters.Country, Width = 600, Height = 500 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "GroupName", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 4, DataField = "CurrencyId", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 5, DataField = "PhoneCode", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 6, DataField = "TaxLabel", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 7, DataField = "ZipRequired", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 8, DataField = "StateRequired", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxCheckBox } + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }) + }); + + #region Country Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormCountry.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), + }, + new() + { + ListFormCode = listFormCountry.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), + }, + new() + { + ListFormCode = listFormCountry.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), + }, + new() + { + ListFormCode = listFormCountry.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "GroupName", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CountryGroupValues, + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), + }, + new() + { + ListFormCode = listFormCountry.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "CurrencyId", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.CurrencyValues, + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), + }, + new() + { + ListFormCode = listFormCountry.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "PhoneCode", + Width = 80, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), + }, + new() + { + ListFormCode = listFormCountry.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "TaxLabel", + Width = 120, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), + }, + new() + { + ListFormCode = listFormCountry.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "ZipRequired", + Width = 80, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), + }, + new() + { + ListFormCode = listFormCountry.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "StateRequired", + Width = 80, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), + } + ]); + #endregion + + } + #endregion + + #region City + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.City)) + { + var listFormCity = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.City, + Name = AppCodes.Parameters.City, + Title = AppCodes.Parameters.City, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Parameters.City, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.City)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Parameters.City), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.City))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Parameters.City, Width = 500, Height = 300 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "Country", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "PlateCode", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox } + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + }); + + #region City Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormCity.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.City), + }, + new() + { + ListFormCode = listFormCity.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Country", + Width = 400, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CountryValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.City), + }, + new() + { + ListFormCode = listFormCity.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.City), + }, + new() + { + ListFormCode = listFormCity.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 120, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.City), + }, + new() + { + ListFormCode = listFormCity.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "PlateCode", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.City), + }, + ]); + #endregion + } + #endregion + + #region District + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.District)) + { + var listFormDistrict = await _listFormRepository.InsertAsync( + new ListForm + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.District, + Name = AppCodes.Parameters.District, + Title = AppCodes.Parameters.District, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Parameters.District, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.District)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Parameters.District), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.District))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto { Title = AppCodes.Parameters.District, Width = 600, Height = 500 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "Country", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 2, DataField = "City", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "Township", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 5, DataField = "Street", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 6, DataField = "ZipCode", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox } + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } + }) + }); + + #region City Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormDistrict.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.District), + }, + new() + { + ListFormCode = listFormDistrict.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Country", + Width = 120, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CountryValues, + CascadeEmptyFields = "City" + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.District), + }, + new() + { + ListFormCode = listFormDistrict.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "City", + Width = 120, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CityValues, + CascadeRelationField = "Country", + CascadeFilterOperator="=", + CascadeParentFields = "Country" + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.District), + }, + new() + { + ListFormCode = listFormDistrict.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.District), + }, + new() + { + ListFormCode = listFormDistrict.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Township", + Width = 200, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.District), + }, + new() + { + ListFormCode = listFormDistrict.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Street", + Width = 400, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.District), + }, + new() + { + ListFormCode = listFormDistrict.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ZipCode", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.District), + }, + ]); + #endregion + } + #endregion + } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_SupplyChain.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_SupplyChain.cs new file mode 100644 index 00000000..c935cbf9 --- /dev/null +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_SupplyChain.cs @@ -0,0 +1,395 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Text.Json; +using System.Threading.Tasks; +using Kurs.Languages.Languages; +using Kurs.Platform.Entities; +using Kurs.Platform.Enums; +using Kurs.Platform.ListForms; +using Kurs.Platform.Queries; +using Microsoft.Extensions.Configuration; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; +using Volo.Abp.TenantManagement; +using AbpIdentity = Kurs.Platform.Data.Seeds.SeedConsts.AbpIdentity; +using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes; +using static Kurs.Platform.PlatformConsts; +using static Kurs.Platform.PlatformSeeder.SeederDefaults; + +namespace Kurs.Platform.Data.Seeds; + +public class ListFormSeeder_SupplyChain : IDataSeedContributor, ITransientDependency +{ + private readonly IRepository _listFormRepository; + private readonly IRepository _listFormFieldRepository; + private readonly IdentityUserManager _identityUserManager; + private readonly IdentityRoleManager _identityRoleManager; + private readonly IConfiguration _configuration; + + public ListFormSeeder_SupplyChain( + IRepository listFormRepository, + IRepository listFormFieldRepository, + IdentityUserManager userManager, + IdentityRoleManager roleManager, + IConfiguration configuration) + { + _listFormRepository = listFormRepository; + _listFormFieldRepository = listFormFieldRepository; + _identityUserManager = userManager; + _identityRoleManager = roleManager; + _configuration = configuration; + } + + public async Task SeedAsync(DataSeedContext context) + { + #region Material Type + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MaterialType)) + { + var listFormMaterialType = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.MaterialType, + Name = AppCodes.SupplyChain.MaterialType, + Title = AppCodes.SupplyChain.MaterialType, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.SupplyChain.MaterialType, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialType)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.SupplyChain.MaterialType), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.SupplyChain.MaterialType, Width = 500, Height = 250 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 4, DataField = "IsActive", ColSpan = 2, EditorType2=EditorTypes.dxCheckBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region MaterialType Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormMaterialType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormMaterialType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormMaterialType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 350, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormMaterialType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 500, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + PivotSettingsJson = DefaultPivotSettingsJson + }, + + new() { + ListFormCode = listFormMaterialType.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + PivotSettingsJson = DefaultPivotSettingsJson + } + }); + #endregion + } + #endregion + + #region Material Group + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MaterialGroup)) + { + var listFormMaterialGroup = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.MaterialGroup, + Name = AppCodes.SupplyChain.MaterialGroup, + Title = AppCodes.SupplyChain.MaterialGroup, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.SupplyChain.MaterialGroup, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullViewName(nameof(TableNameEnum.MaterialGroup)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.SupplyChain.MaterialGroup), + DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialGroup))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + }), + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() { Title = AppCodes.SupplyChain.MaterialGroup, Width = 500, Height = 350 }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = true, + }), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 4, DataField = "IsActive", ColSpan = 2, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 5, DataField = "ParentGroupId", ColSpan = 2, EditorType2=EditorTypes.dxSelectBox }, + ]} + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region MaterialGroup Fields + await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + new() { + ListFormCode = listFormMaterialGroup.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialGroup), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormMaterialGroup.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialGroup), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormMaterialGroup.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 250, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialGroup), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormMaterialGroup.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 300, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialGroup), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormMaterialGroup.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialGroup), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormMaterialGroup.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "ParentGroupId", + Width = 400, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = LookupQueryValues.MaterialGroupValues, + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialGroup), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listFormMaterialGroup.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "HierarchyPath", + Width = 500, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.SupplyChain.MaterialGroup + ".Create", + R = AppCodes.SupplyChain.MaterialGroup, + U = AppCodes.SupplyChain.MaterialGroup + ".Update", + E = true, + I = false, + Deny = false + }), + PivotSettingsJson = DefaultPivotSettingsJson, + } + }); + #endregion + } + #endregion + } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Warehouse.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Warehouse.cs new file mode 100644 index 00000000..9a944419 --- /dev/null +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder_Warehouse.cs @@ -0,0 +1,200 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Text.Json; +using System.Threading.Tasks; +using Kurs.Languages.Languages; +using Kurs.Platform.Entities; +using Kurs.Platform.Enums; +using Kurs.Platform.ListForms; +using Kurs.Platform.Queries; +using Microsoft.Extensions.Configuration; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; +using Volo.Abp.TenantManagement; +using AbpIdentity = Kurs.Platform.Data.Seeds.SeedConsts.AbpIdentity; +using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes; +using static Kurs.Platform.PlatformConsts; +using static Kurs.Platform.PlatformSeeder.SeederDefaults; + +namespace Kurs.Platform.Data.Seeds; + +public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependency +{ + private readonly IRepository _listFormRepository; + private readonly IRepository _listFormFieldRepository; + private readonly IdentityUserManager _identityUserManager; + private readonly IdentityRoleManager _identityRoleManager; + private readonly IConfiguration _configuration; + + public ListFormSeeder_Warehouse( + IRepository listFormRepository, + IRepository listFormFieldRepository, + IdentityUserManager userManager, + IdentityRoleManager roleManager, + IConfiguration configuration) + { + _listFormRepository = listFormRepository; + _listFormFieldRepository = listFormFieldRepository; + _identityUserManager = userManager; + _identityRoleManager = roleManager; + _configuration = configuration; + } + + public async Task SeedAsync(DataSeedContext context) + { + // #region Material Type + // if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MaterialType)) + // { + // var listFormMaterialType = await _listFormRepository.InsertAsync( + // new ListForm() + // { + // ListFormType = ListFormTypeEnum.List, + // IsSubForm = false, + // LayoutJson = DefaultLayoutJson, + // CultureName = LanguageCodes.En, + // ListFormCode = ListFormCodes.Lists.MaterialType, + // Name = AppCodes.SupplyChain.MaterialType, + // Title = AppCodes.SupplyChain.MaterialType, + // DataSourceCode = SeedConsts.DataSources.DefaultCode, + // IsTenant = true, + // IsBranch = false, + // IsOrganizationUnit = false, + // Description = AppCodes.SupplyChain.MaterialType, + // SelectCommandType = SelectCommandTypeEnum.Table, + // SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialType)), + // KeyFieldName = "Id", + // KeyFieldDbSourceType = DbType.Guid, + // DefaultFilter = DefaultFilterJson, + // SortMode = GridOptions.SortModeSingle, + // FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + // HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + // SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + // GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), + // SelectionJson = DefaultSelectionSingleJson, + // ColumnOptionJson = DefaultColumnOptionJson, + // PermissionJson = DefaultPermissionJson(AppCodes.SupplyChain.MaterialType), + // DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + // DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + // new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + // new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } + // }), + // PagerOptionJson = DefaultPagerOptionJson, + // EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + // { + // Popup = new GridEditingPopupDto() { Title = AppCodes.SupplyChain.MaterialType, Width = 500, Height = 250 }, + // AllowDeleting = true, + // AllowAdding = true, + // AllowUpdating = true, + // SendOnlyChangedFormValuesUpdate = false, + // }), + // EditingFormJson = JsonSerializer.Serialize(new List() { + // new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ + // new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + // new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + // new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextArea }, + // new EditingFormItemDto { Order = 4, DataField = "IsActive", ColSpan = 2, EditorType2=EditorTypes.dxCheckBox }, + // ]} + // }), + // InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + // new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + // new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + // new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } + // }), + // FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + // new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + // }), + // } + // ); + + // #region MaterialType Fields + // await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.Guid, + // FieldName = "Id", + // Width = 100, + // ListOrderNo = 1, + // Visible = false, + // IsActive = true, + // IsDeleted = false, + // ValidationRuleJson = DefaultValidationRuleRequiredJson, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.String, + // FieldName = "Code", + // Width = 150, + // ListOrderNo = 2, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // AllowSearch = true, + // ValidationRuleJson = DefaultValidationRuleRequiredJson, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.String, + // FieldName = "Name", + // Width = 350, + // ListOrderNo = 3, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // SortIndex = 1, + // SortDirection = GridColumnOptions.SortOrderAsc, + // AllowSearch = true, + // ValidationRuleJson = DefaultValidationRuleRequiredJson, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.String, + // FieldName = "Description", + // Width = 500, + // ListOrderNo = 4, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // AllowSearch = true, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // }, + + // new() { + // ListFormCode = listFormMaterialType.ListFormCode, + // CultureName = LanguageCodes.En, + // SourceDbType = DbType.Boolean, + // FieldName = "IsActive", + // Width = 100, + // ListOrderNo = 5, + // Visible = true, + // IsActive = true, + // IsDeleted = false, + // AllowSearch = true, + // ColumnCustomizationJson = DefaultColumnCustomizationJson, + // PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), + // PivotSettingsJson = DefaultPivotSettingsJson + // } + // }); + // #endregion + // } + // #endregion + + } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListSeeder.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListSeeder.cs deleted file mode 100644 index 8ab67e01..00000000 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/ListSeeder.cs +++ /dev/null @@ -1,22085 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Text.Json; -using System.Threading.Tasks; -using Kurs.Languages.Languages; -using Kurs.Platform.Entities; -using Kurs.Platform.Enums; -using Kurs.Platform.ListForms; -using Kurs.Platform.Queries; -using Microsoft.Extensions.Configuration; -using Volo.Abp.Data; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Repositories; -using Volo.Abp.Identity; -using Volo.Abp.TenantManagement; -using AbpIdentity = Kurs.Platform.Data.Seeds.SeedConsts.AbpIdentity; -using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes; -using static Kurs.Platform.PlatformConsts; -using static Kurs.Platform.PlatformSeeder.SeederDefaults; - -namespace Kurs.Platform.Data.Seeds; - -public class ListSeeder : IDataSeedContributor, ITransientDependency -{ - private readonly IRepository _listFormRepository; - private readonly IRepository _listFormFieldRepository; - private readonly IdentityUserManager _identityUserManager; - private readonly IdentityRoleManager _identityRoleManager; - private readonly IConfiguration _configuration; - - public ListSeeder( - IRepository listFormRepository, - IRepository listFormFieldRepository, - IdentityUserManager userManager, - IdentityRoleManager roleManager, - IConfiguration configuration) - { - _listFormRepository = listFormRepository; - _listFormFieldRepository = listFormFieldRepository; - _identityUserManager = userManager; - _identityRoleManager = roleManager; - _configuration = configuration; - } - - public async Task SeedAsync(DataSeedContext context) - { - #region Tenant - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Tenant)) - { - var listFormTenants = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Tenant, - Name = TenantManagementPermissions.Tenants.Default, - Title = TenantManagementPermissions.Tenants.Default, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = TenantManagementPermissions.Tenants.Default, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = "AbpTenants", - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, TenantManagementPermissions.Tenants.Delete, TenantManagementPermissions.Tenants.Default + ".Export", TenantManagementPermissions.Tenants.Default + ".Import", TenantManagementPermissions.Tenants.Default + ".Activity"), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = TenantManagementPermissions.Tenants.Default, Width = 900, Height = 450 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items = - [ - new EditingFormItemDto { Order=1, DataField = "Name", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=2, DataField = "OrganizationName", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=3, DataField = "Founder", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=4, DataField = "VknTckn", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order=5, DataField = "TaxOffice", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=6, DataField = "Mobile", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order=7, DataField = "Phone", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order=8, DataField = "Fax", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order=9, DataField = "IsActive", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, - ] - }, - new() { Order=2, ColCount=1, ColSpan=1, ItemType="group", Items = - [ - new EditingFormItemDto { Order=1, DataField = "Country", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=2, DataField = "City", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=3, DataField = "District", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=4, DataField = "Street", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=5, DataField = "PostalCode", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=6, DataField = "Address1", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=7, DataField = "Address2", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=8, DataField = "Email", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=9, DataField = "Website", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=10, DataField = "MenuGroup", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox }, - ] - } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Seed", - Text = "Seed", - AuthName = TenantManagementPermissions.Tenants.ManageConnectionStrings, - DialogName = "TenantsConnectionString", - DialogParameters = JsonSerializer.Serialize(new { - name = "@Name", - id = "@Id" - }) - }, - new() { - Hint = "Branches", - Text = "Branches", - AuthName = AppCodes.Branches, - Url = "/admin/form/form-tenant/@Id", - }, - }), - InsertServiceAddress = "list-form-dynamic-api/tenant-insert", - UpdateServiceAddress = "list-form-dynamic-api/tenant-update", - DeleteCommand = "DELETE FROM \"AbpTenants\" WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - - } - ); - - #region Tenants Fields - await _listFormFieldRepository.InsertManyAsync( - [ - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 500, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "OrganizationName", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Founder", - Width = 200, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "VknTckn", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "TaxOffice", - Width = 150, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Country", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CountryValues, - CascadeEmptyFields = "City,District,Street" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "City", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CityValues, - CascadeRelationField = "Country", - CascadeFilterOperator="=", - CascadeParentFields = "Country", - CascadeEmptyFields = "District,Street" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "District", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.DistrictValues, - CascadeRelationField = "City", - CascadeFilterOperator="=", - CascadeParentFields = "Country,City", - CascadeEmptyFields = "Street", - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Street", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.StreetValues, - CascadeRelationField = "District", - CascadeFilterOperator="=", - CascadeParentFields = "Country,City,District" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address1", - Width = 150, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address2", - Width = 150, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "PostalCode", - Width = 100, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Email", - Width = 170, - ListOrderNo = 14, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleEmailJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Website", - Width = 170, - ListOrderNo = 15, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Mobile", - Width = 100, - ListOrderNo = 16, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Phone", - Width = 100, - ListOrderNo = 17, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Fax", - Width = 100, - ListOrderNo = 18, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - Width = 100, - ListOrderNo = 19, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormTenants.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "MenuGroup", - Width = 100, - ListOrderNo = 20, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Kurs", Name="Kurs" }, - new () { Key="Erp", Name="Erp" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - - } - #endregion - - #region Branche - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Branch)) - { - var listFormBranches = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Branch, - Name = AppCodes.Branches, - Title = AppCodes.Branches, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Branches, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Branch)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Branches), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Branches, Width = 900, Height = 450 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items = - [ - new EditingFormItemDto { Order=1, DataField = "TenantId", ColSpan=2, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=2, DataField = "Code", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=3, DataField = "Name", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=4, DataField = "VknTckn", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order=5, DataField = "TaxOffice", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=6, DataField = "Mobile", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order=7, DataField = "Phone", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order=8, DataField = "Fax", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order=9, DataField = "IsActive", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, - ] - }, - new() { Order=2, ColCount=1, ColSpan=1, ItemType="group", Items = - [ - new EditingFormItemDto { Order=1, DataField = "Country", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=2, DataField = "City", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=3, DataField = "District", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=4, DataField = "Street", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=5, DataField = "Address1", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=6, DataField = "Address2", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=7, DataField = "PostalCode", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=8, DataField = "Email", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=9, DataField = "Website", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - ] - } - }), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Branch))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Seed", - Text = "Seed", - AuthName = AppCodes.Branches + ".Update", - DialogName = "BranchSeed", - DialogParameters = JsonSerializer.Serialize(new { - name = "@Id", - }) - }, - }), - } - ); - - #region Branches Fields - await _listFormFieldRepository.InsertManyAsync( - [ - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 500, - ListOrderNo = 0, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "TenantId", - Width = 200, - ListOrderNo = 1, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.TenantValues, - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "VknTckn", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "TaxOffice", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Country", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CountryValues, - CascadeEmptyFields = "City,District,Street" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "City", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CityValues, - CascadeRelationField = "Country", - CascadeFilterOperator="=", - CascadeParentFields = "Country", - CascadeEmptyFields = "District,Street" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "District", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.DistrictValues, - CascadeRelationField = "City", - CascadeFilterOperator="=", - CascadeParentFields = "Country,City", - CascadeEmptyFields = "Street", - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Street", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.StreetValues, - CascadeRelationField = "District", - CascadeFilterOperator="=", - CascadeParentFields = "Country,City,District" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address1", - Width = 150, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address2", - Width = 150, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "PostalCode", - Width = 100, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Email", - Width = 170, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleEmailJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Website", - Width = 170, - ListOrderNo = 14, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Mobile", - Width = 100, - ListOrderNo = 15, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Phone", - Width = 100, - ListOrderNo = 16, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Fax", - Width = 100, - ListOrderNo = 17, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormBranches.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - Width = 100, - ListOrderNo = 18, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Branches), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Permission Group - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.PermissionGroup)) - { - var listFormPermissionGroups = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.PermissionGroup, - Name = AbpIdentity.PermissionGroups.Default, - Title = AbpIdentity.PermissionGroups.Default, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AbpIdentity.PermissionGroups.Default, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = "AbpPermissionGroups", - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AbpIdentity.PermissionGroups.Create, AbpIdentity.PermissionGroups.Default, AbpIdentity.PermissionGroups.Update, AbpIdentity.PermissionGroups.Delete, AbpIdentity.PermissionGroups.Export, AbpIdentity.PermissionGroups.Import, AbpIdentity.PermissionGroups.Activity), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AbpIdentity.PermissionGroups.Default, Width = 800, Height = 350 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { Order=1, ColCount=1, ColSpan=2, ItemType="group", Items = - [ - new EditingFormItemDto { Order=1, DataField="Name", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=2, DataField="DisplayName", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=3, DataField="ExtraProperties", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - ] - } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "ExtraProperties", FieldDbType = DbType.String, Value = "{}", CustomValueType = FieldCustomValueTypeEnum.Value }, - }) - } - ); - - #region Permission Groups Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - new() { - ListFormCode = listFormPermissionGroups.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AbpIdentity.PermissionGroups.Create, AbpIdentity.PermissionGroups.Default, AbpIdentity.PermissionGroups.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPermissionGroups.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 300, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AbpIdentity.PermissionGroups.Create, AbpIdentity.PermissionGroups.Default, AbpIdentity.PermissionGroups.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPermissionGroups.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DisplayName", - Width = 300, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AbpIdentity.PermissionGroups.Create, AbpIdentity.PermissionGroups.Default, AbpIdentity.PermissionGroups.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPermissionGroups.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ExtraProperties", - Width = 300, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AbpIdentity.PermissionGroups.Create, AbpIdentity.PermissionGroups.Default, AbpIdentity.PermissionGroups.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - }); - #endregion - } - #endregion - - #region Permission - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Permission)) - { - var listFormPermissions = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Permission, - Name = AbpIdentity.Permissions.Default, - Title = AbpIdentity.Permissions.Default, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AbpIdentity.Permissions.Default, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = "AbpPermissions", - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, AbpIdentity.Permissions.Delete, AbpIdentity.Permissions.Export, AbpIdentity.Permissions.Import, AbpIdentity.Permissions.Activity), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AbpIdentity.Permissions.Default, Width = 800, Height = 350 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order=1, DataField="GroupName", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=2, DataField="Name", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=3, DataField="DisplayName", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=4, DataField="IsEnabled", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order=5, DataField="MultiTenancySide", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=6, DataField="MenuGroup", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTagBox }, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsEnabled", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "MultiTenancySide", FieldDbType = DbType.Int16, Value = "3", CustomValueType = FieldCustomValueTypeEnum.Value }, - }) - } - ); - - #region Permission Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - new() { - ListFormCode = listFormPermissions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPermissions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "GroupName", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = $"SELECT \"AbpPermissions\".\"GroupName\" AS \"Key\", \"AbpPermissions\".\"GroupName\" as \"Name\" FROM \"AbpPermissions\" GROUP BY \"AbpPermissions\".\"GroupName\" ORDER BY \"AbpPermissions\".\"GroupName\"", - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPermissions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ParentName", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormPermissions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormPermissions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DisplayName", - Width = 250, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormPermissions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsEnabled", - Width = 85, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormPermissions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int16, - FieldName = "MultiTenancySide", - Width = 85, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key=1,Name="Tenant" }, - new () { Key=2,Name="Host" }, - new () { Key=3,Name="Both" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormPermissions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "MenuGroup", - Width = 85, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Kurs",Name="Kurs" }, - new () { Key="Erp",Name="Erp" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AbpIdentity.Permissions.Create, AbpIdentity.Permissions.Default, AbpIdentity.Permissions.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Role - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Role)) - { - var listFormRoles = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Role, - Name = PlatformConsts.IdentityPermissions.Roles.Default, - Title = PlatformConsts.IdentityPermissions.Roles.Default, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - Description = PlatformConsts.IdentityPermissions.Roles.Default, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = "AbpRoles", - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(PlatformConsts.IdentityPermissions.Roles.Create, PlatformConsts.IdentityPermissions.Roles.Default, PlatformConsts.IdentityPermissions.Roles.Update, PlatformConsts.IdentityPermissions.Roles.Delete, PlatformConsts.IdentityPermissions.Roles.Export, PlatformConsts.IdentityPermissions.Roles.Import, PlatformConsts.IdentityPermissions.Roles.Activity), - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = PlatformConsts.IdentityPermissions.Roles.Default, Width = 500, Height = 300 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1, ColCount=1, ColSpan=2, ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "IsDefault", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 3, DataField = "IsPublic", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - ]} - }), - DeleteCommand = "DELETE FROM \"AbpRoles\" WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new FieldsDefaultValue() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - InsertServiceAddress = "list-form-dynamic-api/role-insert", - UpdateServiceAddress = "list-form-dynamic-api/role-update", - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Permission", - Text = "Permission", - AuthName = PlatformConsts.IdentityPermissions.Roles.ManagePermissions, - DialogName = "RolesPermission", - DialogParameters = JsonSerializer.Serialize(new { - name = "@Name", - }) - }, - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { - FieldName = "IsDefault", - FieldDbType = DbType.Boolean, - Value = "false", - CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { - FieldName = "IsPublic", - FieldDbType = DbType.Boolean, - Value = "true", - CustomValueType = FieldCustomValueTypeEnum.Value }, - }) - } - ); - - #region Roles Fields - await _listFormFieldRepository.InsertManyAsync( - [ - new() { - ListFormCode = listFormRoles.ListFormCode, - RoleId = null, - UserId = null, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 400, - ListOrderNo = 1, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Roles.Create, PlatformConsts.IdentityPermissions.Roles.Default, PlatformConsts.IdentityPermissions.Roles.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormRoles.ListFormCode, - RoleId = null, - UserId = null, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsDefault", - Width = 85, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Roles.Create, PlatformConsts.IdentityPermissions.Roles.Default, PlatformConsts.IdentityPermissions.Roles.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormRoles.ListFormCode, - RoleId = null, - UserId = null, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsPublic", - Width = 85, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Roles.Create, PlatformConsts.IdentityPermissions.Roles.Default, PlatformConsts.IdentityPermissions.Roles.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region User - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.User)) - { - var listFormUsers = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.User, - Name = PlatformConsts.IdentityPermissions.Users.Default, - Title = PlatformConsts.IdentityPermissions.Users.Default, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - Description = PlatformConsts.IdentityPermissions.Users.Default, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = "AbpUsers", - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, PlatformConsts.IdentityPermissions.Users.Delete, PlatformConsts.IdentityPermissions.Users.Export, PlatformConsts.IdentityPermissions.Users.Import, PlatformConsts.IdentityPermissions.Users.Activity), - DeleteCommand = $"UPDATE \"AbpUsers\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = PlatformConsts.IdentityPermissions.Users.Default, Width = 500, Height = 400 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new () { Order=1,ColCount=1,ColSpan=2,ItemType="group",Items=[ - new EditingFormItemDto { Order=1, DataField="Email", 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="Surname", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=4, DataField="PhoneNumber", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=5, DataField="Password", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=6, DataField="IsActive", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, - ]} - }), - InsertServiceAddress = "list-form-dynamic-api/user-insert", - UpdateServiceAddress = "list-form-dynamic-api/user-update", - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new CommandColumnDto() { - Hint = "Detail", - Text ="Detail", - UrlTarget="_blank", - AuthName=PlatformConsts.IdentityPermissions.Users.Update, - Url="/admin/users/detail/@Id" - }, - new CommandColumnDto() { - Hint = "Permission", - Text = "Permission", - AuthName = PlatformConsts.IdentityPermissions.Users.ManagePermissions, - DialogName = "UsersPermission", - DialogParameters = JsonSerializer.Serialize(new { - name = "@Email", - id = "@Id" - }) - }, - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new FieldsDefaultValue() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - }); - - #region Users Fields - await _listFormFieldRepository.InsertManyAsync( - [ - new ListFormField - { - ListFormCode = listFormUsers.ListFormCode, - RoleId = null, - UserId = null, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 125, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormUsers.ListFormCode, - RoleId = null, - UserId = null, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Email", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] - { - new() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.email) }, - new() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) } - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormUsers.ListFormCode, - RoleId = null, - UserId = null, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormUsers.ListFormCode, - RoleId = null, - UserId = null, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Surname", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormUsers.ListFormCode, - RoleId = null, - UserId = null, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "PhoneNumber", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormUsers.ListFormCode, - RoleId = null, - UserId = null, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormUsers.ListFormCode, - RoleId = null, - UserId = null, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Password", - Width = 100, - ListOrderNo = 7, - Visible = false, - IsActive = false, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(PlatformConsts.IdentityPermissions.Users.Create, PlatformConsts.IdentityPermissions.Users.Default, PlatformConsts.IdentityPermissions.Users.Update, true, true, false), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Language - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Language)) - { - var listFormLanguages = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Language, - Name = AppCodes.Languages.Language, - Title = AppCodes.Languages.Language, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Languages.Language, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Language)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Languages.Language), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Language))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Languages.Language, Width = 600, Height = 300 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= - [ - new EditingFormItemDto { Order = 1, DataField = "CultureName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "UiCultureName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "DisplayName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "IsEnabled", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsEnabled", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Manage", - Text ="Manage", - UrlTarget="_blank", - AuthName = AppCodes.Languages.LanguageText, - Url=$"/admin/form/{ListFormCodes.Forms.FormLanguage}/@Id" - }, - }), - } - ); - - #region Language Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new ListFormField - { - ListFormCode = listFormLanguages.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormLanguages.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "CultureName", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormLanguages.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "UiCultureName", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormLanguages.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DisplayName", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormLanguages.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsEnabled", - Width = 125, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.Language), - PivotSettingsJson = DefaultPivotSettingsJson - }, - }); - - #endregion - } - #endregion - - #region LanguageText - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.LanguageText)) - { - var listFormLanguageTexts = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.LanguageText, - Name = AppCodes.Languages.LanguageText, - Title = AppCodes.Languages.LanguageText, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Languages.LanguageText, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.LanguageText)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Languages.LanguageText), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.LanguageText))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Languages.LanguageText, Width = 800, Height = 300 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= - [ - new EditingFormItemDto { Order = 1, DataField = "CultureName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "ResourceName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "Key", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 4, DataField = "Value", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region LanguageText Fields - await _listFormFieldRepository.InsertManyAsync([ - new ListFormField - { - ListFormCode = listFormLanguageTexts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.LanguageText), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormLanguageTexts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "CultureName", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto { - - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CultureValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.LanguageText), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormLanguageTexts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ResourceName", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new() { Key="AbpAccount",Name="AbpAccount" }, - new() { Key="Platform",Name="Platform" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.LanguageText), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormLanguageTexts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Key", - Width = 350, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.LanguageText), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormLanguageTexts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Value", - Width = 350, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Languages.LanguageText), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - - #endregion - } - #endregion - - #region Menu - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Menu)) - { - var listFormMenus = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Menu, - Name = AppCodes.Menus.Menu, - Title = AppCodes.Menus.Menu, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Menus.Menu, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Menu)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Menus.Menu), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Menu))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { - FieldName = "DeleterId", - FieldDbType = DbType.Guid, - Value = "@USERID", - CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { - FieldName = "Id", - FieldDbType = DbType.Guid, - Value = "@ID", - CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Menus.Menu, Width = 800, Height = 500 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= - [ - new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "DisplayName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "Order", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 4, DataField = "Url", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "Icon", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 6, DataField = "ParentCode", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 7, DataField = "CssClass", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 8, DataField = "RequiredPermissionName", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 9, DataField = "Target", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 10, DataField = "IsDisabled", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 11, DataField = "ElementId", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDisabled", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new FieldsDefaultValue() { FieldName = "IsDisabled", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - } - ); - - #region Menu Fields - await _listFormFieldRepository.InsertManyAsync([ - new ListFormField - { - ListFormCode = listFormMenus.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormMenus.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 300, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormMenus.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DisplayName", - Width = 300, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormMenus.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Order", - Width = 50, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormMenus.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Url", - Width = 250, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormMenus.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Icon", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormMenus.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ParentCode", - Width = 200, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.MenuCodeValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormMenus.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "CssClass", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormMenus.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "RequiredPermissionName", - Width = 200, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.PermissionNameValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormMenus.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Target", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormMenus.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsDisabled", - Width = 100, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormMenus.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ElementId", - Width = 100, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Menus.Menu), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - - #endregion - } - #endregion - - #region ListForm - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Listform)) - { - var listForms = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Listform, - Name = AppCodes.Listforms.Listform, - Title = AppCodes.Listforms.Listform, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Listforms.Listform, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ListForm)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeMultiple, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true, ApplyFilter = GridOptions.FilterRowApplyFilterAuto }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionMultipleJson, - ColumnOptionJson = DefaultColumnOptionJson, - DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.ListForm)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new FieldsDefaultValue() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PermissionJson = DefaultPermissionJson(AppCodes.Listforms.Listform), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Listforms.Listform, Width = 800, Height = 500 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "CultureName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "ListFormCode", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "ListFormType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 5, DataField = "SelectCommandType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 6, DataField = "SelectCommand", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 7, DataField = "TableName", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 8, DataField = "KeyFieldName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 9, DataField = "KeyFieldDbSourceType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 10, DataField = "Description", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 11, DataField = "Title", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 12, DataField = "SortMode", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 13, DataField = "DeleteServiceAddress", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 14, DataField = "InsertServiceAddress", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 15, DataField = "UpdateServiceAddress", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 16, DataField = "IsTenant", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 17, DataField = "IsOrganizationUnit", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 18, DataField = "IsSubForm", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - ]}, - new() { - Order=2,ColCount=1,ColSpan=2,ItemType="group", Items= [ - new EditingFormItemDto { Order = 1, DataField = "PermissionJson:C", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "PermissionJson:R", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "PermissionJson:U", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "PermissionJson:D", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new FieldsDefaultValue() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Manage Listform", - Text ="Manage", - UrlTarget="_blank", - AuthName=AppCodes.Listforms.Listform + ".Update", - Url="/admin/listform/edit/@ListFormCode" - }, - new() { - Hint = "Göster", - Text ="Göster", - UrlTarget="_blank", - AuthName=AppCodes.Listforms.Listform, - Url="/admin/list/@ListFormCode" - } - }), - StateStoringJson = JsonSerializer.Serialize(new StateStoringDto { Enabled = true, StorageKey = "listFormGridStorage", Type = "custom" }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new FieldsDefaultValue() { - FieldName = "ListFormType", - FieldDbType = DbType.String, - Value = ListFormTypeEnum.List, - CustomValueType = FieldCustomValueTypeEnum.Value }, - new FieldsDefaultValue() { - FieldName = "InsertServiceAddress", - FieldDbType = DbType.String, - Value = "list-form-data/insert", - CustomValueType = FieldCustomValueTypeEnum.Value }, - new FieldsDefaultValue() { - FieldName = "DeleteServiceAddress", - FieldDbType = DbType.String, - Value = "list-form-data/delete", - CustomValueType = FieldCustomValueTypeEnum.Value }, - new FieldsDefaultValue() { - FieldName = "UpdateServiceAddress", - FieldDbType = DbType.String, - Value = "list-form-data/update", - CustomValueType = FieldCustomValueTypeEnum.Value }, - new FieldsDefaultValue() { - FieldName = "IsDisabled", - FieldDbType = DbType.Boolean, - Value = "false", - CustomValueType = FieldCustomValueTypeEnum.Value }, - new FieldsDefaultValue() { - FieldName = "IsTenant", - FieldDbType = DbType.Boolean, - Value = "false", - CustomValueType = FieldCustomValueTypeEnum.Value }, - new FieldsDefaultValue() { - FieldName = "IsOrganizationUnit", - FieldDbType = DbType.Boolean, - Value = "false", - CustomValueType = FieldCustomValueTypeEnum.Value }, - new FieldsDefaultValue() { - FieldName = "IsSubForm", - FieldDbType = DbType.Boolean, - Value = "false", - CustomValueType = FieldCustomValueTypeEnum.Value }, - new FieldsDefaultValue() { - FieldName = "SortMode", - FieldDbType = DbType.String, - Value = GridOptions.SortModeNone, - CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region ListForms Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "CultureName", - Width = 90, - ListOrderNo = 1, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnHeaderJson = JsonSerializer.Serialize(new ColumnHeaderDto - { - AllowHeaderFiltering = true, - DataSource = new List - { - new ColumnsHeaderDataSourceDto { Text = LanguageNames.Ar, Value = new List { "CultureName", "=", LanguageCodes.Ar } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.Cs, Value = new List { "CultureName", "=", LanguageCodes.Cs } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.De, Value = new List { "CultureName", "=", LanguageCodes.De } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.En, Value = new List { "CultureName", "=", LanguageCodes.En } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.Es, Value = new List { "CultureName", "=", LanguageCodes.Es } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.Fi, Value = new List { "CultureName", "=", LanguageCodes.Fi } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.Fr, Value = new List { "CultureName", "=", LanguageCodes.Fr } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.Hi, Value = new List { "CultureName", "=", LanguageCodes.Hi } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.Hr, Value = new List { "CultureName", "=", LanguageCodes.Hr } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.Hu, Value = new List { "CultureName", "=", LanguageCodes.Hu } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.It, Value = new List { "CultureName", "=", LanguageCodes.It } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.Pt, Value = new List { "CultureName", "=", LanguageCodes.Pt } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.Ru, Value = new List { "CultureName", "=", LanguageCodes.Ru } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.Sk, Value = new List { "CultureName", "=", LanguageCodes.Sk } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.Sl, Value = new List { "CultureName", "=", LanguageCodes.Sl } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.Tr, Value = new List { "CultureName", "=", LanguageCodes.Tr } }, - new ColumnsHeaderDataSourceDto { Text = LanguageNames.Zh, Value = new List { "CultureName", "=", LanguageCodes.Zh } }, - } - }), - AllowSearch = true, - ColumnFilterJson = JsonSerializer.Serialize(new ColumnFilterDto { SelectedFilterOperation = "=", FilterValue = "en" }), - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CultureValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 180, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 180, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ListFormCode", - Width = 120, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ListFormType", - Width = 75, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto{ - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new() { Key=ListFormTypeEnum.Form, Name=ListFormTypeEnum.Form.ToString() }, - new() { Key=ListFormTypeEnum.List, Name=ListFormTypeEnum.List.ToString() }, - new() { Key=ListFormTypeEnum.Chart, Name=ListFormTypeEnum.Chart.ToString() }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "SelectCommandType", - Width = 150, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new() { Key=SelectCommandTypeEnum.Table,Name=SelectCommandTypeEnum.Table.ToString() }, - new() { Key=SelectCommandTypeEnum.View,Name=SelectCommandTypeEnum.View.ToString() }, - new() { Key=SelectCommandTypeEnum.TableValuedFunction,Name=SelectCommandTypeEnum.TableValuedFunction.ToString() }, - new() { Key=SelectCommandTypeEnum.Query,Name=SelectCommandTypeEnum.Query.ToString() }, - new() { Key=SelectCommandTypeEnum.StoredProcedure,Name=SelectCommandTypeEnum.StoredProcedure.ToString() }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "SelectCommand", - Width = 150, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "TableName", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "KeyFieldName", - Width = 120, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "KeyFieldDbSourceType", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new() { Key=DbType.AnsiString,Name=DbType.AnsiString.ToString() }, - new() { Key=DbType.Binary,Name=DbType.Binary.ToString() }, - new() { Key=DbType.Byte,Name=DbType.Byte.ToString() }, - new() { Key=DbType.Boolean,Name=DbType.Boolean.ToString() }, - new() { Key=DbType.Currency,Name=DbType.Currency.ToString() }, - new() { Key=DbType.Date,Name=DbType.Date.ToString() }, - new() { Key=DbType.DateTime,Name=DbType.DateTime.ToString() }, - new() { Key=DbType.Decimal,Name=DbType.Decimal.ToString() }, - new() { Key=DbType.Double,Name=DbType.Double.ToString() }, - new() { Key=DbType.Guid,Name=DbType.Guid.ToString() }, - new() { Key=DbType.Int16,Name=DbType.Int16.ToString() }, - new() { Key=DbType.Int32,Name=DbType.Int32.ToString() }, - new() { Key=DbType.Int64,Name=DbType.Int64.ToString() }, - new() { Key=DbType.Object,Name=DbType.Object.ToString() }, - new() { Key=DbType.SByte,Name=DbType.SByte.ToString() }, - new() { Key=DbType.Single,Name=DbType.Single.ToString() }, - new() { Key=DbType.String,Name=DbType.String.ToString() }, - new() { Key=DbType.Time,Name=DbType.Time.ToString() }, - new() { Key=DbType.UInt16,Name=DbType.UInt16.ToString() }, - new() { Key=DbType.UInt32,Name=DbType.UInt32.ToString() }, - new() { Key=DbType.UInt64,Name=DbType.UInt64.ToString() }, - new() { Key=DbType.VarNumeric,Name=DbType.VarNumeric.ToString() }, - new() { Key=DbType.AnsiStringFixedLength,Name=DbType.AnsiStringFixedLength.ToString() }, - new() { Key=DbType.StringFixedLength,Name=DbType.StringFixedLength.ToString() }, - new() { Key=DbType.Xml,Name=DbType.Xml.ToString() }, - new() { Key=DbType.DateTime2,Name=DbType.DateTime2.ToString() }, - new() { Key=DbType.DateTimeOffset,Name=DbType.DateTimeOffset.ToString() }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Title", - Width = 150, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "SortMode", - Width = 100, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new() { Key=GridOptions.SortModeNone,Name=GridOptions.SortModeNone }, - new() { Key=GridOptions.SortModeSingle,Name=GridOptions.SortModeSingle }, - new() { Key=GridOptions.SortModeMultiple,Name=GridOptions.SortModeMultiple }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsTenant", - Width = 85, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsOrganizationUnit", - Width = 85, - ListOrderNo = 14, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsSubForm", - Width = 85, - ListOrderNo = 15, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "PermissionJson", - Width = 250, - ListOrderNo = 16, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DeleteServiceAddress", - Width = 120, - ListOrderNo = 17, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "InsertServiceAddress", - Width = 120, - ListOrderNo = 18, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listForms.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "UpdateServiceAddress", - Width = 120, - ListOrderNo = 19, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.Listform), - PivotSettingsJson = DefaultPivotSettingsJson - }, - }); - #endregion - } - #endregion - - #region SettingDefinition - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SettingDefinition)) - { - var listFormSettingDefinitions = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.SettingDefinition, - Name = AppCodes.Settings.SettingDefinitions, - Title = AppCodes.Settings.SettingDefinitions, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Settings.SettingDefinitions, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SettingDefinition)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Settings.SettingDefinitions), - DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.SettingDefinition)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new FieldsDefaultValue() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Settings.SettingDefinitions, Width = 800, Height = 400 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= [ - new EditingFormItemDto { Order = 1, DataField = "MainGroupKey", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "SubGroupKey", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "NameKey", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 5, DataField = "DescriptionKey", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 6, DataField = "DefaultValue", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 7, DataField = "IsVisibleToClients", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 8, DataField = "Providers", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 9, DataField = "IsInherited", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 10, DataField = "IsEncrypted", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 11, DataField = "RequiredPermissionName", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 12, DataField = "DataType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 13, DataField = "SelectOptions", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 14, DataField = "Order", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsVisibleToClients", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "IsInherited", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "IsEncrypted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region SettingDefinition Fields - await _listFormFieldRepository.InsertManyAsync([ - new ListFormField - { - ListFormCode = listFormSettingDefinitions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSettingDefinitions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 400, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSettingDefinitions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "MainGroupKey", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSettingDefinitions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "SubGroupKey", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSettingDefinitions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Order", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSettingDefinitions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "NameKey", - Width = 250, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSettingDefinitions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DescriptionKey", - Width = 250, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSettingDefinitions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "RequiredPermissionName", - Width = 400, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.PermissionNameValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSettingDefinitions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Providers", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new() { Key="U", Name="User" }, - new() { Key="T", Name="Tenant"}, - new() { Key="G", Name="Global"}, - new() { Key="C", Name="Configuration"}, - new() { Key="D", Name="Default"}, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSettingDefinitions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DefaultValue", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSettingDefinitions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DataType", - Width = 100, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new() { Key="Bool", Name="Bool" }, - new() { Key="Number", Name="Number"}, - new() { Key="Text", Name="Text"}, - new() { Key="Memo", Name="Memo"}, - new() { Key="List", Name="List"}, - }) - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSettingDefinitions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "SelectOptions", - Width = 100, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSettingDefinitions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsVisibleToClients", - Width = 150, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSettingDefinitions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsInherited", - Width = 100, - ListOrderNo = 14, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSettingDefinitions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsEncrypted", - Width = 100, - ListOrderNo = 15, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.SettingDefinitions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Data Source - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.DataSource)) - { - var listFormDataSources = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.DataSource, - Name = AppCodes.Listforms.DataSource, - Title = AppCodes.Listforms.DataSource, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Listforms.DataSource, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.DataSource)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Listforms.DataSource), - DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.DataSource)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new FieldsDefaultValue() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Listforms.DataSource, Width = 800, Height = 500 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= - [ - new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "DataSourceType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "ConnectionString", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":200}" }, - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - } - ); - - #region Data Source Fields - await _listFormFieldRepository.InsertManyAsync([ - new ListFormField - { - ListFormCode = listFormDataSources.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.DataSource), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormDataSources.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 300, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.DataSource), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormDataSources.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "DataSourceType", - Width = 300, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new() { Key = 1, Name = "Mssql" }, - new() { Key = 2, Name = "Postgresql" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.DataSource), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormDataSources.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ConnectionString", - Width = 250, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Listforms.DataSource), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Background Worker - var configurationSection = _configuration.GetSection("OpenIddict:Applications"); - var swaggerRootUrl = configurationSection["Platform_Swagger:RootUrl"]?.TrimEnd('/'); - - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.BackgroundWorker)) - { - var listFormBackgroundWorkers = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.BackgroundWorker, - Name = AppCodes.BackgroundWorkers, - Title = AppCodes.BackgroundWorkers, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.BackgroundWorkers, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.BackgroundWorker)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - ButtonPosition= UiCommandButtonPositionTypeEnum.Toolbar, - Hint = "Hangfire Login", - Text = "Hangfire Login", - AuthName=AppCodes.BackgroundWorkers, - Url= swaggerRootUrl + "/Account/Login", - }, - new() { - ButtonPosition= UiCommandButtonPositionTypeEnum.Toolbar, - Hint = "Hangfire Aç", - Text = "Hangfire Aç", - AuthName=AppCodes.BackgroundWorkers, - Url= swaggerRootUrl + "/hangfire", - }, - new() { - ButtonPosition= UiCommandButtonPositionTypeEnum.Toolbar, - Hint = "Hangfire Tazele", - Text = "Hangfire Tazele", - AuthName=AppCodes.BackgroundWorkers, - OnClick="UiEvalService.ApiGenerateBackgroundWorkers();" - }, - }), - PermissionJson = DefaultPermissionJson(AppCodes.BackgroundWorkers), - DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.BackgroundWorker)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.BackgroundWorkers, Width = 800, Height = 500 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group",Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Cron", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "WorkerType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 4, DataField = "BeforeSp", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "AfterSp", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 6, DataField = "IsActive", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - ] - }, - new() { Order=2,ColCount=1,ColSpan=2,ItemType="group",Items= [ - new EditingFormItemDto { Order = 1, DataField = "Options:MailType", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Options:MailSubject", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Options:MailTemplate", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":200}" }, - new EditingFormItemDto { Order = 4, DataField = "Options:Tablo", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - } - ); - - #region Background Worker Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormBackgroundWorkers.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBackgroundWorkers.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBackgroundWorkers.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Cron", - Width = 100, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBackgroundWorkers.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "WorkerType", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new() { Key=1,Name="MailQueueWorker" }, - new() { Key=2,Name="SqlWorker" }, - new() { Key=3,Name="NotificationWorker" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBackgroundWorkers.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "BeforeSp", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBackgroundWorkers.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "AfterSp", - Width = 150, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBackgroundWorkers.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Options", - Width = 200, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBackgroundWorkers.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - Width = 50, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BackgroundWorkers), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Notification Rule - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.NotificationRule)) - { - var listFormNotificationRules = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.NotificationRule, - Name = AppCodes.Notifications.NotificationRules, - Title = AppCodes.Notifications.NotificationRules, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Notifications.NotificationRules, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.NotificationRule)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Notifications.NotificationRules), - DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.NotificationRule)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Notifications.NotificationRules, Width = 800, Height = 500 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "NotificationType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "RecipientType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "RecipientId", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "Channel", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 5, DataField = "IsActive", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 6, DataField = "IsFixed", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 7, DataField = "IsCustomized", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "IsFixed", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "IsCustomized", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new CommandColumnDto() { - Hint = "Create", - Text = "Create", - AuthName = AppCodes.Notifications.NotificationRules, - DialogName = "CreateNotification", - DialogParameters = JsonSerializer.Serialize(new { - name = "id", - id = "@Id" - }) - }, - }), - } - ); - - #region Notification Rule Fields - await _listFormFieldRepository.InsertManyAsync([ - new ListFormField - { - ListFormCode = listFormNotificationRules.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormNotificationRules.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "NotificationType", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.WebService, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = "GET;notification-rule/notification-types;{};a;a;null", - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormNotificationRules.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "RecipientType", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="All",Name="All" }, - new () { Key="User",Name="User" }, - new () { Key="Role",Name="Role" }, - new () { Key="OrganizationUnit",Name="OrganizationUnit" }, - new () { Key="Custom",Name="Custom" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormNotificationRules.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "RecipientId", - Width = 200, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormNotificationRules.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Channel", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Sms",Name="Sms" }, - new () { Key="Mail",Name="Mail" }, - new () { Key="Rocket",Name="Rocket" }, - new () { Key="Desktop",Name="Desktop" }, - new () { Key="UiActivity",Name="UiActivity" }, - new () { Key="UiToast",Name="UiToast" }, - new () { Key="WhatsApp",Name="WhatsApp" }, - new () { Key="Telegram",Name="Telegram" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormNotificationRules.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - Width = 85, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormNotificationRules.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsFixed", - Width = 85, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormNotificationRules.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsCustomized", - Width = 85, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.NotificationRules), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Notification - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Notification)) - { - var listFormNotifications = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Notification, - Name = AppCodes.Notifications.Notification, - Title = AppCodes.Notifications.Notification, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Notifications.Notification, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Notification)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Notifications.Notification), - DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.Notification)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - AllowDeleting = false, - AllowAdding = false, - AllowUpdating = false, - SendOnlyChangedFormValuesUpdate = false, - }) - } - ); - - #region Notification Fields - await _listFormFieldRepository.InsertManyAsync([ - new ListFormField - { - ListFormCode = listFormNotifications.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormNotifications.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "NotificationChannel", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Sms",Name="Sms" }, - new () { Key="Mail",Name="Mail" }, - new () { Key="Rocket",Name="Rocket" }, - new () { Key="Desktop",Name="Desktop" }, - new () { Key="UiActivity",Name="UiActivity" }, - new () { Key="UiToast",Name="UiToast" }, - new () { Key="WhatsApp",Name="WhatsApp" }, - new () { Key="Telegram",Name="Telegram" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormNotifications.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "NotificationType", - Width = 200, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.WebService, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = "GET;notification-rule/notification-types;{};a;a;null", - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormNotifications.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Identifier", - Width = 250, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormNotifications.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Message", - Width = 200, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormNotifications.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsSent", - Width = 85, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormNotifications.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsRead", - Width = 85, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormNotifications.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, - FieldName = "ReadTime", - Width = 85, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Notifications.Notification), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Ip Restriction - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.IpRestriction)) - { - var listFormIpRestrictions = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.IpRestriction, - Name = AppCodes.IdentityManagement.IpRestrictions, - Title = AppCodes.IdentityManagement.IpRestrictions, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.IdentityManagement.IpRestrictions, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.IpRestriction)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.IdentityManagement.IpRestrictions), - DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.IpRestriction)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = ListFormCodes.Lists.IpRestriction, Width = 800, Height = 500 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "ResourceType", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "ResourceId", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "IP", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - } - ); - - #region Ip Restriction Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormIpRestrictions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.IpRestrictions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormIpRestrictions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ResourceType", - Width = 300, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="User",Name="User" }, - new () { Key="Role",Name="Role" }, - new () { Key="Global",Name="Global" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.IpRestrictions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormIpRestrictions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ResourceId", - Width = 300, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = $"SELECT \"UserName\" AS \"Key\", \"UserName\" AS \"Name\" FROM \"AbpUsers\" UNION SELECT \"Name\" AS \"Key\", \"Name\" AS \"Name\" FROM \"AbpRoles\"", - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.IpRestrictions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormIpRestrictions.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "IP", - Width = 85, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.IpRestrictions), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Custom Endpoint - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.CustomEndpoint)) - { - var listFormCustomEndpoints = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.CustomEndpoint, - Name = AppCodes.DeveloperKits.CustomEndpoints, - Title = AppCodes.DeveloperKits.CustomEndpoints, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.DeveloperKits.CustomEndpoints, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.CustomEndpoint)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), - DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.CustomEndpoint)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.DeveloperKits.CustomEndpoints, Width = 800, Height = 500 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Url", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Method", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 4, DataField = "DataSourceCode", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 5, DataField = "Sql", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextArea, EditorOptions="{ \"height\" : 60 }" }, - new EditingFormItemDto { Order = 6, DataField = "ParametersJson", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextArea, EditorOptions="{ \"height\" : 60 }" }, - new EditingFormItemDto { Order = 7, DataField = "PermissionsJson", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextArea, EditorOptions="{ \"height\" : 60 }" }, - new EditingFormItemDto { Order = 8, DataField = "Description", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":200}" }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - ButtonPosition= UiCommandButtonPositionTypeEnum.Toolbar, - Hint = "Swagger", - Text = "Swagger", - AuthName=AppCodes.DeveloperKits.CustomEndpoints, - Url= swaggerRootUrl + "/swagger/index.html", - }, - }), - } - ); - - #region Custom Endpoint Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormCustomEndpoints.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCustomEndpoints.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCustomEndpoints.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 350, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCustomEndpoints.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Url", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCustomEndpoints.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Method", - Width = 80, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="GET",Name="GET" }, - new () { Key="POSt",Name="POST" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCustomEndpoints.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DataSourceCode", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.DataSourceValues, - }), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCustomEndpoints.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Sql", - Width = 200, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCustomEndpoints.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ParametersJson", - Width = 200, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCustomEndpoints.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "PermissionsJson", - Width = 200, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.DeveloperKits.CustomEndpoints), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Global Search - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.GlobalSearch)) - { - var listFormGlobalSearch = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.GlobalSearch, - Name = AppCodes.Settings.GlobalSearch, - Title = AppCodes.Settings.GlobalSearch, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Settings.GlobalSearch, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.GlobalSearch)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Int32, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Settings.GlobalSearch), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Settings.GlobalSearch, Width = 500, Height = 350 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { Order=1, ColCount=1, ColSpan=2, ItemType="group", Items = [ - new EditingFormItemDto { Order=1, DataField="System", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=2, DataField="Group", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=3, DataField="Term", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=4, DataField="Url", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=5, DataField="Weight", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxNumberBox }, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "System", FieldDbType = DbType.String, Value = "Platform", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Weight", FieldDbType = DbType.Single, Value = "1.0", CustomValueType = FieldCustomValueTypeEnum.Value }, - }) - } - ); - - #region Global Search Fields - await _listFormFieldRepository.InsertManyAsync( - [ - new() { - ListFormCode = listFormGlobalSearch.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.GlobalSearch), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormGlobalSearch.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "System", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.GlobalSearch), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormGlobalSearch.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Group", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.GlobalSearch), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormGlobalSearch.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Term", - Width = 200, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.GlobalSearch), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormGlobalSearch.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Url", - Width = 300, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.GlobalSearch), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormGlobalSearch.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Single, - FieldName = "Weight", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Settings.GlobalSearch), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Audit Logs - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.AuditLog)) - { - var listFormAuditLog = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.AuditLog, - Name = AppCodes.AuditLogs, - Title = AppCodes.AuditLogs, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.AuditLogs, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = "AbpAuditLogs", - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.AuditLogs), - PagerOptionJson = DefaultPagerOptionJson, - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new CommandColumnDto() { - Hint = "Details", - Text = "Details", - AuthName = AppCodes.AuditLogs, - DialogName = "AuditLogDetail", - DialogParameters = JsonSerializer.Serialize(new { - id = "@Id", - }) - }, - }), - } - ); - - #region Audit Logs Fields - await _listFormFieldRepository.InsertManyAsync( - [ - new() { - ListFormCode = listFormAuditLog.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAuditLog.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "HttpStatusCode", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAuditLog.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "HttpMethod", - Width = 100, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAuditLog.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Url", - Width = 450, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAuditLog.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "UserName", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAuditLog.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ClientIpAddress", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAuditLog.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, - FieldName = "ExecutionTime", - Width = 130, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAuditLog.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "ExecutionDuration", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAuditLog.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ApplicationName", - Width = 200, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.AuditLogs), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region ClaimType - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ClaimType)) - { - var listFormClaimTypes = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.ClaimType, - Name = AppCodes.IdentityManagement.ClaimTypes, - Title = AppCodes.IdentityManagement.ClaimTypes, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.IdentityManagement.ClaimTypes, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = "AbpClaimTypes", - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.IdentityManagement.ClaimTypes), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.IdentityManagement.ClaimTypes, Width = 500, Height = 550 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order=1, DataField="Name", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=2, DataField="ValueType", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions = EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order=3, DataField="Required", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order=4, DataField="IsStatic", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order=5, DataField="Regex", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=6, DataField="RegexDescription", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=7, DataField="Description", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, - ]} - }), - DeleteCommand = "DELETE FROM \"AbpClaimTypes\" WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - InsertCommand = "INSERT INTO \"AbpClaimTypes\" (\"Id\",\"ValueType\",\"Required\",\"IsStatic\",\"Name\",\"ConcurrencyStamp\",\"ExtraProperties\") OUTPUT Inserted.Id VALUES (@Id,@ValueType,@Required,@IsStatic,@Name,@ConcurrencyStamp,@ExtraProperties)", - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "ConcurrencyStamp", FieldDbType = DbType.Guid, Value = Guid.NewGuid().ToString(), CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "ExtraProperties", FieldDbType = DbType.String, Value = "{}", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Required", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "IsStatic", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "ValueType", FieldDbType = DbType.Int16, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - } - ); - - #region ClaimTypes Fields - await _listFormFieldRepository.InsertManyAsync( - [ - new ListFormField - { - ListFormCode = listFormClaimTypes.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 500, - ListOrderNo = 0, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormClaimTypes.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 1, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormClaimTypes.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int16, - FieldName = "ValueType", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key=0,Name="String" }, - new () { Key=1,Name="Number" }, - new () { Key=2,Name="Boolean" }, - new () { Key=3,Name="DateTime" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormClaimTypes.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "Required", - Width = 100, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormClaimTypes.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsStatic", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormClaimTypes.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Regex", - Width = 250, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormClaimTypes.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "RegexDescription", - Width = 250, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormClaimTypes.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 250, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.IdentityManagement.ClaimTypes), - PivotSettingsJson = DefaultPivotSettingsJson - } - ]); - #endregion - } - #endregion - - #region Route - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Route)) - { - var listFormRoute = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Route, - Name = AppCodes.Routes, - Title = AppCodes.Routes, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Routes, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Route)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Routes), - DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.Route)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Routes, Width = 500, Height = 300 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto { Order = 1, DataField = "Key", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Path", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "ComponentPath", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "RouteType", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 5, DataField = "Authority", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox } - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }) - }); - - #region Route Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormRoute.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Routes), - }, - new() - { - ListFormCode = listFormRoute.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Key", - Width = 300, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Routes), - }, - new() - { - ListFormCode = listFormRoute.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Path", - Width = 300, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Routes), - }, - new() - { - ListFormCode = listFormRoute.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ComponentPath", - Width = 300, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Routes), - }, - new() - { - ListFormCode = listFormRoute.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "RouteType", - Width = 120, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="public",Name="Public" }, - new () { Key="protected",Name="Protected" }, - new () { Key="authenticated",Name="Authenticated" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Routes), - }, - new() - { - ListFormCode = listFormRoute.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Authority", - Width = 120, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Routes), - } - ]); - #endregion - } - #endregion - - #region Report Categories - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ReportCategory)) - { - var listFormReportCatory = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.ReportCategory, - Name = AppCodes.Reports.Categories, - Title = AppCodes.Reports.Categories, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Reports.Categories, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ReportCategory)), - KeyFieldName = "Id", - DefaultFilter = DefaultFilterJson, - KeyFieldDbSourceType = DbType.Int32, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Reports.Categories), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Reports.Categories, Width = 500, Height = 300 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = [ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 3, DataField = "Icon", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextBox }, - ]} - }), - DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.ReportCategory)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }) - }); - - #region Report Categories Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormReportCatory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Reports.Categories), - }, - new() - { - ListFormCode = listFormReportCatory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Reports.Categories), - }, - new() - { - ListFormCode = listFormReportCatory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 500, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Reports.Categories), - }, - new() - { - ListFormCode = listFormReportCatory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Icon", - Width = 200, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Reports.Categories), - }, - ]); - #endregion - } - #endregion - - //Web Site - #region About Us - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.About)) - { - var listFormAbout = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.About, - Name = AppCodes.About, - Title = AppCodes.About, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.About, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.About)), - KeyFieldName = "Id", - DefaultFilter = DefaultFilterJson, - KeyFieldDbSourceType = DbType.Guid, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.About), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.About, Width = 800, Height = 720 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto { Order = 1, DataField = "StatsJson", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":200}" }, - new EditingFormItemDto { Order = 2, DataField = "DescriptionsJson", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":200}" }, - new EditingFormItemDto { Order = 3, DataField = "SectionsJson", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":200}" }, - ] - } - }), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.About))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }) - }); - - #region About Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormAbout.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.About), - }, - new() - { - ListFormCode = listFormAbout.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "StatsJson", - Width = 400, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.About), - }, - new() - { - ListFormCode = listFormAbout.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DescriptionsJson", - Width = 400, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.About), - }, - new() - { - ListFormCode = listFormAbout.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "SectionsJson", - Width = 400, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.About), - }, - ]); - #endregion - } - #endregion - - #region Services - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Service)) - { - var listFormService = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Service, - Name = AppCodes.Services, - Title = AppCodes.Services, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Services, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Service)), - KeyFieldName = "Id", - DefaultFilter = DefaultFilterJson, - KeyFieldDbSourceType = DbType.Guid, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Services), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Services, Width = 500, Height = 450 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto { Order = 1, DataField = "Title", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "Icon", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 4, DataField = "Type", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 5, DataField = "Features", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextArea, EditorOptions="{\"height\":200}" }, - ] - } - }), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Service))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - }); - - #region Services Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormService.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Services), - }, - new() - { - ListFormCode = listFormService.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Title", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Services), - }, - new() - { - ListFormCode = listFormService.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Icon", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Services), - }, - new() - { - ListFormCode = listFormService.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Services), - }, - new() - { - ListFormCode = listFormService.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Type", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="service",Name="Service" }, - new () { Key="support",Name="Support" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Services), - }, - new() - { - ListFormCode = listFormService.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Features", - Width = 200, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Services), - } - ]); - #endregion - } - #endregion - - #region Products - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Product)) - { - var listFormProduct = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Product, - Name = AppCodes.Orders.Products, - Title = AppCodes.Orders.Products, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Orders.Products, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Product)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Orders.Products), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Product))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Orders.Products, Width = 500, Height = 400 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "Category", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 4, DataField = "Order", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 5, DataField = "MonthlyPrice", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 6, DataField = "YearlyPrice", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 7, DataField = "IsQuantityBased", ColSpan = 2, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 8, DataField = "ImageUrl", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox }, - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsQuantityBased", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - }); - - #region Product Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormProduct.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), - }, - new() - { - ListFormCode = listFormProduct.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 300, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - }, - new() - { - ListFormCode = listFormProduct.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 300, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - }, - new() - { - ListFormCode = listFormProduct.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Category", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Public.products.categories.Üyelik",Name="Üyelik" }, - new () { Key="Public.products.categories.Lisans",Name="Lisans" }, - new () { Key="Public.products.categories.Ek Hizmetler",Name="Ek Hizmetler" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), - }, - new() - { - ListFormCode = listFormProduct.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "MonthlyPrice", - Format = "fixedPoint", - Alignment = "right", - Width = 120, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), - }, - new() - { - ListFormCode = listFormProduct.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "YearlyPrice", - Format = "fixedPoint", - Alignment = "right", - Width = 120, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), - }, - new() - { - ListFormCode = listFormProduct.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsQuantityBased", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), - }, - new() - { - ListFormCode = listFormProduct.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ImageUrl", - Width = 300, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.Products), - }, - ]); - #endregion - } - #endregion - - #region PaymentMethods - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.PaymentMethod)) - { - var listFormPaymentMethod = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.PaymentMethod, - Name = AppCodes.Orders.PaymentMethods, - Title = AppCodes.Orders.PaymentMethods, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Orders.PaymentMethods, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.PaymentMethod)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.String, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Orders.PaymentMethods), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Orders.PaymentMethods, Width = 500, Height = 300 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - 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 }, - ] - } - }), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.PaymentMethod))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - }); - - #region PaymentMethod Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormPaymentMethod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PaymentMethods), - }, - new() - { - ListFormCode = listFormPaymentMethod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 300, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PaymentMethods), - }, - new() - { - ListFormCode = listFormPaymentMethod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Commission", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PaymentMethods), - }, - new() - { - ListFormCode = listFormPaymentMethod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Logo", - Width = 300, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PaymentMethods), - }, - ]); - #endregion - } - #endregion - - #region InstallmentOptions - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.InstallmentOption)) - { - var listFormInstallmentOption = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.InstallmentOption, - Name = AppCodes.Orders.InstallmentOptions, - Title = AppCodes.Orders.InstallmentOptions, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Orders.InstallmentOptions, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.InstallmentOption)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Orders.InstallmentOptions), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Orders.InstallmentOptions, Width = 500, Height = 300 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto { Order = 1, DataField = "Installment", 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 }, - ] - } - }), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.InstallmentOption))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - }); - - #region PaymentMethod Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormInstallmentOption.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.InstallmentOptions), - }, - new() - { - ListFormCode = listFormInstallmentOption.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Installment", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.InstallmentOptions), - }, - new() - { - ListFormCode = listFormInstallmentOption.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.InstallmentOptions), - }, - new() - { - ListFormCode = listFormInstallmentOption.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Commission", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.InstallmentOptions), - }, - ]); - #endregion - } - #endregion - - #region Purchase Orders - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.PurchaseOrder)) - { - var listFormPurchaseOrder = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.PurchaseOrder, - Name = AppCodes.Orders.PurchaseOrders, - Title = AppCodes.Orders.PurchaseOrders, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Orders.PurchaseOrders, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Order)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Orders.PurchaseOrders), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Order))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Orders.PurchaseOrders, Width = 1000, Height = 500 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items = - [ - 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 = 5, DataField = "Address1", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 6, DataField = "Address2", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 7, DataField = "Country", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 8, DataField = "City", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 9, DataField = "District", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 10, DataField = "PostalCode", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - ] - }, - new() { Order=2, ColCount=1, ColSpan=1, ItemType="group", Items = - [ - new EditingFormItemDto { Order = 11, DataField = "Phone", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order = 12, DataField = "Mobile", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order = 13, DataField = "Fax", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - 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=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 20, DataField = "Installment", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - }); - - #region Purchase Order Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders) - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "OrganizationName", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Founder", - Width = 100, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int64, - FieldName = "VknTckn", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "TaxOffice", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address1", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address2", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Country", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CountryValues, - CascadeEmptyFields = "City,District" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "City", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CityValues, - CascadeRelationField = "Country", - CascadeFilterOperator="=", - CascadeParentFields = "Country", - CascadeEmptyFields = "District" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "District", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.DistrictValues, - CascadeRelationField = "City", - CascadeFilterOperator="=", - CascadeParentFields = "Country,City", - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Phone", - Width = 100, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int64, - FieldName = "Mobile", - Width = 100, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int64, - FieldName = "Fax", - Width = 100, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Website", - Width = 100, - ListOrderNo = 14, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Subtotal", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 15, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Commission", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 16, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Total", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 17, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - 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 = LookupQueryValues.PaymentMethodValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - }, - new() - { - ListFormCode = listFormPurchaseOrder.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - 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 = LookupQueryValues.InstallmentValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Orders.PurchaseOrders), - } - ]); - #endregion - } - #endregion - - #region BlogCategory - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.BlogCategory)) - { - var listFormBlogCategory = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.BlogCategory, - Name = AppCodes.BlogManagement.BlogCategory, - Title = AppCodes.BlogManagement.BlogCategory, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.BlogManagement.BlogCategory, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.BlogCategory)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.BlogManagement.BlogCategory), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.BlogCategory))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.BlogManagement.BlogCategory, Width = 600, Height = 400 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "Slug", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 4, DataField = "Icon", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "DisplayOrder", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 6, DataField = "IsActive", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxCheckBox } - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - }); - - #region BlogCategory Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormBlogCategory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogCategory), - }, - new() - { - ListFormCode = listFormBlogCategory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 400, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogCategory), - }, - new() - { - ListFormCode = listFormBlogCategory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Slug", - Width = 330, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogCategory), - }, - new() - { - ListFormCode = listFormBlogCategory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 400, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogCategory), - }, - new() - { - ListFormCode = listFormBlogCategory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Icon", - Width = 200, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogCategory), - }, - new() - { - ListFormCode = listFormBlogCategory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "DisplayOrder", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogCategory), - }, - new() - { - ListFormCode = listFormBlogCategory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogCategory), - } - ]); - #endregion - } - #endregion - - #region BlogPost - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.BlogPost)) - { - var listFormBlogPosts = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.BlogPost, - Name = AppCodes.BlogManagement.BlogPosts, - Title = AppCodes.BlogManagement.BlogPosts, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.BlogManagement.BlogPosts, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.BlogPost)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.BlogManagement.BlogPosts), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.BlogPost))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.BlogManagement.BlogPosts, Width = 1000, Height = 600 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto { Order = 1, DataField = "Title", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "Slug", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Summary", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 4, DataField = "CoverImage", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "ReadTime", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 6, DataField = "CategoryId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 7, DataField = "ViewCount", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 8, DataField = "LikeCount", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 9, DataField = "CommentCount", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 10, DataField = "IsPublished", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 11, DataField = "PublishedAt", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 12, DataField = "ContentTr", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxHtmlEditor, EditorOptions=EditorOptionValues.HtmlEditorOptions }, - new EditingFormItemDto { Order = 13, DataField = "ContentEn", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxHtmlEditor, EditorOptions=EditorOptionValues.HtmlEditorOptions } - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsPublished", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "PublishedAt", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }) - }); - - #region BlogPosts Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormBlogPosts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), - }, - new() - { - ListFormCode = listFormBlogPosts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Title", - Width = 400, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), - }, - new() - { - ListFormCode = listFormBlogPosts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Slug", - Width = 350, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), - }, - new() - { - ListFormCode = listFormBlogPosts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Summary", - Width = 400, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), - }, - new() - { - ListFormCode = listFormBlogPosts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "CoverImage", - Width = 200, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), - }, - new() - { - ListFormCode = listFormBlogPosts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ReadTime", - Width = 80, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), - }, - new() - { - ListFormCode = listFormBlogPosts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "CategoryId", - Width = 200, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.BlogCategoryValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), - }, - new() - { - ListFormCode = listFormBlogPosts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "ViewCount", - Width = 80, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), - }, - new() - { - ListFormCode = listFormBlogPosts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "LikeCount", - Width = 80, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), - }, - new() - { - ListFormCode = listFormBlogPosts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "CommentCount", - Width = 80, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), - }, - new() - { - ListFormCode = listFormBlogPosts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsPublished", - Width = 80, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), - }, - new() - { - ListFormCode = listFormBlogPosts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, - FieldName = "PublishedAt", - Width = 120, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), - }, - new() - { - ListFormCode = listFormBlogPosts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, - FieldName = "ContentTr", - Width = 120, - ListOrderNo = 11, - Visible = false, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), - }, - new() - { - ListFormCode = listFormBlogPosts.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, - FieldName = "ContentEn", - Width = 120, - ListOrderNo = 12, - Visible = false, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.BlogManagement.BlogPosts), - } - ]); - #endregion - } - #endregion - - #region Demos - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Demo)) - { - var listFormDemo = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Demo, - Name = AppCodes.Demos, - Title = AppCodes.Demos, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Demos, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Demo)), - KeyFieldName = "Id", - DefaultFilter = DefaultFilterJson, - KeyFieldDbSourceType = DbType.Guid, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Demos), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Demos, Width = 500, Height = 500 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto { Order = 1, DataField = "OrganizationName", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "FullName", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Email", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "Phone", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order = 5, DataField = "Address", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 6, DataField = "NumberOfBranches", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 7, DataField = "NumberOfUsers", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 8, DataField = "Message", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextArea }, - ] - } - }), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Demo))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }) - }); - - #region Demos Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormDemo.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), - }, - new() - { - ListFormCode = listFormDemo.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "OrganizationName", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), - }, - new() - { - ListFormCode = listFormDemo.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "FullName", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), - }, - new() - { - ListFormCode = listFormDemo.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Email", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] - { - new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.email) }, - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), - }, - new() - { - ListFormCode = listFormDemo.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Phone", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), - }, - new() - { - ListFormCode = listFormDemo.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address", - Width = 200, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), - }, - new() - { - ListFormCode = listFormDemo.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "NumberOfBranches", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), - }, - new() - { - ListFormCode = listFormDemo.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "NumberOfUsers", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), - }, - new() - { - ListFormCode = listFormDemo.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Message", - Width = 300, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Demos), - }, - ]); - #endregion - - } - #endregion - - #region Contact - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Contact)) - { - var listFormContact = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Contact, - Name = AppCodes.Contact, - Title = AppCodes.Contact, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Contact, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Contact)), - KeyFieldName = "Id", - DefaultFilter = DefaultFilterJson, - KeyFieldDbSourceType = DbType.Guid, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Contact), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Contact, Width = 800, Height = 600 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto { Order = 1, DataField = "Address", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "Phone", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order = 3, DataField = "Email", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "Location", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "TaxNumber", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 6, DataField = "BankJson", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":100}" }, - new EditingFormItemDto { Order = 7, DataField = "WorkHoursJson", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":100}" }, - new EditingFormItemDto { Order = 8, DataField = "MapJson", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextArea, EditorOptions="{\"height\":100}" }, - ] - } - }), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Contact))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }) - }); - - #region Contact Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormContact.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), - }, - new() - { - ListFormCode = listFormContact.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.LanguageKeyValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), - }, - new() - { - ListFormCode = listFormContact.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Phone", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), - }, - new() - { - ListFormCode = listFormContact.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Email", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] - { - new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) }, - new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.email) }, - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), - }, - new() - { - ListFormCode = listFormContact.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Location", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), - }, - new() - { - ListFormCode = listFormContact.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "TaxNumber", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), - }, - new() - { - ListFormCode = listFormContact.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "BankJson", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), - }, - new() - { - ListFormCode = listFormContact.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "WorkHoursJson", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), - }, - new() - { - ListFormCode = listFormContact.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "MapJson", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Contact), - }, - ]); - #endregion - } - #endregion - - //Parameters - #region ContactTag - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ContactTag)) - { - var listFormContactTag = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.ContactTag, - Name = AppCodes.Parameters.ContactTag, - Title = AppCodes.Parameters.ContactTag, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Parameters.ContactTag, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ContactTag)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = false }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Parameters.ContactTag), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.ContactTag))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Parameters.ContactTag, Width = 400, Height = 200 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto - { - Order = 1, - DataField = "Name", - ColSpan = 2, - IsRequired = true, - EditorType2 = EditorTypes.dxTextBox - }, - new EditingFormItemDto - { - Order = 2, - DataField = "Category", - ColSpan = 2, - IsRequired = true, - EditorType2 = EditorTypes.dxTextBox - } - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() - { - FieldName = "CreationTime", - FieldDbType = DbType.DateTime, - Value = "@NOW", - CustomValueType = FieldCustomValueTypeEnum.CustomKey - }, - new() - { - FieldName = "CreatorId", - FieldDbType = DbType.Guid, - Value = "@USERID", - CustomValueType = FieldCustomValueTypeEnum.CustomKey - } - }) - }); - - #region ContactTag Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormContactTag.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.ContactTag), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormContactTag.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.ContactTag), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormContactTag.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Category", - Width = 250, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.ContactTag), - PivotSettingsJson = DefaultPivotSettingsJson - } - ]); - #endregion - } - #endregion - - #region ContactTitle - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ContactTitle)) - { - var listFormContactTitle = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.ContactTitle, - Name = AppCodes.Parameters.ContactTitle, - Title = AppCodes.Parameters.ContactTitle, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Parameters.ContactTitle, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ContactTitle)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = false }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Parameters.ContactTitle), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.ContactTitle))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Parameters.ContactTitle, Width = 400, Height = 200 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto { Order = 1, DataField = "Title", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Abbreviation", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox } - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }) - }); - - #region ContactTitle Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormContactTitle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.ContactTitle), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormContactTitle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Title", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.ContactTitle), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormContactTitle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Abbreviation", - Width = 100, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.ContactTitle), - PivotSettingsJson = DefaultPivotSettingsJson - } - ]); - #endregion - } - #endregion - - #region Currency - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Currency)) - { - var listFormCurrency = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Currency, - Name = AppCodes.Parameters.Currency, - Title = AppCodes.Parameters.Currency, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Parameters.Currency, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Currency)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Parameters.Currency), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Currency))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Parameters.Currency, Width = 500, Height = 350 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() - { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto - { - Order = 1, - DataField = "Code", - ColSpan = 2, - IsRequired = true, - EditorType2 = EditorTypes.dxTextBox - }, - new EditingFormItemDto - { - Order = 2, - DataField = "Symbol", - ColSpan = 2, - IsRequired = false, - EditorType2 = EditorTypes.dxTextBox - }, - new EditingFormItemDto - { - Order = 3, - DataField = "Name", - ColSpan = 2, - IsRequired = true, - EditorType2 = EditorTypes.dxTextBox - }, - new EditingFormItemDto - { - Order = 4, - DataField = "Rate", - ColSpan = 2, - IsRequired = true, - EditorType2 = EditorTypes.dxNumberBox - }, - new EditingFormItemDto - { - Order = 5, - DataField = "IsActive", - ColSpan = 2, - IsRequired = false, - EditorType2 = EditorTypes.dxCheckBox - } - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }) - }); - - #region Currency Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormCurrency.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Currency), - }, - new() - { - ListFormCode = listFormCurrency.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 120, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Currency), - }, - new() - { - ListFormCode = listFormCurrency.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Symbol", - Width = 100, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Currency), - }, - new() - { - ListFormCode = listFormCurrency.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Currency), - }, - new() - { - ListFormCode = listFormCurrency.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Rate", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Currency), - }, - new() - { - ListFormCode = listFormCurrency.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - Width = 80, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Currency), - } - ]); - #endregion - } - #endregion - - #region CountryGroup - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.CountryGroup)) - { - var listFormCountryGroup = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.CountryGroup, - Name = AppCodes.Parameters.CountryGroup, - Title = AppCodes.Parameters.CountryGroup, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Parameters.CountryGroup, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.CountryGroup)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Parameters.CountryGroup), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.CountryGroup))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Parameters.CountryGroup, Width = 400, Height = 200 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto - { - Order = 1, - DataField = "Name", - ColSpan = 2, - IsRequired = true, - EditorType2 = EditorTypes.dxTextBox - } - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }) - }); - - #region CountryGroup Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormCountryGroup.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.CountryGroup), - }, - new() - { - ListFormCode = listFormCountryGroup.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.CountryGroup), - } - ]); - #endregion - } - #endregion - - #region Country - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Country)) - { - var listFormCountry = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Country, - Name = AppCodes.Parameters.Country, - Title = AppCodes.Parameters.Country, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Parameters.Country, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Country)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Parameters.Country), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Country))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Parameters.Country, Width = 600, Height = 500 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "GroupName", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 4, DataField = "CurrencyId", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 5, DataField = "PhoneCode", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 6, DataField = "TaxLabel", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 7, DataField = "ZipRequired", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 8, DataField = "StateRequired", ColSpan = 2, IsRequired = false, EditorType2 = EditorTypes.dxCheckBox } - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }) - }); - - #region Country Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormCountry.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), - }, - new() - { - ListFormCode = listFormCountry.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), - }, - new() - { - ListFormCode = listFormCountry.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), - }, - new() - { - ListFormCode = listFormCountry.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "GroupName", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CountryGroupValues, - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), - }, - new() - { - ListFormCode = listFormCountry.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "CurrencyId", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.CurrencyValues, - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), - }, - new() - { - ListFormCode = listFormCountry.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "PhoneCode", - Width = 80, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), - }, - new() - { - ListFormCode = listFormCountry.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "TaxLabel", - Width = 120, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), - }, - new() - { - ListFormCode = listFormCountry.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "ZipRequired", - Width = 80, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), - }, - new() - { - ListFormCode = listFormCountry.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "StateRequired", - Width = 80, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.Country), - } - ]); - #endregion - - } - #endregion - - #region City - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.City)) - { - var listFormCity = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.City, - Name = AppCodes.Parameters.City, - Title = AppCodes.Parameters.City, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Parameters.City, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.City)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Parameters.City), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.City))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Parameters.City, Width = 500, Height = 300 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto { Order = 1, DataField = "Country", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "PlateCode", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox } - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - }); - - #region City Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormCity.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.City), - }, - new() - { - ListFormCode = listFormCity.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Country", - Width = 400, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CountryValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.City), - }, - new() - { - ListFormCode = listFormCity.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.City), - }, - new() - { - ListFormCode = listFormCity.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 120, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.City), - }, - new() - { - ListFormCode = listFormCity.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "PlateCode", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.City), - }, - ]); - #endregion - } - #endregion - - #region District - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.District)) - { - var listFormDistrict = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.District, - Name = AppCodes.Parameters.District, - Title = AppCodes.Parameters.District, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = false, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Parameters.District, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.District)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Parameters.District), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.District))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Parameters.District, Width = 600, Height = 500 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto { Order = 1, DataField = "Country", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "City", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "Township", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "Street", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 6, DataField = "ZipCode", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox } - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - }); - - #region City Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormDistrict.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.District), - }, - new() - { - ListFormCode = listFormDistrict.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Country", - Width = 120, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CountryValues, - CascadeEmptyFields = "City" - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.District), - }, - new() - { - ListFormCode = listFormDistrict.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "City", - Width = 120, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CityValues, - CascadeRelationField = "Country", - CascadeFilterOperator="=", - CascadeParentFields = "Country" - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.District), - }, - new() - { - ListFormCode = listFormDistrict.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.District), - }, - new() - { - ListFormCode = listFormDistrict.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Township", - Width = 200, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.District), - }, - new() - { - ListFormCode = listFormDistrict.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Street", - Width = 400, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.District), - }, - new() - { - ListFormCode = listFormDistrict.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ZipCode", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Parameters.District), - }, - ]); - #endregion - } - #endregion - - //Definitions - #region Sector - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Sector)) - { - var listFormSector = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Sector, - Name = AppCodes.Definitions.Sector, - Title = AppCodes.Definitions.Sector, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Sector, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Sector)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = false }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Sector), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Sector))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Definitions.Sector, Width = 400, Height = 150 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items =[ - new EditingFormItemDto - { - Order = 1, - DataField = "Name", - ColSpan = 2, - IsRequired = true, - EditorType2 = EditorTypes.dxTextBox - } - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }) - }); - - #region Sector Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormSector.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Sector), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormSector.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Sector), - PivotSettingsJson = DefaultPivotSettingsJson - } - ]); - #endregion - } - #endregion - - #region SkillType - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SkillType)) - { - var listFormSkillType = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.SkillType, - Name = AppCodes.Definitions.SkillType, - Title = AppCodes.Definitions.SkillType, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.SkillType, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SkillType)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.SkillType), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.SkillType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Definitions.SkillType, Width = 400, Height = 200 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox } - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Manage", - Text ="Manage", - UrlTarget="_blank", - AuthName = AppCodes.Definitions.Skill, - Url=$"/admin/form/{ListFormCodes.Forms.FormSkillType}/@Id" - }, - }), - }); - - #region SkillType Fields - await _listFormFieldRepository.InsertManyAsync([ - new () - { - ListFormCode = listFormSkillType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillType), - }, - new() - { - ListFormCode = listFormSkillType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillType), - } - ]); - #endregion - } - #endregion - - #region Skill Level - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SkillLevel)) - { - var listFormSkillLevel = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.SkillLevel, - Name = AppCodes.Definitions.SkillLevel, - Title = AppCodes.Definitions.SkillLevel, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.SkillLevel, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SkillLevel)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.SkillLevel), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.SkillLevel))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = ListFormCodes.Lists.SkillLevel, Width = 600, Height = 300 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= - [ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Progress", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 3, DataField = "IsDefault", ColSpan = 2, IsRequired = false, EditorType2=EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 4, DataField = "SkillTypeId", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsDefault", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region Skill Level Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormSkillLevel.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillLevel), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSkillLevel.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillLevel), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSkillLevel.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Progress", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillLevel), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSkillLevel.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsDefault", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillLevel), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSkillLevel.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "SkillTypeId", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.SkillTypeValues, - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillLevel), - PivotSettingsJson = DefaultPivotSettingsJson - }, - }); - #endregion - } - #endregion - - #region Skill - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Skill)) - { - var listFormSkill = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Skill, - Name = AppCodes.Definitions.Skill, - Title = AppCodes.Definitions.Skill, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Skill, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Skill)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Skill), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Skill))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new FieldsDefaultValue() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Skill, Width = 600, Height = 300 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "SkillTypeId", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region Skill Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new ListFormField - { - ListFormCode = listFormSkill.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Skill), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSkill.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Skill), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormSkill.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "SkillTypeId", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.SkillTypeValues, - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SkillLevel), - PivotSettingsJson = DefaultPivotSettingsJson - }, - }); - #endregion - } - #endregion - - #region UomCategory - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.UomCategory)) - { - var listFormUomCategory = await _listFormRepository.InsertAsync( - new ListForm - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.UomCategory, - Name = AppCodes.Definitions.UomCategory, - Title = AppCodes.Definitions.UomCategory, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.UomCategory, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.UomCategory)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.UomCategory), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.UomCategory))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto { Title = AppCodes.Definitions.UomCategory, Width = 400, Height = 200 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false - }), - EditingFormJson = JsonSerializer.Serialize(new List - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = - [ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox } - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] - { - new FieldsDefaultValue { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new FieldsDefaultValue { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Manage", - Text ="Manage", - UrlTarget="_blank", - AuthName = AppCodes.Definitions.Uom, - Url=$"/admin/form/{ListFormCodes.Forms.FormUomCategory}/@Id" - }, - }), - }); - - #region UomCategory Fields - await _listFormFieldRepository.InsertManyAsync([ - new() - { - ListFormCode = listFormUomCategory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.UomCategory), - }, - new() - { - ListFormCode = listFormUomCategory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.UomCategory), - } - ]); - #endregion - } - #endregion - - #region Uom - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Uom)) - { - var listFormUom = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Uom, - Name = AppCodes.Definitions.Uom, - Title = AppCodes.Definitions.Uom, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Uom, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Uom)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Uom), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Uom))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Uom, Width = 600, Height = 300 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Type", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "Ratio", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 4, DataField = "Rounding", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 5, DataField = "IsActive", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 6, DataField = "UomCategoryId", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region Uom Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new ListFormField - { - ListFormCode = listFormUom.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Uom), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormUom.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Uom), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormUom.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Type", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Reference",Name="Reference" }, - new () { Key="SmallerThanReference",Name="Smaller Than Reference" }, - new () { Key="BiggerThanReference",Name="Bigger Than Reference" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Uom), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormUom.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Ratio", - Format = "fixedPoint", - Alignment = "right", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Uom), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormUom.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Rounding", - Format = "fixedPoint", - Alignment = "right", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Uom), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new ListFormField - { - ListFormCode = listFormUom.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "UomCategoryId", - Width = 150, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.UomCategoryValues, - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Uom), - PivotSettingsJson = DefaultPivotSettingsJson - }, - }); - #endregion - } - #endregion - - #region Behavior - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Behavior)) - { - var listFormBehavior = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Behavior, - Name = AppCodes.Definitions.Behavior, - Title = AppCodes.Definitions.Behavior, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Behavior, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Behavior)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Behavior), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Behavior))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Behavior, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - }); - - #region Behavior Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormBehavior.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Behavior), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBehavior.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Behavior), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Disease - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Disease)) - { - var listFormDisease = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Disease, - Name = AppCodes.Definitions.Disease, - Title = AppCodes.Definitions.Disease, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Disease, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Disease)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Disease), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Disease))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Disease, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= - [ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region Disease Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormDisease.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Disease), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormDisease.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Disease), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Document - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Document)) - { - var listFormDocument = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Document, - Name = AppCodes.Definitions.Document, - Title = AppCodes.Definitions.Document, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Document, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Document)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Document), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Document))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Document, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= - [ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region Document Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormDocument.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Document), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormDocument.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Document), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region EducationStatus - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.EducationStatus)) - { - var listFormEducationStatus = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.EducationStatus, - Name = AppCodes.Definitions.EducationStatus, - Title = AppCodes.Definitions.EducationStatus, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.EducationStatus, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.EducationStatus)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.EducationStatus), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.EducationStatus))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.EducationStatus, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= - [ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Order", ColSpan = 2, EditorType2=EditorTypes.dxNumberBox }, - ] - } - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region EducationStatus Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormEducationStatus.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.EducationStatus), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEducationStatus.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.EducationStatus), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEducationStatus.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Order", - Width = 100, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.EducationStatus), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region MeetingMethod - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MeetingMethod)) - { - var listFormMeetingMethod = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.MeetingMethod, - Name = AppCodes.Definitions.MeetingMethod, - Title = AppCodes.Definitions.MeetingMethod, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.MeetingMethod, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MeetingMethod)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.MeetingMethod), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.MeetingMethod))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.MeetingMethod, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Type", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 3, DataField = "Status", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region MeetingMethod Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormMeetingMethod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingMethod), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormMeetingMethod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingMethod), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormMeetingMethod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Type", - Width = 250, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Dijital",Name="Dijital" }, - new () { Key="Telefon",Name="Telefon" }, - new () { Key="Fiziksel",Name="Fiziksel" }, - new () { Key="Hibrit",Name="Hibrit" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingMethod), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Status - new() - { - ListFormCode = listFormMeetingMethod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 120, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingMethod), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region MeetingResult - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MeetingResult)) - { - var listFormMeetingResult = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.MeetingResult, - Name = AppCodes.Definitions.MeetingResult, - Title = AppCodes.Definitions.MeetingResult, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.MeetingResult, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MeetingResult)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.MeetingResult), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.MeetingResult))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.MeetingResult, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Order", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 3, DataField = "Status", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region MeetingResult Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormMeetingResult.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingResult), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormMeetingResult.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingResult), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormMeetingResult.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Order", - Width = 250, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingResult), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Status - new() - { - ListFormCode = listFormMeetingResult.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 120, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.MeetingResult), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Program - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Program)) - { - var listFormProgram = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Program, - Name = AppCodes.Definitions.Program, - Title = AppCodes.Definitions.Program, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Program, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Program)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Program), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Program))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Program, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region Program Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormProgram.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Program), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormProgram.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Program), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormProgram.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 250, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Program), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Interesting - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Interesting)) - { - var listFormInteresting = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Interesting, - Name = AppCodes.Definitions.Interesting, - Title = AppCodes.Definitions.Interesting, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Interesting, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Interesting)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Interesting), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Interesting))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Interesting, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region Interesting Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormInteresting.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Interesting), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormInteresting.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Interesting), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormInteresting.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 250, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Interesting), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region SalesRejectionReason - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SalesRejectionReason)) - { - var listFormSalesRejectionReason = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.SalesRejectionReason, - Name = AppCodes.Definitions.SalesRejectionReason, - Title = AppCodes.Definitions.SalesRejectionReason, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.SalesRejectionReason, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SalesRejectionReason)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.SalesRejectionReason), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.SalesRejectionReason))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.SalesRejectionReason, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Category", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 3, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region SalesRejectionReason Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormSalesRejectionReason.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SalesRejectionReason), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSalesRejectionReason.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 500, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SalesRejectionReason), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Status - new() - { - ListFormCode = listFormSalesRejectionReason.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Category", - Width = 300, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Kişisel",Name="Kişisel" }, - new () { Key="Fiyat / Bütçe",Name="Fiyat / Bütçe" }, - new () { Key="Ürün / Hizmet",Name="Ürün / Hizmet" }, - new () { Key="Rekabet",Name="Rekabet" }, - new () { Key="Zamanlama",Name="Zamanlama" }, - new () { Key="Lokasyon",Name="Lokasyon" }, - new () { Key="İletişim",Name="İletişim" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SalesRejectionReason), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSalesRejectionReason.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.SalesRejectionReason), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Source - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Source)) - { - var listFormSource = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Source, - Name = AppCodes.Definitions.Source, - Title = AppCodes.Definitions.Source, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Source, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Source)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Source), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Source))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Source, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region Source Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormSource.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Source), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSource.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Source), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSource.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 250, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Source), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Vaccine - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Vaccine)) - { - var listFormVaccine = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Vaccine, - Name = AppCodes.Definitions.Vaccine, - Title = AppCodes.Definitions.Vaccine, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Vaccine, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Vaccine)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Vaccine), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Vaccine))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Vaccine, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region Vaccine Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormVaccine.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vaccine), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVaccine.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vaccine), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region NoteType - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.NoteType)) - { - var listFormNoteType = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.NoteType, - Name = AppCodes.Definitions.NoteType, - Title = AppCodes.Definitions.NoteType, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.NoteType, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.NoteType)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.NoteType), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.NoteType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.NoteType, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region NoteType Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormNoteType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.NoteType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormNoteType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.NoteType), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region ClassCancellationReason - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ClassCancellationReason)) - { - var listFormClassCancellationReason = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.ClassCancellationReason, - Name = AppCodes.Definitions.ClassCancellationReason, - Title = AppCodes.Definitions.ClassCancellationReason, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.ClassCancellationReason, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ClassCancellationReason)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.ClassCancellationReason), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.ClassCancellationReason))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.ClassCancellationReason, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region ClassCancellationReason Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormClassCancellationReason.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassCancellationReason), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormClassCancellationReason.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassCancellationReason), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormClassCancellationReason.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 250, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassCancellationReason), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region WorkHour - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.WorkHour)) - { - var listFormWorkHour = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.WorkHour, - Name = AppCodes.Definitions.WorkHour, - Title = AppCodes.Definitions.WorkHour, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.WorkHour, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.WorkHour)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.WorkHour), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.WorkHour))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.WorkHour, Width = 600, Height = 500 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { - Order = 1, ColCount = 2, ColSpan = 2, ItemType = "group", - Items =[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "StartHour", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "EndHour", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "Monday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 5, DataField = "Tuesday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 6, DataField = "Wednesday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 7, DataField = "Thursday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 8, DataField = "Friday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 9, DataField = "Saturday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 10, DataField = "Sunday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Monday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Tuesday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Wednesday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Thursday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Friday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Saturday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Sunday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - }) - } - ); - - #region WorkHour Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - new() { - ListFormCode = listFormWorkHour.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormWorkHour.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Saat alanları - new() { - ListFormCode = listFormWorkHour.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "StartHour", - Width = 120, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormWorkHour.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "EndHour", - Width = 120, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Günlük kolonlar - new() - { - ListFormCode = listFormWorkHour.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "Monday", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormWorkHour.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "Tuesday", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormWorkHour.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "Wednesday", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormWorkHour.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "Thursday", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormWorkHour.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "Friday", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormWorkHour.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "Saturday", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormWorkHour.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "Sunday", - Width = 100, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.WorkHour), - PivotSettingsJson = DefaultPivotSettingsJson - }, - }); - #endregion - } - #endregion - - #region Vehicle - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Vehicle)) - { - var listFormVehicle = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Vehicle, - Name = AppCodes.Definitions.Vehicle, - Title = AppCodes.Definitions.Vehicle, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Vehicle, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Vehicle)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Vehicle), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Vehicle))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Vehicle, Width = 700, Height = 600 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { - Order = 1, ColCount = 1, ColSpan = 2, ItemType = "group", - Items=[ - new EditingFormItemDto { Order = 1, DataField = "Plate", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Brand", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "ModelYear", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 4, DataField = "DriverNationalId", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "DriverName", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 6, DataField = "DriverPhone1", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 7, DataField = "DriverPhone2", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 8, DataField = "AssistantDriverNationalId", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 9, DataField = "AssistantDriverName", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 10, DataField = "AssistantDriverPhone1", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 11, DataField = "AssistantDriverPhone2", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 12, DataField = "Status", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region Vehicle Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - new() { - ListFormCode = listFormVehicle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVehicle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Plate", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVehicle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Brand", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVehicle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "ModelYear", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Driver bilgileri - new() { - ListFormCode = listFormVehicle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DriverNationalId", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVehicle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DriverName", - Width = 200, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVehicle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DriverPhone1", - Width = 150, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVehicle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DriverPhone2", - Width = 150, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), - PivotSettingsJson = DefaultPivotSettingsJson - }, - - // Assistant Driver bilgileri - new() { - ListFormCode = listFormVehicle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "AssistantDriverNationalId", - Width = 150, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVehicle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "AssistantDriverName", - Width = 200, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVehicle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "AssistantDriverPhone1", - Width = 150, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVehicle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "AssistantDriverPhone2", - Width = 150, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Vehicle), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Status - new() { - ListFormCode = listFormVehicle.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", Width = 120, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto{ C = AppCodes.Definitions.Vehicle + ".Create", R = AppCodes.Definitions.Vehicle, U = AppCodes.Definitions.Vehicle + ".Update", E = true, I = true, Deny = false}), - PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto{ IsPivot = true}) - }, - }); - #endregion - } - #endregion - - #region Psychologist - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Psychologist)) - { - var listFormPsychologist = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Psychologist, - Name = AppCodes.Definitions.Psychologist, - Title = AppCodes.Definitions.Psychologist, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Psychologist, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Psychologist)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Psychologist), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Psychologist))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Psychologist, Width = 650, Height = 500 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items =[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Phone", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order = 3, DataField = "Email", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "Address", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 5, DataField = "Status", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region Psychologist Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - // Id - new() - { - ListFormCode = listFormPsychologist.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Psychologist), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Name - new() - { - ListFormCode = listFormPsychologist.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 2, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Psychologist), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Phone - new() - { - ListFormCode = listFormPsychologist.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Phone", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Psychologist), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Email - new() - { - ListFormCode = listFormPsychologist.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Email", - Width = 200, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleEmailJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Psychologist), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Address - new() - { - ListFormCode = listFormPsychologist.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address", - Width = 300, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Psychologist), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Status - new() - { - ListFormCode = listFormPsychologist.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 150, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Psychologist), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Lawyer - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Lawyer)) - { - var listFormLawyer = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Lawyer, - Name = AppCodes.Definitions.Lawyer, - Title = AppCodes.Definitions.Lawyer, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Lawyer, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Lawyer)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Lawyer), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Lawyer))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = ListFormCodes.Lists.Lawyer, Width = 700, Height = 700 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items =[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "ContactPerson", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Email", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "Address", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 5, DataField = "TaxOffice", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 6, DataField = "TaxNumber", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 7, DataField = "Phone1", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 8, DataField = "Phone2", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 9, DataField = "Phone3", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 10, DataField = "Phone4", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 11, DataField = "Fax", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 12, DataField = "Description", ColSpan = 1, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 13, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region Lawyer Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - // Id - new() - { - ListFormCode = listFormLawyer.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // String alanlar - new() - { - ListFormCode = listFormLawyer.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormLawyer.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ContactPerson", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormLawyer.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Email", - Width = 200, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleEmailJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormLawyer.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address", - Width = 300, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormLawyer.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "TaxOffice", - Width = 150, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormLawyer.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "TaxNumber", - Width = 150, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Telefon ve Fax alanları - new() - { - ListFormCode = listFormLawyer.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Phone1", - Width = 150, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormLawyer.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Phone2", - Width = 150, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormLawyer.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Phone3", - Width = 150, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormLawyer.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Phone4", - Width = 150, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormLawyer.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Fax", - Width = 150, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Description ve Status - new() - { - ListFormCode = listFormLawyer.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 300, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Lawyer), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormLawyer.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 120, - ListOrderNo = 14, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto{ C = AppCodes.Definitions.Lawyer + ".Create", R = AppCodes.Definitions.Lawyer, U = AppCodes.Definitions.Lawyer + ".Update", E = true, I = true, Deny = false }), - PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto{ IsPivot = true }) - }, - }); - #endregion - } - #endregion - - //Branches - #region RegistrationType - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.RegistrationType)) - { - var listFormRegistrationType = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.RegistrationType, - Name = AppCodes.Definitions.RegistrationType, - Title = AppCodes.Definitions.RegistrationType, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = true, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.RegistrationType, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.RegistrationType)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.RegistrationType), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.RegistrationType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.RegistrationType, Width = 500, Height = 300 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = [ - new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region RegistrationType Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - new() - { - ListFormCode = listFormRegistrationType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 0, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // BranchId - new() - { - ListFormCode = listFormRegistrationType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "BranchId", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.BranchValues, - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Name - new() - { - ListFormCode = listFormRegistrationType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Status - new() - { - ListFormCode = listFormRegistrationType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationType), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region RegistrationMethod - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.RegistrationMethod)) - { - var listFormRegistrationMethod = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.RegistrationMethod, - Name = AppCodes.Definitions.RegistrationMethod, - Title = AppCodes.Definitions.RegistrationMethod, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = true, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.RegistrationMethod, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.RegistrationMethod)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.RegistrationMethod), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.RegistrationMethod))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.RegistrationMethod, Width = 550, Height = 350 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = [ - new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "RegistrationTypeId", IsRequired = true, ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 4, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region RegistrationMethod Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - // Id - new() - { - ListFormCode = listFormRegistrationMethod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 0, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationMethod), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // BranchId - new() - { - ListFormCode = listFormRegistrationMethod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "BranchId", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.BranchValues, - CascadeEmptyFields = "RegistrationTypeId" - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationMethod), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // RegistrationTypeId - new() - { - ListFormCode = listFormRegistrationMethod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "RegistrationTypeId", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.RegistrationTypeValues, - CascadeRelationField = "BranchId", - CascadeFilterOperator="=", - CascadeParentFields = "BranchId", - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationMethod), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Name - new() - { - ListFormCode = listFormRegistrationMethod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationMethod), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Status - new() - { - ListFormCode = listFormRegistrationMethod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.RegistrationMethod), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region ClassType - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ClassType)) - { - var listFormClassType = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.ClassType, - Name = AppCodes.Definitions.ClassType, - Title = AppCodes.Definitions.ClassType, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = true, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.ClassType, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ClassType)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.ClassType), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.ClassType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.ClassType, Width = 600, Height = 400 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = [ - new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "RegistrationTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 4, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "MinStudentCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 6, DataField = "MaxStudentCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 7, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region ClassType Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - // Id - new() - { - ListFormCode = listFormClassType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 0, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // BranchId - new() - { - ListFormCode = listFormClassType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "BranchId", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.BranchValues, - CascadeEmptyFields = "RegistrationTypeId" - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // RegistrationTypeId - new() - { - ListFormCode = listFormClassType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "RegistrationTypeId", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.RegistrationTypeValues, - CascadeRelationField = "BranchId", - CascadeFilterOperator="=", - CascadeParentFields = "BranchId", - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Name - new() - { - ListFormCode = listFormClassType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // MinStudentCount - new() - { - ListFormCode = listFormClassType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "MinStudentCount", - Width = 120, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // MaxStudentCount - new() - { - ListFormCode = listFormClassType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "MaxStudentCount", - Width = 120, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Status - new() - { - ListFormCode = listFormClassType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 150, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.ClassType), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Class - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Class)) - { - var listFormClass = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Class, - Name = AppCodes.Definitions.Class, - Title = AppCodes.Definitions.Class, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = true, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Class, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Class)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Class), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Class))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Class, Width = 550, Height = 300 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = [ - new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "ClassTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 4, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region Class Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - // Id - new() - { - ListFormCode = listFormClass.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 0, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Class), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // BranchId - new() - { - ListFormCode = listFormClass.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "BranchId", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.BranchValues, - CascadeEmptyFields = "ClassTypeId" - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Class), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // ClassTypeId - new() - { - ListFormCode = listFormClass.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "ClassTypeId", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.ClassTypeValues, - CascadeRelationField = "BranchId", - CascadeFilterOperator="=", - CascadeParentFields = "BranchId", - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Class), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Name - new() - { - ListFormCode = listFormClass.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Class), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Status - new() - { - ListFormCode = listFormClass.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Class), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Level - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Level)) - { - var listFormLevel = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Level, - Name = AppCodes.Definitions.Level, - Title = AppCodes.Definitions.Level, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = true, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Level, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Level)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Level), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Level))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = ListFormCodes.Lists.Level, Width = 650, Height = 450 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = [ - new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "ClassTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "LevelType", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 4, DataField = "Order", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox}, - new EditingFormItemDto { Order = 5, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 6, DataField = "LessonCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 7, DataField = "LessonDuration", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 8, DataField = "MonthlyPaymentRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 9, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region Level Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - // Id - new() - { - ListFormCode = listFormLevel.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 0, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // BranchId - new() - { - ListFormCode = listFormLevel.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "BranchId", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.BranchValues, - CascadeEmptyFields = "ClassTypeId" - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // ClassTypeId - new() - { - ListFormCode = listFormLevel.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "ClassTypeId", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.ClassTypeValues, - CascadeRelationField = "BranchId", - CascadeFilterOperator="=", - CascadeParentFields = "BranchId", - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // LevelType - new() - { - ListFormCode = listFormLevel.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "LevelType", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Seviye",Name="Seviye" }, - new () { Key="Sınav Eğitimi",Name="Sınav Eğitimi" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Order - new() - { - ListFormCode = listFormLevel.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Order", - Width = 180, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Name - new() - { - ListFormCode = listFormLevel.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 180, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // LessonCount - new() - { - ListFormCode = listFormLevel.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "LessonCount", - Width = 120, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // LessonDuration - new() - { - ListFormCode = listFormLevel.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "LessonDuration", - Width = 120, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // MonthlyPaymentRate - new() - { - ListFormCode = listFormLevel.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "MonthlyPaymentRate", - Format = "fixedPoint", - Alignment = "right", - Width = 150, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Status - new() - { - ListFormCode = listFormLevel.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 150, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Level), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region LessonPeriod - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.LessonPeriod)) - { - var listFormLessonPeriod = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.LessonPeriod, - Name = AppCodes.Definitions.LessonPeriod, - Title = AppCodes.Definitions.LessonPeriod, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = true, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.LessonPeriod, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.LessonPeriod)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.LessonPeriod), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.LessonPeriod))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.LessonPeriod, Width = 600, Height = 500 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items = [ - new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "Day", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "Lesson1", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 6, DataField = "Lesson2", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 7, DataField = "Lesson3", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 8, DataField = "Lesson4", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region LessonPeriod Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - // Id - new() - { - ListFormCode = listFormLessonPeriod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 0, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // BranchId - new() - { - ListFormCode = listFormLessonPeriod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "BranchId", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.BranchValues, - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Name - new() - { - ListFormCode = listFormLessonPeriod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 2, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Day - new() - { - ListFormCode = listFormLessonPeriod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Day", - Width = 120, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 3, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Lesson1-4 - new() - { - ListFormCode = listFormLessonPeriod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Lesson1", - Width = 200, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Ana",Name="Ana Öğretmen" }, - new () { Key="Ek",Name="Ek Öğretmen" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormLessonPeriod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Lesson2", - Width = 200, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Ana",Name="Ana Öğretmen" }, - new () { Key="Ek",Name="Ek Öğretmen" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormLessonPeriod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Lesson3", - Width = 200, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Ana",Name="Ana Öğretmen" }, - new () { Key="Ek",Name="Ek Öğretmen" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormLessonPeriod.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Lesson4", - Width = 200, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Ana",Name="Ana Öğretmen" }, - new () { Key="Ek",Name="Ek Öğretmen" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.LessonPeriod), - PivotSettingsJson = DefaultPivotSettingsJson - }, - }); - #endregion - } - #endregion - - #region Schedule - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Schedule)) - { - var listFormSchedule = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Schedule, - Name = AppCodes.Definitions.Schedule, - Title = AppCodes.Definitions.Schedule, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = true, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Schedule, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Schedule)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Schedule), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Schedule))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Schedule, Width = 750, Height = 700 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { - Order = 1, ColCount = 2, ColSpan = 2, ItemType = "group", - Items = [ - new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "StartTime", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "EndTime", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 6, DataField = "LessonMinute", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 7, DataField = "LessonBreakMinute", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 8, DataField = "LessonCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 9, DataField = "IncludeLunch", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 10, DataField = "LunchTime", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 11, DataField = "LunchMinute", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 12, DataField = "Monday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 13, DataField = "Tuesday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 14, DataField = "Wednesday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 15, DataField = "Thursday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 16, DataField = "Friday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 17, DataField = "Saturday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 18, DataField = "Sunday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 19, DataField = "Status", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IncludeLunch", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Monday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Tuesday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Wednesday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Thursday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Friday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Saturday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Sunday", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region Schedule Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - // Id - new() { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 0, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // BranchId - new() { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "BranchId", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.BranchValues, - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Name - new() { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 2, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Status - new() { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto{ C = AppCodes.Definitions.Schedule + ".Create", R = AppCodes.Definitions.Schedule, U = AppCodes.Definitions.Schedule + ".Update", E = true, I = true, Deny = false}), - PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto{ IsPivot = true}) - }, - // Ders Saatleri - new() - { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "StartTime", - Width = 120, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "EndTime", - Width = 120, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "LessonMinute", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "LessonBreakMinute", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "LessonCount", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - - // Öğle Arası - new() - { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "LunchTime", - Width = 120, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "LunchMinute", - Width = 100, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IncludeLunch", - Width = 100, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - - // Günler - new() - { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "Monday", - Width = 100, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "Tuesday", - Width = 100, - ListOrderNo = 14, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "Wednesday", - Width = 100, - ListOrderNo = 15, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "Thursday", - Width = 100, - ListOrderNo = 16, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "Friday", - Width = 100, - ListOrderNo = 17, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "Saturday", - Width = 100, - ListOrderNo = 18, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() - { - ListFormCode = listFormSchedule.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "Sunday", - Width = 100, - ListOrderNo = 19, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Schedule), - PivotSettingsJson = DefaultPivotSettingsJson - }, - - }); - #endregion - } - #endregion - - #region Bank - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Bank)) - { - var listFormBank = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Bank, - Name = AppCodes.Accounting.Bank, - Title = AppCodes.Accounting.Bank, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = true, - IsOrganizationUnit = false, - Description = AppCodes.Accounting.Bank, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Bank)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Accounting.Bank), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Bank))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Accounting.Bank, Width = 600, Height = 600 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "IdentifierCode", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox}, - new EditingFormItemDto { Order = 5, DataField = "Address1", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 6, DataField = "Address2", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 7, DataField = "Country", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 8, DataField = "City", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 9, DataField = "District", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 10, DataField = "PostalCode", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 11, DataField = "Phone", ColSpan = 2, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order = 12, DataField = "Email", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Manage", - Text ="Manage", - UrlTarget="_blank", - AuthName = AppCodes.Accounting.BankAccount, - Url=$"/admin/form/{ListFormCodes.Forms.FormBank}/@Id" - }, - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - } - ); - - #region Bank Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 0, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // BranchId - new() - { - ListFormCode = listFormBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "BranchId", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.BranchValues, - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "IdentifierCode", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address1", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address2", - Width = 150, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Country", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CountryValues, - CascadeEmptyFields = "City,District,Street" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "City", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CityValues, - CascadeRelationField = "Country", - CascadeFilterOperator="=", - CascadeParentFields = "Country", - CascadeEmptyFields = "District,Street" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "District", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.DistrictValues, - CascadeRelationField = "City", - CascadeFilterOperator="=", - CascadeParentFields = "Country,City", - CascadeEmptyFields = "Street", - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "PostalCode", - Width = 150, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Phone", - Width = 150, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBank.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Email", - Width = 150, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleEmailJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.Bank), - PivotSettingsJson = DefaultPivotSettingsJson - }, - }); - #endregion - } - #endregion - - #region BankAccount - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.BankAccount)) - { - var listFormBankAccount = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.BankAccount, - Name = AppCodes.Accounting.BankAccount, - Title = AppCodes.Accounting.BankAccount, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = true, - IsOrganizationUnit = false, - Description = AppCodes.Accounting.BankAccount, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.BankAccount)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Accounting.BankAccount), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.BankAccount))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Accounting.BankAccount, Width = 600, Height = 300 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "BankId", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "AccountNumber", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "AccountOwner", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "CurrencyId", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 5, DataField = "CanTransferMoney", ColSpan = 2, EditorType2=EditorTypes.dxCheckBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CanTransferMoney", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region Bank Account Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormBankAccount.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.BankAccount), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBankAccount.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "BankId", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.BankValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.BankAccount), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBankAccount.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "AccountNumber", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.BankAccount), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBankAccount.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "AccountOwner", - Width = 250, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.BankAccount), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBankAccount.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "CurrencyId", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CurrencyValues, - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.BankAccount), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBankAccount.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "CanTransferMoney", - Width = 50, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Accounting.BankAccount), - PivotSettingsJson = DefaultPivotSettingsJson - }, - }); - #endregion - } - #endregion - - //Classroom - #region QuestionTag - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.QuestionTag)) - { - var listFormTag = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.QuestionTag, - Name = AppCodes.Definitions.QuestionTag, - Title = AppCodes.Definitions.QuestionTag, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.QuestionTag, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.QuestionTag)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.QuestionTag), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.QuestionTag))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.QuestionTag, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Color", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxColorBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region Tag Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormTag.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionTag), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTag.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionTag), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTag.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 400, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionTag), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTag.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Color", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionTag), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Question Pool - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.QuestionPool)) - { - var listFormQuestionPool = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.QuestionPool, - Name = AppCodes.Definitions.QuestionPool, - Title = AppCodes.Definitions.QuestionPool, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.QuestionPool, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.QuestionPool)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.QuestionPool), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.QuestionPool))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.QuestionPool, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Tags", ColSpan = 2, EditorType2=EditorTypes.dxTagBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Questions", - Text ="Questions", - UrlTarget="_blank", - AuthName = AppCodes.Definitions.Question, - Url=$"/admin/form/{ListFormCodes.Forms.FormQuestionPool}/@Id" - }, - }), - - } - ); - - #region Question Pool Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormQuestionPool.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormQuestionPool.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormQuestionPool.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 400, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormQuestionPool.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Tags", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.QuestionTagValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.QuestionPool), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Question - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Question)) - { - var listFormQuestion = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Question, - Name = AppCodes.Definitions.Question, - Title = AppCodes.Definitions.Question, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Definitions.Question, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Question)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Question), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Question))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Definitions.Question, Width = 500, Height = 520 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Answers", - Text = "Answers", - AuthName = AppCodes.Definitions.Question, - DialogName = "QuestionAnswers", - DialogParameters = JsonSerializer.Serialize(new { - id = "@Id" - }) - }, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= [ - new EditingFormItemDto { Order = 1, DataField = "QuestionPoolId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 2, DataField = "QuestionType", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 3, DataField = "Points", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 4, DataField = "Title", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "Content", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 6, DataField = "Difficulty", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 7, DataField = "MediaType", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 8, DataField = "MediaUrl", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 9, DataField = "CorrectAnswer", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox, EditorOptions="{\"disabled\": true}" }, - new EditingFormItemDto { Order = 10, DataField = "TimeLimit", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 11, DataField = "Explanation", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "MediaType", FieldDbType = DbType.String, Value = "image", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Difficulty", FieldDbType = DbType.String, Value = "easy", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - } - ); - - #region Question Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "QuestionPoolId", - Width = 100, - ListOrderNo = 2, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.QuestionPoolValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "QuestionType", - Width = 120, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "multiple-choice", Name= "Çoktan Seçmeli" }, - new () { Key= "fill-blank", Name= "Boşluk Doldurma" }, - new () { Key= "multiple-answer", Name= "Çok Yanıtlı"}, - new () { Key= "matching", Name= "Eşleştirme" }, - new () { Key= "ordering", Name= "Sıralama" }, - new () { Key= "open-ended", Name= "Açık Uçlu" }, - new () { Key= "true-false", Name= "Doğru-Yanlış" }, - new () { Key= "calculation", Name="Hesaplama" } - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Points", - Format = "fixedPoint", - Alignment = "right", - Width = 60, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Title", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Content", - Width = 350, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "MediaType", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "image", Name= "Image" }, - new () { Key= "video", Name= "Video" }, - }), - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "MediaUrl", - Width = 170, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "CorrectAnswer", - Width = 150, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Difficulty", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "easy", Name= "Easy" }, - new () { Key= "medium", Name= "Medium" }, - new () { Key= "hard", Name= "Hard" }, - }), - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "TimeLimit", - Width = 100, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Explanation", - Width = 100, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Definitions.Question), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - //Hr - #region EmploymentType - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.EmploymentType)) - { - var listFormEmploymentType = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.EmploymentType, - Name = AppCodes.Hr.EmploymentType, - Title = AppCodes.Hr.EmploymentType, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.EmploymentType, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.EmploymentType)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.EmploymentType), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.EmploymentType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.EmploymentType, Width = 500, Height = 200 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField="Name", ColSpan = 2, IsRequired =true, EditorType2 = EditorTypes.dxTextBox }, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new CommandColumnDto() { - Hint = "Personel Listesi", - Text ="Personel Listesi", - UrlTarget="_blank", - AuthName = AppCodes.Hr.Employee, - Url="/admin/list/list-employees/@Id" - }, - }), - } - ); - - #region Employment Type Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormEmploymentType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.EmploymentType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmploymentType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.EmploymentType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Badge - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Badge)) - { - var listFormBadge = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Badge, - Name = AppCodes.Hr.Badge, - Title = AppCodes.Hr.Badge, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.Badge, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Badge)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.Badge), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Badge))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Badge, Width = 500, Height = 520 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items = [ - new EditingFormItemDto { Order = 1, DataField="Code", ColSpan = 2, IsRequired =true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField="Name", ColSpan = 2, IsRequired =true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField="Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 4, DataField="Icon", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 5, DataField="Color", ColSpan = 2, EditorType2 = EditorTypes.dxColorBox }, - new EditingFormItemDto { Order = 6, DataField="BackgroundColor", ColSpan = 2, EditorType2 = EditorTypes.dxColorBox }, - new EditingFormItemDto { Order = 7, DataField="Category", ColSpan = 2, IsRequired =true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 8, DataField="Criteria", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 9, DataField="Points", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 10, DataField="Rarity", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 11, DataField="IsActive", ColSpan = 2, EditorType2 = EditorTypes.dxCheckBox }, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region Badge Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormBadge.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBadge.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBadge.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBadge.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 400, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBadge.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Icon", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "⭐", Name= "⭐ Yıldız" }, - new () { Key= "🏆", Name= "🏆 Kupa" }, - new () { Key= "🥇", Name= "🥇 Altın Madalya" }, - new () { Key= "🥈", Name= "🥈 Gümüş Madalya" }, - new () { Key= "🥉", Name= "🥉 Bronz Madalya" }, - new () { Key= "👑", Name= "👑 Taç" }, - new () { Key= "💎", Name= "💎 Elmas" }, - new () { Key= "💡", Name= "💡 Ampul" }, - new () { Key= "🔥", Name= "🔥 Ateş" }, - new () { Key= "⚡", Name= "⚡ Şimşek" }, - new () { Key= "🎯", Name= "🎯 Hedef" }, - new () { Key= "📈", Name= "📈 Grafik" }, - new () { Key= "🚀", Name= "🚀 Roket" }, - new () { Key= "💪", Name= "💪 Güç" }, - new () { Key= "❤️", Name= "❤️ Kalp" } - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBadge.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Color", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBadge.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "BackgroundColor", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBadge.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Category", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "Performance", Name= "Performance" }, - new () { Key= "Leadership", Name= "Leadership" }, - new () { Key= "Innovation", Name= "Innovation" }, - new () { Key= "Teamwork", Name= "Teamwork" }, - new () { Key= "Customer", Name= "Customer" }, - new () { Key= "Safety", Name= "Safety" }, - new () { Key= "Attendance", Name= "Attendance" }, - new () { Key= "Training", Name= "Training" }, - new () { Key= "Project", Name= "Project" }, - new () { Key= "Special", Name= "Special" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBadge.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Criteria", - Width = 400, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBadge.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Points", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBadge.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Rarity", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "Common", Name= "Common" }, - new () { Key= "Uncommon", Name= "Uncommon" }, - new () { Key= "Rare", Name= "Rare" }, - new () { Key= "Epic", Name= "Epic" }, - new () { Key= "Legendary", Name= "Legendary" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormBadge.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - Width = 100, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Badge), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region JobPosition - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.JobPosition)) - { - var listFormJobPosition = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.JobPosition, - Name = AppCodes.Hr.JobPosition, - Title = AppCodes.Hr.JobPosition, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.JobPosition, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.JobPosition)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.JobPosition), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.JobPosition))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.JobPosition, Width = 500, Height = 600 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField="Code", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField="Name", ColSpan = 2, IsRequired =true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField="Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 4, DataField="DepartmentId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 5, DataField="Level", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 6, DataField="MinSalary", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 7, DataField="MaxSalary", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 8, DataField="CurrencyId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 9, DataField="RequiredSkills", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 10, DataField="Responsibilities", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 11, DataField="Qualifications", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 12, DataField="IsActive", ColSpan = 2, EditorType2 = EditorTypes.dxCheckBox} - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new CommandColumnDto() { - Hint = "Personel Listesi", - Text ="Personel Listesi", - UrlTarget="_blank", - AuthName = AppCodes.Hr.Employee, - Url="/admin/list/list-employees/@Id" - }, - }), - } - ); - - #region Job Position Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormJobPosition.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormJobPosition.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormJobPosition.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormJobPosition.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 400, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormJobPosition.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "DepartmentId", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.DepartmentValues - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormJobPosition.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Level", - Width = 80, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "Entry", Name= "Entry" }, - new () { Key= "Junior", Name= "Junior" }, - new () { Key= "Mid", Name= "Mid"}, - new () { Key= "Senior", Name= "Senior" }, - new () { Key= "Lead", Name= "Lead" }, - new () { Key= "Manager", Name= "Manager" }, - new () { Key= "Director", Name= "Director" }, - new () { Key= "Executive", Name= "Executive" }, - }), - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormJobPosition.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "MinSalary", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormJobPosition.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "MaxSalary", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormJobPosition.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "CurrencyId", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.CurrencyValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormJobPosition.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "RequiredSkills", - Width = 400, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormJobPosition.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Responsibilities", - Width = 400, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormJobPosition.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Qualifications", - Width = 400, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormJobPosition.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - Width = 100, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.JobPosition), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Department - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Department)) - { - var listFormDepartment = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Department, - Name = AppCodes.Hr.Department, - Title = AppCodes.Hr.Department, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.Department, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Department)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.Department), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Department))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Department, Width = 500, Height = 520 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField="Code", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField="Name", ColSpan = 2, IsRequired =true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField="Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 4, DataField="ParentDepartmentId", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 5, DataField="ManagerId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 6, DataField="CostCenterId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 7, DataField="Budget", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 8, DataField="IsActive", ColSpan = 2, EditorType2 = EditorTypes.dxCheckBox} - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new CommandColumnDto() { - Hint = "Personel Listesi", - Text ="Personel Listesi", - UrlTarget="_blank", - AuthName = AppCodes.Hr.Employee, - Url="/admin/list/list-employees/@Id" - }, - }), - } - ); - - #region Department Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormDepartment.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormDepartment.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormDepartment.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormDepartment.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 300, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormDepartment.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "ParentDepartmentId", - Width = 200, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.DepartmentValues - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormDepartment.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "ManagerId", - Width = 200, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmployeeValues - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormDepartment.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "CostCenterId", - Width = 200, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.CostCenterValues - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormDepartment.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Budget", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormDepartment.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Department), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Cost Centers - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.CostCenter)) - { - var listFormCostCenter = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.CostCenter, - Name = AppCodes.Hr.CostCenter, - Title = AppCodes.Hr.CostCenter, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.CostCenter, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.CostCenter)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.CostCenter), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.CostCenter))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.CostCenter, Width = 500, Height = 520 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField="Code", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField="Name", ColSpan = 2, IsRequired =true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField="Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 4, DataField="ParentCostCenterId", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 5, DataField="ResponsibleEmployeeId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 6, DataField="DepartmentId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 7, DataField="CostCenterType", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 8, DataField="BudgetedAmount", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 9, DataField="ActualAmount", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 10, DataField="CurrencyId", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 11, DataField="FiscalYear", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 12, DataField="IsActive", ColSpan = 2, EditorType2 = EditorTypes.dxCheckBox} - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region Cost Center Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormCostCenter.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCostCenter.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCostCenter.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCostCenter.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 300, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCostCenter.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "ParentCostCenterId", - Width = 200, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.CostCenterValues - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCostCenter.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "ResponsibleEmployeeId", - Width = 200, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmployeeValues - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCostCenter.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "DepartmentId", - Width = 200, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.DepartmentValues - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCostCenter.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "CostCenterType", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "Revenue", Name= "Revenue" }, - new () { Key= "Standard", Name= "Standard" }, - new () { Key= "Discretionary", Name= "Discretionary"}, - new () { Key= "Investment", Name= "Investment" }, - new () { Key= "Service", Name= "Service" }, - new () { Key= "Production", Name= "Production" }, - new () { Key= "Support", Name= "Support" }, - new () { Key= "Administrative", Name="Administrative" } - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCostCenter.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "BudgetedAmount", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCostCenter.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "ActualAmount", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCostCenter.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "CurrencyId", - Width = 100, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.CurrencyValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCostCenter.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "FiscalYear", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormCostCenter.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - Width = 100, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.CostCenter), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Employees - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Employee)) - { - var listFormEmployee = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Employee, - Name = AppCodes.Hr.Employee, - Title = AppCodes.Hr.Employee, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.Employee, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Employee)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.Employee), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Employee))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Employee, Width = 1000, Height = 520 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, Caption="General", ColCount=1, ColSpan=1, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField="Code", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField="FullName", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField="NationalId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField="BirthDate", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 5, DataField="Gender", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 6, DataField="MaritalStatus", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 7, DataField="EmployeeStatus", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 8, DataField="IsActive", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, - ]}, - new() { - Order=2, Caption="Contact", ColCount=1, ColSpan=1, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField="Country", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 2, DataField="City", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 3, DataField="District", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 4, DataField="Street", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 5, DataField="PostalCode", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 6, DataField="Phone", ColSpan = 1, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order = 7, DataField="PersonalPhone", ColSpan = 1, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order = 8, DataField="Email", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 9, DataField="Address1", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 10, DataField="Address2", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - ]}, - new() { - Order=3, Caption="Job", ColCount=1, ColSpan=1, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField="HireDate", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 2, DataField="TerminationDate", ColSpan = 1, EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 3, DataField="EmploymentTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 4, DataField="JobPositionId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 5, DataField="DepartmentId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 6, DataField="WorkLocation", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 7, DataField="ManagerId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 8, DataField="BaseSalary", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, - new EditingFormItemDto { Order = 9, DataField="CurrencyId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 10, DataField="PayrollGroup", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 11, DataField="BankAccountId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 12, DataField="BadgeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - ]}, - new() { - Order=4, Caption="Emergency", ColCount=1, ColSpan=1, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField="EmergencyContactName", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField="EmergencyContactRelationship", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField="EmergencyContactPhone", ColSpan = 1, EditorType2=EditorTypes.dxTextBox, EditorOptions=EditorOptionValues.PhoneEditorOptions }, - ]}, - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region Employee Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "FullName", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "NationalId", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "BirthDate", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Gender", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "Male", Name= "Male"}, - new () { Key= "Female", Name= "Female" }, - new () { Key= "Other", Name= "Other" }, - }), - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "MaritalStatus", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "Single", Name= "Single"}, - new () { Key= "Married", Name= "Married" }, - new () { Key= "Divorced", Name= "Divorced" }, - new () { Key= "Widowed", Name= "Widowed" }, - }), - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "EmployeeStatus", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "Active", Name= "Active"}, - new () { Key= "Inactive", Name= "Inactive" }, - new () { Key= "OnLeave", Name= "OnLeave" }, - new () { Key= "Suspended", Name= "Suspended" }, - new () { Key= "Terminated", Name= "Terminated" }, - }), - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address1", - Width = 200, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Address2", - Width = 200, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Country", - Width = 100, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CountryValues, - CascadeEmptyFields = "City,District,Street" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "City", - Width = 100, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.CityValues, - CascadeRelationField = "Country", - CascadeFilterOperator="=", - CascadeParentFields = "Country", - CascadeEmptyFields = "District,Street" - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "District", - Width = 100, - ListOrderNo = 14, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.DistrictValues, - CascadeRelationField = "City", - CascadeFilterOperator="=", - CascadeParentFields = "Country,City", - CascadeEmptyFields = "Street", - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "PostalCode", - Width = 100, - ListOrderNo = 15, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Phone", - Width = 100, - ListOrderNo = 16, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "PersonalPhone", - Width = 100, - ListOrderNo = 17, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Email", - Width = 200, - ListOrderNo = 18, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleEmailJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "EmergencyContactName", - Width = 100, - ListOrderNo = 19, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "EmergencyContactRelationship", - Width = 100, - ListOrderNo = 20, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "EmergencyContactPhone", - Width = 150, - ListOrderNo = 21, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "HireDate", - Width = 100, - ListOrderNo = 22, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "TerminationDate", - Width = 100, - ListOrderNo = 23, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "EmploymentTypeId", - Width = 200, - ListOrderNo = 24, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmploymentTypeValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "JobPositionId", - Width = 100, - ListOrderNo = 25, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.JobPositionValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "DepartmentId", - Width = 100, - ListOrderNo = 26, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.DepartmentValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "WorkLocation", - Width = 150, - ListOrderNo = 27, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "ManagerId", - Width = 100, - ListOrderNo = 28, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmployeeValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "BaseSalary", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 29, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "CurrencyId", - Width = 100, - ListOrderNo = 30, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.CurrencyValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "PayrollGroup", - Width = 100, - ListOrderNo = 31, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "Hours", Name= "Hours" }, - new () { Key= "Weeks", Name= "Weeks" }, - new () { Key= "Months", Name= "Months" } - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "BankAccountId", - Width = 100, - ListOrderNo = 32, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.BankAccountValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEmployee.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "BadgeId", - Width = 100, - ListOrderNo = 33, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.BadgeValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Employee), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Leave - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Leave)) - { - var listFormLeave = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Leave, - Name = AppCodes.Hr.Leave, - Title = AppCodes.Hr.Leave, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.Leave, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Leave)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.Leave), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Leave))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Leave, Width = 500, Height = 520 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField = "AppliedDate", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox}, - new EditingFormItemDto { Order = 2, DataField = "EmployeeId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 3, DataField = "LeaveType", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 4, DataField = "StartDate", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox, EditorScript = EditorScriptValues.CalcTotalDaysFromDates}, - new EditingFormItemDto { Order = 5, DataField = "EndDate", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox, EditorScript = EditorScriptValues.CalcTotalDaysFromDates}, - new EditingFormItemDto { Order = 6, DataField = "TotalDays", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.Disabled}, - new EditingFormItemDto { Order = 7, DataField = "IsHalfDay", ColSpan = 2, EditorType2 = EditorTypes.dxCheckBox}, - new EditingFormItemDto { Order = 8, DataField = "Reason", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextArea}, - new EditingFormItemDto { Order = 9, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox}, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Pending", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "AppliedDate", FieldDbType = DbType.Date, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsHalfDay", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - ButtonPosition = UiCommandButtonPositionTypeEnum.Toolbar, - Hint = "Toplu İzin", - Text ="Toplu İzin", - AuthName = AppCodes.Hr.Leave + ".Update", - DialogName = "CollectiveLeave", - DialogParameters = JsonSerializer.Serialize(new { - name = "@Name", - id = "@Id" - }) - }, - new() { - Hint = "Accept", - Text ="Accept", - UrlTarget="_blank", - AuthName = AppCodes.Hr.Leave + ".Update", - Url="/admin/list/list-employees/@Id" - }, - new() { - Hint = "Reject", - Text ="Reject", - UrlTarget="_blank", - AuthName = AppCodes.Hr.Leave + ".Update", - Url="/admin/list/list-employees/@Id" - }, - }), - } - ); - - #region Leave Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormLeave.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormLeave.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "EmployeeId", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmployeeValues - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormLeave.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "LeaveType", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "Annual", Name= "Annual" }, - new () { Key= "Sick", Name= "Sick" }, - new () { Key= "Maternity", Name= "Maternity"}, - new () { Key= "Paternity", Name= "Paternity" }, - new () { Key= "Personal", Name= "Personal" }, - new () { Key= "Emergency", Name= "Emergency" }, - new () { Key= "Study", Name= "Study" }, - new () { Key= "Unpaid", Name="Unpaid" } - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormLeave.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "StartDate", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormLeave.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "EndDate", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormLeave.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "TotalDays", - Alignment = "right", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormLeave.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsHalfDay", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormLeave.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Reason", - Width = 250, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormLeave.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "Pending", Name= "Pending" }, - new () { Key= "Approved", Name= "Approved" }, - new () { Key= "Rejected", Name= "Rejected"}, - new () { Key= "Cancelled", Name= "Cancelled" }, - }), - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormLeave.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "AppliedDate", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormLeave.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "ApprovedById", - Width = 100, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmployeeValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormLeave.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "ApprovedDate", - Width = 100, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormLeave.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "RejectionReason", - Width = 250, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Leave), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Overtime - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Overtime)) - { - var listFormOvertime = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Overtime, - Name = AppCodes.Hr.Overtime, - Title = AppCodes.Hr.Overtime, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.Overtime, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Overtime)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.Overtime), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Overtime))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Overtime, Width = 500, Height = 520 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField = "Date", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox}, - new EditingFormItemDto { Order = 2, DataField = "EmployeeId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 4, DataField = "StartTime", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox, EditorOptions = EditorOptionValues.TimeSpanOptions, EditorScript = EditorScriptValues.CalcTotalHoursFromTimes}, - new EditingFormItemDto { Order = 5, DataField = "EndTime", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox, EditorOptions = EditorOptionValues.TimeSpanOptions, EditorScript = EditorScriptValues.CalcTotalHoursFromTimes}, - new EditingFormItemDto { Order = 6, DataField = "TotalHours", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.Disabled}, - new EditingFormItemDto { Order = 7, DataField = "Reason", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextArea}, - new EditingFormItemDto { Order = 8, DataField = "Rate", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox}, - new EditingFormItemDto { Order = 9, DataField = "Amount", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.Disabled}, - new EditingFormItemDto { Order = 10, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox}, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Pending", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Date", FieldDbType = DbType.Date, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - ButtonPosition = UiCommandButtonPositionTypeEnum.Toolbar, - Hint = "Toplu Mesai", - Text ="Toplu Mesai", - AuthName = AppCodes.Hr.Overtime + ".Update", - DialogName = "CollectiveOvertime", - DialogParameters = JsonSerializer.Serialize(new { - name = "@Name", - id = "@Id" - }) - }, - new() { - Hint = "Accept", - Text ="Accept", - UrlTarget="_blank", - AuthName = AppCodes.Hr.Overtime + ".Update", - Url="/admin/list/list-employees/@Id" - }, - new() { - Hint = "Reject", - Text ="Reject", - UrlTarget="_blank", - AuthName = AppCodes.Hr.Overtime + ".Update", - Url="/admin/list/list-employees/@Id" - }, - }), - } - ); - - #region Overtime Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormOvertime.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormOvertime.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "EmployeeId", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmployeeValues - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormOvertime.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "StartTime", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormOvertime.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "EndTime", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormOvertime.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "TotalHours", - Alignment = "right", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormOvertime.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Reason", - Width = 250, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormOvertime.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Rate", - Width = 150, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= 1.5, Name= "x1.5 (Normal Mesai)" }, - new () { Key= 2.0, Name= "x2.0 (Hafta Sonu/Tatil)" }, - new () { Key= 2.5, Name= "x2.5 (Resmi Tatil)"}, - }), - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormOvertime.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Amount", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormOvertime.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "Pending", Name= "Pending" }, - new () { Key= "Approved", Name= "Approved" }, - new () { Key= "Rejected", Name= "Rejected"}, - new () { Key= "Cancelled", Name= "Cancelled" }, - }), - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormOvertime.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "Date", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormOvertime.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "ApprovedById", - Width = 100, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmployeeValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormOvertime.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "ApprovedDate", - Width = 100, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormOvertime.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "RejectionReason", - Width = 250, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Overtime), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Payroll - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Payroll)) - { - var listFormPayroll = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Payroll, - Name = AppCodes.Hr.Payroll, - Title = AppCodes.Hr.Payroll, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.Payroll, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Payroll)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.Payroll), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Payroll))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Payroll, Width = 400, Height = 520 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items = [ - new EditingFormItemDto { Order = 1, DataField = "EmployeeId", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 2, DataField = "PeriodYear", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 3, DataField = "PeriodMonth", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 4, DataField = "PaymentDate", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 5, DataField = "BaseSalary", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, - new EditingFormItemDto { Order = 6, DataField = "Overtime", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, - new EditingFormItemDto { Order = 7, DataField = "Bonus", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, - new EditingFormItemDto { Order = 8, DataField = "GrossSalary", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, - new EditingFormItemDto { Order = 9, DataField = "NetSalary", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, - new EditingFormItemDto { Order = 10, DataField = "Tax", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, - new EditingFormItemDto { Order = 11, DataField = "SocialSecurity", ColSpan = 2, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, - new EditingFormItemDto { Order = 12, DataField = "Status", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox}, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Draft", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "PeriodYear", FieldDbType = DbType.Int32, Value = "@YEAR", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "PeriodMonth", FieldDbType = DbType.Int32, Value = "@MONTH", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "PaymentDate", FieldDbType = DbType.Date, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "BaseSalary", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Overtime", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Bonus", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "GrossSalary", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "NetSalary", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Tax", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "SocialSecurity", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - ButtonPosition = UiCommandButtonPositionTypeEnum.Toolbar, - Hint = "Toplu Bordro", - Text ="Toplu Bordro", - AuthName = AppCodes.Hr.Payroll + ".Update", - DialogName = "CollectivePayroll", - DialogParameters = JsonSerializer.Serialize(new { - name = "@Name", - id = "@Id" - }) - }, - new() { - Hint = "Ödeme & Kesinti", - Text ="Ödeme & Kesinti", - UrlTarget="_blank", - AuthName = AppCodes.Hr.Payroll + ".Update", - Url="/admin/list/list-employees/@Id" - }, - new() { - Hint = "Accept", - Text ="Accept", - UrlTarget="_blank", - AuthName = AppCodes.Hr.Payroll + ".Update", - Url="/admin/list/list-employees/@Id" - }, - new() { - Hint = "Reject", - Text ="Reject", - UrlTarget="_blank", - AuthName = AppCodes.Hr.Payroll + ".Update", - Url="/admin/list/list-employees/@Id" - }, - }), - } - ); - - #region Payroll Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormPayroll.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPayroll.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "EmployeeId", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmployeeValues - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPayroll.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "PeriodYear", - Width = 100, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPayroll.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "PeriodMonth", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= 1, Name= "01-Ocak" }, - new () { Key= 2, Name= "02-Şubat" }, - new () { Key= 3, Name= "03-Mart"}, - new () { Key= 4, Name= "04-Nisan" }, - new () { Key= 5, Name= "05-Mayıs" }, - new () { Key= 6, Name= "06-Haziran" }, - new () { Key= 7, Name= "07-Temmuz" }, - new () { Key= 8, Name= "08-Ağustos" }, - new () { Key= 9, Name= "09-Eylül" }, - new () { Key=10, Name= "10-Ekim" }, - new () { Key=11, Name= "11-Kasım" }, - new () { Key=12, Name= "12-Aralık" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPayroll.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "PaymentDate", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPayroll.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "BaseSalary", - Format = "fixedPoint", - Alignment = "right", - Width = 150, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPayroll.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Overtime", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPayroll.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Bonus", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPayroll.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "GrossSalary", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPayroll.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "NetSalary", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPayroll.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Tax", - Format = "fixedPoint", - Alignment = "right", - Width = 100, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPayroll.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "SocialSecurity", - Alignment = "right", - Format = "fixedPoint", - Width = 100, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), - PivotSettingsJson = DefaultPivotSettingsJson - }, - - new() { - ListFormCode = listFormPayroll.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 100, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "Draft", Name= "Draft" }, - new () { Key= "Calculated", Name= "Calculated" }, - new () { Key= "Approved", Name= "Approved"}, - new () { Key= "Paid", Name= "Paid" }, - new () { Key= "Cancelled", Name= "Cancelled" }, - }), - }), - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Payroll), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Template 360 - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Payroll)) - { - var listFormTemplate360 = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Template360, - Name = AppCodes.Hr.Template360, - Title = AppCodes.Hr.Template360, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.Template360, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Template360)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.Template360), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Template360))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Template360, Width = 400, Height = 520 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 4, DataField = "AssessorTypes", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxTagBox }, - new EditingFormItemDto { Order = 3, DataField = "IsActive", ColSpan = 2, EditorType2 = EditorTypes.dxCheckBox }, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Questions", - Text = "Questions", - AuthName = TenantManagementPermissions.Tenants.ManageConnectionStrings, - DialogName = "Template360Questions", - DialogParameters = JsonSerializer.Serialize(new { - name = "@Name", - id = "@Id" - }) - }, - }), - } - ); - - #region Template 360 Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormTemplate360.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Template360), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTemplate360.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Template360), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTemplate360.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 450, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Template360), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTemplate360.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "AssessorTypes", - Width = 500, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "self", Name= "Self" }, - new () { Key= "manager", Name= "Manager" }, - new () { Key= "peer", Name= "Peer"}, - new () { Key= "subordinate", Name= "Subordinate" }, - new () { Key= "customer", Name= "Customer" }, - new () { Key= "otherDepartment", Name= "OtherDepartment" }, - new () { Key= "hrUpperManagement", Name= "HRUpperManagement" }, - new () { Key= "external", Name= "External" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Template360), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Performans 360 - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Performance360)) - { - var listFormPerformans360 = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Performance360, - Name = AppCodes.Hr.Performance360, - Title = AppCodes.Hr.Performance360, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.Performance360, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Performance360)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.Performance360), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Performance360))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Performance360, Width = 500, Height = 520 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 3, DataField = "TemplateId", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 4, DataField = "StartDate", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 5, DataField = "EndDate", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 6, DataField = "Status", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 7, DataField = "DepartmentId", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 8, DataField = "TargetEmployees", ColSpan = 2, IsRequired=true, EditorType2 = EditorTypes.dxTagBox }, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Draft", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Evaluations", - Text = "Evaluations", - AuthName = TenantManagementPermissions.Tenants.ManageConnectionStrings, - DialogName = "Evaluation360", - DialogParameters = JsonSerializer.Serialize(new { - name = "@Name", - id = "@Id" - }) - }, - }), - } - ); - - #region Performans 360 Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormPerformans360.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPerformans360.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPerformans360.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 450, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPerformans360.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "TemplateId", - Width = 200, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.Template360Values - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPerformans360.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "StartDate", - Width = 150, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPerformans360.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "EndDate", - Width = 150, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPerformans360.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "Draft", Name= "Draft" }, - new () { Key= "Active", Name= "Active" }, - new () { Key= "Completed", Name= "Completed"}, - new () { Key= "Cancelled", Name= "Cancelled" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPerformans360.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "DepartmentId", - Width = 150, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.DepartmentValues, - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormPerformans360.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "TargetEmployees", - Width = 300, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmployeeValues, - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Performance360), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - // Intranet - #region EventType - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.EventType)) - { - var listFormEventType = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.EventType, - Name = AppCodes.Intranet.EventType, - Title = AppCodes.Intranet.EventType, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Intranet.EventType, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.EventType)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Intranet.EventType), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.EventType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.EventType, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region EventType Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormEventType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.EventType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEventType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.EventType), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region EventCategory - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.EventCategory)) - { - var listFormEventCategory = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.EventCategory, - Name = AppCodes.Intranet.EventCategory, - Title = AppCodes.Intranet.EventCategory, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Intranet.EventCategory, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.EventCategory)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Intranet.EventCategory), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.EventCategory))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.EventCategory, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region EventCategory Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormEventCategory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.EventCategory), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormEventCategory.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.EventCategory), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Event - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Event)) - { - var listFormEvent = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Event, - Name = AppCodes.Intranet.Event, - Title = AppCodes.Intranet.Event, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Intranet.Event, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Event)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Intranet.Event), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Event))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.Event, Width = 650, Height = 550 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items =[ - new EditingFormItemDto { Order = 1, DataField = "CategoryId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "TypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "Place", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 5, DataField = "OrganizerId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 6, DataField = "Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 7, DataField = "Status", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 8, DataField = "ParticipantsCount", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 9, DataField = "Likes", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Aktif", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - } - ); - - #region Event Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - // Id - new() - { - ListFormCode = listFormEvent.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // CategoryId - new() - { - ListFormCode = listFormEvent.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "CategoryId", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.EventCategoryValues, - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // TypeId - new() - { - ListFormCode = listFormEvent.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "TypeId", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.EventTypeValues, - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Name - new() - { - ListFormCode = listFormEvent.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Place - new() - { - ListFormCode = listFormEvent.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Place", - Width = 200, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Description - new() - { - ListFormCode = listFormEvent.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 400, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // OrganizerId - new() - { - ListFormCode = listFormEvent.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "OrganizerId", - Width = 150, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.UserValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // ParticipantsCount - new() - { - ListFormCode = listFormEvent.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "ParticipantsCount", - Width = 80, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // ParticipantsCount - new() - { - ListFormCode = listFormEvent.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Likes", - Width = 80, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Status - new() - { - ListFormCode = listFormEvent.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 120, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Published",Name="Published" }, - new () { Key="Draft",Name="Draft" }, - new () { Key="Cancelled",Name="Cancelled" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Event), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Trainings - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Training)) - { - var listFormTraining = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Training, - Name = AppCodes.Hr.Training, - Title = AppCodes.Hr.Training, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.Training, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Training)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.Training), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Training))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Training, Width = 500, Height = 600 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField = "Title", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Description", EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 3, DataField = "Instructor", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "Category", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 5, DataField = "Type", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 6, DataField = "Location", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 7, DataField = "Thumbnail", EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 8, DataField = "Duration", IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 9, DataField = "StartDate", IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 10, DataField = "EndDate", IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 11, DataField = "MaxParticipants", EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 12, DataField = "Status", EditorType2 = EditorTypes.dxSelectBox }, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "upcoming", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "MaxParticipants", FieldDbType = DbType.Int32, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new CommandColumnDto() { - Hint = "Sertifikalar", - Text = "Sertifikalar", - AuthName = AppCodes.Hr.Training + ".Update", - DialogName = "TrainingCertificates", - DialogParameters = JsonSerializer.Serialize(new { - name = "@Email", - id = "@Id" - }) - }, - }), - } - ); - - #region Training Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormTraining.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTraining.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Title", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTraining.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 650, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTraining.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Instructor", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTraining.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Category", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "technical", Name= "Technical" }, - new () { Key= "soft-skills", Name= "Soft Skills" }, - new () { Key= "management", Name="Management" }, - new () { Key= "compliance", Name="Compliance" }, - new () { Key= "other", Name="Other" } - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTraining.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Type", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "online", Name= "Online" }, - new () { Key= "classroom", Name= "Classroom" }, - new () { Key= "hybrid", Name="Hybrid" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTraining.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Location", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTraining.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Thumbnail", - Width = 550, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTraining.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Duration", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTraining.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "StartDate", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTraining.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "EndDate", - Width = 100, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTraining.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "MaxParticipants", - Width = 100, - ListOrderNo = 12, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTraining.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Enrolled", - Width = 100, - ListOrderNo = 13, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormTraining.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 100, - ListOrderNo = 17, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "upcoming", Name= "Upcoming" }, - new () { Key= "ongoing", Name= "Ongoing" }, - new () { Key= "completed", Name="Completed" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Training), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Meal - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Meal)) - { - var listFormMeal = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Meal, - Name = AppCodes.Intranet.Meal, - Title = AppCodes.Intranet.Meal, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = true, - IsOrganizationUnit = false, - Description = AppCodes.Intranet.Meal, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Meal)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Intranet.Meal), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Meal))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.Meal, Width = 600, Height = 450 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order = 1, - ColCount = 1, - ColSpan = 2, - ItemType = "group", - Items =[ - new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 2, DataField = "Date", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 3, DataField = "Type", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, - new EditingFormItemDto { Order = 4, DataField = "Materials", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTagBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region Meal Menu Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] - { - // Id - new() - { - ListFormCode = listFormMeal.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Meal), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // BranchId - new() - { - ListFormCode = listFormMeal.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "BranchId", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "Name", - ValueExpr = "Key", - LookupQuery = LookupQueryValues.BranchValues, - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Meal), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Date - new() - { - ListFormCode = listFormMeal.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "Date", - Width = 150, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 2, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Meal), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Type - new() - { - ListFormCode = listFormMeal.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Type", - Width = 300, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "breakfast", Name= "Breakfast" }, - new () { Key= "lunch", Name= "Lunch" }, - new () { Key= "dinner", Name="Dinner" } - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Meal), - PivotSettingsJson = DefaultPivotSettingsJson - }, - // Materials - new() - { - ListFormCode = listFormMeal.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Materials", - Width = 300, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - //TODO: Materials kısmında Query olarak getirmeli - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Mercimek Çorbası", Name="Mercimek Çorbası" }, - new () { Key="Tavuk Şinitzel", Name="Tavuk Şinitzel" }, - new () { Key="Bulgur Pilavı", Name="Bulgur Pilavı" }, - new () { Key="Salata", Name="Salata" }, - new () { Key="Meyve", Name="Meyve" }, - new () { Key="Domates Çorbası", Name="Domates Çorbası" }, - new () { Key="Etli Kuru Fasulye", Name="Etli Kuru Fasulye" }, - new () { Key="Pilav", Name="Pilav" }, - new () { Key="Turşu", Name="Turşu" }, - new () { Key="Komposto", Name="Komposto" }, - new () { Key="Tarator", Name="Tarator" }, - new () { Key="Köfte", Name="Köfte" }, - new () { Key="Patates Püresi", Name="Patates Püresi" }, - new () { Key="Yoğurtlu Kabak Salatası", Name="Yoğurtlu Kabak Salatası" }, - new () { Key="Fırında Levrek", Name="Fırında Levrek" }, - new () { Key="Kuskus", Name="Kuskus" }, - new () { Key="Roka Salatası", Name="Roka Salatası" } - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Meal), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Reservations - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Reservation)) - { - var listFormReservation = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Reservation, - Name = AppCodes.Intranet.Reservation, - Title = AppCodes.Intranet.Reservation, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Intranet.Reservation, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Reservation)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Intranet.Reservation), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Reservation))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.Reservation, Width = 500, Height = 600 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto {Order=1,DataField="Type", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox}, - new EditingFormItemDto {Order=2,DataField="ResourceName", IsRequired = true, EditorType2 = EditorTypes.dxTextBox}, - new EditingFormItemDto {Order=3,DataField="EmployeeId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox}, - new EditingFormItemDto {Order=4,DataField="StartDate", IsRequired = true, EditorType2 = EditorTypes.dxDateBox}, - new EditingFormItemDto {Order=5,DataField="EndDate", IsRequired = true, EditorType2 = EditorTypes.dxDateBox}, - new EditingFormItemDto {Order=6,DataField="Purpose", IsRequired = true, EditorType2 = EditorTypes.dxTextBox}, - new EditingFormItemDto {Order=8,DataField="Participants", EditorType2 = EditorTypes.dxNumberBox}, - new EditingFormItemDto {Order=9,DataField="Notes", EditorType2 = EditorTypes.dxTextArea}, - new EditingFormItemDto {Order=7,DataField="Status", IsRequired = true, EditorType2 = EditorTypes.dxTextBox}, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Pending", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Participants", FieldDbType = DbType.Int32, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - } - ); - - #region Reservation Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormReservation.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormReservation.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Type", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "room", Name= "Room" }, - new () { Key= "vehicle", Name= "Vehicle" }, - new () { Key= "equipment", Name="Equipment" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormReservation.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ResourceName", - Width = 300, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormReservation.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "EmployeeId", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmployeeValues, - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormReservation.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, - FieldName = "StartDate", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormReservation.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, - FieldName = "EndDate", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormReservation.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Purpose", - Width = 200, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormReservation.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Participants", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormReservation.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Notes", - Width = 300, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormReservation.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "pending", Name= "Pending" }, - new () { Key= "approved", Name= "Approved" }, - new () { Key= "rejected", Name="Rejected" }, - new () { Key= "completed", Name="Completed" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Reservation), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Shuttle Routes - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ShuttleRoute)) - { - var listFormShuttleRoute = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.ShuttleRoute, - Name = AppCodes.Intranet.ShuttleRoute, - Title = AppCodes.Intranet.ShuttleRoute, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Intranet.ShuttleRoute, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ShuttleRoute)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Intranet.ShuttleRoute), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.ShuttleRoute))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.ShuttleRoute, Width = 500, Height = 600 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items = - [ - new EditingFormItemDto { Order = 1, DataField = "Name", IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Type", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 3, DataField = "DepartureTime", IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions = EditorOptionValues.TimeSpanOptions }, - new EditingFormItemDto { Order = 4, DataField = "ArrivalTime", IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions = EditorOptionValues.TimeSpanOptions }, - new EditingFormItemDto { Order = 5, DataField = "Capacity", EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 6, DataField = "Route", IsRequired = true, EditorType2 = EditorTypes.dxTagBox } - ] - } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "Capacity", FieldDbType = DbType.Int32, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Type", FieldDbType = DbType.String, Value = "morning", CustomValueType = FieldCustomValueTypeEnum.Value } - }) - } - ); - - #region Shuttle Route Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormShuttleRoute.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormShuttleRoute.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormShuttleRoute.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Type", - Width = 100, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "morning", Name= "Morning" }, - new () { Key= "evening", Name= "Evening" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormShuttleRoute.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "DepartureTime", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormShuttleRoute.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ArrivalTime", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormShuttleRoute.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Capacity", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormShuttleRoute.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Available", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormShuttleRoute.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Route", - Width = 300, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "Kadıköy İskele", Name= "Kadıköy İskele" }, - new () { Key= "Bostancı", Name= "Bostancı" }, - new () { Key= "Acıbadem", Name="Acıbadem" }, - new () { Key= "Kozyatağı", Name="Kozyatağı" }, - new () { Key= "Ofis", Name="Ofis" }, - new () { Key= "Üsküdar Meydanı", Name="Üsküdar Meydanı" }, - new () { Key= "Kısıklı", Name="Kısıklı" }, - new () { Key= "Bulgurlu", Name="Bulgurlu" }, - new () { Key= "Ümraniye", Name="Ümraniye" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.ShuttleRoute), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Announncements - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Announcement)) - { - var listFormAnnouncement = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Announcement, - Name = AppCodes.Intranet.Announcement, - Title = AppCodes.Intranet.Announcement, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Intranet.Announcement, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Announcement)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Intranet.Announcement), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Announcement))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.Announcement, Width = 500, Height = 600 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField = "Title", IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Excerpt", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Content", IsRequired = true, EditorType2 = EditorTypes.dxHtmlEditor, EditorOptions = EditorOptionValues.HtmlEditorOptions }, - new EditingFormItemDto { Order = 4, DataField = "ImageUrl", EditorType2 = EditorTypes.dxTagBox }, - new EditingFormItemDto { Order = 5, DataField = "Category", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 6, DataField = "EmployeeId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 7, DataField = "PublishDate", EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 8, DataField = "ExpiryDate", IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 9, DataField = "IsPinned", EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 10, DataField = "Departments", EditorType2 = EditorTypes.dxTagBox }, - new EditingFormItemDto { Order = 11, DataField = "Attachments", EditorType2 = EditorTypes.dxTagBox } - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "IsPinned", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "PublishDate", FieldDbType = DbType.Date, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }) - } - ); - - #region Announcement Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormAnnouncement.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAnnouncement.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Title", - Width = 250, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAnnouncement.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Excerpt", - Width = 300, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAnnouncement.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Content", - Width = 400, - ListOrderNo = 4, - Visible = false, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAnnouncement.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "ImageUrl", - Width = 200, - ListOrderNo = 5, - Visible = false, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAnnouncement.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Category", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "general", Name= "General" }, - new () { Key= "event", Name= "Event" }, - new () { Key= "urgent", Name= "Urgent" }, - new () { Key= "announcement", Name= "Announcement" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAnnouncement.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "EmployeeId", - Width = 100, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmployeeValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAnnouncement.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, - FieldName = "PublishDate", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAnnouncement.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, - FieldName = "ExpiryDate", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAnnouncement.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsPinned", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAnnouncement.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Departments", - Width = 100, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.DepartmentValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormAnnouncement.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Attachments", - Width = 100, - ListOrderNo = 12, - Visible = false, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Announcement), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Visitors - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Visitor)) - { - var listFormVisitor = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Visitor, - Name = AppCodes.Intranet.Visitor, - Title = AppCodes.Intranet.Visitor, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Intranet.Visitor, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Visitor)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Intranet.Visitor), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Visitor))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.Visitor, Width = 500, Height = 450 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField = "FullName", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "CompanyName", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Email", EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "Phone", IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions = EditorOptionValues.PhoneEditorOptions }, - new EditingFormItemDto { Order = 5, DataField = "Purpose", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 6, DataField = "VisitDate", IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 7, DataField = "CheckIn", EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 8, DataField = "CheckOut", EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 9, DataField = "EmployeeId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 10, DataField = "Status", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "VisitDate", FieldDbType = DbType.Date, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CheckIn", FieldDbType = DbType.Date, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "checked-in", CustomValueType = FieldCustomValueTypeEnum.Value }, - }) - } - ); - - #region Visitor Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormVisitor.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVisitor.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "FullName", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVisitor.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "CompanyName", - Width = 300, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVisitor.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Email", - Width = 150, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleEmailJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVisitor.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Phone", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleEmailJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVisitor.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Purpose", - Width = 200, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleEmailJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVisitor.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, - FieldName = "VisitDate", - Width = 150, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVisitor.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, - FieldName = "CheckIn", - Width = 150, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVisitor.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, - FieldName = "CheckOut", - Width = 150, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVisitor.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "EmployeeId", - Width = 100, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmployeeValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormVisitor.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 100, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "checked-in", Name= "Checked-in" }, - new () { Key= "checked-out", Name= "Checked-out" }, - new () { Key= "scheduled", Name= "Scheduled" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.Visitor), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Expense Request - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Expense)) - { - var listFormExpense = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Expense, - Name = AppCodes.Hr.Expense, - Title = AppCodes.Hr.Expense, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.Expense, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Expense)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.Expense), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Expense))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Expense, Width = 500, Height = 450 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField = "EmployeeId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 2, DataField = "Category", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 3, DataField = "Amount", IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 4, DataField = "CurrencyId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 5, DataField = "RequestDate", IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 6, DataField = "Description", EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 7, DataField = "Project", EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 8, DataField = "Status", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 9, DataField = "Notes", EditorType2 = EditorTypes.dxTextArea }, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "RequestDate", FieldDbType = DbType.Date, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Accept", - Text ="Accept", - UrlTarget="_blank", - AuthName = AppCodes.Hr.Expense + ".Update", - Url="/admin/list/list-employees/@Id" - }, - new() { - Hint = "Reject", - Text ="Reject", - UrlTarget="_blank", - AuthName = AppCodes.Hr.Expense + ".Update", - Url="/admin/list/list-employees/@Id" - }, - }), - } - ); - - #region Expense Request Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormExpense.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormExpense.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "EmployeeId", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmployeeValues - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormExpense.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Category", - Width = 100, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "travel", Name= "Travel" }, - new () { Key= "meal", Name= "Meal" }, - new () { Key= "accommodation", Name= "Accommodation" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormExpense.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Decimal, - FieldName = "Amount", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormExpense.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "CurrencyId", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.CurrencyValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormExpense.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "RequestDate", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormExpense.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 250, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormExpense.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Project", - Width = 100, - ListOrderNo = 8, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormExpense.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 100, - ListOrderNo = 9, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "pending", Name= "Pending" }, - new () { Key= "approved", Name= "Approved" }, - new () { Key= "rejected", Name= "Rejected" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormExpense.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Notes", - Width = 200, - ListOrderNo = 10, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormExpense.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "RejectionReason", - Width = 200, - ListOrderNo = 11, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Expense), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Survey - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Survey)) - { - var listFormSurvey = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.Survey, - Name = AppCodes.Hr.Survey, - Title = AppCodes.Hr.Survey, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.Survey, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Survey)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.Survey), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.Survey))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.Survey, Width = 500, Height = 450 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField = "Title", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Description", IsRequired = true, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 3, DataField = "Deadline", IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, - new EditingFormItemDto { Order = 4, DataField = "Status", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 5, DataField = "IsAnonymous", IsRequired = true, EditorType2 = EditorTypes.dxCheckBox }, - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "IsAnonymous", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "Status", FieldDbType = DbType.String, Value = "draft", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Manage", - Text ="Manage", - UrlTarget="_blank", - AuthName = AppCodes.Hr.Survey + ".Update", - Url="/admin/form/form-survey/@Id" - } - }), - } - ); - - #region Survey Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormSurvey.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSurvey.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Title", - Width = 400, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSurvey.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Date, - FieldName = "Deadline", - Width = 100, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSurvey.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Responses", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSurvey.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Status", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "draft", Name= "Draft" }, - new () { Key= "active", Name= "Active" }, - new () { Key= "closed", Name= "Closed" }, - }), - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSurvey.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsAnonymous", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.Survey), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Survey Question - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SurveyQuestion)) - { - var listFormSurveyQuestion = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.SurveyQuestion, - Name = AppCodes.Hr.SurveyQuestion, - Title = AppCodes.Hr.SurveyQuestion, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.SurveyQuestion, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SurveyQuestion)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.SurveyQuestion), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.SurveyQuestion))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.SurveyQuestion, Width = 500, Height = 400 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField = "SurveyId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 2, DataField = "QuestionText", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Type", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 4, DataField = "IsRequired", IsRequired = true, EditorType2 = EditorTypes.dxCheckBox } - ]} - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] - { - new() { FieldName = "IsRequired", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Options", - Text ="Options", - UrlTarget="_blank", - AuthName = AppCodes.Hr.Survey + ".Update", - Url="/admin/list/list-employees/@Id" - }, - }), - } - ); - - #region Survey Question Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormSurveyQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyQuestion), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSurveyQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "SurveyId", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.SurveyValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyQuestion), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSurveyQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "Order", - Width = 100, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyQuestion), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSurveyQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "QuestionText", - Width = 300, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyQuestion), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSurveyQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Type", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key= "rating", Name= "Rating" }, - new () { Key= "multiple-choice", Name= "Multiple Choice" }, - new () { Key= "text", Name= "Text" }, - new () { Key= "textarea", Name= "Textarea" }, - new () { Key= "yes-no", Name= "Yes/No" }, - }), - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyQuestion), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSurveyQuestion.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsRequired", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyQuestion), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Survey Response - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SurveyResponse)) - { - var listFormSurveyResponse = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.SurveyResponse, - Name = AppCodes.Hr.SurveyResponse, - Title = AppCodes.Hr.SurveyResponse, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Hr.SurveyResponse, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SurveyResponse)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Hr.SurveyResponse), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.SurveyResponse))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Hr.SurveyResponse, Width = 500, Height = 400 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items =[ - new EditingFormItemDto { Order = 1, DataField = "SurveyId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 2, DataField = "EmployeeId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 3, DataField = "SubmissionTime", IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 4, DataField = "CreationTime", IsRequired = true, EditorType2 = EditorTypes.dxDateBox } - ]} - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Answers", - Text ="Answers", - UrlTarget="_blank", - AuthName = AppCodes.Hr.SurveyResponse + ".Update", - Url="/admin/list/list-employees/@Id" - }, - }), - } - ); - - #region Survey Response Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormSurveyResponse.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyResponse), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSurveyResponse.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "SurveyId", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.SurveyValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyQuestion), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSurveyResponse.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "EmployeeId", - Width = 100, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmployeeValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyResponse), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSurveyResponse.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, - FieldName = "SubmissionTime", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyResponse), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSurveyResponse.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, - FieldName = "CreationTime", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Hr.SurveyResponse), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - #region Social Post - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SocialPost)) - { - var listFormSocialPost = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = true, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.SocialPost, - Name = AppCodes.Intranet.SocialPost, - Title = AppCodes.Intranet.SocialPost, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.Intranet.SocialPost, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SocialPost)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.Intranet.SocialPost), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.SocialPost))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.Intranet.SocialPost, Width = 500, Height = 400 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - EditingFormJson = JsonSerializer.Serialize(new List() - { - new() { - Order=1, ColCount=1, ColSpan=2, ItemType="group", Items = [ - new EditingFormItemDto { Order = 1, DataField = "EmployeeId", IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 2, DataField = "Content", IsRequired = true, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 3, DataField = "LikeCount", IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order = 4, DataField = "IsLiked", IsRequired = true, EditorType2 = EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 5, DataField = "IsOwnPost", IsRequired = true, EditorType2 = EditorTypes.dxCheckBox } - ]} - }), - CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { - new() { - Hint = "Comments", - Text ="Comments", - UrlTarget="_blank", - AuthName = AppCodes.Hr.SurveyResponse + ".Update", - Url="/admin/list/list-employees/@Id" - }, - }), - } - ); - - #region Social Post Fields - await _listFormFieldRepository.InsertManyAsync([ - new() { - ListFormCode = listFormSocialPost.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - SortIndex = 0, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.SocialPost), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSocialPost.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "EmployeeId", - Width = 100, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.EmployeeValues - }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.SocialPost), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSocialPost.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Content", - Width = 800, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.SocialPost), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSocialPost.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Int32, - FieldName = "LikeCount", - Width = 100, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.SocialPost), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSocialPost.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsLiked", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.SocialPost), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormSocialPost.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsOwnPost", - Width = 100, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.Intranet.SocialPost), - PivotSettingsJson = DefaultPivotSettingsJson - }, - ]); - #endregion - } - #endregion - - // Supply Chain - #region Material Type - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MaterialType)) - { - var listFormMaterialType = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.MaterialType, - Name = AppCodes.SupplyChain.MaterialType, - Title = AppCodes.SupplyChain.MaterialType, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.SupplyChain.MaterialType, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialType)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.SupplyChain.MaterialType), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialType))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.SupplyChain.MaterialType, Width = 500, Height = 250 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = false, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 4, DataField = "IsActive", ColSpan = 2, EditorType2=EditorTypes.dxCheckBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region MaterialType Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormMaterialType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormMaterialType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 150, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormMaterialType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 350, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormMaterialType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 500, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), - PivotSettingsJson = DefaultPivotSettingsJson - }, - - new() { - ListFormCode = listFormMaterialType.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType), - PivotSettingsJson = DefaultPivotSettingsJson - } - }); - #endregion - } - #endregion - - #region Material Group - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MaterialGroup)) - { - var listFormMaterialGroup = await _listFormRepository.InsertAsync( - new ListForm() - { - ListFormType = ListFormTypeEnum.List, - IsSubForm = false, - LayoutJson = DefaultLayoutJson, - CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.MaterialGroup, - Name = AppCodes.SupplyChain.MaterialGroup, - Title = AppCodes.SupplyChain.MaterialGroup, - DataSourceCode = SeedConsts.DataSources.DefaultCode, - IsTenant = true, - IsBranch = false, - IsOrganizationUnit = false, - Description = AppCodes.SupplyChain.MaterialGroup, - SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullViewName(nameof(TableNameEnum.MaterialGroup)), - KeyFieldName = "Id", - KeyFieldDbSourceType = DbType.Guid, - DefaultFilter = DefaultFilterJson, - SortMode = GridOptions.SortModeSingle, - FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), - HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), - SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), - GroupPanelJson = JsonSerializer.Serialize(new { Visible = true }), - SelectionJson = DefaultSelectionSingleJson, - ColumnOptionJson = DefaultColumnOptionJson, - PermissionJson = DefaultPermissionJson(AppCodes.SupplyChain.MaterialGroup), - DeleteCommand = $"UPDATE \"{TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialGroup))}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", - DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "DeleterId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@ID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } - }), - PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto - { - Popup = new GridEditingPopupDto() { Title = AppCodes.SupplyChain.MaterialGroup, Width = 500, Height = 350 }, - AllowDeleting = true, - AllowAdding = true, - AllowUpdating = true, - SendOnlyChangedFormValuesUpdate = true, - }), - EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=[ - new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 4, DataField = "IsActive", ColSpan = 2, EditorType2=EditorTypes.dxCheckBox }, - new EditingFormItemDto { Order = 5, DataField = "ParentGroupId", ColSpan = 2, EditorType2=EditorTypes.dxSelectBox }, - ]} - }), - InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, - new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } - }), - } - ); - - #region MaterialGroup Fields - await _listFormFieldRepository.InsertManyAsync(new ListFormField[] { - new() { - ListFormCode = listFormMaterialGroup.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "Id", - Width = 100, - ListOrderNo = 1, - Visible = false, - IsActive = true, - IsDeleted = false, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialGroup), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormMaterialGroup.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 200, - ListOrderNo = 2, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialGroup), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormMaterialGroup.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Name", - Width = 250, - ListOrderNo = 3, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialGroup), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormMaterialGroup.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 300, - ListOrderNo = 4, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialGroup), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormMaterialGroup.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - Width = 100, - ListOrderNo = 5, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialGroup), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormMaterialGroup.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.Guid, - FieldName = "ParentGroupId", - Width = 400, - ListOrderNo = 6, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - LookupJson = JsonSerializer.Serialize(new LookupDto - { - DataSourceType = UiLookupDataSourceTypeEnum.Query, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = LookupQueryValues.MaterialGroupValues, - }), - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialGroup), - PivotSettingsJson = DefaultPivotSettingsJson - }, - new() { - ListFormCode = listFormMaterialGroup.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "HierarchyPath", - Width = 500, - ListOrderNo = 7, - Visible = true, - IsActive = true, - IsDeleted = false, - AllowSearch = true, - SortIndex = 1, - SortDirection = GridColumnOptions.SortOrderAsc, - ColumnCustomizationJson = DefaultColumnCustomizationJson, - PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto - { - C = AppCodes.SupplyChain.MaterialGroup + ".Create", - R = AppCodes.SupplyChain.MaterialGroup, - U = AppCodes.SupplyChain.MaterialGroup + ".Update", - E = true, - I = false, - Deny = false - }), - PivotSettingsJson = DefaultPivotSettingsJson, - } - }); - #endregion - } - #endregion - } -} \ No newline at end of file diff --git a/api/src/Kurs.Platform.DbMigrator/appsettings.Dev.json b/api/src/Kurs.Platform.DbMigrator/appsettings.Dev.json index 18e2742c..59cf69df 100644 --- a/api/src/Kurs.Platform.DbMigrator/appsettings.Dev.json +++ b/api/src/Kurs.Platform.DbMigrator/appsettings.Dev.json @@ -1,7 +1,7 @@ { "ConnectionStrings": { - "SqlServer": "Server=sql;Database=KURS;User Id=sa;password=NvQp8s@l;Trusted_Connection=False;TrustServerCertificate=True;", - "PostgreSql": "User ID=sa;Password=NvQp8s@l;Host=postgres;Port=5432;Database=KURS;" + "SqlServer": "Server=sql;Database=Erp;User Id=sa;password=NvQp8s@l;Trusted_Connection=False;Encrypt=False;TrustServerCertificate=True;Connection Timeout=60;", + "PostgreSql": "User ID=sa;Password=NvQp8s@l;Host=postgres;Port=5432;Database=Erp;" }, "Redis": { "IsEnabled": "true", diff --git a/api/src/Kurs.Platform.DbMigrator/appsettings.Production.json b/api/src/Kurs.Platform.DbMigrator/appsettings.Production.json index 339c3f57..2505fc40 100644 --- a/api/src/Kurs.Platform.DbMigrator/appsettings.Production.json +++ b/api/src/Kurs.Platform.DbMigrator/appsettings.Production.json @@ -1,7 +1,7 @@ { "ConnectionStrings": { - "SqlServer": "Server=sql;Database=KURS;User Id=sa;password=NvQp8s@l;Trusted_Connection=False;TrustServerCertificate=True;", - "PostgreSql": "User ID=sa;Password=NvQp8s@l;Host=postgres;Port=5432;Database=KURS;" + "SqlServer": "Server=sql;Database=Erp;User Id=sa;password=NvQp8s@l;Trusted_Connection=False;Encrypt=False;TrustServerCertificate=True;Connection Timeout=60;", + "PostgreSql": "User ID=sa;Password=NvQp8s@l;Host=postgres;Port=5432;Database=Erp;" }, "Redis": { "IsEnabled": "true", diff --git a/api/src/Kurs.Platform.DbMigrator/appsettings.json b/api/src/Kurs.Platform.DbMigrator/appsettings.json index 5b7b8d7a..9aff8e97 100644 --- a/api/src/Kurs.Platform.DbMigrator/appsettings.json +++ b/api/src/Kurs.Platform.DbMigrator/appsettings.json @@ -1,8 +1,8 @@ { "Seed": false, "ConnectionStrings": { - "SqlServer": "Server=localhost;Database=KURS;User Id=sa;password=NvQp8s@l;Trusted_Connection=False;TrustServerCertificate=True;", - "PostgreSql": "User ID=sa;Password=NvQp8s@l;Host=localhost;Port=5432;Database=KURS;" + "SqlServer": "Server=localhost;Database=Erp;User Id=sa;password=NvQp8s@l;Trusted_Connection=False;Encrypt=False;TrustServerCertificate=True;Connection Timeout=60;", + "PostgreSql": "User ID=sa;Password=NvQp8s@l;Host=localhost;Port=5432;Database=Erp;" }, "Redis": { "IsEnabled": "true", diff --git a/api/src/Kurs.Platform.Domain.Shared/Enums/LookUpQueryValues.cs b/api/src/Kurs.Platform.Domain.Shared/Enums/LookUpQueryValues.cs index ad186412..68379a50 100644 --- a/api/src/Kurs.Platform.Domain.Shared/Enums/LookUpQueryValues.cs +++ b/api/src/Kurs.Platform.Domain.Shared/Enums/LookUpQueryValues.cs @@ -5,6 +5,8 @@ namespace Kurs.Platform; public static class LookupQueryValues { + private const string defaultDomain = "Erp"; + public static string LanguageKeyValues = $"SELECT " + $"\"{FullNameTable(TableNameEnum.LanguageKey)}\".\"Key\", " + @@ -129,7 +131,7 @@ public static class LookupQueryValues public static string BranchValues = $"SELECT \"Id\" AS \"Key\", " + $"\"Name\" AS \"Name\" " + - $"FROM \"KURS\".\"dbo\".\"{FullNameTable(TableNameEnum.Branch)}\" " + + $"FROM \"{defaultDomain}\".\"dbo\".\"{FullNameTable(TableNameEnum.Branch)}\" " + $"WHERE " + $"\"TenantId\" = '@TENANTID' " + // 🔹 Bu form doğru — Replace hedefi bu. $"AND \"IsDeleted\" = 'false' " + diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251101111255_Initial.Designer.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251103110012_Initial.Designer.cs similarity index 99% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251101111255_Initial.Designer.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251103110012_Initial.Designer.cs index fb77c330..96df44ad 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251101111255_Initial.Designer.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251103110012_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Kurs.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251101111255_Initial")] + [Migration("20251103110012_Initial")] partial class Initial { /// diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251101111255_Initial.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251103110012_Initial.cs similarity index 100% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251101111255_Initial.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251103110012_Initial.cs diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json index ea30cad9..bfead27e 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json @@ -571,8 +571,8 @@ { "Title": "blog.posts.database.title", "Slug": "veritabani-yonetim-sistemleri-karsilastirmasi", - "ContentTr": "

Veritabanları, günümüzün dijital dünyasında veri temelli karar alma süreçlerinin, web ve mobil uygulamaların, iş zekası çözümlerinin ve büyük veri altyapılarının temel yapı taşlarından biridir. Özellikle veri hacminin, veri çeşitliliğinin ve veri erişim gereksinimlerinin sürekli arttığı günümüzde, uygun bir veritabanı yönetim sistemi (VTYS) seçimi yapmak, teknik olduğu kadar stratejik de bir karardır. Geliştiriciler, yazılım mimarları ve karar vericiler için bu yazı, ilişkisel (RDBMS) ve NoSQL veritabanlarının temel yapılarını, avantajlarını, zorluklarını ve hangi senaryolarda hangisinin tercih edilmesi gerektiğini detaylı bir biçimde ortaya koyacaktır.

📌 Veritabanlarının Rolü ve Önemi

Bir yazılım projesinde veritabanı, genellikle en az görünür ama en kritik bileşenlerden biridir. Kullanıcı verilerinin saklanması, ürün bilgilerinin yönetimi, işlem geçmişlerinin kaydı, raporlama sistemlerinin desteklenmesi ve daha fazlası veritabanı altyapısına dayanır.

Kötü yapılandırılmış veya yanlış seçilmiş bir veritabanı:

  • Performans darboğazlarına,
  • Veri tutarsızlıklarına,
  • Güvenlik açıklarına,
  • Ölçekleme zorluklarına ve
  • Geliştirme süreçlerinde verimsizliklere yol açabilir.

Bu nedenle, VTYS seçimi sadece teknik özellikler değil, aynı zamanda projenin iş hedefleri, veri yapısı, ölçeklenebilirlik gereksinimleri ve bütçesi dikkate alınarak yapılmalıdır.

🧱 İlişkisel Veritabanları (RDBMS): Yapı ve Özellikler

İlişkisel veritabanları, verileri satır ve sütunlardan oluşan tablolar şeklinde organize eder. Bu yapı, ilişkisel model olarak adlandırılır ve veri bütünlüğü, normalizasyon, anahtar-kısıt ilişkileri gibi katı yapısal kurallarıyla tanınır. Temel özellikleri şunlardır:

  • SQL Desteği: Verilere erişim için yapılandırılmış sorgu dili olan SQL kullanılır. Bu da karmaşık veri analizleri ve JOIN işlemleri gibi yetenekleri mümkün kılar.
  • ACID Uyumluluğu: Veritabanı işlemlerinin atomiklik, tutarlılık, izolasyon ve kalıcılık (ACID) ilkelerine göre gerçekleşmesi, güvenli ve hatasız işlemler sağlar.
  • Veri Tutarlılığı: Veriler arasındaki ilişkiler net olarak tanımlanır ve veri bütünlüğü sıkı bir şekilde korunur.

🎯 Öne Çıkan RDBMS Çözümleri:

  • MySQL: Açık kaynak, yaygın kullanım, kolay öğrenilebilirlik.
  • PostgreSQL: Gelişmiş özellikler, geniş veri tipi desteği, açık kaynak.
  • Oracle DB: Kurumsal çözümler için güçlü, kapsamlı yönetim araçları.
  • Microsoft SQL Server: .NET ekosistemiyle uyumlu, güçlü GUI araçlarıyla birlikte gelir.

🚫 Zorluklar:

  • Ölçeklendirme genellikle dikeydir (daha güçlü donanım), yatay ölçeklenebilirlik zordur.
  • Esnek veri yapıları ile çalışmak zor olabilir.
  • Yüksek hacimli, gerçek zamanlı veri işleme senaryolarında performans sınırlamaları görülebilir.

🔀 NoSQL Veritabanları: Esneklik ve Performans Odaklı Yaklaşım

“NoSQL” kavramı, “Not Only SQL” ifadesinin kısaltmasıdır. Geleneksel tablo yapısının ötesine geçerek daha esnek veri modelleri sunar. NoSQL veritabanları, özellikle yüksek hız, esneklik ve büyük veri senaryoları için tercih edilir.

🧩 NoSQL Kategorileri:

  1. Belge Tabanlı (Document): JSON ya da BSON belgeleriyle çalışır (örneğin MongoDB).
  2. Anahtar-Değer (Key-Value): Hızlı erişim için idealdir (örneğin Redis).
  3. Geniş Sütunlu (Wide-Column): Çok büyük veri kümeleri için optimize edilmiştir (örneğin Cassandra).
  4. Graf Veritabanları: Karmaşık ilişkileri grafik yapılarla modellenir (örneğin Neo4j).

🚀 Avantajları:

  • Yatay Ölçeklenebilirlik: Veri, birden çok sunucuya kolayca dağıtılabilir.
  • Şemadan Bağımsızlık: Veri yapısı dinamik olarak değiştirilebilir.
  • Yüksek Performans: Okuma ve yazma işlemlerinde düşük gecikme süresi sağlar.
  • Büyük Veri ve Gerçek Zamanlı Analiz İçin Uygun: IoT, log işleme ve sosyal medya uygulamaları gibi senaryolarda etkilidir.

🔎 Zorluklar:

  • Veri tutarlılığı, genellikle eventual consistency (sonunda tutarlılık) modeline dayanır.
  • Karmaşık ilişkisel sorgular zordur ya da mümkün değildir.
  • ACID yerine BASE (Basically Available, Soft state, Eventually consistent) modeline dayanır.

🔄 RDBMS vs NoSQL: Hangi Durumda Hangisi Tercih Edilmeli?

KriterRDBMSNoSQLVeri YapısıYapısal, ilişkiselYapısal olmayan, esnekÖlçeklenebilirlikDikeyYataySorgu KarmaşıklığıÇok güçlü (JOIN, subquery vs.)Kısıtlı (ya da yok)Veri TutarlılığıYüksek (ACID)Esnek (BASE)Performans (gerçek zamanlı)OrtaYüksekŞema DeğişikliğiZorKolayTipik Kullanım AlanıFinans, ERP, CRMIoT, sosyal medya, analitik


🧪 Gerçek Hayattan Senaryolar ve Öneriler

  • Bir e-ticaret platformu geliştiriyorsanız ve stok yönetimi, sipariş takibi gibi kritik işlemler söz konusuysa, ilişkisel veritabanı (örneğin PostgreSQL) tercih edilmelidir.
  • Gerçek zamanlı bildirimler, chat uygulamaları veya cache mekanizmaları için Redis gibi key-value tabanlı NoSQL çözümleri ideal olacaktır.
  • Blog, içerik yönetim sistemleri (CMS) gibi şeması zamanla değişebilecek uygulamalarda MongoDB öne çıkar.
  • Büyük veri işleme ve zaman serisi verileri için Cassandra veya Amazon DynamoDB kullanılabilir.

🎯 Sonuç: Stratejik Bir Tercih Olarak Veritabanı Seçimi

Doğru veritabanı mimarisi, yalnızca bugünkü ihtiyaçlara değil, gelecekteki büyüme hedeflerine de hizmet etmelidir. İlişkisel ve NoSQL veritabanları birbirinin alternatifi değil, çoğu zaman birbirini tamamlayıcı çözümler olabilir. Mikroservis mimarilerinde her servis kendi ihtiyacına uygun VTYS kullanabilir. Önemli olan, projenin doğasına, verinin yapısına ve iş gereksinimlerine uygun bir karar vermektir.

Unutmayın: Veri stratejiniz, büyüme stratejinizin temelidir.

", - "ContentEn": "

Databases are one of the foundational components of today’s digital world, supporting data-driven decision-making, web and mobile applications, business intelligence solutions, and big data infrastructures. In an era where data volume, variety, and access requirements are constantly increasing, choosing the right database management system (DBMS) is as much a strategic decision as it is a technical one. For developers, software architects, and decision-makers, this article will outline in detail the fundamentals, advantages, challenges, and ideal usage scenarios of both relational (RDBMS) and NoSQL databases.

📌 The Role and Importance of Databases

In any software project, the database is often one of the least visible yet most critical components. User data storage, product information management, transaction history, reporting systems, and more all rely on database infrastructure.

A poorly configured or inappropriately chosen database can lead to:

  • Performance bottlenecks,
  • Data inconsistencies,
  • Security vulnerabilities,
  • Scalability challenges, and
  • Inefficiencies in development processes.

Therefore, DBMS selection should consider not only technical specifications but also the project’s business goals, data structure, scalability needs, and budget.

🧱 Relational Databases (RDBMS): Structure and Features

Relational databases organize data in tables composed of rows and columns, following the relational model. They are known for strict structural rules including data integrity, normalization, and key-constraint relationships.

  • SQL Support: Structured Query Language (SQL) is used for accessing data, allowing complex queries and JOIN operations.
  • ACID Compliance: Transactions adhere to atomicity, consistency, isolation, and durability principles, ensuring reliable operations.
  • Data Consistency: Clearly defined relationships maintain strict data integrity.

🎯 Leading RDBMS Solutions:

  • MySQL: Open-source, widely used, easy to learn.
  • PostgreSQL: Advanced features, broad data type support, open-source.
  • Oracle DB: Enterprise-grade, rich in administration tools.
  • Microsoft SQL Server: Well integrated with the .NET ecosystem, powerful GUI tools.

🚫 Challenges:

  • Scaling is typically vertical (more powerful hardware); horizontal scaling is complex.
  • Less flexible with unstructured data.
  • Performance limitations in high-volume, real-time processing scenarios.

🔀 NoSQL Databases: Flexibility and Performance-Driven Approach

NoSQL stands for “Not Only SQL” and goes beyond traditional table structures, offering flexible data models. NoSQL is preferred in scenarios requiring high speed, flexibility, and big data handling.

🧩 NoSQL Categories:

  1. Document-Based: Uses JSON/BSON documents (e.g., MongoDB).
  2. Key-Value: Ideal for fast access (e.g., Redis).
  3. Wide-Column: Optimized for massive data sets (e.g., Cassandra).
  4. Graph Databases: Model complex relationships using graph structures (e.g., Neo4j).

🚀 Advantages:

  • Horizontal Scalability: Data can be easily distributed across multiple servers.
  • Schema Independence: Data structure can evolve dynamically.
  • High Performance: Low latency in read/write operations.
  • Big Data and Real-Time Analytics Friendly: Effective in IoT, log processing, and social media use cases.

🔎 Challenges:

  • Data consistency often follows eventual consistency rather than strict models.
  • Complex relational queries are difficult or unsupported.
  • Based on the BASE (Basically Available, Soft state, Eventually consistent) model instead of ACID.

🔄 RDBMS vs NoSQL: When to Choose What?

CriteriaRDBMSNoSQLData StructureStructured, relationalUnstructured, flexibleScalabilityVerticalHorizontalQuery ComplexityStrong (JOINs, subqueries)Limited or noneData ConsistencyHigh (ACID)Flexible (BASE)Real-Time PerformanceMediumHighSchema FlexibilityHardEasyTypical Use CaseFinance, ERP, CRMIoT, social media, analytics

🧪 Real-World Scenarios and Recommendations

  • For an e-commerce platform managing stock and order tracking, a relational database like PostgreSQL is ideal.
  • For real-time notifications, chat applications, or caching mechanisms, Redis (key-value NoSQL) is highly effective.
  • For blog or content management systems (CMS) with evolving schemas, MongoDB stands out.
  • For big data processing and time series data, consider Cassandra or Amazon DynamoDB.

🎯 Conclusion: Database Selection as a Strategic Choice

The right database architecture should serve not only current needs but also future growth plans. Relational and NoSQL databases are not mutually exclusive; they can complement each other. In microservice architectures, each service can use the DBMS that best fits its purpose. What matters is making a choice aligned with the project’s nature, data structure, and business requirements.

Remember: Your data strategy is the foundation of your growth strategy.

", + "ContentTr": "

Veritabanları, günümüzün dijital dünyasında veri temelli karar alma süreçlerinin, web ve mobil uygulamaların, iş zekası çözümlerinin ve büyük veri altyapılarının temel yapı taşlarından biridir. Özellikle veri hacminin, veri çeşitliliğinin ve veri erişim gereksinimlerinin sürekli arttığı günümüzde, uygun bir veritabanı yönetim sistemi (VTYS) seçimi yapmak, teknik olduğu kadar stratejik de bir karardır. Geliştiriciler, yazılım mimarları ve karar vericiler için bu yazı, ilişkisel (RDBMS) ve NoSQL veritabanlarının temel yapılarını, avantajlarını, zorluklarını ve hangi senaryolarda hangisinin tercih edilmesi gerektiğini detaylı bir biçimde ortaya koyacaktır.

📌 Veritabanlarının Rolü ve Önemi

Bir yazılım projesinde veritabanı, genellikle en az görünür ama en kritik bileşenlerden biridir. Kullanıcı verilerinin saklanması, ürün bilgilerinin yönetimi, işlem geçmişlerinin kaydı, raporlama sistemlerinin desteklenmesi ve daha fazlası veritabanı altyapısına dayanır.

Kötü yapılandırılmış veya yanlış seçilmiş bir veritabanı:

  • Performans darboğazlarına,
  • Veri tutarsızlıklarına,
  • Güvenlik açıklarına,
  • Ölçekleme zorluklarına ve
  • Geliştirme süreçlerinde verimsizliklere yol açabilir.

Bu nedenle, VTYS seçimi sadece teknik özellikler değil, aynı zamanda projenin iş hedefleri, veri yapısı, ölçeklenebilirlik gereksinimleri ve bütçesi dikkate alınarak yapılmalıdır.

🧱 İlişkisel Veritabanları (RDBMS): Yapı ve Özellikler

İlişkisel veritabanları, verileri satır ve sütunlardan oluşan tablolar şeklinde organize eder. Bu yapı, ilişkisel model olarak adlandırılır ve veri bütünlüğü, normalizasyon, anahtar-kısıt ilişkileri gibi katı yapısal kurallarıyla tanınır. Temel özellikleri şunlardır:

  • SQL Desteği: Verilere erişim için yapılandırılmış sorgu dili olan SQL kullanılır. Bu da karmaşık veri analizleri ve JOIN işlemleri gibi yetenekleri mümkün kılar.
  • ACID Uyumluluğu: Veritabanı işlemlerinin atomiklik, tutarlılık, izolasyon ve kalıcılık (ACID) ilkelerine göre gerçekleşmesi, güvenli ve hatasız işlemler sağlar.
  • Veri Tutarlılığı: Veriler arasındaki ilişkiler net olarak tanımlanır ve veri bütünlüğü sıkı bir şekilde korunur.

🎯 Öne Çıkan RDBMS Çözümleri:

  • MySQL: Açık kaynak, yaygın kullanım, kolay öğrenilebilirlik.
  • PostgreSQL: Gelişmiş özellikler, geniş veri tipi desteği, açık kaynak.
  • Oracle DB: Kurumsal çözümler için güçlü, kapsamlı yönetim araçları.
  • Microsoft SQL Server: .NET ekosistemiyle uyumlu, güçlü GUI araçlarıyla birlikte gelir.

🚫 Zorluklar:

  • Ölçeklendirme genellikle dikeydir (daha güçlü donanım), yatay ölçeklenebilirlik zordur.
  • Esnek veri yapıları ile çalışmak zor olabilir.
  • Yüksek hacimli, gerçek zamanlı veri işleme senaryolarında performans sınırlamaları görülebilir.

🔀 NoSQL Veritabanları: Esneklik ve Performans Odaklı Yaklaşım

“NoSQL” kavramı, “Not Only SQL” ifadesinin kısaltmasıdır. Geleneksel tablo yapısının ötesine geçerek daha esnek veri modelleri sunar. NoSQL veritabanları, özellikle yüksek hız, esneklik ve büyük veri senaryoları için tercih edilir.

🧩 NoSQL Kategorileri:

  1. Belge Tabanlı (Document): JSON ya da BSON belgeleriyle çalışır (örneğin MongoDB).
  2. Anahtar-Değer (Key-Value): Hızlı erişim için idealdir (örneğin Redis).
  3. Geniş Sütunlu (Wide-Column): Çok büyük veri kümeleri için optimize edilmiştir (örneğin Cassandra).
  4. Graf Veritabanları: Karmaşık ilişkileri grafik yapılarla modellenir (örneğin Neo4j).

🚀 Avantajları:

  • Yatay Ölçeklenebilirlik: Veri, birden çok sunucuya kolayca dağıtılabilir.
  • Şemadan Bağımsızlık: Veri yapısı dinamik olarak değiştirilebilir.
  • Yüksek Performans: Okuma ve yazma işlemlerinde düşük gecikme süresi sağlar.
  • Büyük Veri ve Gerçek Zamanlı Analiz İçin Uygun: IoT, log işleme ve sosyal medya uygulamaları gibi senaryolarda etkilidir.

🔎 Zorluklar:

  • Veri tutarlılığı, genellikle eventual consistency (sonunda tutarlılık) modeline dayanır.
  • Karmaşık ilişkisel sorgular zordur ya da mümkün değildir.
  • ACID yerine BASE (Basically Available, Soft state, Eventually consistent) modeline dayanır.

🔄 RDBMS vs NoSQL: Hangi Durumda Hangisi Tercih Edilmeli?

KriterRDBMSNoSQLVeri YapısıYapısal, ilişkiselYapısal olmayan, esnekÖlçeklenebilirlikDikeyYataySorgu KarmaşıklığıÇok güçlü (JOIN, subquery vs.)Kısıtlı (ya da yok)Veri TutarlılığıYüksek (ACID)Esnek (BASE)Performans (gerçek zamanlı)OrtaYüksekŞema DeğişikliğiZorKolayTipik Kullanım AlanıFinans, Erp, CRMIoT, sosyal medya, analitik


🧪 Gerçek Hayattan Senaryolar ve Öneriler

  • Bir e-ticaret platformu geliştiriyorsanız ve stok yönetimi, sipariş takibi gibi kritik işlemler söz konusuysa, ilişkisel veritabanı (örneğin PostgreSQL) tercih edilmelidir.
  • Gerçek zamanlı bildirimler, chat uygulamaları veya cache mekanizmaları için Redis gibi key-value tabanlı NoSQL çözümleri ideal olacaktır.
  • Blog, içerik yönetim sistemleri (CMS) gibi şeması zamanla değişebilecek uygulamalarda MongoDB öne çıkar.
  • Büyük veri işleme ve zaman serisi verileri için Cassandra veya Amazon DynamoDB kullanılabilir.

🎯 Sonuç: Stratejik Bir Tercih Olarak Veritabanı Seçimi

Doğru veritabanı mimarisi, yalnızca bugünkü ihtiyaçlara değil, gelecekteki büyüme hedeflerine de hizmet etmelidir. İlişkisel ve NoSQL veritabanları birbirinin alternatifi değil, çoğu zaman birbirini tamamlayıcı çözümler olabilir. Mikroservis mimarilerinde her servis kendi ihtiyacına uygun VTYS kullanabilir. Önemli olan, projenin doğasına, verinin yapısına ve iş gereksinimlerine uygun bir karar vermektir.

Unutmayın: Veri stratejiniz, büyüme stratejinizin temelidir.

", + "ContentEn": "

Databases are one of the foundational components of today’s digital world, supporting data-driven decision-making, web and mobile applications, business intelligence solutions, and big data infrastructures. In an era where data volume, variety, and access requirements are constantly increasing, choosing the right database management system (DBMS) is as much a strategic decision as it is a technical one. For developers, software architects, and decision-makers, this article will outline in detail the fundamentals, advantages, challenges, and ideal usage scenarios of both relational (RDBMS) and NoSQL databases.

📌 The Role and Importance of Databases

In any software project, the database is often one of the least visible yet most critical components. User data storage, product information management, transaction history, reporting systems, and more all rely on database infrastructure.

A poorly configured or inappropriately chosen database can lead to:

  • Performance bottlenecks,
  • Data inconsistencies,
  • Security vulnerabilities,
  • Scalability challenges, and
  • Inefficiencies in development processes.

Therefore, DBMS selection should consider not only technical specifications but also the project’s business goals, data structure, scalability needs, and budget.

🧱 Relational Databases (RDBMS): Structure and Features

Relational databases organize data in tables composed of rows and columns, following the relational model. They are known for strict structural rules including data integrity, normalization, and key-constraint relationships.

  • SQL Support: Structured Query Language (SQL) is used for accessing data, allowing complex queries and JOIN operations.
  • ACID Compliance: Transactions adhere to atomicity, consistency, isolation, and durability principles, ensuring reliable operations.
  • Data Consistency: Clearly defined relationships maintain strict data integrity.

🎯 Leading RDBMS Solutions:

  • MySQL: Open-source, widely used, easy to learn.
  • PostgreSQL: Advanced features, broad data type support, open-source.
  • Oracle DB: Enterprise-grade, rich in administration tools.
  • Microsoft SQL Server: Well integrated with the .NET ecosystem, powerful GUI tools.

🚫 Challenges:

  • Scaling is typically vertical (more powerful hardware); horizontal scaling is complex.
  • Less flexible with unstructured data.
  • Performance limitations in high-volume, real-time processing scenarios.

🔀 NoSQL Databases: Flexibility and Performance-Driven Approach

NoSQL stands for “Not Only SQL” and goes beyond traditional table structures, offering flexible data models. NoSQL is preferred in scenarios requiring high speed, flexibility, and big data handling.

🧩 NoSQL Categories:

  1. Document-Based: Uses JSON/BSON documents (e.g., MongoDB).
  2. Key-Value: Ideal for fast access (e.g., Redis).
  3. Wide-Column: Optimized for massive data sets (e.g., Cassandra).
  4. Graph Databases: Model complex relationships using graph structures (e.g., Neo4j).

🚀 Advantages:

  • Horizontal Scalability: Data can be easily distributed across multiple servers.
  • Schema Independence: Data structure can evolve dynamically.
  • High Performance: Low latency in read/write operations.
  • Big Data and Real-Time Analytics Friendly: Effective in IoT, log processing, and social media use cases.

🔎 Challenges:

  • Data consistency often follows eventual consistency rather than strict models.
  • Complex relational queries are difficult or unsupported.
  • Based on the BASE (Basically Available, Soft state, Eventually consistent) model instead of ACID.

🔄 RDBMS vs NoSQL: When to Choose What?

CriteriaRDBMSNoSQLData StructureStructured, relationalUnstructured, flexibleScalabilityVerticalHorizontalQuery ComplexityStrong (JOINs, subqueries)Limited or noneData ConsistencyHigh (ACID)Flexible (BASE)Real-Time PerformanceMediumHighSchema FlexibilityHardEasyTypical Use CaseFinance, Erp, CRMIoT, social media, analytics

🧪 Real-World Scenarios and Recommendations

  • For an e-commerce platform managing stock and order tracking, a relational database like PostgreSQL is ideal.
  • For real-time notifications, chat applications, or caching mechanisms, Redis (key-value NoSQL) is highly effective.
  • For blog or content management systems (CMS) with evolving schemas, MongoDB stands out.
  • For big data processing and time series data, consider Cassandra or Amazon DynamoDB.

🎯 Conclusion: Database Selection as a Strategic Choice

The right database architecture should serve not only current needs but also future growth plans. Relational and NoSQL databases are not mutually exclusive; they can complement each other. In microservice architectures, each service can use the DBMS that best fits its purpose. What matters is making a choice aligned with the project’s nature, data structure, and business requirements.

Remember: Your data strategy is the foundation of your growth strategy.

", "Summary": "blog.posts.database.excerpt", "ReadTime": "8 dk", "CoverImage": "https://images.pexels.com/photos/325229/pexels-photo-325229.jpeg?auto=compress&cs=tinysrgb&w=1920", diff --git a/api/src/Kurs.Platform.HttpApi.Host/appsettings.Dev.json b/api/src/Kurs.Platform.HttpApi.Host/appsettings.Dev.json index f8f25afc..9946e123 100644 --- a/api/src/Kurs.Platform.HttpApi.Host/appsettings.Dev.json +++ b/api/src/Kurs.Platform.HttpApi.Host/appsettings.Dev.json @@ -9,8 +9,8 @@ "BaseDomain": "sozsoft.com" }, "ConnectionStrings": { - "SqlServer": "Server=sql;Database=KURS;User Id=sa;password=NvQp8s@l;Trusted_Connection=False;TrustServerCertificate=True;", - "PostgreSql": "User ID=sa;Password=NvQp8s@l;Host=postgres;Port=5432;Database=KURS;" + "SqlServer": "Server=sql;Database=Erp;User Id=sa;password=NvQp8s@l;Trusted_Connection=False;Encrypt=False;TrustServerCertificate=True;Connection Timeout=60;", + "PostgreSql": "User ID=sa;Password=NvQp8s@l;Host=postgres;Port=5432;Database=Erp;" }, "Redis": { "IsEnabled": "true", diff --git a/api/src/Kurs.Platform.HttpApi.Host/appsettings.Production.json b/api/src/Kurs.Platform.HttpApi.Host/appsettings.Production.json index 08c2d075..37e7649e 100644 --- a/api/src/Kurs.Platform.HttpApi.Host/appsettings.Production.json +++ b/api/src/Kurs.Platform.HttpApi.Host/appsettings.Production.json @@ -9,8 +9,8 @@ "BaseDomain": "sozsoft.com" }, "ConnectionStrings": { - "SqlServer": "Server=sql;Database=KURS;User Id=sa;password=NvQp8s@l;Trusted_Connection=False;TrustServerCertificate=True;", - "PostgreSql": "User ID=sa;Password=NvQp8s@l;Host=postgres;Port=5432;Database=KURS;" + "SqlServer": "Server=sql;Database=Erp;User Id=sa;password=NvQp8s@l;Trusted_Connection=False;Encrypt=False;TrustServerCertificate=True;Connection Timeout=60;", + "PostgreSql": "User ID=sa;Password=NvQp8s@l;Host=postgres;Port=5432;Database=Erp;" }, "Redis": { "IsEnabled": "true", diff --git a/api/src/Kurs.Platform.HttpApi.Host/appsettings.json b/api/src/Kurs.Platform.HttpApi.Host/appsettings.json index 67b82f3d..0aa2fb50 100644 --- a/api/src/Kurs.Platform.HttpApi.Host/appsettings.json +++ b/api/src/Kurs.Platform.HttpApi.Host/appsettings.json @@ -9,8 +9,8 @@ "Version": "1.0.1" }, "ConnectionStrings": { - "SqlServer": "Server=localhost;Database=KURS;User Id=sa;password=NvQp8s@l;Trusted_Connection=False;TrustServerCertificate=True;", - "PostgreSql": "User ID=sa;Password=NvQp8s@l;Host=localhost;Port=5432;Database=KURS;" + "SqlServer": "Server=localhost;Database=Erp;User Id=sa;password=NvQp8s@l;Trusted_Connection=False;Encrypt=False;TrustServerCertificate=True;Connection Timeout=60;", + "PostgreSql": "User ID=sa;Password=NvQp8s@l;Host=localhost;Port=5432;Database=Erp;" }, "Redis": { "IsEnabled": "true", diff --git a/configs/ai/My_workflow.json b/configs/ai/My_workflow.json index c77ccb7c..c96d2bc3 100644 --- a/configs/ai/My_workflow.json +++ b/configs/ai/My_workflow.json @@ -199,7 +199,7 @@ "promptType": "define", "text": "={{ $('Webhook').item.json.body.question }}", "options": { - "systemMessage": "- Veritabanı Şeması:\n\n1. Tablo: AI_Tanim_Iplik_Listesi\n\nGenel Tanım: \nTekstil üretiminde kullanılan tüm iplik ve iplik bazlı hammaddelerin sistemsel olarak tanımlandığı bir master veri tablosudur. Bu tablo; hammaddeye dair teknik, yapısal, sınıflayıcı ve süreçsel tüm bilgileri merkezi bir yapıda saklar ve üretimden satın almaya kadar birçok sistem modülüyle ilişkilidir.\n\nSütun Tanımları ve Anlamları:\n- IplikKodu: Tanımlı olan hammaddenin sistemsel hammadde kodunu belirtir.\n- RenkAdi: Tanımlı olan hammaddenin renk adını belirtir.\n- RenkKodu: Tanımlı olan hammaddenin sistemde tanımlı renk kodudur.\n- Renk: Tanımlı olan hammaddenin renk numarasını belirtir.\n- Cins: Tanımlı olan hammaddenin cinsini belirtir. Örneğin; polyester, pamuk, viskon vb.\n- Numara: Tanımlı olan hammaddenin numarasını belirtir. Hammaddenin kalınlığını veya inceliğini ifade eder (örneğin: 2 numara iplik, 30/1 Ne vb.).\n- Birim: Tanımlı olan hammaddenin numara birim bilgisini belirtir (örneğin: Nm, NeB, den).\n- Nm: İpliğin numarasını ifade eden metrik sistemdeki (Nm) numarasıdır. Bu değer, 1 gram iplikten kaç metre elde edilebileceğini gösterir. Numara büyüdükçe iplik incelir.\n- KompozisyonKisaltmasi: Hammaddenin kompozisyon yüzdelerinin belirtir. (örneğin; %90 PAN %10 PES, %100 PES, %100 RPET)\n- IplikKisaltmasi: Tanımlı olan hammaddenin sistemsel kısaltılmış hammadde kodunu belirtir.\n- UstGrup1: Hammaddenin bulunduğu ana grubu ifade eder.\n- UstGrup2: Hammaddenin ait olduğu ana grubun bir alt grubudur.\n- Tarih: Hammadde tanımlamasının yapıldığı tarihtir.\n- InsertUser: Hammadde tanımlamasını yapan kullanıcıyı belirtir.\n- IsikHasligi: Hammaddenin ışığa karşı dayanıklılık seviyesini (haslık derecesi) belirtir.\n- Bukum: Hammaddenin büküm şekli hakkında bilgi verir (örneğin: S, Z, çift büküm).\n- OrtBobinKg: Ortalama bir bobin hammaddenin kilogram cinsinden ağırlığını belirtir.\n- NumuneKodu: Hammadde tanımlamasından önce numune olarak tanımlandığındaki iplik numune kodunu belirtir.\n- NumuneOnayTarihi: Hammadde numunesinin onaylandığı tarihi belirtir. Numune onaylandıktan sonra regüle iplik tanımlanır.\n- UrunHizmetGrubu: Hammadde tanımının hizmet grubunu belirtir. Örneğin: iplik, kumaş, aksesuar vb.\n- HamMamul: Hammaddenin üretim aşamasını ifade eder. (YARI MAMÜL İPLİK, MAMÜL İPLİK, HAM İPLİK)\n- IplikKullanimDurumu: Hammadde tanımının mevcut durumunu belirtir (örneğin: Aktif, Pasif).\n- HammaddeTipi: Tanımlı olan hammaddenin tipini belirtir. (CİPS, İPLİK, ELYAF, JOKER İPLİK, POLİP BOYA)\n\nFonksiyonel Amaçlar ve İlişkiler\n- Bu tablo, üretim emirlerinde hammadde seçimi, satın alma planlaması ve depo kontrol gibi birçok süreçle ilişkilidir.\n- IplikKodu anahtar alan olarak diğer tablolarla (örneğin AI_Iplik_SatinalmaSiparis_Durum) join ilişkisinde kullanılır.\n- KompozisyonKisaltmasi, kalite hesaplamaları, üretim reçeteleri ve stok analizlerinde kullanılır.\n- NumuneOnayTarihi, numuneden regüleye geçişin kritik eşiğidir.\n\n2. Tablo: AI_Tanim_Kalite_Listesi\n\nGenel Tanım: \nAI_Tanim_Kalite_Listesi, firmanın ürün gamında yer alan kumaş kalitelerinin detaylı tanımlarını içeren referans tablosudur. Bu tablo, kumaşların üretimsel, teknik ve ticari sınıflandırmalarının yapıldığı üst seviye bilgi kaynağıdır. Kalite; çözgü/atkı özellikleri, iplik tipi, ambalaj biçimi, uygulanan proses ve kullanım cinsine kadar birçok parametre ile tanımlanır ve tüm üretim & stok yönetimi süreçlerinin çekirdek bileşeni olarak kullanılır.\n\nSütun Tanımları ve Anlamları:\n- KaliteKodu: Kumaş kalitesini ifade eden akıllı kodlama yapısı ile belirtilmiş benzersiz bir tanımlama koddur. \n- KaliteAdi: Kumaşın kaliteye verilmiş ticari veya teknik adını belirtir. Kullanıcıya daha anlaşılır bir kalite tanımı sunar.\n- AsilKaliteAdi: Kalitenin bağlı olduğu bir üst kalite adını belirtir. \n- KaliteTipi: Kalitenin genel sınıfını belirtir. Bu tip kalitenin üretim değer farklılıklarını, üretim şekillerini ve teknik yapısını da ifade eder. Örneğin; ÖRME, ÜRETİM, YATAK YÜZÜ, KADİFE, YUVARLAK ÖRME \n- KaliteCinsi: Kalitenin genel kullanım amacına göre ait olduğu grubu tanımlar. Örneğin; standart, recycle, outdoor, easy life, prive gibi kalite cinslerini belirtir.\n- KapKaliteGrubu: Kalitenin ait olduğu teknik kalite grubunu belirtir. Örneğin; örme, 4800 class, 9600, 1056 gibi üretim gruplarını içerir.\n- AmbalajSekli: Kaliteye bağlı olarak üretilen kumaşların nasıl ambalajlanacağını belirtir. Örneğin; shrink, baloncuk gibi ambalaj türleri içerir.\n- ApreIslemiTipi: Kumaşın kalite sürecinde hangi apre işlemine tabi tutulduğunu belirtir. Örneğin; boyama, proses, dijital baskı gibi işlemleri kapsar.\n- AtkliSikligi: Kumaşın kalitesine bağlı olarak 1 cm de kullanılan atkı (enine iplik) iplik adedini - sıklığını belirtir. Bu değer, kalitenin dokuma yoğunluğu hakkında bilgi verir.\n- CozguSikligi: Kaliteye bağlı olarak 1 cm de kullanılan çözgü (boyuna iplik) iplik adedini - sıklığını ifade eder. Kumaşın teknik özelliklerini belirleyen temel parametrelerden biridir.\n- CozguTelAdedi: Kaliteye bağlı olarak kullanılan toplam çözgü tel adedini belirtir. Kumaşın yoğunluğu ve dayanıklılığı ile doğrudan ilişkilidir.\n- İplikCinsi: Kalitenin için de kullanılan çözgü ipliğinde kullanılan iplik türünü belirtir. Örneğin; polyester, pamuk, viskon gibi iplik cinsleri bu alanda yer alır.\n- ProsesKodu: Kalitenin üretim sürecinde geçtiği işlemleri tanımlayan koddur. Apre dairesinde yapılan rota olarak ta belirtilebilir. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Kayit_Kimin: Kalitenin hangi şirkete ait olduğunu gösterir. ERP süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- Tanimlayan: Kalite tanımını yapan kişiyi kullanıcı adını belirtir. \n- Tarih: Kalite tanımlamasının yapıldığı tarihtir.\n\nFonksiyonel Amaçlar ve İlişkiler\n- Kalite, kumaşın en temel referans kimliğidir. Tüm üretim, satış, stok ve sevkiyat tablolarıyla birebir ilişkilidir.\n- KaliteKodu, tablolar arasında anahtar niteliğindedir (örn. AI_Tanim_Kumas_Listesi, AI_Kumas_Siparis_Paz_Listesi, AI_Dokuma_IsEmri_Listesi).\n- KapKaliteGrubu ve KaliteTipi teknik/üretim ayrımı yaparken, KaliteCinsi pazarlama segmentasyonu sağlar.\n- AtkliSikligi, CozguSikligi, CozguTelAdedi gibi parametreler üretim reçetelerinde kritik teknik girdilerdir.\n- ApreIslemiTipi, kalitenin işlemsel farklarını yansıtır, kalite kontrol süreçlerini doğrudan etkiler.\n\n3. Tablo: AI_Tanim_Cozgu_Listesi\n\nGenel Tanım:\nAI_Tanim_Cozgu_Listesi, tekstil üretiminde kumaşların çözgü yapılarını tanımlayan teknik ve sınıflayıcı bilgileri içeren referans tablosudur. Dokuma reçetelerinin oluşturulması, kalite kontrol süreçlerinin yönetilmesi ve kumaş varyant eşleşmelerinin doğru yapılabilmesi için kritik rol oynar. Çözgü, bir kumaşın üretim mimarisindeki iskelet yapıdır ve bu yapı sistematik şekilde burada tariflenir.\n\nSütun Tanımları ve Anlamları:\n- CozKodu: Kumaşın dokunmasında kullanılan dikey ipliklerini oluşturan ipliklerin çözgü tanımına ait teknik ve benzersiz tanımlama kodudur. Bu kod, üretim takibi, çözgü reçeteleri ve kalite kontrol süreçlerinde referans olarak kullanılır.\n- CozAdi: Kumaşın dokunmasında kullanılan dikey ipliklerini oluşturan ipliklerin çözgü tanımına ait teknik tanımlama adıdır. Çözgü yapısını tanımlar ve kumaşın üretim sürecindeki yerini belirlemede kullanılır. \n- CozguGrubu: Tanımlı olan çözgünün üst çözgü adıdır. Yoğunlukla CozAdi sütunu değerlerini içerir.\n- CozTipi: Tanımlı olan çözgünün çalışabileceği tezgah tipini ve dokuma yapısını belirtir. Örneğin; jakarlı, armürlü gibi dokuma yapılarını tanımlar.\n- CozguTuru: Kullanılan çözgünün Numunemi, Blanket veya Regüle olup olmadığını belirtir. \n- TelAdet: Çözgüde kullanılan toplam tel adedini ifade eder.\n- CozSiklik: Çözgü sıklığını belirtir. Yani 1 cm den geçen çözgü iplik adedi - sıklığını gösterir.\n- CozEni: Çözgü sisteminin kumaş üzerindeki eni (genişliği) bilgisini ifade eder.\n- KaliteTipi: Çözgünü çalışabileceği kumaşların kalite tipini belirtir. Örneğin; ÖRME, ÜRETİM, YATAK YÜZÜ, KADİFE, YUVARLAK ÖRME \n- KaliteGrubu: Çözgünün çalışabileceği kumaşların kalite grubunu belirtir. Örneğin; 4800, 9600 gibi teknik gruplar.\n- KoleksiyonTipi: Kumaş koleksiyonunun genel mi yoksa müşteriye özel mi olduğunu belirtir.\n- Kompozisyon: Çözgüde kullanılan hammadde yüzlerini belirtir. Örneğin; %60 polyester, %40 pamuk gibi lif karışım bilgilerini içerir.\n- Tarih: Çözgünün tanımını yapan kişiyi kullanıcı adını belirtir.\n\nFonksiyonel Kullanım ve İlişkiler\n- CozKodu, çözgü-reçete bağlantılarında anahtar işlevi görür.\n- KaliteTipi, KaliteGrubu ile birlikte çözgülerin hangi ürün ailesine ait olduğunu belirtir.\n- CozTipi ve CozguTuru, üretim tipi ayrımında kritik bilgi sağlar.\n- TelAdet, CozSiklik, CozEni değerleri, dokuma optimizasyonu ve randıman hesaplamaları için kullanılır.\n- KoleksiyonTipi, müşteri taleplerine özel üretimlerin sınıflandırılmasını mümkün kılar.\n\n4. Tablo: AI_Tanim_Cagarlik_Listesi\n\nGenel Tanım:\nAI_Tanim_Cagarlik_Listesi, özellikle kadife tipi kumaşların üretiminde kullanılan cağarlık yapılarını tanımlayan temel veri tablosudur. Cağarlık; dokuma öncesinde çözgü ipliklerinin bobinler üzerine sarılmasıyla oluşan ve dokuma makinesine çözgü ipliklerini aktaran sistemdir. Bu yapı, dokumanın temel bileşeni olan çözgü sisteminin planlanması ve standartlaştırılması için kritik öneme sahiptir. Sistem içinde tanımlı her cağar, belirli bir iplik cinsi, rengi, tel sayısı ve bobin adediyle temsil edilir. Tablo, üretim reçeteleri, kalite takibi, stok yönetimi ve üretim verimliliği açısından cağarlıkların teknik izlenebilirliğini sağlar.\n\nSütun Tanımları ve Anlamları:\n- CagarNo: Cağara ait benzersiz kod bilgisini içerir.\n- CagarKodu: Cağarın sistemde tanımlı adını belirtir.\n- IplikKodu: Cağarda kullanılan ipliğin sistemsel kodunu belirtir.\n- Cins: İpliğin cinsini belirtir. Örneğin; polyester, pamuk, viskon vb.\n- RenkAdi: Kullanılan ipliğin renk adını belirtir.\n- TelAdedi: Cağarlıkta kullanılan ipliğin tel adedini ifade eder.\n- ToplamAdet: Cağarlıkta kullanılan toplam tel adedini gösterir.\n- Tarih_Tanimlama: Cağarlık tanımının yapıldığı tarihi belirtir.\n\nFonksiyonel Kullanım ve İlişkiler:\n- IplikKodu, AI_Tanim_Iplik_Listesi ile birebir eşleşir. Kullanılan ipliğin tüm teknik bilgilerine erişim sağlar.\n- CagarKodu, çözgü planlamasında veya dokuma reçetelerinde doğrudan çağrılan tanımlayıcıdır.\n- TelAdedi ve ToplamAdet, iplik tüketimi, stok yönetimi ve üretim planlamasında hesaplama girdisi olarak kullanılır.\n- RenkAdi ve Cins kombinasyonu, kalite kontrol ve üretim standardizasyonu açısından önemli eşleştirme parametreleridir.\n\n5. Tablo: AI_Tanim_Kumas_Listesi\n\nGenel Tanım:\nBu tablo, tekstil üretiminde kullanılan veya dışarıdan satın alınan tüm kumaşlara ait temel tanım ve teknik özelliklerin tutulduğu referans veri kaynağıdır. Kumaşların kalite, desen, varyant, çözgü yapısı, kompozisyonu ve üretim bilgileri gibi parametrelerini içerir. Üretim planlama, kalite kontrol, desen takibi ve stok yönetimi süreçlerinde merkezi rol oynar. Bu tablo, kumaş bazlı operasyonların bütüncül takibi için temel veri zemini sağlar.\n\nSütun Tanımları ve Anlamları:\n- KumasID: Tanımlanan her kumaşın veri tabanında saklanan benzersiz değeridir. Otomatik numara türünde olan bu değer her kumaş için tanımlayıcıdır. (primary key) \n- Kalite: Kumaş kalitesini ifade eden akıllı kodlama yapısı ile belirtilmiş benzersiz bir tanımlama koddur. AI_Tanim_Kalite_Listesi tablosundaki KaliteKodu sütunu ile ilişkilidir. \n- KaliteAdi: Kumaşın kaliteye verilmiş ticari veya teknik adını belirtir. Kullanıcıya daha anlaşılır bir kalite tanımı sunar. AI_Tanim_Kalite_Listesi tablosundaki KaliteAdi sütunu ile ilişkilidir. \n- AsilKaliteAdi: Kalitenin bağlı olduğu bir üst kalite adını belirtir. AI_Tanim_Kalite_Listesi tablosundaki AsilKaliteAdi sütunu ile ilişkilidir.\n- KaliteTipi: Kalitenin genel sınıfını belirtir. Bu tip kalitenin üretim değer farklılıklarını, üretim şekillerini ve teknik yapısını da ifade eder. Örneğin; ÖRME, ÜRETİM, YATAK YÜZÜ, KADİFE, YUVARLAK ÖRME\n- KumasGrubu: Kumaşın teknik veya tasarımsal açıdan üretilecek tezgah grubunu belirtir. Örneğin; Armürlü, Jakarlı, Dedektörlü, Jumbo vs. gibi sınıflandırmaları içerir.\n- KumasTuru: Kumaşın kullanım amacını tanımlar. Örneğin; numune, regüle (seri üretim), özel üretim gibi türleri ayırt etmek için kullanılır.\n- DesenNo: Kumaşa ait benzersiz desen numarasını belirtir. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaşa ait benzersiz desen adını belirtir. Tasarımcının verdiği isim ya da sistemde kayıtlı ad olabilir.\n- VaryantNo: Aynı desenin farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasını belirtir.\n- Kompozisyon: Kumaşın içeriğinde kullanılan hammadde yüzdelerini belirtir. Örneğin; %60 polyester, %40 pamuk gibi lif karışım bilgilerini içerir.\n- CozKodu: Kumaşta kullanılan çözgü ipliğine ait sistemsel veya teknik kodu belirtir. Bu kod, üretim takibi, çözgü reçeteleri ve kalite kontrol süreçlerinde referans olarak kullanılır.\n- CozAdi: Kumaşın dokunmasında kullanılan çözgü ipliğine verilen teknik adı ifade eder. Çözgü yapısını tanımlar ve kumaşın üretim sürecindeki yerini belirlemede kullanılır.\n- HamKg: Kumaşın ilk dokuma sonrası işlenmemiş, yani ham haliyle kilogram cinsinden ağırlığını belirtir.\n- MamKg: Kumaşın dokuma sonrası ve apre rotasından sonra mamul hale geldikten sonraki kilogram cinsinden ağırlığını belirtir.\n- ProsesKodu: Kumaşın geçtiği üretim veya işlem süreçlerini ifade eden rota kodu içerir. Örneğin; boyama, apre, yıkama gibi işlemleri gösterir.\n- UretimiDurdur: Tanımlı olan kumaşın nüretiminin devam edip etmediğini gösterir. Aktif üretim mi, durdurulmuş mu bilgisini taşır.\n- Kayit_Kimin: Kumaşın hangi şirkete ait olduğunu gösterir. ERP süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- Tanimlayan: Kumaşın tanımını yapan kişiyi kullanıcı adını belirtir. \n- Tarih: Kumaş tanımlamasının yapıldığı tarihtir.\n\nFonksiyonel Kullanım ve İlişkiler:\n- Kalite, KaliteAdi, AsilKaliteAdi sütunları kalite detay tabloları ile ilişkilidir.\n- CozKodu, CozAdi çözgü tanım tablosu ile (AI_Tanim_Cozgu_Listesi) ilişkili çalışır.\n- ProsesKodu, kumaşın üretim rotasının izlenmesinde kullanılır.\n- KumasTuru ve UretimiDurdur, üretim planlaması ve aktif üretim takip sistemi için filtreleme sağlar.\n- Kompozisyon, malzeme planlama ve kalite standardizasyonuna katkı sunar.\n\n6. Tablo: AI_Tanim_Firma_Listesi\n\nGenel Tanım:\nAI_Tanim_Firma_Listesi tablosu, kurumun ticari ilişkide bulunduğu tüm firmaların temel tanımlayıcı bilgilerini içerir. Bu firmalar; müşteri, tedarikçi, fason üretici ya da dış hizmet sağlayıcı olabilir. ERP süreçlerinde üretim, satın alma, satış ve sevkiyat gibi operasyonel iş akışlarında muhatap olarak tanımlanan firmaların sistemdeki kayıtlarını standardize etmek ve ilişkisel veri tabanında izlenebilirlik sağlamak amacıyla kullanılır.\n\nSütun Tanımları ve Anlamları:\n- FirmaKodu: Her firmaya sistem tarafından atanmış benzersiz tanımlayıcı koddur. Tüm diğer tablolarda firma bilgisiyle ilişki kurarken referans alınır.\n- FirmaAdi: Firmanın ticaret unvanıdır. İnsan tarafından okunabilir ve raporlamada görünen firma adıdır.\n- Tur: Firmanın sistemdeki işlevsel rolünü belirtir. Örnek değerler: müşteri, tedarikçi, fasoncu, apre tedarikçisi gibi. Operasyonların sınıflandırılmasını sağlar.\n- FirmaGrubu: Firma ile ilişkili yüksek seviye sınıflandırmadır. Örnek: yerli, yabancı, holding grubu gibi tanımlar sayesinde pazar analizleri ve tedarikçi segmentasyonu yapılabilir.\n- SirketAdi: Bu firma ile ilişkili olan şirket ya da ERP sistemindeki iş birimi bilgisini içerir. Çoklu şirket yapılanmalarında kurum içi ayrımı ifade eder.\n- Ulke: Firmanın faaliyet gösterdiği veya yasal olarak kayıtlı olduğu ülke bilgisidir. Dış ticaret, lojistik ve gümrük süreçleri için önemlidir.\n- SatisBolgesi: Firmanın coğrafi satış bölgesini tanımlar. Örnek: Avrupa, Orta Doğu, İç Anadolu. Pazarlama stratejilerinin bölgesel dağılım analizlerinde kullanılır.\n\nFonksiyonel Kullanım ve İlişkiler:\n- FirmaKodu, sistem genelinde sipariş, sevkiyat, stok, üretim veya satın alma tablolarında yabancı anahtar (foreign key) olarak kullanılır.\n- Tur ve FirmaGrubu, sistemde firma filtrelemelerinde, yetkilendirme yapılarında ve dashboard segmentasyonlarında kullanılır.\n- SirketAdi, kurum içi dağılımı göstererek firma-şirket ilişkisini şeffaf hale getirir.\n- Ulke ve SatisBolgesi sütunları dış ticaret ve ihracat/iç pazar ayrımlarında kritik rol oynar.\n\n7. Tablo: AI_Tanim_Tezgah_Listesi\n\nGenel Tanım:\nAI_Tanim_Tezgah_Listesi tablosu, firmanın üretim altyapısında yer alan tüm tezgahların teknik ve operasyonel özelliklerini kayıt altında tutar. Bu bilgiler sayesinde üretim planlaması, verimlilik ölçümü, performans analizi, bakım yönetimi ve kapasite değerlendirmesi gibi kritik karar destek süreçleri yürütülür. Tezgahlar fiziksel olarak üretimin kalbidir ve bu tablo, o kalbin nabzını dijital olarak izlemeyi sağlar.\n\nSütun Tanımları ve Anlamları:\n- TezgahKodu: Her bir tezgah için sistemde tanımlı olan benzersiz koddur. Diğer üretim tabloları (örneğin: iş emirleri, planlama) ile ilişki kurmak için anahtar alan olarak kullanılır.\n- En: Tezgahın kumaşı tek en (tek taraflı) mi, çift en (her iki taraflı) mi, üç en mi dokunacağı ve örüleceğini belirtir. Bu bilgi üretim tipi seçiminde kullanılır.\n- Markasi: Tezgahın üretici markasını belirtir. Örneğin: Dornier, Picanol, Smit gibi makine markaları olabilir.\n- Tipi: Tezgahın teknik kullanım tipini belirtir. Örneğin: saten, örme, yuvarlak örme gibi kumaş türüne göre ayrım yapar.\n- Cinsi: Tezgahın çalıştığı dokuma türünü tanımlar. Örneğin: jakarlı, armürlü, örme vb. Bu bilgi, kumaş türüyle uyum açısından kritiktir.\n- Grup: Tezgahın dahil olduğu tezgah grubunu ifade eder. Raporlama ve grup bazlı analizlerde kullanılır. Örneğin; Y13-Y16 tezgah grubunu ifade eder.\n- SubeAdi: Tezgahın fiziksel olarak bulunduğu şubenin adıdır. Özellikle birden fazla üretim tesisi olan firmalarda, lokasyon bazlı yönetim için önemlidir.\n- Konum: Tezgahın fiziksel olarak kaçıncı katta bulunduğu yer bilgisidir. (örnek: 1. Kat, 2. Kat, Boğaziçi vb.)\n- TarakEni: Tezgahın çalışabileceği maksimum kumaş genişliğini gösterir. (cm cinsinden)\n- ReelCozguTeli: Tezgahta fiilen kullanılan toplam çözgü teli adedidir. Kumaş yoğunluğu ve dokuma optimizasyonu açısından kritik bir parametredir.\n- MakinaDevri: Tezgahın ortalama çalışma hızı (rpm: devir/dakika) bilgisidir. Hız ve kalite dengesi bu alana bağlıdır.\n- OrtRandiman: Tezgahın belirli bir dönem için ölçülmüş ortalama verimlilik yüzde değeridir. Performans ölçümlerinde kullanılır.\n- GunlukTCalisma: Tezgahın günlük ortalama çalışma saat süre bilgisidir. Üretim kapasitesi analizlerinde referans alınır.\n- CalismaDurumu: Tezgahın mevcut durumu hakkında bilgi verir. Örnek değerler: Aktif, Pasif, Kapalı, Sanal olabilir.\n\nFonksiyonel Kullanım ve İlişkiler:\n- TezgahKodu, iş emri, üretim takibi ve planlama tablolarında foreign key olarak kullanılır.\n- Tipi, Cinsi ve Grup, kumaş türüne göre doğru tezgah atamasını yapabilmek için eşleştirme kriteridir.\n- TarakEni, ReelCozguTeli ve MakinaDevri gibi teknik sütunlar, randıman optimizasyonu ve rota planlamasında rol oynar.\n- CalismaDurumu ve OrtRandiman, bakım periyodu takibi ve yatırım planlamalarında analiz kriteridir.\n\n8. Tablo: AI_Iplik_SatinalmaSiparis_Durum\n\nGenel Tanım:\nAI_Iplik_SatinalmaSiparis_Durum tablosu, kumaş üretim süreci için tedarik edilen ipliklerin sipariş süreçlerine dair tüm kritik verileri içerir. Hangi ipliğin, hangi firmadan, ne zaman ve ne miktarda sipariş edildiğini gösterir. Tablodaki bilgiler, tedarik zinciri yönetimi, termin uygunluk takibi ve maliyet analizleri için kullanılmakta olup, satın alma planlaması ve stok giriş süreçlerinin temelini oluşturur. Ayrıca geciken siparişlerin, teslim edilen miktarların ve kalan ihtiyaçların takibi bu tablo üzerinden yapılır.\n\nSütun Tanımları ve Anlamları:\n- SiparisID: Her bir satın alma siparişinin sistemdeki benzersiz kimlik numarasıdır. Anahtar (primary key) alan olarak kullanılır.\n- SipNo: Satın alma siparişin sistem tarafından otomatik atanan takip numarasıdır. Operasyonel takibin yapılmasında referans niteliğindedir.\n- Tarih: Satın alma siparişin tarih bilgisini ifade eder.\n- GirisTarihi: Satın alma siparişin sisteme giriş yapıldığı tarihi gösterir.\n- FirmaAdi: Satın alma siparişi verilen ipliğin tedarik edildiği firma adıdır. AI_Tanim_Firma_Listesi ile ilişkilidir.\n- Kayit_Kimin: Satın alma siparişinin hangi şirkete ait olduğunu gösterir. Grup şirketleri veya çoklu organizasyon yapılarında ayrımı sağlar.\n- IplikKodu: Satın alma siparişi verilen ipliğin sistemsel kodudur. AI_Tanim_Iplik_Listesi tablosu ile ilişkilidir.\n- Cins: Satın alma siparişi verilen ipliğin cins bilgisidir. Örnek: polyester, pamuk vb. İplik sınıflandırmasında kullanılır.\n- Renk: Satın alma sipariş edilen ipliğin sistemsel renk kodudur.\n- RenkAdi: Satın alma renk alanının açıklayıcı adıdır. İnsan tarafından daha anlaşılır hale getirilmiş tanımıdır.\n- Miktar: Satın alma yapılacak olan ipliğin sipariş edilen miktarını belirtir.\n- GelenMiktar: Satın alma siparişinin teslim alınan miktarını gösterir. Satın alma siparişi farklı zamanlarda parçalı şekilde teslim alınabilir. Karşılaştırmalı analizlerde kullanılır.\n- TerminTarihi: Satın alma sipariş edilen ipliğin beklenen teslim tarihidir. Tedarik performans analizleri için önemlidir.\n- TerminUygunDurum: Siparişin zamanında teslim edilip edilmediğini belirtir. Zamanında teslimat KPI’si bu alandan hesaplanır.\n- BirimFiyati: Satın alma siparişindeki her bir ipliğin satın alma birim fiyatı içerir.\n- OdemeSekli: Ödeme para birimini ve KDV dahil mi belirtir. Döviz bazlı muhasebe işlemlerinde kullanılır.\n- TeslimatYeri: İpliğin teslim edilmesi gereken yeri lokasyonu tanımlar (örnek: Merkez Depo, Boyahane Girişi).\n- SiparisKapandi: Siparişin tamamlanıp tamamlanmadığını gösterir. (Evet/Hayır gibi değer alabilir)\n\n9. Tablo: AI_Iplik_ImalEmri_Durum\n\nGenel Tanım:\nAI_Iplik_ImalEmri_Durum tablosu, firmanın iplik üretim süreci kapsamında oluşturulan tüm imalat emirlerine ait detayları kayıt altına alır. Bu tablo, üretilecek ipliğin teknik tanımı, miktarı, kullanılan hammadde çıkışları, üretim girişi ve fire değerleri gibi üretimsel verileri içerir. Tablodaki bilgiler, üretim planlama, termin yönetimi, stok takibi, fire kontrolü ve üretim performans analizlerinde kritik rol oynar. Özellikle fason üretim süreçlerinde geri dönüşlerin takibi ve üretimle karşılaştırılması açısından merkezi bir kontrol mekanizması sunar.\n\nSütun Tanımları ve Anlamları:\n- ImID: Her imalat emrine sistem tarafından atanan benzersiz tanımlayıcıdır. (Primary key)\n- IIENo: İmalat emrinin sistemdeki takip numarasıdır. Operasyonel izleme ve raporlama süreçlerinde referans kod olarak kullanılır.\n- Tarih: İmalat emrinin sisteme kaydedildiği tarihi ifade eder. Zamansal raporlamalar için referans alınır.\n- FirmaAdi: İpliğin tedarik edildiği firma adıdır. Tedarikçi takibi ve performans ölçümünde kullanılır.\n- IplikKodu: Üretilmesi planlanan ipliğin sistemsel hammadde kodudur. AI_Tanim_Iplik_Listesi ile ilişkilidir.\n- Cins: Üretilmesi planlanan ipliğin cins bilgisidir. Örnek: polyester, pamuk vb. İplik sınıflandırmasında kullanılır.\n- UstGrup1: İpliğin ait olduğu ana ürün grubunu belirtir. Kategori bazlı sınıflandırmalarda kullanılır.\n- UstGrup2: İpliğin bağlı olduğu daha alt seviye grup bilgisidir.\n- Birim: Tanımlı olan hammaddenin numara birim bilgisini belirtir (örneğin: Nm, NeB, den).\n- RenkAdi: Üretilecek hammaddenin renk adını belirtir.\n- HarmanNo: Üretilen ipliğe ait harman (lot) numarasıdır. Takip, izlenebilirlik ve kalite kontrol süreçlerinde kullanılır. Depo girişi yapılırken hammaddenin lot numarası olarak kullanılır.\n- Miktar: İmal emri kapsamında üretilecek toplam iplik miktarını ifade eder. (kg bazında)\n- ELCikis: Elyaf olarak üretimden çıkan hammaddenin miktarını gösterir. Elyaf kullanımı ile ilgili hammadde çıkışlarını izlemek için kullanılır.\n- IPCikis: İmal emri üretimi için iplik işletmelerine gönderilen hammadde veya yarı mamül iplik miktarıdır. \n- HamMaddeCikis: ELCikis ve IPCikis toplamı olup, üretimde kullanılan toplam hammadde çıkışını ifade eder.\n- IPGiris: İmal emri için üretilmiş ve depoya girmiş olan ipliğin miktarıdır.\n- UretilenKg: İplik işletmelerinde imal emri için üretilmiş olan iplik miktarıdır. Bu bilgi sahadan toplanıyor olup depo girişi yapılma zorunluluğu bulunmamaktadır. \n- BakiyeKg: İmal emri oluşturulan miktardan henüz üretilmemiş, eksik kalan iplik miktarıdır.\n- Fire: Üretim sürecinde oluşan kayıp miktarıdır. (kg bazında)\n- TerminTarihi: İmalat emrinin üretiminin tamamlanmasının planlandığı tarih bilgisidir.\n- Senil: Üretilen ipliğin şönil li iplik olup olmadığını belirtir. (Evet/Hayır gibi değerler alır)\n\n10. Tablo: AI_Iplik_FasonSiparis_Durum\n\nGenel Tanım:\nAI_Iplik_FasonSiparis_Durum tablosu, firma dışı üretim yöntemi olan fason iplik siparişlerine ilişkin tüm verileri içerir. Bu yapı, dış üreticiye (fason firmaya) yaptırılan ipliklerin tedarik sürecini, miktarlarını, teslimat zamanlarını ve maliyetlerini izlemek amacıyla kullanılır. İplik üretiminin tamamının ya da bir kısmının dış kaynakla yürütüldüğü durumlarda, sipariş detaylarının sistematik takibini sağlar. Böylece satın alma ve üretim ekipleri, fason üretim performansını ölçebilir, stok kontrolü ve termin yönetimi yapabilir.\n\nSütun Tanımları ve Anlamları:\n- FasonSipNo: Her bir fason iplik siparişi için sistem tarafından oluşturulan benzersiz takip numarasıdır. Bu alan üzerinden fason siparişin tamamı izlenir.\n- Tarih: Fason siparişin sisteme kaydedildiği tarihi ifade eder. Operasyonel süreç takibi için önemlidir.\n- GirisTarihi: Fason siparişi Üretilen ipliğin firmaya fiziksel olarak giriş yaptığı tarih bilgisidir.\n- FirmaAdi: Fason üretimi gerçekleştiren tedarikçi firmanın ticari adıdır. AI_Tanim_Firma_Listesi tablosuyla ilişkilidir.\n- Kayit_Kimin: İlgili siparişin hangi şirket adına açıldığını belirtir. Çoklu şirket yapılanmalarında ayırıcı kimlik görevi görür.\n- IplikKodu: Fason siparişe konu olan ipliğin sistemdeki tanımlı hammadde kodudur. AI_Tanim_Iplik_Listesi ile ilişkilidir.\n- Cins: Fason sipariş edilen ipliğin cinsini belirtir. Örneğin; polyester, pamuk gibi sınıflandırmalar içerir.\n- Renk: Fason sipariş edilen ipliğin sistemsel renk kodudur. Teknik ve görsel ayrım açısından kullanılır.\n- RenkAdi: Fason sipariş edilen renk kodunun açıklayıcı adıdır. Kullanıcı dostu tanım sağlar (örneğin: Koyu Mavi, Krem).\n- Miktar: Fason sipariş edilen iplik miktarıdır. Genellikle kilogram (kg) cinsindendir.\n- GelenMiktar: Fason sipariş edilen ipliğin teslimat miktarını gösterir.\n- TerminTarihi: Fason siparişin üretilip teslim edileceği tarihi bilgisidir. Tedarik kontrolü ve teslimat uyum analizinde kullanılır.\n- BirimFiyati: Fason sipariş kapsamında iplik başına belirlenen birim fiyat bilgisidir. Maliyet analizleri için gereklidir.\n- OdemeSekli: Fason siparişin ödeme birimini belirtir. (Örn: TL, USD, EUR) Döviz cinsinden raporlama yapılabilmesi için gereklidir.\n- SiparisKapandi: Fason siparişin tamamlanıp tamamlanmadığını ifade eder. Evet/Hayır veya 1/0 gibi mantıksal veri içerir.\n\n11. Tablo: AI_Iplik_BoyahaneSiparis_Durum\n\nGenel Tanım:\nAI_Iplik_BoyahaneSiparis_Durum tablosu, dış kaynak (fason) üretim yoluyla boyahaneye verilen iplik siparişlerine ilişkin tüm operasyonel bilgilerin takip edildiği temel veri kaynağıdır. Bu yapı, boyahane süreçlerinde üretimi yapılan ipliklerin takibini kolaylaştırmak amacıyla oluşturulmuştur. Hangi iplik cinsinin, hangi renkte ve miktarda boyanmak üzere hangi firmaya ne zaman sipariş edildiğini kayıt altına alır. Ayrıca teslimat durumu, depoya giriş miktarı, termin tarihleri, kazan bilgisi gibi detaylar da tabloda tutulur. Tablodaki bilgiler sayesinde planlama, depo yönetimi, tedarikçi performans takibi ve stok kontrol süreçleri entegre biçimde yürütülür. Sipariş kabul durumu ve kalan miktar takibi gibi kontrol noktaları bu tablo üzerinden izlenebilir.\n\nSütun Tanımları ve Anlamları:\n- BoyahaneSipID: Boyahane siparişine ait sistemdeki benzersiz tanımlayıcı (ID).\n- SiparisNo: Boyahane sisteminden gelen senkron sipariş numarası.\n- BoyahaneSipNO: İplik siparişinin boyahaneye atanan sipariş numarası.\n- BoyaSiparisTarihi: Boyahane siparişinin oluşturulduğu tarih.\n- FirmaAdi: Boyahane siparişinin tedarikçi firmanın ticari adıdır. AI_Tanim_Firma_Listesi tablosuyla ilişkilidir.\n- IplikKodu: Boyahane siparişe konu olan ipliğin sistemdeki tanımlı kodu.\n- IplikCinsi: Boyahane Sipariş verilen ipliğin hammadde cinsi. Örn: polyester, pamuk vb.\n- RenkKodu: İpliğe ait sistemsel renk kodu.\n- RenkAdi: Boyahane Siparişi verilen hammaddenin renk kodunun açıklayıcı adıdır. Kullanıcı dostu tanım sağlar (örneğin: Koyu Mavi, Krem).\n- UstGrup1: İpliğin ait olduğu birinci seviye kategori veya ana grup.\n- UstGrup2: İpliğin ait olduğu ikinci seviye kategori (UstGrup1’in alt grubu).\n- KabulDurum: Boyahaneden alınan siparişin kabul edilme durumu.\n- Miktar: Toplam sipariş miktarı. (Tekrar KadifeSipMiktari ile aynı olabilir)\n- GirisMiktari: Depoya fiziksel olarak giren toplam iplik miktarı.\n- Aciklama: Boyahane Siparişine ilişkin özel not ya da açıklama alanı.\n- TerminTarihi: Boyahane siparişi için planlanan teslim tarihi.\n- KazanNo: Boyama işleminin yapıldığı kazan numarası.\n- Kayit_Kimin: Siparişin hangi şirkete (holding, birim) ait olduğunu belirtir.\n- Durum: Siparişin genel durum bilgisidir. (Aktif, pasif vb.)\n\n12. Tablo: AI_Iplik_Depo_Durum_Listesi\n\nGenel Tanım:\nAI_Iplik_Depo_Durum_Listesi tablosu, iplik depolarında bulunan tüm hammadde stoklarının detaylı ve anlık takibini sağlayan referans veri kaynağıdır. Bu tablo sayesinde ipliğin hangi renkte, hangi partide (lot), hangi firmadan temin edildiği ve fiziksel olarak depo içindeki konumu izlenebilir. Ayrıca hammaddenin üretim durumu, kalite sınıfı ve varsa boyahane süreciyle olan ilişkisi gibi kritik bilgiler sistematik olarak saklanır. İpliklerin depo miktarı, hangi iş emirlerine tahsis edildiği (rezerve miktar) ve geriye kalan kullanılabilir miktarı da bu yapı üzerinden yönetilir. Stok yönetimi, üretim planlama, lot bazlı izlenebilirlik ve depo içi yerleşim gibi süreçler için hayati öneme sahiptir.\n\nSütun Tanımları ve Anlamları:\n- IplikKodu: İpliğin sistemde kayıtlı olan teknik ve benzersiz hammadde kodudur. Malzeme takibi ve süreç ilişkilerinde anahtar rol oynar.\n- RenkAdi: Depoda bulunan ipliğin görsel tanımını sunan renk adıdır. Kullanıcıya daha anlaşılır bir renk bilgisi sağlar.\n- Cins: İpliğin hammaddesel türünü belirtir. Örnek: polyester, pamuk, viskon. İplik gruplaması ve kalite kontrol süreçleri için önemlidir.\n- LotNo: İpliğe ait üretim partisini (lot) belirtir. Aynı ipliğin farklı lotları fiziksel farklılık gösterebileceğinden izlenebilirlik açısından zorunludur.\n- FirmaAdi: İpliği tedarik eden veya üreten firmanın adıdır. Kendi üretimleri için genellikle “KADİFETEKS” sabit ifadesi kullanılır.\n- DepoAdi: Hangi fiziksel depoda saklandığını ifade eder. Çok lokasyonlu depo sistemlerinde konum yönetimi sağlar.\n- Ack: Depodaki ipliğe dair açıklayıcı not veya durum bilgisidir. Üretim aşaması, kalite dışı durumlar, iade, hasar gibi notları içerebilir.\n- Koordinat: Depo içinde ipliğin fiziksel yerini tanımlar. Genellikle raf sistemine göre tanımlanır (örnek: A2-RF3).\n- Kalite: Depodaki ipliğin kalite sınıfını belirtir. Örneğin: A Kalite, 2. Kalite, Fire gibi üretim uygunluğuna göre sınıflamalar içerir.\n- BanyoNo: Eğer iplik boya işleminden geçmişse, hangi reçeteyle boyandığını gösteren boyahane reçete numarasıdır. Boyanmış ipliklerin takibinde kritik veridir.\n- DepoMiktari: İpliğin depoda fiziksel olarak mevcut olan toplam miktarını (kg cinsinden) belirtir.\n- ReserveMiktari: Dokuma veya üretim iş emirlerine tahsis edilmiş (rezerve edilmiş) iplik miktarıdır. Bu miktar üretim için ayrılmış ama henüz kullanılmamış olabilir.\n- KalanDepoMiktari: Kullanılabilir net miktarı gösterir. Yani DepoMiktari - ReserveMiktari hesabıyla elde edilen, henüz tahsis edilmemiş kullanılabilir stok bilgisidir.\n\n13. Tablo: AI_Iplik_Depo_Hareket_Listesi\n\nGenel Tanım:\nAI_Iplik_Depo_Hareket_Listesi tablosu, iplik deposunda gerçekleşen tüm hareketlerin (giriş, çıkış, transfer, red vs.) ayrıntılı olarak takip edilmesini sağlar. Her bir hareket, iplik kodu, lot bilgisi, miktar, tarih, hangi kullanıcı tarafından işlendiği ve hareketin nedeni gibi operasyonel detayları içerir. Bu tablo, depo yönetimi, stok takibi, kalite kontrol ve red yönetimi gibi süreçlerde kritik rol oynar. Aynı zamanda fason ilişkili hareketlerin, üretim emirlerine bağlı giriş-çıkışların ve depo koordinat bilgilerinin izlenmesini sağlar. Parti bazlı ve detaylı izlenebilirlik için temel veri kaynağıdır.\n\nSütun Tanımları ve Anlamları:\n- IpDepoHrkSubID: İplik depo hareketi yapılan iplik için atanmış olan barkod numarasıdır.\n- FisNo: İplik depo hareket emrini ait fiş numarasıdır. Bu numara ile ipliklerin nereye ne zaman hareket edileceği belirlenir.\n- Tarih: İplik depo hareketine ait tarih bilgisini ifade eder. \n- FirmaAdi: İplik depo hareketine kayıtlı olan firmanın ticari adını belirtir. Depo girişi yapılırken tedarikçi, Depo çıkışı yapılırken müşteri olarak değerlendirilir.\n- HarSebebi: İpliğin depo haretinin ne amaçla yapıldığını açıklar. Satın alma, Üretime çıkış, Devir, Sayım vb.\n- IplikKodu: İplik depo hareket yapılan hammaddenin sistemsel kodunu belirtir.\n- RenkAdi: İplik depo hareket yapılan hammaddenin renk adını belirtir.\n- Cins: İplik depo hareket yapılan hammaddenin cinsini belirtir. Örneğin; polyester, pamuk, viskon vb.\n- DepoAdi: Hangi fiziksel depoda saklandığını ifade eder. Çok lokasyonlu depo sistemlerinde konum yönetimi sağlar.\n- Koordinat: Depo içinde ipliğin fiziksel yerini tanımlar. Genellikle raf sistemine göre tanımlanır (örnek: A2-RF3).\n- Kalite: Depo hareketindeki hammaddenin kalite sınıfını belirtir. Örneğin: A Kalite, 2. Kalite, Fire gibi üretim uygunluğuna göre sınıflamalar içerir.\n- UstGrup1: İpliğin ait olduğu birinci seviye kategori veya ana grup.\n- UstGrup2: İpliğin ait olduğu ikinci seviye kategori (UstGrup1’in alt grubu).\n- LotNo: Depo hareketine ait hammaddenin lot (parti) numarasını belirtir.\n- Sonil: Depo hareketindeki ipliğin şönil li iplik olup olmadığını belirtir.\n- Miktar: Depo hareketindeki ipliğin hareket miktarını ifade eder. Depo çıkışı yapılıyorsa Çıkış Miktarını, Depo girişi yapılıyorsa Giriş Miktarını ifade eder.\n- IIENo: Hangi imalat emri üzerinden sisteme geldiğini ifade eder. AI_Iplik_ImalEmri_Durum tablosu ile ilişkilidir.\n- FasonSipNo: Hangi fason sipariş üzerinden sisteme geldiğini ifade eder. AI_Iplik_FasonSiparis_Durum tablosu ile ilişkilidir.\n- GirenKullanici: Depo hareketi yapan kullanıcının adını gösterir.\n- Kayit_Kimin: Depo hareketin hangi şirkete (holding, birim) ait olduğunu belirtir.\n- Aciklama: Depo Hareketine ait Açıklama bilgisini gösterir\n- HrkTuru: Ç olanlar Depo Çıkışları G harfi olanlar Depo Girişleri ifade etmektedir. \n\n14. Tablo: AI_Iplik_Ihtiyac_Listesi\n\nGenel Tanım: \nAI_Iplik_Ihtiyac_Listesi tablosu, kumaş siparişleri doğrultusunda ihtiyaç duyulan iplik miktarlarını takip eden temel veri kaynağıdır. Bu tablo, belirli kumaş siparişlerinin hangi iplik türlerini (atkı, çözgü, hav) ve miktarlarını gerektirdiğini gösterir. İhtiyaçların karşılanma durumu, tahmini teslim tarihleri ve iplik tipi gibi önemli bilgilerle, üretim ve tedarik süreçlerinin daha verimli yönetilmesine yardımcı olur. \n\nSütun Tanımları ve Anlamları:\nIhtiyacID: Kumaş siparişinden doğan iplik ihtiyacı için verilen benzersiz barkod numarasıdır. Her bir iplik ihtiyacı kaydının takibini sağlar.\nTarih: Hammadde ihtiyacı kaydının oluşturulduğu tarihtir. İhtiyaçların ne zaman doğduğunu ve kaydedildiğini belirler.\nGrup: Oluşan hammadde ihtiyacının tipi veya kategorisidir. Örneğin, atkı, çözgü veya hav gibi gruplar.\nIplikKodu: Oluşan hammadde ihtiyacının belirli bir iplik türüne ait sistemsel kodudur. Bu, hangi iplik türünün gerektiğini belirtir.\nMiktar: Oluşan hammadde ihtiyacının miktarını belirtir. İhtiyaç duyulan iplik miktarının kilogram veya diğer ölçü birimindeki değerini ifade eder.\nAtamaMik: Karşılanan hammadde ihtiyacını belirtir. Hangi miktar ihtiyacın tedarik edildiğini gösterir.\nAtamaBakiye: Henüz karşılanmamış olan iplik ihtiyacını ifade eder. Yani, henüz tedarik edilmemiş miktarı belirtir.\nKapanmaTarihi: Hammadde ihtiyacının tamamının karşılanması durumunda, ihtiyacın kapanma tarihini ifade eder. Tedarik süreci tamamlandığında bu tarih belirlenir.\nTeorikIplikTermin: Hammadde ihtiyacının karşılanması planlanan tarihtir. İhtiyacın ne zaman tamamlanacağına dair tahmini teslim tarihini belirtir.\nSiparisNo: Kumaş siparişine ait benzersiz numaradır. Her siparişin takibi için sistem tarafından otomatik olarak atanır.\nFirmaAdi: Kumaş siparişi veren firmanın ticari adıdır. Hangi firmaya ait bir sipariş olduğunu belirtir.\nKaliteKodu: Kumaşın kalite kodunu belirtir. Bu alan, kalite sınıflandırması yapmak için kullanılır ve AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\nKaliteAdi: Kumaşın kalitesine verilen ticari veya teknik adıdır. Kullanıcıların kumaş kalitesini anlaması için açıklayıcı bir ad sağlar.\nDesenNo: Kumaş siparişine ait benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\nDesenAdi: Kumaş siparişine ait benzersiz desen adıdır. Bu ad tasarımcı tarafından verilen isim veya sistemde kayıtlı olan ad olabilir.\nVaryantNo: Aynı desenin farklı renk kombinasyonlarını ayırt etmek için kullanılan varyant numarasıdır.\nProsesKodu: Kumaşın üretim sürecinde geçtiği işlemleri tanımlayan koddur. Bu, kumaşın boyama, apre, yıkama gibi işlemlerden geçtiği rotayı gösterir.\n\n15. Tablo: AI_Kumas_Siparis_Paz_Listesi\n\nGenel Tanım:\nAI_Kumas_Siparis_Paz_Listesi tablosu, pazarlama birimi tarafından oluşturulan kumaş siparişlerinin tüm süreç bilgilerini içeren bir referans tablosudur. Bu tablo, siparişin türünden, müşteri temsilcisine, kalite tanımlarından, çözgü yapısı ve cağar kodlarına kadar geniş bir yelpazede teknik ve ticari detayları barındırır. Siparişin üretime geçiş durumu, müşteri talepleri ve üretimle koordinasyon sağlanabilmesi için kritik bir kaynaktır. Ayrıca, sipariş sürecinin her aşamasını takip etmeye olanak tanır, böylece üretim hazırlığı ve siparişin gerçekleştirilmesi arasında bağlantı kurar.\n\nSütun Tanımları ve Anlamları:\n- SiparisNo: Kumaş Siparişin fişine ait sistemde otomatik oluşturulan benzersiz numarasıdır. Siparişlerin takibi ve raporlanması için kullanılır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, firma bazlı raporlama ve analizler için kullanılır. AI_Tanim_Firma_Listesi tablosu ile ilişkilidir.\n- SipTarihi: Kumaş siparişin verildiği tarihi belirtir. Siparişin zamanlamasını ve teslimat takibini sağlamak için önemlidir.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- Ulke: Kumaş siparişi veren firmanın kayıtlı olduğu ülkeyi belirtir. Siparişlerin yerel ve uluslararası takibini sağlar.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır. \n- ProsesKodu: Kumaş siparişine ait kumaşın üretim sürecinde geçtiği işlemleri rotasını tanımlayan koddur. Örneğin; boyama, apre, yıkama gibi işlemler.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- Kompozisyon: Kumaş siparişi verilen kumaşta kullanılan hammadde yüzdelerini belirtir. \n- CozKodu: Kumaş siparişi verilen kumaştaki çözgü kodunu belirtir.\n- CozAdi: Kumaş siparişi verilen kumaştaki çözgü adını belirtir.\n- CagarKodu: Kumaş siparişi verilen kumaştaki cağarlık kodunu belirtir. Sadece Kadife olan Kalite Tipleri için geçerlidir.\n- UretimeGecti: Kumaş siparişin süreç olarak müşteriden alındığını ancak üretime geçip geçmediğini belirten sütundur. Siparişin üretim aşamasına ne zaman geçtiğini takip eder.\n- SipMiktar: Kumaş sipariş verilen kumaşın sipariş miktarını ifade eder. Bu, üretim sürecindeki siparişin büyüklüğünü belirler.\n- Kayit_Kimin: Kumaşın hangi firmaya ait olduğunu gösterir. Bu, tedarikçi ya da müşteri bazlı sahiplik bilgisini içerir.\n\n16. Tablo: AI_Kumas_Siparis_Listesi\n\nGenel Tanım:\nAI_Kumas_Siparis_Listesi tablosu, pazarlama biriminde yazılan kumaş siparişlerinin üretim sürecine alınmış siparişlerin temel veri kaynağıdır. Tabloda, kumaş sipariş edilen kumaşın kalite adı, desen adı, varyantı, sipariş metrajı, siparişin mevcut durumu ve termin tarihleri gibi bilgileri içerir. Ayrıca, kumaş siparişin hangi aşamada olduğu (örneğin: sanalda, üretimde, depoda, aprede) ve kumaş siparişin tamamlanıp tamamlanmadığı gibi bilgiler de bu tabloda yer almaktadır. Bu yapı, kumaş siparişlerin takibi ve üretim süreçlerinin verimli yönetilmesi için kritik öneme sahiptir.\n\nSütun Tanımları ve Anlamları:\n- SiparisNo: Kumaş siparişin sistemdeki benzersiz numarasıdır. Her siparişin takip edilmesi ve raporlanması için kullanılır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- SiparisYeri: Kumaş siparişin açıldığı yeri belirtir. Örneğin: üretimde, depoda aprede veya sanalda\n- SiparisSekli: Kumaş siparişin alım şekli belirtir. Örneğin: regüle (seri üretim), kesmece, sanal, contract (sözleşmeli), parti gibi sipariş türleri bulunur.\n- SiparisGrubu: Kumaş siparişin üretim şeklini belirtir. Örneğin: express (hızlı teslimat), 2. kalite, normal sipariş gibi kategoriler.\n- SipTarihi: Kumaş sipariş verildiği tarihtir. Siparişin zamanlamasını ve teslimatın takibini sağlar.\n- TerminTarihi: Kumaş siparişin genel termin tarihidir. Kumaş sipariş edilen kumaşın, üretim sürecinde tamamlanıp teslim edilmesi planlanan tarihi ifade eder.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- SatisBolgesi: Kumaş siparişi veren firmanın satış bölgesini belirtir. Örneğin: Orta Doğu, Avrupa, İç Anadolu gibi coğrafi bölgeler.\n- Ulke: Kumaş siparişi veren firmanın ülkesini belirtir. Siparişin kaynağını ve coğrafi takibini sağlar.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır. \n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KapKaliteGrubu: Kumaş siparişi verilen kumaşın ait olduğu teknik kalite grubunu belirtir. Örneğin; örme, 4800 class, 9600 gibi üretim gruplarını içerir.\n- ApreIslemiTipi: Kumaş siparişi verilen kumaşın hangi apre işlemine tabi tutulduğunu belirtir. Örneğin; boyama, proses, dijital baskı gibi işlemleri kapsar.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- CozKodu: Kumaş siparişi verilen kumaştaki çözgü kodunu belirtir.\n- CozAdi: Kumaş siparişi verilen kumaştaki çözgü adını belirtir.\n- SipMiktar: Kumaş sipariş verilen kumaşın sipariş miktarını ifade eder. Bu, üretim sürecindeki siparişin büyüklüğünü belirler.\n- ProsesKodu: Kumaş sipariş verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan koddur. Örneğin; boyama, yıkama, apre gibi işlemler.\n- TeorikYuklemeTarihi: Kumaş siparişi verilen kumaşın teorik olarak sevk edilmesi planlanan tarih bilgisidir. Sevk planlamasında önemli bir referans tarihidir.\n- Kapandi: Kumaş siparişin tamamlanıp tamamlanmadığını belirten durum bilgisidir. (Evet/Hayır, 1/0 gibi mantıksal veri içerir.)\n\n17. Tablo: AI_Dokuma_IsEmri_Listesi\n\nGenel Tanım:\nAI_Dokuma_IsEmri_Listesi tablosu, kumaş üretim sürecinde yapılan dokuma iş emirlerinin tüm detaylarını içerir. Her bir iş emri, kumaş siparişine dayalı olarak başlatılır ve tablonun içeriği, bu iş emirlerinin zaman çizelgesi, kalite bilgileri, kullanılan materyaller ve üretimle ilgili teknik parametreleri kapsamlı bir şekilde takip eder. Bu tablo, üretim planlaması, kalite kontrolü, dokuma takibi ve süreç izlenebilirliği açısından kritik bir veri kaynağıdır.\n\nSütun Tanımları ve Anlamları:\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- Tarih: Dokuma iş emrinin tanımlandığı tarihtir.\n- SiparisNo: Dokuma iş emri ait sistemdeki benzersiz numaradır.\n- FirmaAdi: Dokuma iş emri veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- TezgahNo: Dokuma iş emrinin dokunacağı veya örüleceği tezgahın numarasını belirtir.\n- PUrBasTar: Dokuma iş emrinin üretime başlama tarihidir.\n- PUrBitTar: Dokuma iş emrinin üretime bitiş tarihidir.\n- PlanMetraj: Dokuma iş emrinin plan metresidir.\n- ToplamHamMetre: Dokuma iş emrine ait üretimi yapılıp ham kalite kontrolde sarılmış toplam metredir.\n- Kalite: Dokuma iş emri verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Dokuma iş emri verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- KaliteTipi: Dokuma iş emri verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- DesenNo: Dokuma iş emri ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Dokuma iş emri ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: KDokuma iş emri ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- CozKodu: Dokuma iş emri verilen kumaştaki çözgü kodunu belirtir.\n- CozAdi: Dokuma iş emri verilen kumaştaki çözgü adını belirtir.\n- CagarKodu: Dokuma iş emri verilen kumaştaki cağarlık kodunu belirtir.\n- ProsesKodu: Dokuma iş emri verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Durumu: Dokuma iş emrinin son durumunu gösterir.\n\n18. Tablo: AI_Apre_HamToplar_Listesi\n\nGenel Tanım:\nAI_Apre_HamToplar_Listesi tablosu, üretim sürecindeki ham kumaşlara ait kalite, desen, varyant, iş emri ve üretim aşamalarına dair teknik bilgileri kayıt altına alır. Kumaşın ham kalite ve desen bilgileri, iş emri numarası, ölçülen metrajı ve üretim sırasında (iğneleme, apre gibi) oluşan fire miktarları gibi kritik veriler bu tabloda yer alır. Ayrıca kumaşta tespit edilen hataların tanımı da bu yapı içinde tutulur. Ham kumaşın üretim ve işlem geçmişini izlemek, kalite kontrol ve stok planlama gibi süreçlerde referans olarak kullanılır.\n\nSütun Tanımları ve Anlamları:\n- TopID: Ham kumaşa ait atanan benzersiz kimlik ID bilgisidir.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- TezgahNo: Dokuma iş emrinin dokunacağı veya örüleceği tezgahın numarasını belirtir.\n- K_Tarih: Ham kumaş sarım yapılıp metrelendiği tarihi belirtir.\n- SiparisNo: Kumaş siparişine ait sistemdeki benzersiz numaradır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- CozAdi: Kumaş siparişi verilen kumaştaki çözgü adını belirtir.\n- AprePartiNo: Ham kumaşın apre işlemi sırasında kullanılan benzersiz (uniq) parti numarasıdır.\n- HamMetre: Ham kumaşın sarılmasından sonra ham metraj bilgisini belirtir (metre cinsinden).\n\n19. Tablo: AI_Apre_MamulToplar_Listesi_Kalite\n\nGenel Tanım:\nAI_Apre_MamulToplar_Listesi_Kalite tablosu, firma tarafından üretilen kumaşların son kontrollerinin yapıldığı mamül sarım makinelerinden alınan verileri içerir. Bu tablodaki sütunlar, kumaşın kalite durumu, metre bilgisi, kalite desen ve varyantı gibi kritik verileri içerir.\n\nSütun Tanımları ve Anlamları:\n- TopID: Mamul kumaşa sistem tarafından atanan benzersiz kimlik ID bilgisidir.\n- KontrolTarihi: Mamul kumaşın kontrol edildiği tarih bilgisini içerir.\n- HamID: Ham kumaşın ham sarımında tüm topa atanan benzersiz (uniq) koddur.\n- SiparisNo: Kumaş siparişe ait benzersiz numaradır. Sistem tarafından tanımlanır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- K_Tarih: Mamul kumaşın sarıldığı tarihtir.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- K_Kont: Mamul kumaşı kontrol eden operatörün adını belirtir.\n- K_En: Mamul kumaşın kontrol esnasında ölçülen kumaş enini belirtir.\n- K_grm: Mamul kumaşın gramaj bilgisini (g/m²) ifade eder.\n- K_Kalite: Mamul kumaşın kalite durumunu belirtir. Örneğin: 1. Kalite, İç Piyasa, Sorunlu, Bekleme, Parti Hazırlama, Baskı, Tamir.\n- ReelKaliteDurumu: Mamul kumaşın kalite durumunu harf olarak derecesini belirtir (örneğin: A, B, C, D).\n- K_Kg: Mamul kumaşın kontrol sırasında ölçülen kumaş kilosunu belirtir.\n- Net_Mt: Mamul kumaşın ölçülen net uzunluğunu (metre cinsinden) belirtir.\n- Isk: Mamul kumaş üzerindeki hatalı bölgelerin toplam uzunluğunu belirtir. Bazı hatalar noktasal bazı hatalar sürekli olabilir.\n- ParcaIskonto: Mamul kumaşın hatalı bölgelerden kesilerek çıkarılan parçaların toplam uzunluğunu belirtir.\n- ParcaMt: Mamul kumaştan alınan parçaların toplam uzunluğunu belirtir.\n- MknPayi: Mamul kumaşın kontrol makinesinde oluşan fire miktarını ifade eder.\n\n20. Tablo: AI_Apre_ReserveToplar_Listesi_Top\n\nGenel Tanım:\nAI_Apre_ReserveToplar_Listesi_Top tablosu, tekstil kumaş üretim sürecine dahil olan sipariş, kalite, firma ve sevkiyat bilgilerinin detaylı şekilde takibini sağlar. Tablo, her bir kumaşa ait kalite kodları, desen ve varyant bilgileri, teknik kalite grupları ve üretim süreçleri ile ilgili tanımlar içerir. Ayrıca, siparişin hangi firmaya ait olduğu, müşteri temsilcisi bilgisi, sipariş tarihi, yükleme yapılacak depo ve sevkiyat planlaması gibi lojistik bilgileri de yer alır. Bu yapı, üretim planlama, kalite yönetimi, müşteri hizmetleri ve depo operasyonları arasında bilgi bütünlüğü ve operasyonel izlenebilirlik sağlar.\n\nSütun Tanımları ve Anlamları:\n- ReserveID: Müşteri siparişlerinden oluşan mamul topların depoda hazır hale getirilmiş topların benzersiz fiş numarasıdır.\n- KayitEden: Rezerv kaydını oluşturan kullanıcının adını belirtir. Tedarikçi ya da müşteri olabilir.\n- TopID: Mamul kumaşın kumaşa sistem tarafından atanan benzersiz kimlik ID bilgisidir.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- SiparisNo: Kumaş siparişine ait benzersiz numaradır. Sistem tarafından tanımlanır.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Kayit_Kimin: Rezervin hangi şirkete ait olduğunu gösterir. ERP süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- K_Kalite: Mamul kumaşın kalite durumunu belirtir. Örneğin: 1. Kalite, İç Piyasa, Sorunlu, Bekleme, Parti Hazırlama, Baskı, Tamir.\n- GercekKalite: Mamul kumaşın kalite durumunu harf olarak derecesini belirtir (örneğin: A, B, C, D).\n- DepoYeri: Rezervin hangi depodan yükleneceğini belirtir. Depo adı veya kodu olabilir.\n- TeorikYuklemeTarihi: Rezervin sevk edilmesi planlanan tarih bilgisidir.\n\n21. Tablo: AI_Apre_CikisToplar_Listesi_Top\n\nGenel Tanım:\nAI_Apre_CikisToplar_Listesi_Top tablosu, tekstil kumaş üretim sürecine dahil olan sipariş, kalite, firma ve sevkiyat bilgilerinin detaylı şekilde takibini sağlar. Tablo, her bir kumaşa ait kalite kodları, desen ve varyant bilgileri, teknik kalite grupları ve üretim süreçleri ile ilgili tanımları içerir. Ayrıca, siparişin hangi firmaya ait olduğu, müşteri temsilcisi bilgisi, sipariş tarihi, yükleme yapılacak depo ve sevkiyat planlaması gibi lojistik bilgiler de yer alır. Bu yapı, üretim planlama, kalite yönetimi, müşteri hizmetleri ve depo operasyonları arasında bilgi bütünlüğü ve operasyonel izlenebilirlik sağlar.\n\nSütun Tanımları ve Anlamları:\n- KETSCekiNo: Mamul çıkış sevkiyat yapılan çıkışa ait benzersiz fiş numarasıdır.\n- KayitEden: Mamul çıkış sevkiyat kaydını oluşturan kullanıcının adını belirtir. Tedarikçi ya da müşteri olabilir.\n- TopID: Mamul kumaşın kumaşa sistem tarafından atanan benzersiz kimlik ID bilgisidir.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- SiparisNo: Kumaş siparişine ait benzersiz numaradır. Sistem tarafından tanımlanır.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Kayit_Kimin: Mamul çıkış hangi şirkete ait olduğunu gösterir. ERP süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- K_Kalite: Mamul kumaşın kalite durumunu belirtir. Örneğin: 1. Kalite, İç Piyasa, Sorunlu, Bekleme, Parti Hazırlama, Baskı, Tamir.\n- GercekKalite: Mamul kumaşın kalite durumunu harf olarak derecesini belirtir (örneğin: A, B, C, D).\n- DepoYeri: Mamul çıkış sevkiyat hangi depodan yükleneceğini belirtir. Depo adı veya kodu olabilir.\n- TeorikYuklemeTarihi: Mamul çıkış sevkiyat sevk edilmesi planlanan tarih bilgisidir.\n\nSenin görevin, kullanıcıdan gelen doğal dildeki istekleri okuyarak sadece Microsoft SQL Server 2012 için çalıştırılabilir düz SQL sorguları üretmektir.\n\n‼️ Kurallar:\n\n1. Sadece saf SQL sorgusu döndür. \n2. Açıklama, yorum, bilgi, örnek, yönlendirme yazma. \n3. SELECT cümlesi oluştururken seçilen her sütun yeni bir satırda yer almalıdır. \nÖrneğin; SELECT TOP 10 \n SiparisNo, \n FirmaAdi, \n SiparisYeri, \n SiparisSekli, \n SiparisGrubu, \n SipTarihi, \n TerminTarihi, \n MusTemsilcisi\nFROM AI_Kumas_Siparis_Listesi\nORDER BY SipTarihi DESC;\n5. SET DATEFORMAT 'DMY'; ile başla. \n6. SELECT * kullanma, sadece gerekli sütun adlarını yaz. \n7. BETWEEN kullanarak tarih aralığı belirt. \n8. Kullanıcının istediği bilgiye uygun tabloyu sadece aşağıdaki şemadan seç:\n9. SQL dışı açıklama, yorum, markdown, metin yazarsan hata oluşur. \n10. PIVOT sorgularda DISTINCT ifadesi kullanılmayacak.\n" + "systemMessage": "- Veritabanı Şeması:\n\n1. Tablo: AI_Tanim_Iplik_Listesi\n\nGenel Tanım: \nTekstil üretiminde kullanılan tüm iplik ve iplik bazlı hammaddelerin sistemsel olarak tanımlandığı bir master veri tablosudur. Bu tablo; hammaddeye dair teknik, yapısal, sınıflayıcı ve süreçsel tüm bilgileri merkezi bir yapıda saklar ve üretimden satın almaya kadar birçok sistem modülüyle ilişkilidir.\n\nSütun Tanımları ve Anlamları:\n- IplikKodu: Tanımlı olan hammaddenin sistemsel hammadde kodunu belirtir.\n- RenkAdi: Tanımlı olan hammaddenin renk adını belirtir.\n- RenkKodu: Tanımlı olan hammaddenin sistemde tanımlı renk kodudur.\n- Renk: Tanımlı olan hammaddenin renk numarasını belirtir.\n- Cins: Tanımlı olan hammaddenin cinsini belirtir. Örneğin; polyester, pamuk, viskon vb.\n- Numara: Tanımlı olan hammaddenin numarasını belirtir. Hammaddenin kalınlığını veya inceliğini ifade eder (örneğin: 2 numara iplik, 30/1 Ne vb.).\n- Birim: Tanımlı olan hammaddenin numara birim bilgisini belirtir (örneğin: Nm, NeB, den).\n- Nm: İpliğin numarasını ifade eden metrik sistemdeki (Nm) numarasıdır. Bu değer, 1 gram iplikten kaç metre elde edilebileceğini gösterir. Numara büyüdükçe iplik incelir.\n- KompozisyonKisaltmasi: Hammaddenin kompozisyon yüzdelerinin belirtir. (örneğin; %90 PAN %10 PES, %100 PES, %100 RPET)\n- IplikKisaltmasi: Tanımlı olan hammaddenin sistemsel kısaltılmış hammadde kodunu belirtir.\n- UstGrup1: Hammaddenin bulunduğu ana grubu ifade eder.\n- UstGrup2: Hammaddenin ait olduğu ana grubun bir alt grubudur.\n- Tarih: Hammadde tanımlamasının yapıldığı tarihtir.\n- InsertUser: Hammadde tanımlamasını yapan kullanıcıyı belirtir.\n- IsikHasligi: Hammaddenin ışığa karşı dayanıklılık seviyesini (haslık derecesi) belirtir.\n- Bukum: Hammaddenin büküm şekli hakkında bilgi verir (örneğin: S, Z, çift büküm).\n- OrtBobinKg: Ortalama bir bobin hammaddenin kilogram cinsinden ağırlığını belirtir.\n- NumuneKodu: Hammadde tanımlamasından önce numune olarak tanımlandığındaki iplik numune kodunu belirtir.\n- NumuneOnayTarihi: Hammadde numunesinin onaylandığı tarihi belirtir. Numune onaylandıktan sonra regüle iplik tanımlanır.\n- UrunHizmetGrubu: Hammadde tanımının hizmet grubunu belirtir. Örneğin: iplik, kumaş, aksesuar vb.\n- HamMamul: Hammaddenin üretim aşamasını ifade eder. (YARI MAMÜL İPLİK, MAMÜL İPLİK, HAM İPLİK)\n- IplikKullanimDurumu: Hammadde tanımının mevcut durumunu belirtir (örneğin: Aktif, Pasif).\n- HammaddeTipi: Tanımlı olan hammaddenin tipini belirtir. (CİPS, İPLİK, ELYAF, JOKER İPLİK, POLİP BOYA)\n\nFonksiyonel Amaçlar ve İlişkiler\n- Bu tablo, üretim emirlerinde hammadde seçimi, satın alma planlaması ve depo kontrol gibi birçok süreçle ilişkilidir.\n- IplikKodu anahtar alan olarak diğer tablolarla (örneğin AI_Iplik_SatinalmaSiparis_Durum) join ilişkisinde kullanılır.\n- KompozisyonKisaltmasi, kalite hesaplamaları, üretim reçeteleri ve stok analizlerinde kullanılır.\n- NumuneOnayTarihi, numuneden regüleye geçişin kritik eşiğidir.\n\n2. Tablo: AI_Tanim_Kalite_Listesi\n\nGenel Tanım: \nAI_Tanim_Kalite_Listesi, firmanın ürün gamında yer alan kumaş kalitelerinin detaylı tanımlarını içeren referans tablosudur. Bu tablo, kumaşların üretimsel, teknik ve ticari sınıflandırmalarının yapıldığı üst seviye bilgi kaynağıdır. Kalite; çözgü/atkı özellikleri, iplik tipi, ambalaj biçimi, uygulanan proses ve kullanım cinsine kadar birçok parametre ile tanımlanır ve tüm üretim & stok yönetimi süreçlerinin çekirdek bileşeni olarak kullanılır.\n\nSütun Tanımları ve Anlamları:\n- KaliteKodu: Kumaş kalitesini ifade eden akıllı kodlama yapısı ile belirtilmiş benzersiz bir tanımlama koddur. \n- KaliteAdi: Kumaşın kaliteye verilmiş ticari veya teknik adını belirtir. Kullanıcıya daha anlaşılır bir kalite tanımı sunar.\n- AsilKaliteAdi: Kalitenin bağlı olduğu bir üst kalite adını belirtir. \n- KaliteTipi: Kalitenin genel sınıfını belirtir. Bu tip kalitenin üretim değer farklılıklarını, üretim şekillerini ve teknik yapısını da ifade eder. Örneğin; ÖRME, ÜRETİM, YATAK YÜZÜ, KADİFE, YUVARLAK ÖRME \n- KaliteCinsi: Kalitenin genel kullanım amacına göre ait olduğu grubu tanımlar. Örneğin; standart, recycle, outdoor, easy life, prive gibi kalite cinslerini belirtir.\n- KapKaliteGrubu: Kalitenin ait olduğu teknik kalite grubunu belirtir. Örneğin; örme, 4800 class, 9600, 1056 gibi üretim gruplarını içerir.\n- AmbalajSekli: Kaliteye bağlı olarak üretilen kumaşların nasıl ambalajlanacağını belirtir. Örneğin; shrink, baloncuk gibi ambalaj türleri içerir.\n- ApreIslemiTipi: Kumaşın kalite sürecinde hangi apre işlemine tabi tutulduğunu belirtir. Örneğin; boyama, proses, dijital baskı gibi işlemleri kapsar.\n- AtkliSikligi: Kumaşın kalitesine bağlı olarak 1 cm de kullanılan atkı (enine iplik) iplik adedini - sıklığını belirtir. Bu değer, kalitenin dokuma yoğunluğu hakkında bilgi verir.\n- CozguSikligi: Kaliteye bağlı olarak 1 cm de kullanılan çözgü (boyuna iplik) iplik adedini - sıklığını ifade eder. Kumaşın teknik özelliklerini belirleyen temel parametrelerden biridir.\n- CozguTelAdedi: Kaliteye bağlı olarak kullanılan toplam çözgü tel adedini belirtir. Kumaşın yoğunluğu ve dayanıklılığı ile doğrudan ilişkilidir.\n- İplikCinsi: Kalitenin için de kullanılan çözgü ipliğinde kullanılan iplik türünü belirtir. Örneğin; polyester, pamuk, viskon gibi iplik cinsleri bu alanda yer alır.\n- ProsesKodu: Kalitenin üretim sürecinde geçtiği işlemleri tanımlayan koddur. Apre dairesinde yapılan rota olarak ta belirtilebilir. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Kayit_Kimin: Kalitenin hangi şirkete ait olduğunu gösterir. Erp süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- Tanimlayan: Kalite tanımını yapan kişiyi kullanıcı adını belirtir. \n- Tarih: Kalite tanımlamasının yapıldığı tarihtir.\n\nFonksiyonel Amaçlar ve İlişkiler\n- Kalite, kumaşın en temel referans kimliğidir. Tüm üretim, satış, stok ve sevkiyat tablolarıyla birebir ilişkilidir.\n- KaliteKodu, tablolar arasında anahtar niteliğindedir (örn. AI_Tanim_Kumas_Listesi, AI_Kumas_Siparis_Paz_Listesi, AI_Dokuma_IsEmri_Listesi).\n- KapKaliteGrubu ve KaliteTipi teknik/üretim ayrımı yaparken, KaliteCinsi pazarlama segmentasyonu sağlar.\n- AtkliSikligi, CozguSikligi, CozguTelAdedi gibi parametreler üretim reçetelerinde kritik teknik girdilerdir.\n- ApreIslemiTipi, kalitenin işlemsel farklarını yansıtır, kalite kontrol süreçlerini doğrudan etkiler.\n\n3. Tablo: AI_Tanim_Cozgu_Listesi\n\nGenel Tanım:\nAI_Tanim_Cozgu_Listesi, tekstil üretiminde kumaşların çözgü yapılarını tanımlayan teknik ve sınıflayıcı bilgileri içeren referans tablosudur. Dokuma reçetelerinin oluşturulması, kalite kontrol süreçlerinin yönetilmesi ve kumaş varyant eşleşmelerinin doğru yapılabilmesi için kritik rol oynar. Çözgü, bir kumaşın üretim mimarisindeki iskelet yapıdır ve bu yapı sistematik şekilde burada tariflenir.\n\nSütun Tanımları ve Anlamları:\n- CozKodu: Kumaşın dokunmasında kullanılan dikey ipliklerini oluşturan ipliklerin çözgü tanımına ait teknik ve benzersiz tanımlama kodudur. Bu kod, üretim takibi, çözgü reçeteleri ve kalite kontrol süreçlerinde referans olarak kullanılır.\n- CozAdi: Kumaşın dokunmasında kullanılan dikey ipliklerini oluşturan ipliklerin çözgü tanımına ait teknik tanımlama adıdır. Çözgü yapısını tanımlar ve kumaşın üretim sürecindeki yerini belirlemede kullanılır. \n- CozguGrubu: Tanımlı olan çözgünün üst çözgü adıdır. Yoğunlukla CozAdi sütunu değerlerini içerir.\n- CozTipi: Tanımlı olan çözgünün çalışabileceği tezgah tipini ve dokuma yapısını belirtir. Örneğin; jakarlı, armürlü gibi dokuma yapılarını tanımlar.\n- CozguTuru: Kullanılan çözgünün Numunemi, Blanket veya Regüle olup olmadığını belirtir. \n- TelAdet: Çözgüde kullanılan toplam tel adedini ifade eder.\n- CozSiklik: Çözgü sıklığını belirtir. Yani 1 cm den geçen çözgü iplik adedi - sıklığını gösterir.\n- CozEni: Çözgü sisteminin kumaş üzerindeki eni (genişliği) bilgisini ifade eder.\n- KaliteTipi: Çözgünü çalışabileceği kumaşların kalite tipini belirtir. Örneğin; ÖRME, ÜRETİM, YATAK YÜZÜ, KADİFE, YUVARLAK ÖRME \n- KaliteGrubu: Çözgünün çalışabileceği kumaşların kalite grubunu belirtir. Örneğin; 4800, 9600 gibi teknik gruplar.\n- KoleksiyonTipi: Kumaş koleksiyonunun genel mi yoksa müşteriye özel mi olduğunu belirtir.\n- Kompozisyon: Çözgüde kullanılan hammadde yüzlerini belirtir. Örneğin; %60 polyester, %40 pamuk gibi lif karışım bilgilerini içerir.\n- Tarih: Çözgünün tanımını yapan kişiyi kullanıcı adını belirtir.\n\nFonksiyonel Kullanım ve İlişkiler\n- CozKodu, çözgü-reçete bağlantılarında anahtar işlevi görür.\n- KaliteTipi, KaliteGrubu ile birlikte çözgülerin hangi ürün ailesine ait olduğunu belirtir.\n- CozTipi ve CozguTuru, üretim tipi ayrımında kritik bilgi sağlar.\n- TelAdet, CozSiklik, CozEni değerleri, dokuma optimizasyonu ve randıman hesaplamaları için kullanılır.\n- KoleksiyonTipi, müşteri taleplerine özel üretimlerin sınıflandırılmasını mümkün kılar.\n\n4. Tablo: AI_Tanim_Cagarlik_Listesi\n\nGenel Tanım:\nAI_Tanim_Cagarlik_Listesi, özellikle kadife tipi kumaşların üretiminde kullanılan cağarlık yapılarını tanımlayan temel veri tablosudur. Cağarlık; dokuma öncesinde çözgü ipliklerinin bobinler üzerine sarılmasıyla oluşan ve dokuma makinesine çözgü ipliklerini aktaran sistemdir. Bu yapı, dokumanın temel bileşeni olan çözgü sisteminin planlanması ve standartlaştırılması için kritik öneme sahiptir. Sistem içinde tanımlı her cağar, belirli bir iplik cinsi, rengi, tel sayısı ve bobin adediyle temsil edilir. Tablo, üretim reçeteleri, kalite takibi, stok yönetimi ve üretim verimliliği açısından cağarlıkların teknik izlenebilirliğini sağlar.\n\nSütun Tanımları ve Anlamları:\n- CagarNo: Cağara ait benzersiz kod bilgisini içerir.\n- CagarKodu: Cağarın sistemde tanımlı adını belirtir.\n- IplikKodu: Cağarda kullanılan ipliğin sistemsel kodunu belirtir.\n- Cins: İpliğin cinsini belirtir. Örneğin; polyester, pamuk, viskon vb.\n- RenkAdi: Kullanılan ipliğin renk adını belirtir.\n- TelAdedi: Cağarlıkta kullanılan ipliğin tel adedini ifade eder.\n- ToplamAdet: Cağarlıkta kullanılan toplam tel adedini gösterir.\n- Tarih_Tanimlama: Cağarlık tanımının yapıldığı tarihi belirtir.\n\nFonksiyonel Kullanım ve İlişkiler:\n- IplikKodu, AI_Tanim_Iplik_Listesi ile birebir eşleşir. Kullanılan ipliğin tüm teknik bilgilerine erişim sağlar.\n- CagarKodu, çözgü planlamasında veya dokuma reçetelerinde doğrudan çağrılan tanımlayıcıdır.\n- TelAdedi ve ToplamAdet, iplik tüketimi, stok yönetimi ve üretim planlamasında hesaplama girdisi olarak kullanılır.\n- RenkAdi ve Cins kombinasyonu, kalite kontrol ve üretim standardizasyonu açısından önemli eşleştirme parametreleridir.\n\n5. Tablo: AI_Tanim_Kumas_Listesi\n\nGenel Tanım:\nBu tablo, tekstil üretiminde kullanılan veya dışarıdan satın alınan tüm kumaşlara ait temel tanım ve teknik özelliklerin tutulduğu referans veri kaynağıdır. Kumaşların kalite, desen, varyant, çözgü yapısı, kompozisyonu ve üretim bilgileri gibi parametrelerini içerir. Üretim planlama, kalite kontrol, desen takibi ve stok yönetimi süreçlerinde merkezi rol oynar. Bu tablo, kumaş bazlı operasyonların bütüncül takibi için temel veri zemini sağlar.\n\nSütun Tanımları ve Anlamları:\n- KumasID: Tanımlanan her kumaşın veri tabanında saklanan benzersiz değeridir. Otomatik numara türünde olan bu değer her kumaş için tanımlayıcıdır. (primary key) \n- Kalite: Kumaş kalitesini ifade eden akıllı kodlama yapısı ile belirtilmiş benzersiz bir tanımlama koddur. AI_Tanim_Kalite_Listesi tablosundaki KaliteKodu sütunu ile ilişkilidir. \n- KaliteAdi: Kumaşın kaliteye verilmiş ticari veya teknik adını belirtir. Kullanıcıya daha anlaşılır bir kalite tanımı sunar. AI_Tanim_Kalite_Listesi tablosundaki KaliteAdi sütunu ile ilişkilidir. \n- AsilKaliteAdi: Kalitenin bağlı olduğu bir üst kalite adını belirtir. AI_Tanim_Kalite_Listesi tablosundaki AsilKaliteAdi sütunu ile ilişkilidir.\n- KaliteTipi: Kalitenin genel sınıfını belirtir. Bu tip kalitenin üretim değer farklılıklarını, üretim şekillerini ve teknik yapısını da ifade eder. Örneğin; ÖRME, ÜRETİM, YATAK YÜZÜ, KADİFE, YUVARLAK ÖRME\n- KumasGrubu: Kumaşın teknik veya tasarımsal açıdan üretilecek tezgah grubunu belirtir. Örneğin; Armürlü, Jakarlı, Dedektörlü, Jumbo vs. gibi sınıflandırmaları içerir.\n- KumasTuru: Kumaşın kullanım amacını tanımlar. Örneğin; numune, regüle (seri üretim), özel üretim gibi türleri ayırt etmek için kullanılır.\n- DesenNo: Kumaşa ait benzersiz desen numarasını belirtir. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaşa ait benzersiz desen adını belirtir. Tasarımcının verdiği isim ya da sistemde kayıtlı ad olabilir.\n- VaryantNo: Aynı desenin farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasını belirtir.\n- Kompozisyon: Kumaşın içeriğinde kullanılan hammadde yüzdelerini belirtir. Örneğin; %60 polyester, %40 pamuk gibi lif karışım bilgilerini içerir.\n- CozKodu: Kumaşta kullanılan çözgü ipliğine ait sistemsel veya teknik kodu belirtir. Bu kod, üretim takibi, çözgü reçeteleri ve kalite kontrol süreçlerinde referans olarak kullanılır.\n- CozAdi: Kumaşın dokunmasında kullanılan çözgü ipliğine verilen teknik adı ifade eder. Çözgü yapısını tanımlar ve kumaşın üretim sürecindeki yerini belirlemede kullanılır.\n- HamKg: Kumaşın ilk dokuma sonrası işlenmemiş, yani ham haliyle kilogram cinsinden ağırlığını belirtir.\n- MamKg: Kumaşın dokuma sonrası ve apre rotasından sonra mamul hale geldikten sonraki kilogram cinsinden ağırlığını belirtir.\n- ProsesKodu: Kumaşın geçtiği üretim veya işlem süreçlerini ifade eden rota kodu içerir. Örneğin; boyama, apre, yıkama gibi işlemleri gösterir.\n- UretimiDurdur: Tanımlı olan kumaşın nüretiminin devam edip etmediğini gösterir. Aktif üretim mi, durdurulmuş mu bilgisini taşır.\n- Kayit_Kimin: Kumaşın hangi şirkete ait olduğunu gösterir. Erp süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- Tanimlayan: Kumaşın tanımını yapan kişiyi kullanıcı adını belirtir. \n- Tarih: Kumaş tanımlamasının yapıldığı tarihtir.\n\nFonksiyonel Kullanım ve İlişkiler:\n- Kalite, KaliteAdi, AsilKaliteAdi sütunları kalite detay tabloları ile ilişkilidir.\n- CozKodu, CozAdi çözgü tanım tablosu ile (AI_Tanim_Cozgu_Listesi) ilişkili çalışır.\n- ProsesKodu, kumaşın üretim rotasının izlenmesinde kullanılır.\n- KumasTuru ve UretimiDurdur, üretim planlaması ve aktif üretim takip sistemi için filtreleme sağlar.\n- Kompozisyon, malzeme planlama ve kalite standardizasyonuna katkı sunar.\n\n6. Tablo: AI_Tanim_Firma_Listesi\n\nGenel Tanım:\nAI_Tanim_Firma_Listesi tablosu, kurumun ticari ilişkide bulunduğu tüm firmaların temel tanımlayıcı bilgilerini içerir. Bu firmalar; müşteri, tedarikçi, fason üretici ya da dış hizmet sağlayıcı olabilir. Erp süreçlerinde üretim, satın alma, satış ve sevkiyat gibi operasyonel iş akışlarında muhatap olarak tanımlanan firmaların sistemdeki kayıtlarını standardize etmek ve ilişkisel veri tabanında izlenebilirlik sağlamak amacıyla kullanılır.\n\nSütun Tanımları ve Anlamları:\n- FirmaKodu: Her firmaya sistem tarafından atanmış benzersiz tanımlayıcı koddur. Tüm diğer tablolarda firma bilgisiyle ilişki kurarken referans alınır.\n- FirmaAdi: Firmanın ticaret unvanıdır. İnsan tarafından okunabilir ve raporlamada görünen firma adıdır.\n- Tur: Firmanın sistemdeki işlevsel rolünü belirtir. Örnek değerler: müşteri, tedarikçi, fasoncu, apre tedarikçisi gibi. Operasyonların sınıflandırılmasını sağlar.\n- FirmaGrubu: Firma ile ilişkili yüksek seviye sınıflandırmadır. Örnek: yerli, yabancı, holding grubu gibi tanımlar sayesinde pazar analizleri ve tedarikçi segmentasyonu yapılabilir.\n- SirketAdi: Bu firma ile ilişkili olan şirket ya da Erp sistemindeki iş birimi bilgisini içerir. Çoklu şirket yapılanmalarında kurum içi ayrımı ifade eder.\n- Ulke: Firmanın faaliyet gösterdiği veya yasal olarak kayıtlı olduğu ülke bilgisidir. Dış ticaret, lojistik ve gümrük süreçleri için önemlidir.\n- SatisBolgesi: Firmanın coğrafi satış bölgesini tanımlar. Örnek: Avrupa, Orta Doğu, İç Anadolu. Pazarlama stratejilerinin bölgesel dağılım analizlerinde kullanılır.\n\nFonksiyonel Kullanım ve İlişkiler:\n- FirmaKodu, sistem genelinde sipariş, sevkiyat, stok, üretim veya satın alma tablolarında yabancı anahtar (foreign key) olarak kullanılır.\n- Tur ve FirmaGrubu, sistemde firma filtrelemelerinde, yetkilendirme yapılarında ve dashboard segmentasyonlarında kullanılır.\n- SirketAdi, kurum içi dağılımı göstererek firma-şirket ilişkisini şeffaf hale getirir.\n- Ulke ve SatisBolgesi sütunları dış ticaret ve ihracat/iç pazar ayrımlarında kritik rol oynar.\n\n7. Tablo: AI_Tanim_Tezgah_Listesi\n\nGenel Tanım:\nAI_Tanim_Tezgah_Listesi tablosu, firmanın üretim altyapısında yer alan tüm tezgahların teknik ve operasyonel özelliklerini kayıt altında tutar. Bu bilgiler sayesinde üretim planlaması, verimlilik ölçümü, performans analizi, bakım yönetimi ve kapasite değerlendirmesi gibi kritik karar destek süreçleri yürütülür. Tezgahlar fiziksel olarak üretimin kalbidir ve bu tablo, o kalbin nabzını dijital olarak izlemeyi sağlar.\n\nSütun Tanımları ve Anlamları:\n- TezgahKodu: Her bir tezgah için sistemde tanımlı olan benzersiz koddur. Diğer üretim tabloları (örneğin: iş emirleri, planlama) ile ilişki kurmak için anahtar alan olarak kullanılır.\n- En: Tezgahın kumaşı tek en (tek taraflı) mi, çift en (her iki taraflı) mi, üç en mi dokunacağı ve örüleceğini belirtir. Bu bilgi üretim tipi seçiminde kullanılır.\n- Markasi: Tezgahın üretici markasını belirtir. Örneğin: Dornier, Picanol, Smit gibi makine markaları olabilir.\n- Tipi: Tezgahın teknik kullanım tipini belirtir. Örneğin: saten, örme, yuvarlak örme gibi kumaş türüne göre ayrım yapar.\n- Cinsi: Tezgahın çalıştığı dokuma türünü tanımlar. Örneğin: jakarlı, armürlü, örme vb. Bu bilgi, kumaş türüyle uyum açısından kritiktir.\n- Grup: Tezgahın dahil olduğu tezgah grubunu ifade eder. Raporlama ve grup bazlı analizlerde kullanılır. Örneğin; Y13-Y16 tezgah grubunu ifade eder.\n- SubeAdi: Tezgahın fiziksel olarak bulunduğu şubenin adıdır. Özellikle birden fazla üretim tesisi olan firmalarda, lokasyon bazlı yönetim için önemlidir.\n- Konum: Tezgahın fiziksel olarak kaçıncı katta bulunduğu yer bilgisidir. (örnek: 1. Kat, 2. Kat, Boğaziçi vb.)\n- TarakEni: Tezgahın çalışabileceği maksimum kumaş genişliğini gösterir. (cm cinsinden)\n- ReelCozguTeli: Tezgahta fiilen kullanılan toplam çözgü teli adedidir. Kumaş yoğunluğu ve dokuma optimizasyonu açısından kritik bir parametredir.\n- MakinaDevri: Tezgahın ortalama çalışma hızı (rpm: devir/dakika) bilgisidir. Hız ve kalite dengesi bu alana bağlıdır.\n- OrtRandiman: Tezgahın belirli bir dönem için ölçülmüş ortalama verimlilik yüzde değeridir. Performans ölçümlerinde kullanılır.\n- GunlukTCalisma: Tezgahın günlük ortalama çalışma saat süre bilgisidir. Üretim kapasitesi analizlerinde referans alınır.\n- CalismaDurumu: Tezgahın mevcut durumu hakkında bilgi verir. Örnek değerler: Aktif, Pasif, Kapalı, Sanal olabilir.\n\nFonksiyonel Kullanım ve İlişkiler:\n- TezgahKodu, iş emri, üretim takibi ve planlama tablolarında foreign key olarak kullanılır.\n- Tipi, Cinsi ve Grup, kumaş türüne göre doğru tezgah atamasını yapabilmek için eşleştirme kriteridir.\n- TarakEni, ReelCozguTeli ve MakinaDevri gibi teknik sütunlar, randıman optimizasyonu ve rota planlamasında rol oynar.\n- CalismaDurumu ve OrtRandiman, bakım periyodu takibi ve yatırım planlamalarında analiz kriteridir.\n\n8. Tablo: AI_Iplik_SatinalmaSiparis_Durum\n\nGenel Tanım:\nAI_Iplik_SatinalmaSiparis_Durum tablosu, kumaş üretim süreci için tedarik edilen ipliklerin sipariş süreçlerine dair tüm kritik verileri içerir. Hangi ipliğin, hangi firmadan, ne zaman ve ne miktarda sipariş edildiğini gösterir. Tablodaki bilgiler, tedarik zinciri yönetimi, termin uygunluk takibi ve maliyet analizleri için kullanılmakta olup, satın alma planlaması ve stok giriş süreçlerinin temelini oluşturur. Ayrıca geciken siparişlerin, teslim edilen miktarların ve kalan ihtiyaçların takibi bu tablo üzerinden yapılır.\n\nSütun Tanımları ve Anlamları:\n- SiparisID: Her bir satın alma siparişinin sistemdeki benzersiz kimlik numarasıdır. Anahtar (primary key) alan olarak kullanılır.\n- SipNo: Satın alma siparişin sistem tarafından otomatik atanan takip numarasıdır. Operasyonel takibin yapılmasında referans niteliğindedir.\n- Tarih: Satın alma siparişin tarih bilgisini ifade eder.\n- GirisTarihi: Satın alma siparişin sisteme giriş yapıldığı tarihi gösterir.\n- FirmaAdi: Satın alma siparişi verilen ipliğin tedarik edildiği firma adıdır. AI_Tanim_Firma_Listesi ile ilişkilidir.\n- Kayit_Kimin: Satın alma siparişinin hangi şirkete ait olduğunu gösterir. Grup şirketleri veya çoklu organizasyon yapılarında ayrımı sağlar.\n- IplikKodu: Satın alma siparişi verilen ipliğin sistemsel kodudur. AI_Tanim_Iplik_Listesi tablosu ile ilişkilidir.\n- Cins: Satın alma siparişi verilen ipliğin cins bilgisidir. Örnek: polyester, pamuk vb. İplik sınıflandırmasında kullanılır.\n- Renk: Satın alma sipariş edilen ipliğin sistemsel renk kodudur.\n- RenkAdi: Satın alma renk alanının açıklayıcı adıdır. İnsan tarafından daha anlaşılır hale getirilmiş tanımıdır.\n- Miktar: Satın alma yapılacak olan ipliğin sipariş edilen miktarını belirtir.\n- GelenMiktar: Satın alma siparişinin teslim alınan miktarını gösterir. Satın alma siparişi farklı zamanlarda parçalı şekilde teslim alınabilir. Karşılaştırmalı analizlerde kullanılır.\n- TerminTarihi: Satın alma sipariş edilen ipliğin beklenen teslim tarihidir. Tedarik performans analizleri için önemlidir.\n- TerminUygunDurum: Siparişin zamanında teslim edilip edilmediğini belirtir. Zamanında teslimat KPI’si bu alandan hesaplanır.\n- BirimFiyati: Satın alma siparişindeki her bir ipliğin satın alma birim fiyatı içerir.\n- OdemeSekli: Ödeme para birimini ve KDV dahil mi belirtir. Döviz bazlı muhasebe işlemlerinde kullanılır.\n- TeslimatYeri: İpliğin teslim edilmesi gereken yeri lokasyonu tanımlar (örnek: Merkez Depo, Boyahane Girişi).\n- SiparisKapandi: Siparişin tamamlanıp tamamlanmadığını gösterir. (Evet/Hayır gibi değer alabilir)\n\n9. Tablo: AI_Iplik_ImalEmri_Durum\n\nGenel Tanım:\nAI_Iplik_ImalEmri_Durum tablosu, firmanın iplik üretim süreci kapsamında oluşturulan tüm imalat emirlerine ait detayları kayıt altına alır. Bu tablo, üretilecek ipliğin teknik tanımı, miktarı, kullanılan hammadde çıkışları, üretim girişi ve fire değerleri gibi üretimsel verileri içerir. Tablodaki bilgiler, üretim planlama, termin yönetimi, stok takibi, fire kontrolü ve üretim performans analizlerinde kritik rol oynar. Özellikle fason üretim süreçlerinde geri dönüşlerin takibi ve üretimle karşılaştırılması açısından merkezi bir kontrol mekanizması sunar.\n\nSütun Tanımları ve Anlamları:\n- ImID: Her imalat emrine sistem tarafından atanan benzersiz tanımlayıcıdır. (Primary key)\n- IIENo: İmalat emrinin sistemdeki takip numarasıdır. Operasyonel izleme ve raporlama süreçlerinde referans kod olarak kullanılır.\n- Tarih: İmalat emrinin sisteme kaydedildiği tarihi ifade eder. Zamansal raporlamalar için referans alınır.\n- FirmaAdi: İpliğin tedarik edildiği firma adıdır. Tedarikçi takibi ve performans ölçümünde kullanılır.\n- IplikKodu: Üretilmesi planlanan ipliğin sistemsel hammadde kodudur. AI_Tanim_Iplik_Listesi ile ilişkilidir.\n- Cins: Üretilmesi planlanan ipliğin cins bilgisidir. Örnek: polyester, pamuk vb. İplik sınıflandırmasında kullanılır.\n- UstGrup1: İpliğin ait olduğu ana ürün grubunu belirtir. Kategori bazlı sınıflandırmalarda kullanılır.\n- UstGrup2: İpliğin bağlı olduğu daha alt seviye grup bilgisidir.\n- Birim: Tanımlı olan hammaddenin numara birim bilgisini belirtir (örneğin: Nm, NeB, den).\n- RenkAdi: Üretilecek hammaddenin renk adını belirtir.\n- HarmanNo: Üretilen ipliğe ait harman (lot) numarasıdır. Takip, izlenebilirlik ve kalite kontrol süreçlerinde kullanılır. Depo girişi yapılırken hammaddenin lot numarası olarak kullanılır.\n- Miktar: İmal emri kapsamında üretilecek toplam iplik miktarını ifade eder. (kg bazında)\n- ELCikis: Elyaf olarak üretimden çıkan hammaddenin miktarını gösterir. Elyaf kullanımı ile ilgili hammadde çıkışlarını izlemek için kullanılır.\n- IPCikis: İmal emri üretimi için iplik işletmelerine gönderilen hammadde veya yarı mamül iplik miktarıdır. \n- HamMaddeCikis: ELCikis ve IPCikis toplamı olup, üretimde kullanılan toplam hammadde çıkışını ifade eder.\n- IPGiris: İmal emri için üretilmiş ve depoya girmiş olan ipliğin miktarıdır.\n- UretilenKg: İplik işletmelerinde imal emri için üretilmiş olan iplik miktarıdır. Bu bilgi sahadan toplanıyor olup depo girişi yapılma zorunluluğu bulunmamaktadır. \n- BakiyeKg: İmal emri oluşturulan miktardan henüz üretilmemiş, eksik kalan iplik miktarıdır.\n- Fire: Üretim sürecinde oluşan kayıp miktarıdır. (kg bazında)\n- TerminTarihi: İmalat emrinin üretiminin tamamlanmasının planlandığı tarih bilgisidir.\n- Senil: Üretilen ipliğin şönil li iplik olup olmadığını belirtir. (Evet/Hayır gibi değerler alır)\n\n10. Tablo: AI_Iplik_FasonSiparis_Durum\n\nGenel Tanım:\nAI_Iplik_FasonSiparis_Durum tablosu, firma dışı üretim yöntemi olan fason iplik siparişlerine ilişkin tüm verileri içerir. Bu yapı, dış üreticiye (fason firmaya) yaptırılan ipliklerin tedarik sürecini, miktarlarını, teslimat zamanlarını ve maliyetlerini izlemek amacıyla kullanılır. İplik üretiminin tamamının ya da bir kısmının dış kaynakla yürütüldüğü durumlarda, sipariş detaylarının sistematik takibini sağlar. Böylece satın alma ve üretim ekipleri, fason üretim performansını ölçebilir, stok kontrolü ve termin yönetimi yapabilir.\n\nSütun Tanımları ve Anlamları:\n- FasonSipNo: Her bir fason iplik siparişi için sistem tarafından oluşturulan benzersiz takip numarasıdır. Bu alan üzerinden fason siparişin tamamı izlenir.\n- Tarih: Fason siparişin sisteme kaydedildiği tarihi ifade eder. Operasyonel süreç takibi için önemlidir.\n- GirisTarihi: Fason siparişi Üretilen ipliğin firmaya fiziksel olarak giriş yaptığı tarih bilgisidir.\n- FirmaAdi: Fason üretimi gerçekleştiren tedarikçi firmanın ticari adıdır. AI_Tanim_Firma_Listesi tablosuyla ilişkilidir.\n- Kayit_Kimin: İlgili siparişin hangi şirket adına açıldığını belirtir. Çoklu şirket yapılanmalarında ayırıcı kimlik görevi görür.\n- IplikKodu: Fason siparişe konu olan ipliğin sistemdeki tanımlı hammadde kodudur. AI_Tanim_Iplik_Listesi ile ilişkilidir.\n- Cins: Fason sipariş edilen ipliğin cinsini belirtir. Örneğin; polyester, pamuk gibi sınıflandırmalar içerir.\n- Renk: Fason sipariş edilen ipliğin sistemsel renk kodudur. Teknik ve görsel ayrım açısından kullanılır.\n- RenkAdi: Fason sipariş edilen renk kodunun açıklayıcı adıdır. Kullanıcı dostu tanım sağlar (örneğin: Koyu Mavi, Krem).\n- Miktar: Fason sipariş edilen iplik miktarıdır. Genellikle kilogram (kg) cinsindendir.\n- GelenMiktar: Fason sipariş edilen ipliğin teslimat miktarını gösterir.\n- TerminTarihi: Fason siparişin üretilip teslim edileceği tarihi bilgisidir. Tedarik kontrolü ve teslimat uyum analizinde kullanılır.\n- BirimFiyati: Fason sipariş kapsamında iplik başına belirlenen birim fiyat bilgisidir. Maliyet analizleri için gereklidir.\n- OdemeSekli: Fason siparişin ödeme birimini belirtir. (Örn: TL, USD, EUR) Döviz cinsinden raporlama yapılabilmesi için gereklidir.\n- SiparisKapandi: Fason siparişin tamamlanıp tamamlanmadığını ifade eder. Evet/Hayır veya 1/0 gibi mantıksal veri içerir.\n\n11. Tablo: AI_Iplik_BoyahaneSiparis_Durum\n\nGenel Tanım:\nAI_Iplik_BoyahaneSiparis_Durum tablosu, dış kaynak (fason) üretim yoluyla boyahaneye verilen iplik siparişlerine ilişkin tüm operasyonel bilgilerin takip edildiği temel veri kaynağıdır. Bu yapı, boyahane süreçlerinde üretimi yapılan ipliklerin takibini kolaylaştırmak amacıyla oluşturulmuştur. Hangi iplik cinsinin, hangi renkte ve miktarda boyanmak üzere hangi firmaya ne zaman sipariş edildiğini kayıt altına alır. Ayrıca teslimat durumu, depoya giriş miktarı, termin tarihleri, kazan bilgisi gibi detaylar da tabloda tutulur. Tablodaki bilgiler sayesinde planlama, depo yönetimi, tedarikçi performans takibi ve stok kontrol süreçleri entegre biçimde yürütülür. Sipariş kabul durumu ve kalan miktar takibi gibi kontrol noktaları bu tablo üzerinden izlenebilir.\n\nSütun Tanımları ve Anlamları:\n- BoyahaneSipID: Boyahane siparişine ait sistemdeki benzersiz tanımlayıcı (ID).\n- SiparisNo: Boyahane sisteminden gelen senkron sipariş numarası.\n- BoyahaneSipNO: İplik siparişinin boyahaneye atanan sipariş numarası.\n- BoyaSiparisTarihi: Boyahane siparişinin oluşturulduğu tarih.\n- FirmaAdi: Boyahane siparişinin tedarikçi firmanın ticari adıdır. AI_Tanim_Firma_Listesi tablosuyla ilişkilidir.\n- IplikKodu: Boyahane siparişe konu olan ipliğin sistemdeki tanımlı kodu.\n- IplikCinsi: Boyahane Sipariş verilen ipliğin hammadde cinsi. Örn: polyester, pamuk vb.\n- RenkKodu: İpliğe ait sistemsel renk kodu.\n- RenkAdi: Boyahane Siparişi verilen hammaddenin renk kodunun açıklayıcı adıdır. Kullanıcı dostu tanım sağlar (örneğin: Koyu Mavi, Krem).\n- UstGrup1: İpliğin ait olduğu birinci seviye kategori veya ana grup.\n- UstGrup2: İpliğin ait olduğu ikinci seviye kategori (UstGrup1’in alt grubu).\n- KabulDurum: Boyahaneden alınan siparişin kabul edilme durumu.\n- Miktar: Toplam sipariş miktarı. (Tekrar KadifeSipMiktari ile aynı olabilir)\n- GirisMiktari: Depoya fiziksel olarak giren toplam iplik miktarı.\n- Aciklama: Boyahane Siparişine ilişkin özel not ya da açıklama alanı.\n- TerminTarihi: Boyahane siparişi için planlanan teslim tarihi.\n- KazanNo: Boyama işleminin yapıldığı kazan numarası.\n- Kayit_Kimin: Siparişin hangi şirkete (holding, birim) ait olduğunu belirtir.\n- Durum: Siparişin genel durum bilgisidir. (Aktif, pasif vb.)\n\n12. Tablo: AI_Iplik_Depo_Durum_Listesi\n\nGenel Tanım:\nAI_Iplik_Depo_Durum_Listesi tablosu, iplik depolarında bulunan tüm hammadde stoklarının detaylı ve anlık takibini sağlayan referans veri kaynağıdır. Bu tablo sayesinde ipliğin hangi renkte, hangi partide (lot), hangi firmadan temin edildiği ve fiziksel olarak depo içindeki konumu izlenebilir. Ayrıca hammaddenin üretim durumu, kalite sınıfı ve varsa boyahane süreciyle olan ilişkisi gibi kritik bilgiler sistematik olarak saklanır. İpliklerin depo miktarı, hangi iş emirlerine tahsis edildiği (rezerve miktar) ve geriye kalan kullanılabilir miktarı da bu yapı üzerinden yönetilir. Stok yönetimi, üretim planlama, lot bazlı izlenebilirlik ve depo içi yerleşim gibi süreçler için hayati öneme sahiptir.\n\nSütun Tanımları ve Anlamları:\n- IplikKodu: İpliğin sistemde kayıtlı olan teknik ve benzersiz hammadde kodudur. Malzeme takibi ve süreç ilişkilerinde anahtar rol oynar.\n- RenkAdi: Depoda bulunan ipliğin görsel tanımını sunan renk adıdır. Kullanıcıya daha anlaşılır bir renk bilgisi sağlar.\n- Cins: İpliğin hammaddesel türünü belirtir. Örnek: polyester, pamuk, viskon. İplik gruplaması ve kalite kontrol süreçleri için önemlidir.\n- LotNo: İpliğe ait üretim partisini (lot) belirtir. Aynı ipliğin farklı lotları fiziksel farklılık gösterebileceğinden izlenebilirlik açısından zorunludur.\n- FirmaAdi: İpliği tedarik eden veya üreten firmanın adıdır. Kendi üretimleri için genellikle “KADİFETEKS” sabit ifadesi kullanılır.\n- DepoAdi: Hangi fiziksel depoda saklandığını ifade eder. Çok lokasyonlu depo sistemlerinde konum yönetimi sağlar.\n- Ack: Depodaki ipliğe dair açıklayıcı not veya durum bilgisidir. Üretim aşaması, kalite dışı durumlar, iade, hasar gibi notları içerebilir.\n- Koordinat: Depo içinde ipliğin fiziksel yerini tanımlar. Genellikle raf sistemine göre tanımlanır (örnek: A2-RF3).\n- Kalite: Depodaki ipliğin kalite sınıfını belirtir. Örneğin: A Kalite, 2. Kalite, Fire gibi üretim uygunluğuna göre sınıflamalar içerir.\n- BanyoNo: Eğer iplik boya işleminden geçmişse, hangi reçeteyle boyandığını gösteren boyahane reçete numarasıdır. Boyanmış ipliklerin takibinde kritik veridir.\n- DepoMiktari: İpliğin depoda fiziksel olarak mevcut olan toplam miktarını (kg cinsinden) belirtir.\n- ReserveMiktari: Dokuma veya üretim iş emirlerine tahsis edilmiş (rezerve edilmiş) iplik miktarıdır. Bu miktar üretim için ayrılmış ama henüz kullanılmamış olabilir.\n- KalanDepoMiktari: Kullanılabilir net miktarı gösterir. Yani DepoMiktari - ReserveMiktari hesabıyla elde edilen, henüz tahsis edilmemiş kullanılabilir stok bilgisidir.\n\n13. Tablo: AI_Iplik_Depo_Hareket_Listesi\n\nGenel Tanım:\nAI_Iplik_Depo_Hareket_Listesi tablosu, iplik deposunda gerçekleşen tüm hareketlerin (giriş, çıkış, transfer, red vs.) ayrıntılı olarak takip edilmesini sağlar. Her bir hareket, iplik kodu, lot bilgisi, miktar, tarih, hangi kullanıcı tarafından işlendiği ve hareketin nedeni gibi operasyonel detayları içerir. Bu tablo, depo yönetimi, stok takibi, kalite kontrol ve red yönetimi gibi süreçlerde kritik rol oynar. Aynı zamanda fason ilişkili hareketlerin, üretim emirlerine bağlı giriş-çıkışların ve depo koordinat bilgilerinin izlenmesini sağlar. Parti bazlı ve detaylı izlenebilirlik için temel veri kaynağıdır.\n\nSütun Tanımları ve Anlamları:\n- IpDepoHrkSubID: İplik depo hareketi yapılan iplik için atanmış olan barkod numarasıdır.\n- FisNo: İplik depo hareket emrini ait fiş numarasıdır. Bu numara ile ipliklerin nereye ne zaman hareket edileceği belirlenir.\n- Tarih: İplik depo hareketine ait tarih bilgisini ifade eder. \n- FirmaAdi: İplik depo hareketine kayıtlı olan firmanın ticari adını belirtir. Depo girişi yapılırken tedarikçi, Depo çıkışı yapılırken müşteri olarak değerlendirilir.\n- HarSebebi: İpliğin depo haretinin ne amaçla yapıldığını açıklar. Satın alma, Üretime çıkış, Devir, Sayım vb.\n- IplikKodu: İplik depo hareket yapılan hammaddenin sistemsel kodunu belirtir.\n- RenkAdi: İplik depo hareket yapılan hammaddenin renk adını belirtir.\n- Cins: İplik depo hareket yapılan hammaddenin cinsini belirtir. Örneğin; polyester, pamuk, viskon vb.\n- DepoAdi: Hangi fiziksel depoda saklandığını ifade eder. Çok lokasyonlu depo sistemlerinde konum yönetimi sağlar.\n- Koordinat: Depo içinde ipliğin fiziksel yerini tanımlar. Genellikle raf sistemine göre tanımlanır (örnek: A2-RF3).\n- Kalite: Depo hareketindeki hammaddenin kalite sınıfını belirtir. Örneğin: A Kalite, 2. Kalite, Fire gibi üretim uygunluğuna göre sınıflamalar içerir.\n- UstGrup1: İpliğin ait olduğu birinci seviye kategori veya ana grup.\n- UstGrup2: İpliğin ait olduğu ikinci seviye kategori (UstGrup1’in alt grubu).\n- LotNo: Depo hareketine ait hammaddenin lot (parti) numarasını belirtir.\n- Sonil: Depo hareketindeki ipliğin şönil li iplik olup olmadığını belirtir.\n- Miktar: Depo hareketindeki ipliğin hareket miktarını ifade eder. Depo çıkışı yapılıyorsa Çıkış Miktarını, Depo girişi yapılıyorsa Giriş Miktarını ifade eder.\n- IIENo: Hangi imalat emri üzerinden sisteme geldiğini ifade eder. AI_Iplik_ImalEmri_Durum tablosu ile ilişkilidir.\n- FasonSipNo: Hangi fason sipariş üzerinden sisteme geldiğini ifade eder. AI_Iplik_FasonSiparis_Durum tablosu ile ilişkilidir.\n- GirenKullanici: Depo hareketi yapan kullanıcının adını gösterir.\n- Kayit_Kimin: Depo hareketin hangi şirkete (holding, birim) ait olduğunu belirtir.\n- Aciklama: Depo Hareketine ait Açıklama bilgisini gösterir\n- HrkTuru: Ç olanlar Depo Çıkışları G harfi olanlar Depo Girişleri ifade etmektedir. \n\n14. Tablo: AI_Iplik_Ihtiyac_Listesi\n\nGenel Tanım: \nAI_Iplik_Ihtiyac_Listesi tablosu, kumaş siparişleri doğrultusunda ihtiyaç duyulan iplik miktarlarını takip eden temel veri kaynağıdır. Bu tablo, belirli kumaş siparişlerinin hangi iplik türlerini (atkı, çözgü, hav) ve miktarlarını gerektirdiğini gösterir. İhtiyaçların karşılanma durumu, tahmini teslim tarihleri ve iplik tipi gibi önemli bilgilerle, üretim ve tedarik süreçlerinin daha verimli yönetilmesine yardımcı olur. \n\nSütun Tanımları ve Anlamları:\nIhtiyacID: Kumaş siparişinden doğan iplik ihtiyacı için verilen benzersiz barkod numarasıdır. Her bir iplik ihtiyacı kaydının takibini sağlar.\nTarih: Hammadde ihtiyacı kaydının oluşturulduğu tarihtir. İhtiyaçların ne zaman doğduğunu ve kaydedildiğini belirler.\nGrup: Oluşan hammadde ihtiyacının tipi veya kategorisidir. Örneğin, atkı, çözgü veya hav gibi gruplar.\nIplikKodu: Oluşan hammadde ihtiyacının belirli bir iplik türüne ait sistemsel kodudur. Bu, hangi iplik türünün gerektiğini belirtir.\nMiktar: Oluşan hammadde ihtiyacının miktarını belirtir. İhtiyaç duyulan iplik miktarının kilogram veya diğer ölçü birimindeki değerini ifade eder.\nAtamaMik: Karşılanan hammadde ihtiyacını belirtir. Hangi miktar ihtiyacın tedarik edildiğini gösterir.\nAtamaBakiye: Henüz karşılanmamış olan iplik ihtiyacını ifade eder. Yani, henüz tedarik edilmemiş miktarı belirtir.\nKapanmaTarihi: Hammadde ihtiyacının tamamının karşılanması durumunda, ihtiyacın kapanma tarihini ifade eder. Tedarik süreci tamamlandığında bu tarih belirlenir.\nTeorikIplikTermin: Hammadde ihtiyacının karşılanması planlanan tarihtir. İhtiyacın ne zaman tamamlanacağına dair tahmini teslim tarihini belirtir.\nSiparisNo: Kumaş siparişine ait benzersiz numaradır. Her siparişin takibi için sistem tarafından otomatik olarak atanır.\nFirmaAdi: Kumaş siparişi veren firmanın ticari adıdır. Hangi firmaya ait bir sipariş olduğunu belirtir.\nKaliteKodu: Kumaşın kalite kodunu belirtir. Bu alan, kalite sınıflandırması yapmak için kullanılır ve AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\nKaliteAdi: Kumaşın kalitesine verilen ticari veya teknik adıdır. Kullanıcıların kumaş kalitesini anlaması için açıklayıcı bir ad sağlar.\nDesenNo: Kumaş siparişine ait benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\nDesenAdi: Kumaş siparişine ait benzersiz desen adıdır. Bu ad tasarımcı tarafından verilen isim veya sistemde kayıtlı olan ad olabilir.\nVaryantNo: Aynı desenin farklı renk kombinasyonlarını ayırt etmek için kullanılan varyant numarasıdır.\nProsesKodu: Kumaşın üretim sürecinde geçtiği işlemleri tanımlayan koddur. Bu, kumaşın boyama, apre, yıkama gibi işlemlerden geçtiği rotayı gösterir.\n\n15. Tablo: AI_Kumas_Siparis_Paz_Listesi\n\nGenel Tanım:\nAI_Kumas_Siparis_Paz_Listesi tablosu, pazarlama birimi tarafından oluşturulan kumaş siparişlerinin tüm süreç bilgilerini içeren bir referans tablosudur. Bu tablo, siparişin türünden, müşteri temsilcisine, kalite tanımlarından, çözgü yapısı ve cağar kodlarına kadar geniş bir yelpazede teknik ve ticari detayları barındırır. Siparişin üretime geçiş durumu, müşteri talepleri ve üretimle koordinasyon sağlanabilmesi için kritik bir kaynaktır. Ayrıca, sipariş sürecinin her aşamasını takip etmeye olanak tanır, böylece üretim hazırlığı ve siparişin gerçekleştirilmesi arasında bağlantı kurar.\n\nSütun Tanımları ve Anlamları:\n- SiparisNo: Kumaş Siparişin fişine ait sistemde otomatik oluşturulan benzersiz numarasıdır. Siparişlerin takibi ve raporlanması için kullanılır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, firma bazlı raporlama ve analizler için kullanılır. AI_Tanim_Firma_Listesi tablosu ile ilişkilidir.\n- SipTarihi: Kumaş siparişin verildiği tarihi belirtir. Siparişin zamanlamasını ve teslimat takibini sağlamak için önemlidir.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- Ulke: Kumaş siparişi veren firmanın kayıtlı olduğu ülkeyi belirtir. Siparişlerin yerel ve uluslararası takibini sağlar.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır. \n- ProsesKodu: Kumaş siparişine ait kumaşın üretim sürecinde geçtiği işlemleri rotasını tanımlayan koddur. Örneğin; boyama, apre, yıkama gibi işlemler.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- Kompozisyon: Kumaş siparişi verilen kumaşta kullanılan hammadde yüzdelerini belirtir. \n- CozKodu: Kumaş siparişi verilen kumaştaki çözgü kodunu belirtir.\n- CozAdi: Kumaş siparişi verilen kumaştaki çözgü adını belirtir.\n- CagarKodu: Kumaş siparişi verilen kumaştaki cağarlık kodunu belirtir. Sadece Kadife olan Kalite Tipleri için geçerlidir.\n- UretimeGecti: Kumaş siparişin süreç olarak müşteriden alındığını ancak üretime geçip geçmediğini belirten sütundur. Siparişin üretim aşamasına ne zaman geçtiğini takip eder.\n- SipMiktar: Kumaş sipariş verilen kumaşın sipariş miktarını ifade eder. Bu, üretim sürecindeki siparişin büyüklüğünü belirler.\n- Kayit_Kimin: Kumaşın hangi firmaya ait olduğunu gösterir. Bu, tedarikçi ya da müşteri bazlı sahiplik bilgisini içerir.\n\n16. Tablo: AI_Kumas_Siparis_Listesi\n\nGenel Tanım:\nAI_Kumas_Siparis_Listesi tablosu, pazarlama biriminde yazılan kumaş siparişlerinin üretim sürecine alınmış siparişlerin temel veri kaynağıdır. Tabloda, kumaş sipariş edilen kumaşın kalite adı, desen adı, varyantı, sipariş metrajı, siparişin mevcut durumu ve termin tarihleri gibi bilgileri içerir. Ayrıca, kumaş siparişin hangi aşamada olduğu (örneğin: sanalda, üretimde, depoda, aprede) ve kumaş siparişin tamamlanıp tamamlanmadığı gibi bilgiler de bu tabloda yer almaktadır. Bu yapı, kumaş siparişlerin takibi ve üretim süreçlerinin verimli yönetilmesi için kritik öneme sahiptir.\n\nSütun Tanımları ve Anlamları:\n- SiparisNo: Kumaş siparişin sistemdeki benzersiz numarasıdır. Her siparişin takip edilmesi ve raporlanması için kullanılır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- SiparisYeri: Kumaş siparişin açıldığı yeri belirtir. Örneğin: üretimde, depoda aprede veya sanalda\n- SiparisSekli: Kumaş siparişin alım şekli belirtir. Örneğin: regüle (seri üretim), kesmece, sanal, contract (sözleşmeli), parti gibi sipariş türleri bulunur.\n- SiparisGrubu: Kumaş siparişin üretim şeklini belirtir. Örneğin: express (hızlı teslimat), 2. kalite, normal sipariş gibi kategoriler.\n- SipTarihi: Kumaş sipariş verildiği tarihtir. Siparişin zamanlamasını ve teslimatın takibini sağlar.\n- TerminTarihi: Kumaş siparişin genel termin tarihidir. Kumaş sipariş edilen kumaşın, üretim sürecinde tamamlanıp teslim edilmesi planlanan tarihi ifade eder.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- SatisBolgesi: Kumaş siparişi veren firmanın satış bölgesini belirtir. Örneğin: Orta Doğu, Avrupa, İç Anadolu gibi coğrafi bölgeler.\n- Ulke: Kumaş siparişi veren firmanın ülkesini belirtir. Siparişin kaynağını ve coğrafi takibini sağlar.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır. \n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KapKaliteGrubu: Kumaş siparişi verilen kumaşın ait olduğu teknik kalite grubunu belirtir. Örneğin; örme, 4800 class, 9600 gibi üretim gruplarını içerir.\n- ApreIslemiTipi: Kumaş siparişi verilen kumaşın hangi apre işlemine tabi tutulduğunu belirtir. Örneğin; boyama, proses, dijital baskı gibi işlemleri kapsar.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- CozKodu: Kumaş siparişi verilen kumaştaki çözgü kodunu belirtir.\n- CozAdi: Kumaş siparişi verilen kumaştaki çözgü adını belirtir.\n- SipMiktar: Kumaş sipariş verilen kumaşın sipariş miktarını ifade eder. Bu, üretim sürecindeki siparişin büyüklüğünü belirler.\n- ProsesKodu: Kumaş sipariş verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan koddur. Örneğin; boyama, yıkama, apre gibi işlemler.\n- TeorikYuklemeTarihi: Kumaş siparişi verilen kumaşın teorik olarak sevk edilmesi planlanan tarih bilgisidir. Sevk planlamasında önemli bir referans tarihidir.\n- Kapandi: Kumaş siparişin tamamlanıp tamamlanmadığını belirten durum bilgisidir. (Evet/Hayır, 1/0 gibi mantıksal veri içerir.)\n\n17. Tablo: AI_Dokuma_IsEmri_Listesi\n\nGenel Tanım:\nAI_Dokuma_IsEmri_Listesi tablosu, kumaş üretim sürecinde yapılan dokuma iş emirlerinin tüm detaylarını içerir. Her bir iş emri, kumaş siparişine dayalı olarak başlatılır ve tablonun içeriği, bu iş emirlerinin zaman çizelgesi, kalite bilgileri, kullanılan materyaller ve üretimle ilgili teknik parametreleri kapsamlı bir şekilde takip eder. Bu tablo, üretim planlaması, kalite kontrolü, dokuma takibi ve süreç izlenebilirliği açısından kritik bir veri kaynağıdır.\n\nSütun Tanımları ve Anlamları:\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- Tarih: Dokuma iş emrinin tanımlandığı tarihtir.\n- SiparisNo: Dokuma iş emri ait sistemdeki benzersiz numaradır.\n- FirmaAdi: Dokuma iş emri veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- TezgahNo: Dokuma iş emrinin dokunacağı veya örüleceği tezgahın numarasını belirtir.\n- PUrBasTar: Dokuma iş emrinin üretime başlama tarihidir.\n- PUrBitTar: Dokuma iş emrinin üretime bitiş tarihidir.\n- PlanMetraj: Dokuma iş emrinin plan metresidir.\n- ToplamHamMetre: Dokuma iş emrine ait üretimi yapılıp ham kalite kontrolde sarılmış toplam metredir.\n- Kalite: Dokuma iş emri verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Dokuma iş emri verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- KaliteTipi: Dokuma iş emri verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- DesenNo: Dokuma iş emri ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Dokuma iş emri ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: KDokuma iş emri ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- CozKodu: Dokuma iş emri verilen kumaştaki çözgü kodunu belirtir.\n- CozAdi: Dokuma iş emri verilen kumaştaki çözgü adını belirtir.\n- CagarKodu: Dokuma iş emri verilen kumaştaki cağarlık kodunu belirtir.\n- ProsesKodu: Dokuma iş emri verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Durumu: Dokuma iş emrinin son durumunu gösterir.\n\n18. Tablo: AI_Apre_HamToplar_Listesi\n\nGenel Tanım:\nAI_Apre_HamToplar_Listesi tablosu, üretim sürecindeki ham kumaşlara ait kalite, desen, varyant, iş emri ve üretim aşamalarına dair teknik bilgileri kayıt altına alır. Kumaşın ham kalite ve desen bilgileri, iş emri numarası, ölçülen metrajı ve üretim sırasında (iğneleme, apre gibi) oluşan fire miktarları gibi kritik veriler bu tabloda yer alır. Ayrıca kumaşta tespit edilen hataların tanımı da bu yapı içinde tutulur. Ham kumaşın üretim ve işlem geçmişini izlemek, kalite kontrol ve stok planlama gibi süreçlerde referans olarak kullanılır.\n\nSütun Tanımları ve Anlamları:\n- TopID: Ham kumaşa ait atanan benzersiz kimlik ID bilgisidir.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- TezgahNo: Dokuma iş emrinin dokunacağı veya örüleceği tezgahın numarasını belirtir.\n- K_Tarih: Ham kumaş sarım yapılıp metrelendiği tarihi belirtir.\n- SiparisNo: Kumaş siparişine ait sistemdeki benzersiz numaradır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- CozAdi: Kumaş siparişi verilen kumaştaki çözgü adını belirtir.\n- AprePartiNo: Ham kumaşın apre işlemi sırasında kullanılan benzersiz (uniq) parti numarasıdır.\n- HamMetre: Ham kumaşın sarılmasından sonra ham metraj bilgisini belirtir (metre cinsinden).\n\n19. Tablo: AI_Apre_MamulToplar_Listesi_Kalite\n\nGenel Tanım:\nAI_Apre_MamulToplar_Listesi_Kalite tablosu, firma tarafından üretilen kumaşların son kontrollerinin yapıldığı mamül sarım makinelerinden alınan verileri içerir. Bu tablodaki sütunlar, kumaşın kalite durumu, metre bilgisi, kalite desen ve varyantı gibi kritik verileri içerir.\n\nSütun Tanımları ve Anlamları:\n- TopID: Mamul kumaşa sistem tarafından atanan benzersiz kimlik ID bilgisidir.\n- KontrolTarihi: Mamul kumaşın kontrol edildiği tarih bilgisini içerir.\n- HamID: Ham kumaşın ham sarımında tüm topa atanan benzersiz (uniq) koddur.\n- SiparisNo: Kumaş siparişe ait benzersiz numaradır. Sistem tarafından tanımlanır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- K_Tarih: Mamul kumaşın sarıldığı tarihtir.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- K_Kont: Mamul kumaşı kontrol eden operatörün adını belirtir.\n- K_En: Mamul kumaşın kontrol esnasında ölçülen kumaş enini belirtir.\n- K_grm: Mamul kumaşın gramaj bilgisini (g/m²) ifade eder.\n- K_Kalite: Mamul kumaşın kalite durumunu belirtir. Örneğin: 1. Kalite, İç Piyasa, Sorunlu, Bekleme, Parti Hazırlama, Baskı, Tamir.\n- ReelKaliteDurumu: Mamul kumaşın kalite durumunu harf olarak derecesini belirtir (örneğin: A, B, C, D).\n- K_Kg: Mamul kumaşın kontrol sırasında ölçülen kumaş kilosunu belirtir.\n- Net_Mt: Mamul kumaşın ölçülen net uzunluğunu (metre cinsinden) belirtir.\n- Isk: Mamul kumaş üzerindeki hatalı bölgelerin toplam uzunluğunu belirtir. Bazı hatalar noktasal bazı hatalar sürekli olabilir.\n- ParcaIskonto: Mamul kumaşın hatalı bölgelerden kesilerek çıkarılan parçaların toplam uzunluğunu belirtir.\n- ParcaMt: Mamul kumaştan alınan parçaların toplam uzunluğunu belirtir.\n- MknPayi: Mamul kumaşın kontrol makinesinde oluşan fire miktarını ifade eder.\n\n20. Tablo: AI_Apre_ReserveToplar_Listesi_Top\n\nGenel Tanım:\nAI_Apre_ReserveToplar_Listesi_Top tablosu, tekstil kumaş üretim sürecine dahil olan sipariş, kalite, firma ve sevkiyat bilgilerinin detaylı şekilde takibini sağlar. Tablo, her bir kumaşa ait kalite kodları, desen ve varyant bilgileri, teknik kalite grupları ve üretim süreçleri ile ilgili tanımlar içerir. Ayrıca, siparişin hangi firmaya ait olduğu, müşteri temsilcisi bilgisi, sipariş tarihi, yükleme yapılacak depo ve sevkiyat planlaması gibi lojistik bilgileri de yer alır. Bu yapı, üretim planlama, kalite yönetimi, müşteri hizmetleri ve depo operasyonları arasında bilgi bütünlüğü ve operasyonel izlenebilirlik sağlar.\n\nSütun Tanımları ve Anlamları:\n- ReserveID: Müşteri siparişlerinden oluşan mamul topların depoda hazır hale getirilmiş topların benzersiz fiş numarasıdır.\n- KayitEden: Rezerv kaydını oluşturan kullanıcının adını belirtir. Tedarikçi ya da müşteri olabilir.\n- TopID: Mamul kumaşın kumaşa sistem tarafından atanan benzersiz kimlik ID bilgisidir.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- SiparisNo: Kumaş siparişine ait benzersiz numaradır. Sistem tarafından tanımlanır.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Kayit_Kimin: Rezervin hangi şirkete ait olduğunu gösterir. Erp süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- K_Kalite: Mamul kumaşın kalite durumunu belirtir. Örneğin: 1. Kalite, İç Piyasa, Sorunlu, Bekleme, Parti Hazırlama, Baskı, Tamir.\n- GercekKalite: Mamul kumaşın kalite durumunu harf olarak derecesini belirtir (örneğin: A, B, C, D).\n- DepoYeri: Rezervin hangi depodan yükleneceğini belirtir. Depo adı veya kodu olabilir.\n- TeorikYuklemeTarihi: Rezervin sevk edilmesi planlanan tarih bilgisidir.\n\n21. Tablo: AI_Apre_CikisToplar_Listesi_Top\n\nGenel Tanım:\nAI_Apre_CikisToplar_Listesi_Top tablosu, tekstil kumaş üretim sürecine dahil olan sipariş, kalite, firma ve sevkiyat bilgilerinin detaylı şekilde takibini sağlar. Tablo, her bir kumaşa ait kalite kodları, desen ve varyant bilgileri, teknik kalite grupları ve üretim süreçleri ile ilgili tanımları içerir. Ayrıca, siparişin hangi firmaya ait olduğu, müşteri temsilcisi bilgisi, sipariş tarihi, yükleme yapılacak depo ve sevkiyat planlaması gibi lojistik bilgiler de yer alır. Bu yapı, üretim planlama, kalite yönetimi, müşteri hizmetleri ve depo operasyonları arasında bilgi bütünlüğü ve operasyonel izlenebilirlik sağlar.\n\nSütun Tanımları ve Anlamları:\n- KETSCekiNo: Mamul çıkış sevkiyat yapılan çıkışa ait benzersiz fiş numarasıdır.\n- KayitEden: Mamul çıkış sevkiyat kaydını oluşturan kullanıcının adını belirtir. Tedarikçi ya da müşteri olabilir.\n- TopID: Mamul kumaşın kumaşa sistem tarafından atanan benzersiz kimlik ID bilgisidir.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- SiparisNo: Kumaş siparişine ait benzersiz numaradır. Sistem tarafından tanımlanır.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Kayit_Kimin: Mamul çıkış hangi şirkete ait olduğunu gösterir. Erp süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- K_Kalite: Mamul kumaşın kalite durumunu belirtir. Örneğin: 1. Kalite, İç Piyasa, Sorunlu, Bekleme, Parti Hazırlama, Baskı, Tamir.\n- GercekKalite: Mamul kumaşın kalite durumunu harf olarak derecesini belirtir (örneğin: A, B, C, D).\n- DepoYeri: Mamul çıkış sevkiyat hangi depodan yükleneceğini belirtir. Depo adı veya kodu olabilir.\n- TeorikYuklemeTarihi: Mamul çıkış sevkiyat sevk edilmesi planlanan tarih bilgisidir.\n\nSenin görevin, kullanıcıdan gelen doğal dildeki istekleri okuyarak sadece Microsoft SQL Server 2012 için çalıştırılabilir düz SQL sorguları üretmektir.\n\n‼️ Kurallar:\n\n1. Sadece saf SQL sorgusu döndür. \n2. Açıklama, yorum, bilgi, örnek, yönlendirme yazma. \n3. SELECT cümlesi oluştururken seçilen her sütun yeni bir satırda yer almalıdır. \nÖrneğin; SELECT TOP 10 \n SiparisNo, \n FirmaAdi, \n SiparisYeri, \n SiparisSekli, \n SiparisGrubu, \n SipTarihi, \n TerminTarihi, \n MusTemsilcisi\nFROM AI_Kumas_Siparis_Listesi\nORDER BY SipTarihi DESC;\n5. SET DATEFORMAT 'DMY'; ile başla. \n6. SELECT * kullanma, sadece gerekli sütun adlarını yaz. \n7. BETWEEN kullanarak tarih aralığı belirt. \n8. Kullanıcının istediği bilgiye uygun tabloyu sadece aşağıdaki şemadan seç:\n9. SQL dışı açıklama, yorum, markdown, metin yazarsan hata oluşur. \n10. PIVOT sorgularda DISTINCT ifadesi kullanılmayacak.\n" } }, "type": "@n8n/n8n-nodes-langchain.agent", @@ -244,7 +244,7 @@ "promptType": "define", "text": "={{ $('Webhook').item.json.body.question }}", "options": { - "systemMessage": "Senin görevin, kullanıcıdan gelen soruları yalnızca Microsoft SQL Server 2012 için çalıştırılabilir aşağıdaki örneğe ve verilen Veritabanı Şemasına göre SQL sorguları üretmektir. Bu SQL sorgunun verileri çekerek bir ön hazırlık yapacak. Bu ön hazırlık sorgusunda Yıl, Ay, Tarih ve Miktar sütunları yer almalıdır. SQL sorgularının yalnızca gerekli veriyi döndürmesi gerekmektedir. Sorguların ilk satırında `SET DATEFORMAT 'DMY';` ifadesi olmalıdır.\n\nKurallar:\n1. Sadece saf SQL sorgusu döndür. Sql sorgusuyla birlikte açıklama yapma.\n2. Microsoft SQL Server 2012 için çalıştırılabilir düz SQL sorguları üretmektir\n3. Kullanıcının sorduğu soruya göre doğru tabloyu ve sütunları seçmelisin. Sadece verilen Veritabanı şeması ve tabloları kullanarak SQL sorguları üret.\n4. Sorgularında `SELECT *` kullanma. Sadece gerekli sütunları belirt. \n5. `BETWEEN` kullanarak tarih aralığı belirt. Eğer bir tarih aralığı varsa, kullanıcının sorgusuna göre bu aralığı filtrele.\n6. Sadece veri sağlayacak SQL sorgularını döndür. Kullanıcının sorusuna göre veri toplamak için uygun sorguyu oluştur.\n7. Kullanıcının sorduğu sorunun içeriğine göre:\n - **Yıl**, **Ay**, **Tarih**, ve **Miktar** gibi bilgileri döndürebileceğin sorguları oluştur.\n8. SQL sorguları yalnızca veri sağlayacak şekilde olmalıdır. Kullanıcıya analiz veya yorum yapma, sadece veri sağlayacak SQL sorgusunu döndür.\n\nÖrnek olarak, \"Son 3 aydaki kumaş siparişlerine göre, ne kadar artış bekleniyor?\" sorusu şu şekilde bir sorguya dönüşebilir:\n\nSET DATEFORMAT 'DMY'; \nSELECT \n YEAR(SipTarihi) AS Yil, \n DATEPART(MONTH, SipTarihi) AS Ay, \n MIN(SipTarihi) AS Tarih, \n SUM(SipMiktar) AS Miktar \nFROM AI_Kumas_Siparis_Listesi \nWHERE SipTarihi BETWEEN '01-01-2025' AND '31-03-2025' \nGROUP BY YEAR(SipTarihi), DATEPART(MONTH, SipTarihi);\n\nSadece SQL sorgusunu döndür. Açıklama veya yorum ekleme.\n\nVeritabanı şeması:\n\n1. Tablo: AI_Tanim_Iplik_Listesi\n\nGenel Tanım: \nTekstil üretiminde kullanılan tüm iplik ve iplik bazlı hammaddelerin sistemsel olarak tanımlandığı bir master veri tablosudur. Bu tablo; hammaddeye dair teknik, yapısal, sınıflayıcı ve süreçsel tüm bilgileri merkezi bir yapıda saklar ve üretimden satın almaya kadar birçok sistem modülüyle ilişkilidir.\n\nSütun Tanımları ve Anlamları:\n- IplikKodu: Tanımlı olan hammaddenin sistemsel hammadde kodunu belirtir.\n- RenkAdi: Tanımlı olan hammaddenin renk adını belirtir.\n- RenkKodu: Tanımlı olan hammaddenin sistemde tanımlı renk kodudur.\n- Renk: Tanımlı olan hammaddenin renk numarasını belirtir.\n- Cins: Tanımlı olan hammaddenin cinsini belirtir. Örneğin; polyester, pamuk, viskon vb.\n- Numara: Tanımlı olan hammaddenin numarasını belirtir. Hammaddenin kalınlığını veya inceliğini ifade eder (örneğin: 2 numara iplik, 30/1 Ne vb.).\n- Birim: Tanımlı olan hammaddenin numara birim bilgisini belirtir (örneğin: Nm, NeB, den).\n- Nm: İpliğin numarasını ifade eden metrik sistemdeki (Nm) numarasıdır. Bu değer, 1 gram iplikten kaç metre elde edilebileceğini gösterir. Numara büyüdükçe iplik incelir.\n- KompozisyonKisaltmasi: Hammaddenin kompozisyon yüzdelerinin belirtir. (örneğin; %90 PAN %10 PES, %100 PES, %100 RPET)\n- IplikKisaltmasi: Tanımlı olan hammaddenin sistemsel kısaltılmış hammadde kodunu belirtir.\n- UstGrup1: Hammaddenin bulunduğu ana grubu ifade eder.\n- UstGrup2: Hammaddenin ait olduğu ana grubun bir alt grubudur.\n- Tarih: Hammadde tanımlamasının yapıldığı tarihtir.\n- InsertUser: Hammadde tanımlamasını yapan kullanıcıyı belirtir.\n- IsikHasligi: Hammaddenin ışığa karşı dayanıklılık seviyesini (haslık derecesi) belirtir.\n- Bukum: Hammaddenin büküm şekli hakkında bilgi verir (örneğin: S, Z, çift büküm).\n- OrtBobinKg: Ortalama bir bobin hammaddenin kilogram cinsinden ağırlığını belirtir.\n- NumuneKodu: Hammadde tanımlamasından önce numune olarak tanımlandığındaki iplik numune kodunu belirtir.\n- NumuneOnayTarihi: Hammadde numunesinin onaylandığı tarihi belirtir. Numune onaylandıktan sonra regüle iplik tanımlanır.\n- UrunHizmetGrubu: Hammadde tanımının hizmet grubunu belirtir. Örneğin: iplik, kumaş, aksesuar vb.\n- HamMamul: Hammaddenin üretim aşamasını ifade eder. (YARI MAMÜL İPLİK, MAMÜL İPLİK, HAM İPLİK)\n- IplikKullanimDurumu: Hammadde tanımının mevcut durumunu belirtir (örneğin: Aktif, Pasif).\n- HammaddeTipi: Tanımlı olan hammaddenin tipini belirtir. (CİPS, İPLİK, ELYAF, JOKER İPLİK, POLİP BOYA)\n\nFonksiyonel Amaçlar ve İlişkiler\n- Bu tablo, üretim emirlerinde hammadde seçimi, satın alma planlaması ve depo kontrol gibi birçok süreçle ilişkilidir.\n- IplikKodu anahtar alan olarak diğer tablolarla (örneğin AI_Iplik_SatinalmaSiparis_Durum) join ilişkisinde kullanılır.\n- KompozisyonKisaltmasi, kalite hesaplamaları, üretim reçeteleri ve stok analizlerinde kullanılır.\n- NumuneOnayTarihi, numuneden regüleye geçişin kritik eşiğidir.\n\n2. Tablo: AI_Tanim_Kalite_Listesi\n\nGenel Tanım: \nAI_Tanim_Kalite_Listesi, firmanın ürün gamında yer alan kumaş kalitelerinin detaylı tanımlarını içeren referans tablosudur. Bu tablo, kumaşların üretimsel, teknik ve ticari sınıflandırmalarının yapıldığı üst seviye bilgi kaynağıdır. Kalite; çözgü/atkı özellikleri, iplik tipi, ambalaj biçimi, uygulanan proses ve kullanım cinsine kadar birçok parametre ile tanımlanır ve tüm üretim & stok yönetimi süreçlerinin çekirdek bileşeni olarak kullanılır.\n\nSütun Tanımları ve Anlamları:\n- KaliteKodu: Kumaş kalitesini ifade eden akıllı kodlama yapısı ile belirtilmiş benzersiz bir tanımlama koddur. \n- KaliteAdi: Kumaşın kaliteye verilmiş ticari veya teknik adını belirtir. Kullanıcıya daha anlaşılır bir kalite tanımı sunar.\n- AsilKaliteAdi: Kalitenin bağlı olduğu bir üst kalite adını belirtir. \n- KaliteTipi: Kalitenin genel sınıfını belirtir. Bu tip kalitenin üretim değer farklılıklarını, üretim şekillerini ve teknik yapısını da ifade eder. Örneğin; ÖRME, ÜRETİM, YATAK YÜZÜ, KADİFE, YUVARLAK ÖRME \n- KaliteCinsi: Kalitenin genel kullanım amacına göre ait olduğu grubu tanımlar. Örneğin; standart, recycle, outdoor, easy life, prive gibi kalite cinslerini belirtir.\n- KapKaliteGrubu: Kalitenin ait olduğu teknik kalite grubunu belirtir. Örneğin; örme, 4800 class, 9600, 1056 gibi üretim gruplarını içerir.\n- AmbalajSekli: Kaliteye bağlı olarak üretilen kumaşların nasıl ambalajlanacağını belirtir. Örneğin; shrink, baloncuk gibi ambalaj türleri içerir.\n- ApreIslemiTipi: Kumaşın kalite sürecinde hangi apre işlemine tabi tutulduğunu belirtir. Örneğin; boyama, proses, dijital baskı gibi işlemleri kapsar.\n- AtkliSikligi: Kumaşın kalitesine bağlı olarak 1 cm de kullanılan atkı (enine iplik) iplik adedini - sıklığını belirtir. Bu değer, kalitenin dokuma yoğunluğu hakkında bilgi verir.\n- CozguSikligi: Kaliteye bağlı olarak 1 cm de kullanılan çözgü (boyuna iplik) iplik adedini - sıklığını ifade eder. Kumaşın teknik özelliklerini belirleyen temel parametrelerden biridir.\n- CozguTelAdedi: Kaliteye bağlı olarak kullanılan toplam çözgü tel adedini belirtir. Kumaşın yoğunluğu ve dayanıklılığı ile doğrudan ilişkilidir.\n- İplikCinsi: Kalitenin için de kullanılan çözgü ipliğinde kullanılan iplik türünü belirtir. Örneğin; polyester, pamuk, viskon gibi iplik cinsleri bu alanda yer alır.\n- ProsesKodu: Kalitenin üretim sürecinde geçtiği işlemleri tanımlayan koddur. Apre dairesinde yapılan rota olarak ta belirtilebilir. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Kayit_Kimin: Kalitenin hangi şirkete ait olduğunu gösterir. ERP süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- Tanimlayan: Kalite tanımını yapan kişiyi kullanıcı adını belirtir. \n- Tarih: Kalite tanımlamasının yapıldığı tarihtir.\n\nFonksiyonel Amaçlar ve İlişkiler\n- Kalite, kumaşın en temel referans kimliğidir. Tüm üretim, satış, stok ve sevkiyat tablolarıyla birebir ilişkilidir.\n- KaliteKodu, tablolar arasında anahtar niteliğindedir (örn. AI_Tanim_Kumas_Listesi, AI_Kumas_Siparis_Paz_Listesi, AI_Dokuma_IsEmri_Listesi).\n- KapKaliteGrubu ve KaliteTipi teknik/üretim ayrımı yaparken, KaliteCinsi pazarlama segmentasyonu sağlar.\n- AtkliSikligi, CozguSikligi, CozguTelAdedi gibi parametreler üretim reçetelerinde kritik teknik girdilerdir.\n- ApreIslemiTipi, kalitenin işlemsel farklarını yansıtır, kalite kontrol süreçlerini doğrudan etkiler.\n\n3. Tablo: AI_Tanim_Cozgu_Listesi\n\nGenel Tanım:\nAI_Tanim_Cozgu_Listesi, tekstil üretiminde kumaşların çözgü yapılarını tanımlayan teknik ve sınıflayıcı bilgileri içeren referans tablosudur. Dokuma reçetelerinin oluşturulması, kalite kontrol süreçlerinin yönetilmesi ve kumaş varyant eşleşmelerinin doğru yapılabilmesi için kritik rol oynar. Çözgü, bir kumaşın üretim mimarisindeki iskelet yapıdır ve bu yapı sistematik şekilde burada tariflenir.\n\nSütun Tanımları ve Anlamları:\n- CozKodu: Kumaşın dokunmasında kullanılan dikey ipliklerini oluşturan ipliklerin çözgü tanımına ait teknik ve benzersiz tanımlama kodudur. Bu kod, üretim takibi, çözgü reçeteleri ve kalite kontrol süreçlerinde referans olarak kullanılır.\n- CozAdi: Kumaşın dokunmasında kullanılan dikey ipliklerini oluşturan ipliklerin çözgü tanımına ait teknik tanımlama adıdır. Çözgü yapısını tanımlar ve kumaşın üretim sürecindeki yerini belirlemede kullanılır. \n- CozguGrubu: Tanımlı olan çözgünün üst çözgü adıdır. Yoğunlukla CozAdi sütunu değerlerini içerir.\n- CozTipi: Tanımlı olan çözgünün çalışabileceği tezgah tipini ve dokuma yapısını belirtir. Örneğin; jakarlı, armürlü gibi dokuma yapılarını tanımlar.\n- CozguTuru: Kullanılan çözgünün Numunemi, Blanket veya Regüle olup olmadığını belirtir. \n- TelAdet: Çözgüde kullanılan toplam tel adedini ifade eder.\n- CozSiklik: Çözgü sıklığını belirtir. Yani 1 cm den geçen çözgü iplik adedi - sıklığını gösterir.\n- CozEni: Çözgü sisteminin kumaş üzerindeki eni (genişliği) bilgisini ifade eder.\n- KaliteTipi: Çözgünü çalışabileceği kumaşların kalite tipini belirtir. Örneğin; ÖRME, ÜRETİM, YATAK YÜZÜ, KADİFE, YUVARLAK ÖRME \n- KaliteGrubu: Çözgünün çalışabileceği kumaşların kalite grubunu belirtir. Örneğin; 4800, 9600 gibi teknik gruplar.\n- KoleksiyonTipi: Kumaş koleksiyonunun genel mi yoksa müşteriye özel mi olduğunu belirtir.\n- Kompozisyon: Çözgüde kullanılan hammadde yüzlerini belirtir. Örneğin; %60 polyester, %40 pamuk gibi lif karışım bilgilerini içerir.\n- Tarih: Çözgünün tanımını yapan kişiyi kullanıcı adını belirtir.\n\nFonksiyonel Kullanım ve İlişkiler\n- CozKodu, çözgü-reçete bağlantılarında anahtar işlevi görür.\n- KaliteTipi, KaliteGrubu ile birlikte çözgülerin hangi ürün ailesine ait olduğunu belirtir.\n- CozTipi ve CozguTuru, üretim tipi ayrımında kritik bilgi sağlar.\n- TelAdet, CozSiklik, CozEni değerleri, dokuma optimizasyonu ve randıman hesaplamaları için kullanılır.\n- KoleksiyonTipi, müşteri taleplerine özel üretimlerin sınıflandırılmasını mümkün kılar.\n\n4. Tablo: AI_Tanim_Cagarlik_Listesi\n\nGenel Tanım:\nAI_Tanim_Cagarlik_Listesi, özellikle kadife tipi kumaşların üretiminde kullanılan cağarlık yapılarını tanımlayan temel veri tablosudur. Cağarlık; dokuma öncesinde çözgü ipliklerinin bobinler üzerine sarılmasıyla oluşan ve dokuma makinesine çözgü ipliklerini aktaran sistemdir. Bu yapı, dokumanın temel bileşeni olan çözgü sisteminin planlanması ve standartlaştırılması için kritik öneme sahiptir. Sistem içinde tanımlı her cağar, belirli bir iplik cinsi, rengi, tel sayısı ve bobin adediyle temsil edilir. Tablo, üretim reçeteleri, kalite takibi, stok yönetimi ve üretim verimliliği açısından cağarlıkların teknik izlenebilirliğini sağlar.\n\nSütun Tanımları ve Anlamları:\n- CagarNo: Cağara ait benzersiz kod bilgisini içerir.\n- CagarKodu: Cağarın sistemde tanımlı adını belirtir.\n- IplikKodu: Cağarda kullanılan ipliğin sistemsel kodunu belirtir.\n- Cins: İpliğin cinsini belirtir. Örneğin; polyester, pamuk, viskon vb.\n- RenkAdi: Kullanılan ipliğin renk adını belirtir.\n- TelAdedi: Cağarlıkta kullanılan ipliğin tel adedini ifade eder.\n- ToplamAdet: Cağarlıkta kullanılan toplam tel adedini gösterir.\n- Tarih_Tanimlama: Cağarlık tanımının yapıldığı tarihi belirtir.\n\nFonksiyonel Kullanım ve İlişkiler:\n- IplikKodu, AI_Tanim_Iplik_Listesi ile birebir eşleşir. Kullanılan ipliğin tüm teknik bilgilerine erişim sağlar.\n- CagarKodu, çözgü planlamasında veya dokuma reçetelerinde doğrudan çağrılan tanımlayıcıdır.\n- TelAdedi ve ToplamAdet, iplik tüketimi, stok yönetimi ve üretim planlamasında hesaplama girdisi olarak kullanılır.\n- RenkAdi ve Cins kombinasyonu, kalite kontrol ve üretim standardizasyonu açısından önemli eşleştirme parametreleridir.\n\n5. Tablo: AI_Tanim_Kumas_Listesi\n\nGenel Tanım:\nBu tablo, tekstil üretiminde kullanılan veya dışarıdan satın alınan tüm kumaşlara ait temel tanım ve teknik özelliklerin tutulduğu referans veri kaynağıdır. Kumaşların kalite, desen, varyant, çözgü yapısı, kompozisyonu ve üretim bilgileri gibi parametrelerini içerir. Üretim planlama, kalite kontrol, desen takibi ve stok yönetimi süreçlerinde merkezi rol oynar. Bu tablo, kumaş bazlı operasyonların bütüncül takibi için temel veri zemini sağlar.\n\nSütun Tanımları ve Anlamları:\n- KumasID: Tanımlanan her kumaşın veri tabanında saklanan benzersiz değeridir. Otomatik numara türünde olan bu değer her kumaş için tanımlayıcıdır. (primary key) \n- Kalite: Kumaş kalitesini ifade eden akıllı kodlama yapısı ile belirtilmiş benzersiz bir tanımlama koddur. AI_Tanim_Kalite_Listesi tablosundaki KaliteKodu sütunu ile ilişkilidir. \n- KaliteAdi: Kumaşın kaliteye verilmiş ticari veya teknik adını belirtir. Kullanıcıya daha anlaşılır bir kalite tanımı sunar. AI_Tanim_Kalite_Listesi tablosundaki KaliteAdi sütunu ile ilişkilidir. \n- AsilKaliteAdi: Kalitenin bağlı olduğu bir üst kalite adını belirtir. AI_Tanim_Kalite_Listesi tablosundaki AsilKaliteAdi sütunu ile ilişkilidir.\n- KaliteTipi: Kalitenin genel sınıfını belirtir. Bu tip kalitenin üretim değer farklılıklarını, üretim şekillerini ve teknik yapısını da ifade eder. Örneğin; ÖRME, ÜRETİM, YATAK YÜZÜ, KADİFE, YUVARLAK ÖRME\n- KumasGrubu: Kumaşın teknik veya tasarımsal açıdan üretilecek tezgah grubunu belirtir. Örneğin; Armürlü, Jakarlı, Dedektörlü, Jumbo vs. gibi sınıflandırmaları içerir.\n- KumasTuru: Kumaşın kullanım amacını tanımlar. Örneğin; numune, regüle (seri üretim), özel üretim gibi türleri ayırt etmek için kullanılır.\n- DesenNo: Kumaşa ait benzersiz desen numarasını belirtir. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaşa ait benzersiz desen adını belirtir. Tasarımcının verdiği isim ya da sistemde kayıtlı ad olabilir.\n- VaryantNo: Aynı desenin farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasını belirtir.\n- Kompozisyon: Kumaşın içeriğinde kullanılan hammadde yüzdelerini belirtir. Örneğin; %60 polyester, %40 pamuk gibi lif karışım bilgilerini içerir.\n- CozKodu: Kumaşta kullanılan çözgü ipliğine ait sistemsel veya teknik kodu belirtir. Bu kod, üretim takibi, çözgü reçeteleri ve kalite kontrol süreçlerinde referans olarak kullanılır.\n- CozAdi: Kumaşın dokunmasında kullanılan çözgü ipliğine verilen teknik adı ifade eder. Çözgü yapısını tanımlar ve kumaşın üretim sürecindeki yerini belirlemede kullanılır.\n- HamKg: Kumaşın ilk dokuma sonrası işlenmemiş, yani ham haliyle kilogram cinsinden ağırlığını belirtir.\n- MamKg: Kumaşın dokuma sonrası ve apre rotasından sonra mamul hale geldikten sonraki kilogram cinsinden ağırlığını belirtir.\n- ProsesKodu: Kumaşın geçtiği üretim veya işlem süreçlerini ifade eden rota kodu içerir. Örneğin; boyama, apre, yıkama gibi işlemleri gösterir.\n- UretimiDurdur: Tanımlı olan kumaşın nüretiminin devam edip etmediğini gösterir. Aktif üretim mi, durdurulmuş mu bilgisini taşır.\n- Kayit_Kimin: Kumaşın hangi şirkete ait olduğunu gösterir. ERP süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- Tanimlayan: Kumaşın tanımını yapan kişiyi kullanıcı adını belirtir. \n- Tarih: Kumaş tanımlamasının yapıldığı tarihtir.\n\nFonksiyonel Kullanım ve İlişkiler:\n- Kalite, KaliteAdi, AsilKaliteAdi sütunları kalite detay tabloları ile ilişkilidir.\n- CozKodu, CozAdi çözgü tanım tablosu ile (AI_Tanim_Cozgu_Listesi) ilişkili çalışır.\n- ProsesKodu, kumaşın üretim rotasının izlenmesinde kullanılır.\n- KumasTuru ve UretimiDurdur, üretim planlaması ve aktif üretim takip sistemi için filtreleme sağlar.\n- Kompozisyon, malzeme planlama ve kalite standardizasyonuna katkı sunar.\n\n6. Tablo: AI_Tanim_Firma_Listesi\n\nGenel Tanım:\nAI_Tanim_Firma_Listesi tablosu, kurumun ticari ilişkide bulunduğu tüm firmaların temel tanımlayıcı bilgilerini içerir. Bu firmalar; müşteri, tedarikçi, fason üretici ya da dış hizmet sağlayıcı olabilir. ERP süreçlerinde üretim, satın alma, satış ve sevkiyat gibi operasyonel iş akışlarında muhatap olarak tanımlanan firmaların sistemdeki kayıtlarını standardize etmek ve ilişkisel veri tabanında izlenebilirlik sağlamak amacıyla kullanılır.\n\nSütun Tanımları ve Anlamları:\n- FirmaKodu: Her firmaya sistem tarafından atanmış benzersiz tanımlayıcı koddur. Tüm diğer tablolarda firma bilgisiyle ilişki kurarken referans alınır.\n- FirmaAdi: Firmanın ticaret unvanıdır. İnsan tarafından okunabilir ve raporlamada görünen firma adıdır.\n- Tur: Firmanın sistemdeki işlevsel rolünü belirtir. Örnek değerler: müşteri, tedarikçi, fasoncu, apre tedarikçisi gibi. Operasyonların sınıflandırılmasını sağlar.\n- FirmaGrubu: Firma ile ilişkili yüksek seviye sınıflandırmadır. Örnek: yerli, yabancı, holding grubu gibi tanımlar sayesinde pazar analizleri ve tedarikçi segmentasyonu yapılabilir.\n- SirketAdi: Bu firma ile ilişkili olan şirket ya da ERP sistemindeki iş birimi bilgisini içerir. Çoklu şirket yapılanmalarında kurum içi ayrımı ifade eder.\n- Ulke: Firmanın faaliyet gösterdiği veya yasal olarak kayıtlı olduğu ülke bilgisidir. Dış ticaret, lojistik ve gümrük süreçleri için önemlidir.\n- SatisBolgesi: Firmanın coğrafi satış bölgesini tanımlar. Örnek: Avrupa, Orta Doğu, İç Anadolu. Pazarlama stratejilerinin bölgesel dağılım analizlerinde kullanılır.\n\nFonksiyonel Kullanım ve İlişkiler:\n- FirmaKodu, sistem genelinde sipariş, sevkiyat, stok, üretim veya satın alma tablolarında yabancı anahtar (foreign key) olarak kullanılır.\n- Tur ve FirmaGrubu, sistemde firma filtrelemelerinde, yetkilendirme yapılarında ve dashboard segmentasyonlarında kullanılır.\n- SirketAdi, kurum içi dağılımı göstererek firma-şirket ilişkisini şeffaf hale getirir.\n- Ulke ve SatisBolgesi sütunları dış ticaret ve ihracat/iç pazar ayrımlarında kritik rol oynar.\n\n7. Tablo: AI_Tanim_Tezgah_Listesi\n\nGenel Tanım:\nAI_Tanim_Tezgah_Listesi tablosu, firmanın üretim altyapısında yer alan tüm tezgahların teknik ve operasyonel özelliklerini kayıt altında tutar. Bu bilgiler sayesinde üretim planlaması, verimlilik ölçümü, performans analizi, bakım yönetimi ve kapasite değerlendirmesi gibi kritik karar destek süreçleri yürütülür. Tezgahlar fiziksel olarak üretimin kalbidir ve bu tablo, o kalbin nabzını dijital olarak izlemeyi sağlar.\n\nSütun Tanımları ve Anlamları:\n- TezgahKodu: Her bir tezgah için sistemde tanımlı olan benzersiz koddur. Diğer üretim tabloları (örneğin: iş emirleri, planlama) ile ilişki kurmak için anahtar alan olarak kullanılır.\n- En: Tezgahın kumaşı tek en (tek taraflı) mi, çift en (her iki taraflı) mi, üç en mi dokunacağı ve örüleceğini belirtir. Bu bilgi üretim tipi seçiminde kullanılır.\n- Markasi: Tezgahın üretici markasını belirtir. Örneğin: Dornier, Picanol, Smit gibi makine markaları olabilir.\n- Tipi: Tezgahın teknik kullanım tipini belirtir. Örneğin: saten, örme, yuvarlak örme gibi kumaş türüne göre ayrım yapar.\n- Cinsi: Tezgahın çalıştığı dokuma türünü tanımlar. Örneğin: jakarlı, armürlü, örme vb. Bu bilgi, kumaş türüyle uyum açısından kritiktir.\n- Grup: Tezgahın dahil olduğu tezgah grubunu ifade eder. Raporlama ve grup bazlı analizlerde kullanılır. Örneğin; Y13-Y16 tezgah grubunu ifade eder.\n- SubeAdi: Tezgahın fiziksel olarak bulunduğu şubenin adıdır. Özellikle birden fazla üretim tesisi olan firmalarda, lokasyon bazlı yönetim için önemlidir.\n- Konum: Tezgahın fiziksel olarak kaçıncı katta bulunduğu yer bilgisidir. (örnek: 1. Kat, 2. Kat, Boğaziçi vb.)\n- TarakEni: Tezgahın çalışabileceği maksimum kumaş genişliğini gösterir. (cm cinsinden)\n- ReelCozguTeli: Tezgahta fiilen kullanılan toplam çözgü teli adedidir. Kumaş yoğunluğu ve dokuma optimizasyonu açısından kritik bir parametredir.\n- MakinaDevri: Tezgahın ortalama çalışma hızı (rpm: devir/dakika) bilgisidir. Hız ve kalite dengesi bu alana bağlıdır.\n- OrtRandiman: Tezgahın belirli bir dönem için ölçülmüş ortalama verimlilik yüzde değeridir. Performans ölçümlerinde kullanılır.\n- GunlukTCalisma: Tezgahın günlük ortalama çalışma saat süre bilgisidir. Üretim kapasitesi analizlerinde referans alınır.\n- CalismaDurumu: Tezgahın mevcut durumu hakkında bilgi verir. Örnek değerler: Aktif, Pasif, Kapalı, Sanal olabilir.\n\nFonksiyonel Kullanım ve İlişkiler:\n- TezgahKodu, iş emri, üretim takibi ve planlama tablolarında foreign key olarak kullanılır.\n- Tipi, Cinsi ve Grup, kumaş türüne göre doğru tezgah atamasını yapabilmek için eşleştirme kriteridir.\n- TarakEni, ReelCozguTeli ve MakinaDevri gibi teknik sütunlar, randıman optimizasyonu ve rota planlamasında rol oynar.\n- CalismaDurumu ve OrtRandiman, bakım periyodu takibi ve yatırım planlamalarında analiz kriteridir.\n\n8. Tablo: AI_Iplik_SatinalmaSiparis_Durum\n\nGenel Tanım:\nAI_Iplik_SatinalmaSiparis_Durum tablosu, kumaş üretim süreci için tedarik edilen ipliklerin sipariş süreçlerine dair tüm kritik verileri içerir. Hangi ipliğin, hangi firmadan, ne zaman ve ne miktarda sipariş edildiğini gösterir. Tablodaki bilgiler, tedarik zinciri yönetimi, termin uygunluk takibi ve maliyet analizleri için kullanılmakta olup, satın alma planlaması ve stok giriş süreçlerinin temelini oluşturur. Ayrıca geciken siparişlerin, teslim edilen miktarların ve kalan ihtiyaçların takibi bu tablo üzerinden yapılır.\n\nSütun Tanımları ve Anlamları:\n- SiparisID: Her bir satın alma siparişinin sistemdeki benzersiz kimlik numarasıdır. Anahtar (primary key) alan olarak kullanılır.\n- SipNo: Satın alma siparişin sistem tarafından otomatik atanan takip numarasıdır. Operasyonel takibin yapılmasında referans niteliğindedir.\n- Tarih: Satın alma siparişin tarih bilgisini ifade eder.\n- GirisTarihi: Satın alma siparişin sisteme giriş yapıldığı tarihi gösterir.\n- FirmaAdi: Satın alma siparişi verilen ipliğin tedarik edildiği firma adıdır. AI_Tanim_Firma_Listesi ile ilişkilidir.\n- Kayit_Kimin: Satın alma siparişinin hangi şirkete ait olduğunu gösterir. Grup şirketleri veya çoklu organizasyon yapılarında ayrımı sağlar.\n- IplikKodu: Satın alma siparişi verilen ipliğin sistemsel kodudur. AI_Tanim_Iplik_Listesi tablosu ile ilişkilidir.\n- Cins: Satın alma siparişi verilen ipliğin cins bilgisidir. Örnek: polyester, pamuk vb. İplik sınıflandırmasında kullanılır.\n- Renk: Satın alma sipariş edilen ipliğin sistemsel renk kodudur.\n- RenkAdi: Satın alma renk alanının açıklayıcı adıdır. İnsan tarafından daha anlaşılır hale getirilmiş tanımıdır.\n- Miktar: Satın alma yapılacak olan ipliğin sipariş edilen miktarını belirtir.\n- GelenMiktar: Satın alma siparişinin teslim alınan miktarını gösterir. Satın alma siparişi farklı zamanlarda parçalı şekilde teslim alınabilir. Karşılaştırmalı analizlerde kullanılır.\n- TerminTarihi: Satın alma sipariş edilen ipliğin beklenen teslim tarihidir. Tedarik performans analizleri için önemlidir.\n- TerminUygunDurum: Siparişin zamanında teslim edilip edilmediğini belirtir. Zamanında teslimat KPI’si bu alandan hesaplanır.\n- BirimFiyati: Satın alma siparişindeki her bir ipliğin satın alma birim fiyatı içerir.\n- OdemeSekli: Ödeme para birimini ve KDV dahil mi belirtir. Döviz bazlı muhasebe işlemlerinde kullanılır.\n- TeslimatYeri: İpliğin teslim edilmesi gereken yeri lokasyonu tanımlar (örnek: Merkez Depo, Boyahane Girişi).\n- SiparisKapandi: Siparişin tamamlanıp tamamlanmadığını gösterir. (Evet/Hayır gibi değer alabilir)\n\n9. Tablo: AI_Iplik_ImalEmri_Durum\n\nGenel Tanım:\nAI_Iplik_ImalEmri_Durum tablosu, firmanın iplik üretim süreci kapsamında oluşturulan tüm imalat emirlerine ait detayları kayıt altına alır. Bu tablo, üretilecek ipliğin teknik tanımı, miktarı, kullanılan hammadde çıkışları, üretim girişi ve fire değerleri gibi üretimsel verileri içerir. Tablodaki bilgiler, üretim planlama, termin yönetimi, stok takibi, fire kontrolü ve üretim performans analizlerinde kritik rol oynar. Özellikle fason üretim süreçlerinde geri dönüşlerin takibi ve üretimle karşılaştırılması açısından merkezi bir kontrol mekanizması sunar.\n\nSütun Tanımları ve Anlamları:\n- ImID: Her imalat emrine sistem tarafından atanan benzersiz tanımlayıcıdır. (Primary key)\n- IIENo: İmalat emrinin sistemdeki takip numarasıdır. Operasyonel izleme ve raporlama süreçlerinde referans kod olarak kullanılır.\n- Tarih: İmalat emrinin sisteme kaydedildiği tarihi ifade eder. Zamansal raporlamalar için referans alınır.\n- FirmaAdi: İpliğin tedarik edildiği firma adıdır. Tedarikçi takibi ve performans ölçümünde kullanılır.\n- IplikKodu: Üretilmesi planlanan ipliğin sistemsel hammadde kodudur. AI_Tanim_Iplik_Listesi ile ilişkilidir.\n- Cins: Üretilmesi planlanan ipliğin cins bilgisidir. Örnek: polyester, pamuk vb. İplik sınıflandırmasında kullanılır.\n- UstGrup1: İpliğin ait olduğu ana ürün grubunu belirtir. Kategori bazlı sınıflandırmalarda kullanılır.\n- UstGrup2: İpliğin bağlı olduğu daha alt seviye grup bilgisidir.\n- Birim: Tanımlı olan hammaddenin numara birim bilgisini belirtir (örneğin: Nm, NeB, den).\n- RenkAdi: Üretilecek hammaddenin renk adını belirtir.\n- HarmanNo: Üretilen ipliğe ait harman (lot) numarasıdır. Takip, izlenebilirlik ve kalite kontrol süreçlerinde kullanılır. Depo girişi yapılırken hammaddenin lot numarası olarak kullanılır.\n- Miktar: İmal emri kapsamında üretilecek toplam iplik miktarını ifade eder. (kg bazında)\n- ELCikis: Elyaf olarak üretimden çıkan hammaddenin miktarını gösterir. Elyaf kullanımı ile ilgili hammadde çıkışlarını izlemek için kullanılır.\n- IPCikis: İmal emri üretimi için iplik işletmelerine gönderilen hammadde veya yarı mamül iplik miktarıdır. \n- HamMaddeCikis: ELCikis ve IPCikis toplamı olup, üretimde kullanılan toplam hammadde çıkışını ifade eder.\n- IPGiris: İmal emri için üretilmiş ve depoya girmiş olan ipliğin miktarıdır.\n- UretilenKg: İplik işletmelerinde imal emri için üretilmiş olan iplik miktarıdır. Bu bilgi sahadan toplanıyor olup depo girişi yapılma zorunluluğu bulunmamaktadır. \n- BakiyeKg: İmal emri oluşturulan miktardan henüz üretilmemiş, eksik kalan iplik miktarıdır.\n- Fire: Üretim sürecinde oluşan kayıp miktarıdır. (kg bazında)\n- TerminTarihi: İmalat emrinin üretiminin tamamlanmasının planlandığı tarih bilgisidir.\n- Senil: Üretilen ipliğin şönil li iplik olup olmadığını belirtir. (Evet/Hayır gibi değerler alır)\n\n10. Tablo: AI_Iplik_FasonSiparis_Durum\n\nGenel Tanım:\nAI_Iplik_FasonSiparis_Durum tablosu, firma dışı üretim yöntemi olan fason iplik siparişlerine ilişkin tüm verileri içerir. Bu yapı, dış üreticiye (fason firmaya) yaptırılan ipliklerin tedarik sürecini, miktarlarını, teslimat zamanlarını ve maliyetlerini izlemek amacıyla kullanılır. İplik üretiminin tamamının ya da bir kısmının dış kaynakla yürütüldüğü durumlarda, sipariş detaylarının sistematik takibini sağlar. Böylece satın alma ve üretim ekipleri, fason üretim performansını ölçebilir, stok kontrolü ve termin yönetimi yapabilir.\n\nSütun Tanımları ve Anlamları:\n- FasonSipNo: Her bir fason iplik siparişi için sistem tarafından oluşturulan benzersiz takip numarasıdır. Bu alan üzerinden fason siparişin tamamı izlenir.\n- Tarih: Fason siparişin sisteme kaydedildiği tarihi ifade eder. Operasyonel süreç takibi için önemlidir.\n- GirisTarihi: Fason siparişi Üretilen ipliğin firmaya fiziksel olarak giriş yaptığı tarih bilgisidir.\n- FirmaAdi: Fason üretimi gerçekleştiren tedarikçi firmanın ticari adıdır. AI_Tanim_Firma_Listesi tablosuyla ilişkilidir.\n- Kayit_Kimin: İlgili siparişin hangi şirket adına açıldığını belirtir. Çoklu şirket yapılanmalarında ayırıcı kimlik görevi görür.\n- IplikKodu: Fason siparişe konu olan ipliğin sistemdeki tanımlı hammadde kodudur. AI_Tanim_Iplik_Listesi ile ilişkilidir.\n- Cins: Fason sipariş edilen ipliğin cinsini belirtir. Örneğin; polyester, pamuk gibi sınıflandırmalar içerir.\n- Renk: Fason sipariş edilen ipliğin sistemsel renk kodudur. Teknik ve görsel ayrım açısından kullanılır.\n- RenkAdi: Fason sipariş edilen renk kodunun açıklayıcı adıdır. Kullanıcı dostu tanım sağlar (örneğin: Koyu Mavi, Krem).\n- Miktar: Fason sipariş edilen iplik miktarıdır. Genellikle kilogram (kg) cinsindendir.\n- GelenMiktar: Fason sipariş edilen ipliğin teslimat miktarını gösterir.\n- TerminTarihi: Fason siparişin üretilip teslim edileceği tarihi bilgisidir. Tedarik kontrolü ve teslimat uyum analizinde kullanılır.\n- BirimFiyati: Fason sipariş kapsamında iplik başına belirlenen birim fiyat bilgisidir. Maliyet analizleri için gereklidir.\n- OdemeSekli: Fason siparişin ödeme birimini belirtir. (Örn: TL, USD, EUR) Döviz cinsinden raporlama yapılabilmesi için gereklidir.\n- SiparisKapandi: Fason siparişin tamamlanıp tamamlanmadığını ifade eder. Evet/Hayır veya 1/0 gibi mantıksal veri içerir.\n\n11. Tablo: AI_Iplik_BoyahaneSiparis_Durum\n\nGenel Tanım:\nAI_Iplik_BoyahaneSiparis_Durum tablosu, dış kaynak (fason) üretim yoluyla boyahaneye verilen iplik siparişlerine ilişkin tüm operasyonel bilgilerin takip edildiği temel veri kaynağıdır. Bu yapı, boyahane süreçlerinde üretimi yapılan ipliklerin takibini kolaylaştırmak amacıyla oluşturulmuştur. Hangi iplik cinsinin, hangi renkte ve miktarda boyanmak üzere hangi firmaya ne zaman sipariş edildiğini kayıt altına alır. Ayrıca teslimat durumu, depoya giriş miktarı, termin tarihleri, kazan bilgisi gibi detaylar da tabloda tutulur. Tablodaki bilgiler sayesinde planlama, depo yönetimi, tedarikçi performans takibi ve stok kontrol süreçleri entegre biçimde yürütülür. Sipariş kabul durumu ve kalan miktar takibi gibi kontrol noktaları bu tablo üzerinden izlenebilir.\n\nSütun Tanımları ve Anlamları:\n- BoyahaneSipID: Boyahane siparişine ait sistemdeki benzersiz tanımlayıcı (ID).\n- SiparisNo: Boyahane sisteminden gelen senkron sipariş numarası.\n- BoyahaneSipNO: İplik siparişinin boyahaneye atanan sipariş numarası.\n- BoyaSiparisTarihi: Boyahane siparişinin oluşturulduğu tarih.\n- FirmaAdi: Boyahane siparişinin tedarikçi firmanın ticari adıdır. AI_Tanim_Firma_Listesi tablosuyla ilişkilidir.\n- IplikKodu: Boyahane siparişe konu olan ipliğin sistemdeki tanımlı kodu.\n- IplikCinsi: Boyahane Sipariş verilen ipliğin hammadde cinsi. Örn: polyester, pamuk vb.\n- RenkKodu: İpliğe ait sistemsel renk kodu.\n- RenkAdi: Boyahane Siparişi verilen hammaddenin renk kodunun açıklayıcı adıdır. Kullanıcı dostu tanım sağlar (örneğin: Koyu Mavi, Krem).\n- UstGrup1: İpliğin ait olduğu birinci seviye kategori veya ana grup.\n- UstGrup2: İpliğin ait olduğu ikinci seviye kategori (UstGrup1’in alt grubu).\n- KabulDurum: Boyahaneden alınan siparişin kabul edilme durumu.\n- Miktar: Toplam sipariş miktarı. (Tekrar KadifeSipMiktari ile aynı olabilir)\n- GirisMiktari: Depoya fiziksel olarak giren toplam iplik miktarı.\n- Aciklama: Boyahane Siparişine ilişkin özel not ya da açıklama alanı.\n- TerminTarihi: Boyahane siparişi için planlanan teslim tarihi.\n- KazanNo: Boyama işleminin yapıldığı kazan numarası.\n- Kayit_Kimin: Siparişin hangi şirkete (holding, birim) ait olduğunu belirtir.\n- Durum: Siparişin genel durum bilgisidir. (Aktif, pasif vb.)\n\n12. Tablo: AI_Iplik_Depo_Durum_Listesi\n\nGenel Tanım:\nAI_Iplik_Depo_Durum_Listesi tablosu, iplik depolarında bulunan tüm hammadde stoklarının detaylı ve anlık takibini sağlayan referans veri kaynağıdır. Bu tablo sayesinde ipliğin hangi renkte, hangi partide (lot), hangi firmadan temin edildiği ve fiziksel olarak depo içindeki konumu izlenebilir. Ayrıca hammaddenin üretim durumu, kalite sınıfı ve varsa boyahane süreciyle olan ilişkisi gibi kritik bilgiler sistematik olarak saklanır. İpliklerin depo miktarı, hangi iş emirlerine tahsis edildiği (rezerve miktar) ve geriye kalan kullanılabilir miktarı da bu yapı üzerinden yönetilir. Stok yönetimi, üretim planlama, lot bazlı izlenebilirlik ve depo içi yerleşim gibi süreçler için hayati öneme sahiptir.\n\nSütun Tanımları ve Anlamları:\n- IplikKodu: İpliğin sistemde kayıtlı olan teknik ve benzersiz hammadde kodudur. Malzeme takibi ve süreç ilişkilerinde anahtar rol oynar.\n- RenkAdi: Depoda bulunan ipliğin görsel tanımını sunan renk adıdır. Kullanıcıya daha anlaşılır bir renk bilgisi sağlar.\n- Cins: İpliğin hammaddesel türünü belirtir. Örnek: polyester, pamuk, viskon. İplik gruplaması ve kalite kontrol süreçleri için önemlidir.\n- LotNo: İpliğe ait üretim partisini (lot) belirtir. Aynı ipliğin farklı lotları fiziksel farklılık gösterebileceğinden izlenebilirlik açısından zorunludur.\n- FirmaAdi: İpliği tedarik eden veya üreten firmanın adıdır. Kendi üretimleri için genellikle “KADİFETEKS” sabit ifadesi kullanılır.\n- DepoAdi: Hangi fiziksel depoda saklandığını ifade eder. Çok lokasyonlu depo sistemlerinde konum yönetimi sağlar.\n- Ack: Depodaki ipliğe dair açıklayıcı not veya durum bilgisidir. Üretim aşaması, kalite dışı durumlar, iade, hasar gibi notları içerebilir.\n- Koordinat: Depo içinde ipliğin fiziksel yerini tanımlar. Genellikle raf sistemine göre tanımlanır (örnek: A2-RF3).\n- Kalite: Depodaki ipliğin kalite sınıfını belirtir. Örneğin: A Kalite, 2. Kalite, Fire gibi üretim uygunluğuna göre sınıflamalar içerir.\n- BanyoNo: Eğer iplik boya işleminden geçmişse, hangi reçeteyle boyandığını gösteren boyahane reçete numarasıdır. Boyanmış ipliklerin takibinde kritik veridir.\n- DepoMiktari: İpliğin depoda fiziksel olarak mevcut olan toplam miktarını (kg cinsinden) belirtir.\n- ReserveMiktari: Dokuma veya üretim iş emirlerine tahsis edilmiş (rezerve edilmiş) iplik miktarıdır. Bu miktar üretim için ayrılmış ama henüz kullanılmamış olabilir.\n- KalanDepoMiktari: Kullanılabilir net miktarı gösterir. Yani DepoMiktari - ReserveMiktari hesabıyla elde edilen, henüz tahsis edilmemiş kullanılabilir stok bilgisidir.\n\n13. Tablo: AI_Iplik_Depo_Hareket_Listesi\n\nGenel Tanım:\nAI_Iplik_Depo_Hareket_Listesi tablosu, iplik deposunda gerçekleşen tüm hareketlerin (giriş, çıkış, transfer, red vs.) ayrıntılı olarak takip edilmesini sağlar. Her bir hareket, iplik kodu, lot bilgisi, miktar, tarih, hangi kullanıcı tarafından işlendiği ve hareketin nedeni gibi operasyonel detayları içerir. Bu tablo, depo yönetimi, stok takibi, kalite kontrol ve red yönetimi gibi süreçlerde kritik rol oynar. Aynı zamanda fason ilişkili hareketlerin, üretim emirlerine bağlı giriş-çıkışların ve depo koordinat bilgilerinin izlenmesini sağlar. Parti bazlı ve detaylı izlenebilirlik için temel veri kaynağıdır.\n\nSütun Tanımları ve Anlamları:\n- IpDepoHrkSubID: İplik depo hareketi yapılan iplik için atanmış olan barkod numarasıdır.\n- FisNo: İplik depo hareket emrini ait fiş numarasıdır. Bu numara ile ipliklerin nereye ne zaman hareket edileceği belirlenir.\n- Tarih: İplik depo hareketine ait tarih bilgisini ifade eder. \n- FirmaAdi: İplik depo hareketine kayıtlı olan firmanın ticari adını belirtir. Depo girişi yapılırken tedarikçi, Depo çıkışı yapılırken müşteri olarak değerlendirilir.\n- HarSebebi: İpliğin depo haretinin ne amaçla yapıldığını açıklar. Satın alma, Üretime çıkış, Devir, Sayım vb.\n- IplikKodu: İplik depo hareket yapılan hammaddenin sistemsel kodunu belirtir.\n- RenkAdi: İplik depo hareket yapılan hammaddenin renk adını belirtir.\n- Cins: İplik depo hareket yapılan hammaddenin cinsini belirtir. Örneğin; polyester, pamuk, viskon vb.\n- DepoAdi: Hangi fiziksel depoda saklandığını ifade eder. Çok lokasyonlu depo sistemlerinde konum yönetimi sağlar.\n- Koordinat: Depo içinde ipliğin fiziksel yerini tanımlar. Genellikle raf sistemine göre tanımlanır (örnek: A2-RF3).\n- Kalite: Depo hareketindeki hammaddenin kalite sınıfını belirtir. Örneğin: A Kalite, 2. Kalite, Fire gibi üretim uygunluğuna göre sınıflamalar içerir.\n- UstGrup1: İpliğin ait olduğu birinci seviye kategori veya ana grup.\n- UstGrup2: İpliğin ait olduğu ikinci seviye kategori (UstGrup1’in alt grubu).\n- LotNo: Depo hareketine ait hammaddenin lot (parti) numarasını belirtir.\n- Sonil: Depo hareketindeki ipliğin şönil li iplik olup olmadığını belirtir.\n- Miktar: Depo hareketindeki ipliğin hareket miktarını ifade eder. Depo çıkışı yapılıyorsa Çıkış Miktarını, Depo girişi yapılıyorsa Giriş Miktarını ifade eder.\n- IIENo: Hangi imalat emri üzerinden sisteme geldiğini ifade eder. AI_Iplik_ImalEmri_Durum tablosu ile ilişkilidir.\n- FasonSipNo: Hangi fason sipariş üzerinden sisteme geldiğini ifade eder. AI_Iplik_FasonSiparis_Durum tablosu ile ilişkilidir.\n- GirenKullanici: Depo hareketi yapan kullanıcının adını gösterir.\n- Kayit_Kimin: Depo hareketin hangi şirkete (holding, birim) ait olduğunu belirtir.\n- Aciklama: Depo Hareketine ait Açıklama bilgisini gösterir\n- HrkTuru: Ç olanlar Depo Çıkışları G harfi olanlar Depo Girişleri ifade etmektedir. \n\n14. Tablo: AI_Iplik_Ihtiyac_Listesi\n\nGenel Tanım: \nAI_Iplik_Ihtiyac_Listesi tablosu, kumaş siparişleri doğrultusunda ihtiyaç duyulan iplik miktarlarını takip eden temel veri kaynağıdır. Bu tablo, belirli kumaş siparişlerinin hangi iplik türlerini (atkı, çözgü, hav) ve miktarlarını gerektirdiğini gösterir. İhtiyaçların karşılanma durumu, tahmini teslim tarihleri ve iplik tipi gibi önemli bilgilerle, üretim ve tedarik süreçlerinin daha verimli yönetilmesine yardımcı olur. \n\nSütun Tanımları ve Anlamları:\nIhtiyacID: Kumaş siparişinden doğan iplik ihtiyacı için verilen benzersiz barkod numarasıdır. Her bir iplik ihtiyacı kaydının takibini sağlar.\nTarih: Hammadde ihtiyacı kaydının oluşturulduğu tarihtir. İhtiyaçların ne zaman doğduğunu ve kaydedildiğini belirler.\nGrup: Oluşan hammadde ihtiyacının tipi veya kategorisidir. Örneğin, atkı, çözgü veya hav gibi gruplar.\nIplikKodu: Oluşan hammadde ihtiyacının belirli bir iplik türüne ait sistemsel kodudur. Bu, hangi iplik türünün gerektiğini belirtir.\nMiktar: Oluşan hammadde ihtiyacının miktarını belirtir. İhtiyaç duyulan iplik miktarının kilogram veya diğer ölçü birimindeki değerini ifade eder.\nAtamaMik: Karşılanan hammadde ihtiyacını belirtir. Hangi miktar ihtiyacın tedarik edildiğini gösterir.\nAtamaBakiye: Henüz karşılanmamış olan iplik ihtiyacını ifade eder. Yani, henüz tedarik edilmemiş miktarı belirtir.\nKapanmaTarihi: Hammadde ihtiyacının tamamının karşılanması durumunda, ihtiyacın kapanma tarihini ifade eder. Tedarik süreci tamamlandığında bu tarih belirlenir.\nTeorikIplikTermin: Hammadde ihtiyacının karşılanması planlanan tarihtir. İhtiyacın ne zaman tamamlanacağına dair tahmini teslim tarihini belirtir.\nSiparisNo: Kumaş siparişine ait benzersiz numaradır. Her siparişin takibi için sistem tarafından otomatik olarak atanır.\nFirmaAdi: Kumaş siparişi veren firmanın ticari adıdır. Hangi firmaya ait bir sipariş olduğunu belirtir.\nKaliteKodu: Kumaşın kalite kodunu belirtir. Bu alan, kalite sınıflandırması yapmak için kullanılır ve AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\nKaliteAdi: Kumaşın kalitesine verilen ticari veya teknik adıdır. Kullanıcıların kumaş kalitesini anlaması için açıklayıcı bir ad sağlar.\nDesenNo: Kumaş siparişine ait benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\nDesenAdi: Kumaş siparişine ait benzersiz desen adıdır. Bu ad tasarımcı tarafından verilen isim veya sistemde kayıtlı olan ad olabilir.\nVaryantNo: Aynı desenin farklı renk kombinasyonlarını ayırt etmek için kullanılan varyant numarasıdır.\nProsesKodu: Kumaşın üretim sürecinde geçtiği işlemleri tanımlayan koddur. Bu, kumaşın boyama, apre, yıkama gibi işlemlerden geçtiği rotayı gösterir.\n\n15. Tablo: AI_Kumas_Siparis_Paz_Listesi\n\nGenel Tanım:\nAI_Kumas_Siparis_Paz_Listesi tablosu, pazarlama birimi tarafından oluşturulan kumaş siparişlerinin tüm süreç bilgilerini içeren bir referans tablosudur. Bu tablo, siparişin türünden, müşteri temsilcisine, kalite tanımlarından, çözgü yapısı ve cağar kodlarına kadar geniş bir yelpazede teknik ve ticari detayları barındırır. Siparişin üretime geçiş durumu, müşteri talepleri ve üretimle koordinasyon sağlanabilmesi için kritik bir kaynaktır. Ayrıca, sipariş sürecinin her aşamasını takip etmeye olanak tanır, böylece üretim hazırlığı ve siparişin gerçekleştirilmesi arasında bağlantı kurar.\n\nSütun Tanımları ve Anlamları:\n- SiparisNo: Kumaş Siparişin fişine ait sistemde otomatik oluşturulan benzersiz numarasıdır. Siparişlerin takibi ve raporlanması için kullanılır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, firma bazlı raporlama ve analizler için kullanılır. AI_Tanim_Firma_Listesi tablosu ile ilişkilidir.\n- SipTarihi: Kumaş siparişin verildiği tarihi belirtir. Siparişin zamanlamasını ve teslimat takibini sağlamak için önemlidir.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- Ulke: Kumaş siparişi veren firmanın kayıtlı olduğu ülkeyi belirtir. Siparişlerin yerel ve uluslararası takibini sağlar.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır. \n- ProsesKodu: Kumaş siparişine ait kumaşın üretim sürecinde geçtiği işlemleri rotasını tanımlayan koddur. Örneğin; boyama, apre, yıkama gibi işlemler.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- Kompozisyon: Kumaş siparişi verilen kumaşta kullanılan hammadde yüzdelerini belirtir. \n- CozKodu: Kumaş siparişi verilen kumaştaki çözgü kodunu belirtir.\n- CozAdi: Kumaş siparişi verilen kumaştaki çözgü adını belirtir.\n- CagarKodu: Kumaş siparişi verilen kumaştaki cağarlık kodunu belirtir. Sadece Kadife olan Kalite Tipleri için geçerlidir.\n- UretimeGecti: Kumaş siparişin süreç olarak müşteriden alındığını ancak üretime geçip geçmediğini belirten sütundur. Siparişin üretim aşamasına ne zaman geçtiğini takip eder.\n- SipMiktar: Kumaş sipariş verilen kumaşın sipariş miktarını ifade eder. Bu, üretim sürecindeki siparişin büyüklüğünü belirler.\n- Kayit_Kimin: Kumaşın hangi firmaya ait olduğunu gösterir. Bu, tedarikçi ya da müşteri bazlı sahiplik bilgisini içerir.\n\n16. Tablo: AI_Kumas_Siparis_Listesi\n\nGenel Tanım:\nAI_Kumas_Siparis_Listesi tablosu, pazarlama biriminde yazılan kumaş siparişlerinin üretim sürecine alınmış siparişlerin temel veri kaynağıdır. Tabloda, kumaş sipariş edilen kumaşın kalite adı, desen adı, varyantı, sipariş metrajı, siparişin mevcut durumu ve termin tarihleri gibi bilgileri içerir. Ayrıca, kumaş siparişin hangi aşamada olduğu (örneğin: sanalda, üretimde, depoda, aprede) ve kumaş siparişin tamamlanıp tamamlanmadığı gibi bilgiler de bu tabloda yer almaktadır. Bu yapı, kumaş siparişlerin takibi ve üretim süreçlerinin verimli yönetilmesi için kritik öneme sahiptir.\n\nSütun Tanımları ve Anlamları:\n- SiparisNo: Kumaş siparişin sistemdeki benzersiz numarasıdır. Her siparişin takip edilmesi ve raporlanması için kullanılır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- SiparisYeri: Kumaş siparişin açıldığı yeri belirtir. Örneğin: üretimde, depoda aprede veya sanalda\n- SiparisSekli: Kumaş siparişin alım şekli belirtir. Örneğin: regüle (seri üretim), kesmece, sanal, contract (sözleşmeli), parti gibi sipariş türleri bulunur.\n- SiparisGrubu: Kumaş siparişin üretim şeklini belirtir. Örneğin: express (hızlı teslimat), 2. kalite, normal sipariş gibi kategoriler.\n- SipTarihi: Kumaş sipariş verildiği tarihtir. Siparişin zamanlamasını ve teslimatın takibini sağlar.\n- TerminTarihi: Kumaş siparişin genel termin tarihidir. Kumaş sipariş edilen kumaşın, üretim sürecinde tamamlanıp teslim edilmesi planlanan tarihi ifade eder.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- SatisBolgesi: Kumaş siparişi veren firmanın satış bölgesini belirtir. Örneğin: Orta Doğu, Avrupa, İç Anadolu gibi coğrafi bölgeler.\n- Ulke: Kumaş siparişi veren firmanın ülkesini belirtir. Siparişin kaynağını ve coğrafi takibini sağlar.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır. \n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KapKaliteGrubu: Kumaş siparişi verilen kumaşın ait olduğu teknik kalite grubunu belirtir. Örneğin; örme, 4800 class, 9600 gibi üretim gruplarını içerir.\n- ApreIslemiTipi: Kumaş siparişi verilen kumaşın hangi apre işlemine tabi tutulduğunu belirtir. Örneğin; boyama, proses, dijital baskı gibi işlemleri kapsar.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- CozKodu: Kumaş siparişi verilen kumaştaki çözgü kodunu belirtir.\n- CozAdi: Kumaş siparişi verilen kumaştaki çözgü adını belirtir.\n- SipMiktar: Kumaş sipariş verilen kumaşın sipariş miktarını ifade eder. Bu, üretim sürecindeki siparişin büyüklüğünü belirler.\n- ProsesKodu: Kumaş sipariş verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan koddur. Örneğin; boyama, yıkama, apre gibi işlemler.\n- TeorikYuklemeTarihi: Kumaş siparişi verilen kumaşın teorik olarak sevk edilmesi planlanan tarih bilgisidir. Sevk planlamasında önemli bir referans tarihidir.\n- Kapandi: Kumaş siparişin tamamlanıp tamamlanmadığını belirten durum bilgisidir. (Evet/Hayır, 1/0 gibi mantıksal veri içerir.)\n\n17. Tablo: AI_Dokuma_IsEmri_Listesi\n\nGenel Tanım:\nAI_Dokuma_IsEmri_Listesi tablosu, kumaş üretim sürecinde yapılan dokuma iş emirlerinin tüm detaylarını içerir. Her bir iş emri, kumaş siparişine dayalı olarak başlatılır ve tablonun içeriği, bu iş emirlerinin zaman çizelgesi, kalite bilgileri, kullanılan materyaller ve üretimle ilgili teknik parametreleri kapsamlı bir şekilde takip eder. Bu tablo, üretim planlaması, kalite kontrolü, dokuma takibi ve süreç izlenebilirliği açısından kritik bir veri kaynağıdır.\n\nSütun Tanımları ve Anlamları:\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- Tarih: Dokuma iş emrinin tanımlandığı tarihtir.\n- SiparisNo: Dokuma iş emri ait sistemdeki benzersiz numaradır.\n- FirmaAdi: Dokuma iş emri veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- TezgahNo: Dokuma iş emrinin dokunacağı veya örüleceği tezgahın numarasını belirtir.\n- PUrBasTar: Dokuma iş emrinin üretime başlama tarihidir.\n- PUrBitTar: Dokuma iş emrinin üretime bitiş tarihidir.\n- PlanMetraj: Dokuma iş emrinin plan metresidir.\n- ToplamHamMetre: Dokuma iş emrine ait üretimi yapılıp ham kalite kontrolde sarılmış toplam metredir.\n- Kalite: Dokuma iş emri verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Dokuma iş emri verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- KaliteTipi: Dokuma iş emri verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- DesenNo: Dokuma iş emri ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Dokuma iş emri ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: KDokuma iş emri ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- CozKodu: Dokuma iş emri verilen kumaştaki çözgü kodunu belirtir.\n- CozAdi: Dokuma iş emri verilen kumaştaki çözgü adını belirtir.\n- CagarKodu: Dokuma iş emri verilen kumaştaki cağarlık kodunu belirtir.\n- ProsesKodu: Dokuma iş emri verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Durumu: Dokuma iş emrinin son durumunu gösterir.\n\n18. Tablo: AI_Apre_HamToplar_Listesi\n\nGenel Tanım:\nAI_Apre_HamToplar_Listesi tablosu, üretim sürecindeki ham kumaşlara ait kalite, desen, varyant, iş emri ve üretim aşamalarına dair teknik bilgileri kayıt altına alır. Kumaşın ham kalite ve desen bilgileri, iş emri numarası, ölçülen metrajı ve üretim sırasında (iğneleme, apre gibi) oluşan fire miktarları gibi kritik veriler bu tabloda yer alır. Ayrıca kumaşta tespit edilen hataların tanımı da bu yapı içinde tutulur. Ham kumaşın üretim ve işlem geçmişini izlemek, kalite kontrol ve stok planlama gibi süreçlerde referans olarak kullanılır.\n\nSütun Tanımları ve Anlamları:\n- TopID: Ham kumaşa ait atanan benzersiz kimlik ID bilgisidir.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- TezgahNo: Dokuma iş emrinin dokunacağı veya örüleceği tezgahın numarasını belirtir.\n- K_Tarih: Ham kumaş sarım yapılıp metrelendiği tarihi belirtir.\n- SiparisNo: Kumaş siparişine ait sistemdeki benzersiz numaradır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- CozAdi: Kumaş siparişi verilen kumaştaki çözgü adını belirtir.\n- AprePartiNo: Ham kumaşın apre işlemi sırasında kullanılan benzersiz (uniq) parti numarasıdır.\n- HamMetre: Ham kumaşın sarılmasından sonra ham metraj bilgisini belirtir (metre cinsinden).\n\n19. Tablo: AI_Apre_MamulToplar_Listesi_Kalite\n\nGenel Tanım:\nAI_Apre_MamulToplar_Listesi_Kalite tablosu, firma tarafından üretilen kumaşların son kontrollerinin yapıldığı mamül sarım makinelerinden alınan verileri içerir. Bu tablodaki sütunlar, kumaşın kalite durumu, metre bilgisi, kalite desen ve varyantı gibi kritik verileri içerir.\n\nSütun Tanımları ve Anlamları:\n- TopID: Mamul kumaşa sistem tarafından atanan benzersiz kimlik ID bilgisidir.\n- KontrolTarihi: Mamul kumaşın kontrol edildiği tarih bilgisini içerir.\n- HamID: Ham kumaşın ham sarımında tüm topa atanan benzersiz (uniq) koddur.\n- SiparisNo: Kumaş siparişe ait benzersiz numaradır. Sistem tarafından tanımlanır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- K_Tarih: Mamul kumaşın sarıldığı tarihtir.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- K_Kont: Mamul kumaşı kontrol eden operatörün adını belirtir.\n- K_En: Mamul kumaşın kontrol esnasında ölçülen kumaş enini belirtir.\n- K_grm: Mamul kumaşın gramaj bilgisini (g/m²) ifade eder.\n- K_Kalite: Mamul kumaşın kalite durumunu belirtir. Örneğin: 1. Kalite, İç Piyasa, Sorunlu, Bekleme, Parti Hazırlama, Baskı, Tamir.\n- ReelKaliteDurumu: Mamul kumaşın kalite durumunu harf olarak derecesini belirtir (örneğin: A, B, C, D).\n- K_Kg: Mamul kumaşın kontrol sırasında ölçülen kumaş kilosunu belirtir.\n- Net_Mt: Mamul kumaşın ölçülen net uzunluğunu (metre cinsinden) belirtir.\n- Isk: Mamul kumaş üzerindeki hatalı bölgelerin toplam uzunluğunu belirtir. Bazı hatalar noktasal bazı hatalar sürekli olabilir.\n- ParcaIskonto: Mamul kumaşın hatalı bölgelerden kesilerek çıkarılan parçaların toplam uzunluğunu belirtir.\n- ParcaMt: Mamul kumaştan alınan parçaların toplam uzunluğunu belirtir.\n- MknPayi: Mamul kumaşın kontrol makinesinde oluşan fire miktarını ifade eder.\n\n20. Tablo: AI_Apre_ReserveToplar_Listesi_Top\n\nGenel Tanım:\nAI_Apre_ReserveToplar_Listesi_Top tablosu, tekstil kumaş üretim sürecine dahil olan sipariş, kalite, firma ve sevkiyat bilgilerinin detaylı şekilde takibini sağlar. Tablo, her bir kumaşa ait kalite kodları, desen ve varyant bilgileri, teknik kalite grupları ve üretim süreçleri ile ilgili tanımlar içerir. Ayrıca, siparişin hangi firmaya ait olduğu, müşteri temsilcisi bilgisi, sipariş tarihi, yükleme yapılacak depo ve sevkiyat planlaması gibi lojistik bilgileri de yer alır. Bu yapı, üretim planlama, kalite yönetimi, müşteri hizmetleri ve depo operasyonları arasında bilgi bütünlüğü ve operasyonel izlenebilirlik sağlar.\n\nSütun Tanımları ve Anlamları:\n- ReserveID: Müşteri siparişlerinden oluşan mamul topların depoda hazır hale getirilmiş topların benzersiz fiş numarasıdır.\n- KayitEden: Rezerv kaydını oluşturan kullanıcının adını belirtir. Tedarikçi ya da müşteri olabilir.\n- TopID: Mamul kumaşın kumaşa sistem tarafından atanan benzersiz kimlik ID bilgisidir.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- SiparisNo: Kumaş siparişine ait benzersiz numaradır. Sistem tarafından tanımlanır.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Kayit_Kimin: Rezervin hangi şirkete ait olduğunu gösterir. ERP süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- K_Kalite: Mamul kumaşın kalite durumunu belirtir. Örneğin: 1. Kalite, İç Piyasa, Sorunlu, Bekleme, Parti Hazırlama, Baskı, Tamir.\n- GercekKalite: Mamul kumaşın kalite durumunu harf olarak derecesini belirtir (örneğin: A, B, C, D).\n- DepoYeri: Rezervin hangi depodan yükleneceğini belirtir. Depo adı veya kodu olabilir.\n- TeorikYuklemeTarihi: Rezervin sevk edilmesi planlanan tarih bilgisidir.\n\n21. Tablo: AI_Apre_CikisToplar_Listesi_Top\n\nGenel Tanım:\nAI_Apre_CikisToplar_Listesi_Top tablosu, tekstil kumaş üretim sürecine dahil olan sipariş, kalite, firma ve sevkiyat bilgilerinin detaylı şekilde takibini sağlar. Tablo, her bir kumaşa ait kalite kodları, desen ve varyant bilgileri, teknik kalite grupları ve üretim süreçleri ile ilgili tanımları içerir. Ayrıca, siparişin hangi firmaya ait olduğu, müşteri temsilcisi bilgisi, sipariş tarihi, yükleme yapılacak depo ve sevkiyat planlaması gibi lojistik bilgiler de yer alır. Bu yapı, üretim planlama, kalite yönetimi, müşteri hizmetleri ve depo operasyonları arasında bilgi bütünlüğü ve operasyonel izlenebilirlik sağlar.\n\nSütun Tanımları ve Anlamları:\n- KETSCekiNo: Mamul çıkış sevkiyat yapılan çıkışa ait benzersiz fiş numarasıdır.\n- KayitEden: Mamul çıkış sevkiyat kaydını oluşturan kullanıcının adını belirtir. Tedarikçi ya da müşteri olabilir.\n- TopID: Mamul kumaşın kumaşa sistem tarafından atanan benzersiz kimlik ID bilgisidir.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- SiparisNo: Kumaş siparişine ait benzersiz numaradır. Sistem tarafından tanımlanır.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Kayit_Kimin: Mamul çıkış hangi şirkete ait olduğunu gösterir. ERP süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- K_Kalite: Mamul kumaşın kalite durumunu belirtir. Örneğin: 1. Kalite, İç Piyasa, Sorunlu, Bekleme, Parti Hazırlama, Baskı, Tamir.\n- GercekKalite: Mamul kumaşın kalite durumunu harf olarak derecesini belirtir (örneğin: A, B, C, D).\n- DepoYeri: Mamul çıkış sevkiyat hangi depodan yükleneceğini belirtir. Depo adı veya kodu olabilir.\n- TeorikYuklemeTarihi: Mamul çıkış sevkiyat sevk edilmesi planlanan tarih bilgisidir." + "systemMessage": "Senin görevin, kullanıcıdan gelen soruları yalnızca Microsoft SQL Server 2012 için çalıştırılabilir aşağıdaki örneğe ve verilen Veritabanı Şemasına göre SQL sorguları üretmektir. Bu SQL sorgunun verileri çekerek bir ön hazırlık yapacak. Bu ön hazırlık sorgusunda Yıl, Ay, Tarih ve Miktar sütunları yer almalıdır. SQL sorgularının yalnızca gerekli veriyi döndürmesi gerekmektedir. Sorguların ilk satırında `SET DATEFORMAT 'DMY';` ifadesi olmalıdır.\n\nKurallar:\n1. Sadece saf SQL sorgusu döndür. Sql sorgusuyla birlikte açıklama yapma.\n2. Microsoft SQL Server 2012 için çalıştırılabilir düz SQL sorguları üretmektir\n3. Kullanıcının sorduğu soruya göre doğru tabloyu ve sütunları seçmelisin. Sadece verilen Veritabanı şeması ve tabloları kullanarak SQL sorguları üret.\n4. Sorgularında `SELECT *` kullanma. Sadece gerekli sütunları belirt. \n5. `BETWEEN` kullanarak tarih aralığı belirt. Eğer bir tarih aralığı varsa, kullanıcının sorgusuna göre bu aralığı filtrele.\n6. Sadece veri sağlayacak SQL sorgularını döndür. Kullanıcının sorusuna göre veri toplamak için uygun sorguyu oluştur.\n7. Kullanıcının sorduğu sorunun içeriğine göre:\n - **Yıl**, **Ay**, **Tarih**, ve **Miktar** gibi bilgileri döndürebileceğin sorguları oluştur.\n8. SQL sorguları yalnızca veri sağlayacak şekilde olmalıdır. Kullanıcıya analiz veya yorum yapma, sadece veri sağlayacak SQL sorgusunu döndür.\n\nÖrnek olarak, \"Son 3 aydaki kumaş siparişlerine göre, ne kadar artış bekleniyor?\" sorusu şu şekilde bir sorguya dönüşebilir:\n\nSET DATEFORMAT 'DMY'; \nSELECT \n YEAR(SipTarihi) AS Yil, \n DATEPART(MONTH, SipTarihi) AS Ay, \n MIN(SipTarihi) AS Tarih, \n SUM(SipMiktar) AS Miktar \nFROM AI_Kumas_Siparis_Listesi \nWHERE SipTarihi BETWEEN '01-01-2025' AND '31-03-2025' \nGROUP BY YEAR(SipTarihi), DATEPART(MONTH, SipTarihi);\n\nSadece SQL sorgusunu döndür. Açıklama veya yorum ekleme.\n\nVeritabanı şeması:\n\n1. Tablo: AI_Tanim_Iplik_Listesi\n\nGenel Tanım: \nTekstil üretiminde kullanılan tüm iplik ve iplik bazlı hammaddelerin sistemsel olarak tanımlandığı bir master veri tablosudur. Bu tablo; hammaddeye dair teknik, yapısal, sınıflayıcı ve süreçsel tüm bilgileri merkezi bir yapıda saklar ve üretimden satın almaya kadar birçok sistem modülüyle ilişkilidir.\n\nSütun Tanımları ve Anlamları:\n- IplikKodu: Tanımlı olan hammaddenin sistemsel hammadde kodunu belirtir.\n- RenkAdi: Tanımlı olan hammaddenin renk adını belirtir.\n- RenkKodu: Tanımlı olan hammaddenin sistemde tanımlı renk kodudur.\n- Renk: Tanımlı olan hammaddenin renk numarasını belirtir.\n- Cins: Tanımlı olan hammaddenin cinsini belirtir. Örneğin; polyester, pamuk, viskon vb.\n- Numara: Tanımlı olan hammaddenin numarasını belirtir. Hammaddenin kalınlığını veya inceliğini ifade eder (örneğin: 2 numara iplik, 30/1 Ne vb.).\n- Birim: Tanımlı olan hammaddenin numara birim bilgisini belirtir (örneğin: Nm, NeB, den).\n- Nm: İpliğin numarasını ifade eden metrik sistemdeki (Nm) numarasıdır. Bu değer, 1 gram iplikten kaç metre elde edilebileceğini gösterir. Numara büyüdükçe iplik incelir.\n- KompozisyonKisaltmasi: Hammaddenin kompozisyon yüzdelerinin belirtir. (örneğin; %90 PAN %10 PES, %100 PES, %100 RPET)\n- IplikKisaltmasi: Tanımlı olan hammaddenin sistemsel kısaltılmış hammadde kodunu belirtir.\n- UstGrup1: Hammaddenin bulunduğu ana grubu ifade eder.\n- UstGrup2: Hammaddenin ait olduğu ana grubun bir alt grubudur.\n- Tarih: Hammadde tanımlamasının yapıldığı tarihtir.\n- InsertUser: Hammadde tanımlamasını yapan kullanıcıyı belirtir.\n- IsikHasligi: Hammaddenin ışığa karşı dayanıklılık seviyesini (haslık derecesi) belirtir.\n- Bukum: Hammaddenin büküm şekli hakkında bilgi verir (örneğin: S, Z, çift büküm).\n- OrtBobinKg: Ortalama bir bobin hammaddenin kilogram cinsinden ağırlığını belirtir.\n- NumuneKodu: Hammadde tanımlamasından önce numune olarak tanımlandığındaki iplik numune kodunu belirtir.\n- NumuneOnayTarihi: Hammadde numunesinin onaylandığı tarihi belirtir. Numune onaylandıktan sonra regüle iplik tanımlanır.\n- UrunHizmetGrubu: Hammadde tanımının hizmet grubunu belirtir. Örneğin: iplik, kumaş, aksesuar vb.\n- HamMamul: Hammaddenin üretim aşamasını ifade eder. (YARI MAMÜL İPLİK, MAMÜL İPLİK, HAM İPLİK)\n- IplikKullanimDurumu: Hammadde tanımının mevcut durumunu belirtir (örneğin: Aktif, Pasif).\n- HammaddeTipi: Tanımlı olan hammaddenin tipini belirtir. (CİPS, İPLİK, ELYAF, JOKER İPLİK, POLİP BOYA)\n\nFonksiyonel Amaçlar ve İlişkiler\n- Bu tablo, üretim emirlerinde hammadde seçimi, satın alma planlaması ve depo kontrol gibi birçok süreçle ilişkilidir.\n- IplikKodu anahtar alan olarak diğer tablolarla (örneğin AI_Iplik_SatinalmaSiparis_Durum) join ilişkisinde kullanılır.\n- KompozisyonKisaltmasi, kalite hesaplamaları, üretim reçeteleri ve stok analizlerinde kullanılır.\n- NumuneOnayTarihi, numuneden regüleye geçişin kritik eşiğidir.\n\n2. Tablo: AI_Tanim_Kalite_Listesi\n\nGenel Tanım: \nAI_Tanim_Kalite_Listesi, firmanın ürün gamında yer alan kumaş kalitelerinin detaylı tanımlarını içeren referans tablosudur. Bu tablo, kumaşların üretimsel, teknik ve ticari sınıflandırmalarının yapıldığı üst seviye bilgi kaynağıdır. Kalite; çözgü/atkı özellikleri, iplik tipi, ambalaj biçimi, uygulanan proses ve kullanım cinsine kadar birçok parametre ile tanımlanır ve tüm üretim & stok yönetimi süreçlerinin çekirdek bileşeni olarak kullanılır.\n\nSütun Tanımları ve Anlamları:\n- KaliteKodu: Kumaş kalitesini ifade eden akıllı kodlama yapısı ile belirtilmiş benzersiz bir tanımlama koddur. \n- KaliteAdi: Kumaşın kaliteye verilmiş ticari veya teknik adını belirtir. Kullanıcıya daha anlaşılır bir kalite tanımı sunar.\n- AsilKaliteAdi: Kalitenin bağlı olduğu bir üst kalite adını belirtir. \n- KaliteTipi: Kalitenin genel sınıfını belirtir. Bu tip kalitenin üretim değer farklılıklarını, üretim şekillerini ve teknik yapısını da ifade eder. Örneğin; ÖRME, ÜRETİM, YATAK YÜZÜ, KADİFE, YUVARLAK ÖRME \n- KaliteCinsi: Kalitenin genel kullanım amacına göre ait olduğu grubu tanımlar. Örneğin; standart, recycle, outdoor, easy life, prive gibi kalite cinslerini belirtir.\n- KapKaliteGrubu: Kalitenin ait olduğu teknik kalite grubunu belirtir. Örneğin; örme, 4800 class, 9600, 1056 gibi üretim gruplarını içerir.\n- AmbalajSekli: Kaliteye bağlı olarak üretilen kumaşların nasıl ambalajlanacağını belirtir. Örneğin; shrink, baloncuk gibi ambalaj türleri içerir.\n- ApreIslemiTipi: Kumaşın kalite sürecinde hangi apre işlemine tabi tutulduğunu belirtir. Örneğin; boyama, proses, dijital baskı gibi işlemleri kapsar.\n- AtkliSikligi: Kumaşın kalitesine bağlı olarak 1 cm de kullanılan atkı (enine iplik) iplik adedini - sıklığını belirtir. Bu değer, kalitenin dokuma yoğunluğu hakkında bilgi verir.\n- CozguSikligi: Kaliteye bağlı olarak 1 cm de kullanılan çözgü (boyuna iplik) iplik adedini - sıklığını ifade eder. Kumaşın teknik özelliklerini belirleyen temel parametrelerden biridir.\n- CozguTelAdedi: Kaliteye bağlı olarak kullanılan toplam çözgü tel adedini belirtir. Kumaşın yoğunluğu ve dayanıklılığı ile doğrudan ilişkilidir.\n- İplikCinsi: Kalitenin için de kullanılan çözgü ipliğinde kullanılan iplik türünü belirtir. Örneğin; polyester, pamuk, viskon gibi iplik cinsleri bu alanda yer alır.\n- ProsesKodu: Kalitenin üretim sürecinde geçtiği işlemleri tanımlayan koddur. Apre dairesinde yapılan rota olarak ta belirtilebilir. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Kayit_Kimin: Kalitenin hangi şirkete ait olduğunu gösterir. Erp süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- Tanimlayan: Kalite tanımını yapan kişiyi kullanıcı adını belirtir. \n- Tarih: Kalite tanımlamasının yapıldığı tarihtir.\n\nFonksiyonel Amaçlar ve İlişkiler\n- Kalite, kumaşın en temel referans kimliğidir. Tüm üretim, satış, stok ve sevkiyat tablolarıyla birebir ilişkilidir.\n- KaliteKodu, tablolar arasında anahtar niteliğindedir (örn. AI_Tanim_Kumas_Listesi, AI_Kumas_Siparis_Paz_Listesi, AI_Dokuma_IsEmri_Listesi).\n- KapKaliteGrubu ve KaliteTipi teknik/üretim ayrımı yaparken, KaliteCinsi pazarlama segmentasyonu sağlar.\n- AtkliSikligi, CozguSikligi, CozguTelAdedi gibi parametreler üretim reçetelerinde kritik teknik girdilerdir.\n- ApreIslemiTipi, kalitenin işlemsel farklarını yansıtır, kalite kontrol süreçlerini doğrudan etkiler.\n\n3. Tablo: AI_Tanim_Cozgu_Listesi\n\nGenel Tanım:\nAI_Tanim_Cozgu_Listesi, tekstil üretiminde kumaşların çözgü yapılarını tanımlayan teknik ve sınıflayıcı bilgileri içeren referans tablosudur. Dokuma reçetelerinin oluşturulması, kalite kontrol süreçlerinin yönetilmesi ve kumaş varyant eşleşmelerinin doğru yapılabilmesi için kritik rol oynar. Çözgü, bir kumaşın üretim mimarisindeki iskelet yapıdır ve bu yapı sistematik şekilde burada tariflenir.\n\nSütun Tanımları ve Anlamları:\n- CozKodu: Kumaşın dokunmasında kullanılan dikey ipliklerini oluşturan ipliklerin çözgü tanımına ait teknik ve benzersiz tanımlama kodudur. Bu kod, üretim takibi, çözgü reçeteleri ve kalite kontrol süreçlerinde referans olarak kullanılır.\n- CozAdi: Kumaşın dokunmasında kullanılan dikey ipliklerini oluşturan ipliklerin çözgü tanımına ait teknik tanımlama adıdır. Çözgü yapısını tanımlar ve kumaşın üretim sürecindeki yerini belirlemede kullanılır. \n- CozguGrubu: Tanımlı olan çözgünün üst çözgü adıdır. Yoğunlukla CozAdi sütunu değerlerini içerir.\n- CozTipi: Tanımlı olan çözgünün çalışabileceği tezgah tipini ve dokuma yapısını belirtir. Örneğin; jakarlı, armürlü gibi dokuma yapılarını tanımlar.\n- CozguTuru: Kullanılan çözgünün Numunemi, Blanket veya Regüle olup olmadığını belirtir. \n- TelAdet: Çözgüde kullanılan toplam tel adedini ifade eder.\n- CozSiklik: Çözgü sıklığını belirtir. Yani 1 cm den geçen çözgü iplik adedi - sıklığını gösterir.\n- CozEni: Çözgü sisteminin kumaş üzerindeki eni (genişliği) bilgisini ifade eder.\n- KaliteTipi: Çözgünü çalışabileceği kumaşların kalite tipini belirtir. Örneğin; ÖRME, ÜRETİM, YATAK YÜZÜ, KADİFE, YUVARLAK ÖRME \n- KaliteGrubu: Çözgünün çalışabileceği kumaşların kalite grubunu belirtir. Örneğin; 4800, 9600 gibi teknik gruplar.\n- KoleksiyonTipi: Kumaş koleksiyonunun genel mi yoksa müşteriye özel mi olduğunu belirtir.\n- Kompozisyon: Çözgüde kullanılan hammadde yüzlerini belirtir. Örneğin; %60 polyester, %40 pamuk gibi lif karışım bilgilerini içerir.\n- Tarih: Çözgünün tanımını yapan kişiyi kullanıcı adını belirtir.\n\nFonksiyonel Kullanım ve İlişkiler\n- CozKodu, çözgü-reçete bağlantılarında anahtar işlevi görür.\n- KaliteTipi, KaliteGrubu ile birlikte çözgülerin hangi ürün ailesine ait olduğunu belirtir.\n- CozTipi ve CozguTuru, üretim tipi ayrımında kritik bilgi sağlar.\n- TelAdet, CozSiklik, CozEni değerleri, dokuma optimizasyonu ve randıman hesaplamaları için kullanılır.\n- KoleksiyonTipi, müşteri taleplerine özel üretimlerin sınıflandırılmasını mümkün kılar.\n\n4. Tablo: AI_Tanim_Cagarlik_Listesi\n\nGenel Tanım:\nAI_Tanim_Cagarlik_Listesi, özellikle kadife tipi kumaşların üretiminde kullanılan cağarlık yapılarını tanımlayan temel veri tablosudur. Cağarlık; dokuma öncesinde çözgü ipliklerinin bobinler üzerine sarılmasıyla oluşan ve dokuma makinesine çözgü ipliklerini aktaran sistemdir. Bu yapı, dokumanın temel bileşeni olan çözgü sisteminin planlanması ve standartlaştırılması için kritik öneme sahiptir. Sistem içinde tanımlı her cağar, belirli bir iplik cinsi, rengi, tel sayısı ve bobin adediyle temsil edilir. Tablo, üretim reçeteleri, kalite takibi, stok yönetimi ve üretim verimliliği açısından cağarlıkların teknik izlenebilirliğini sağlar.\n\nSütun Tanımları ve Anlamları:\n- CagarNo: Cağara ait benzersiz kod bilgisini içerir.\n- CagarKodu: Cağarın sistemde tanımlı adını belirtir.\n- IplikKodu: Cağarda kullanılan ipliğin sistemsel kodunu belirtir.\n- Cins: İpliğin cinsini belirtir. Örneğin; polyester, pamuk, viskon vb.\n- RenkAdi: Kullanılan ipliğin renk adını belirtir.\n- TelAdedi: Cağarlıkta kullanılan ipliğin tel adedini ifade eder.\n- ToplamAdet: Cağarlıkta kullanılan toplam tel adedini gösterir.\n- Tarih_Tanimlama: Cağarlık tanımının yapıldığı tarihi belirtir.\n\nFonksiyonel Kullanım ve İlişkiler:\n- IplikKodu, AI_Tanim_Iplik_Listesi ile birebir eşleşir. Kullanılan ipliğin tüm teknik bilgilerine erişim sağlar.\n- CagarKodu, çözgü planlamasında veya dokuma reçetelerinde doğrudan çağrılan tanımlayıcıdır.\n- TelAdedi ve ToplamAdet, iplik tüketimi, stok yönetimi ve üretim planlamasında hesaplama girdisi olarak kullanılır.\n- RenkAdi ve Cins kombinasyonu, kalite kontrol ve üretim standardizasyonu açısından önemli eşleştirme parametreleridir.\n\n5. Tablo: AI_Tanim_Kumas_Listesi\n\nGenel Tanım:\nBu tablo, tekstil üretiminde kullanılan veya dışarıdan satın alınan tüm kumaşlara ait temel tanım ve teknik özelliklerin tutulduğu referans veri kaynağıdır. Kumaşların kalite, desen, varyant, çözgü yapısı, kompozisyonu ve üretim bilgileri gibi parametrelerini içerir. Üretim planlama, kalite kontrol, desen takibi ve stok yönetimi süreçlerinde merkezi rol oynar. Bu tablo, kumaş bazlı operasyonların bütüncül takibi için temel veri zemini sağlar.\n\nSütun Tanımları ve Anlamları:\n- KumasID: Tanımlanan her kumaşın veri tabanında saklanan benzersiz değeridir. Otomatik numara türünde olan bu değer her kumaş için tanımlayıcıdır. (primary key) \n- Kalite: Kumaş kalitesini ifade eden akıllı kodlama yapısı ile belirtilmiş benzersiz bir tanımlama koddur. AI_Tanim_Kalite_Listesi tablosundaki KaliteKodu sütunu ile ilişkilidir. \n- KaliteAdi: Kumaşın kaliteye verilmiş ticari veya teknik adını belirtir. Kullanıcıya daha anlaşılır bir kalite tanımı sunar. AI_Tanim_Kalite_Listesi tablosundaki KaliteAdi sütunu ile ilişkilidir. \n- AsilKaliteAdi: Kalitenin bağlı olduğu bir üst kalite adını belirtir. AI_Tanim_Kalite_Listesi tablosundaki AsilKaliteAdi sütunu ile ilişkilidir.\n- KaliteTipi: Kalitenin genel sınıfını belirtir. Bu tip kalitenin üretim değer farklılıklarını, üretim şekillerini ve teknik yapısını da ifade eder. Örneğin; ÖRME, ÜRETİM, YATAK YÜZÜ, KADİFE, YUVARLAK ÖRME\n- KumasGrubu: Kumaşın teknik veya tasarımsal açıdan üretilecek tezgah grubunu belirtir. Örneğin; Armürlü, Jakarlı, Dedektörlü, Jumbo vs. gibi sınıflandırmaları içerir.\n- KumasTuru: Kumaşın kullanım amacını tanımlar. Örneğin; numune, regüle (seri üretim), özel üretim gibi türleri ayırt etmek için kullanılır.\n- DesenNo: Kumaşa ait benzersiz desen numarasını belirtir. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaşa ait benzersiz desen adını belirtir. Tasarımcının verdiği isim ya da sistemde kayıtlı ad olabilir.\n- VaryantNo: Aynı desenin farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasını belirtir.\n- Kompozisyon: Kumaşın içeriğinde kullanılan hammadde yüzdelerini belirtir. Örneğin; %60 polyester, %40 pamuk gibi lif karışım bilgilerini içerir.\n- CozKodu: Kumaşta kullanılan çözgü ipliğine ait sistemsel veya teknik kodu belirtir. Bu kod, üretim takibi, çözgü reçeteleri ve kalite kontrol süreçlerinde referans olarak kullanılır.\n- CozAdi: Kumaşın dokunmasında kullanılan çözgü ipliğine verilen teknik adı ifade eder. Çözgü yapısını tanımlar ve kumaşın üretim sürecindeki yerini belirlemede kullanılır.\n- HamKg: Kumaşın ilk dokuma sonrası işlenmemiş, yani ham haliyle kilogram cinsinden ağırlığını belirtir.\n- MamKg: Kumaşın dokuma sonrası ve apre rotasından sonra mamul hale geldikten sonraki kilogram cinsinden ağırlığını belirtir.\n- ProsesKodu: Kumaşın geçtiği üretim veya işlem süreçlerini ifade eden rota kodu içerir. Örneğin; boyama, apre, yıkama gibi işlemleri gösterir.\n- UretimiDurdur: Tanımlı olan kumaşın nüretiminin devam edip etmediğini gösterir. Aktif üretim mi, durdurulmuş mu bilgisini taşır.\n- Kayit_Kimin: Kumaşın hangi şirkete ait olduğunu gösterir. Erp süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- Tanimlayan: Kumaşın tanımını yapan kişiyi kullanıcı adını belirtir. \n- Tarih: Kumaş tanımlamasının yapıldığı tarihtir.\n\nFonksiyonel Kullanım ve İlişkiler:\n- Kalite, KaliteAdi, AsilKaliteAdi sütunları kalite detay tabloları ile ilişkilidir.\n- CozKodu, CozAdi çözgü tanım tablosu ile (AI_Tanim_Cozgu_Listesi) ilişkili çalışır.\n- ProsesKodu, kumaşın üretim rotasının izlenmesinde kullanılır.\n- KumasTuru ve UretimiDurdur, üretim planlaması ve aktif üretim takip sistemi için filtreleme sağlar.\n- Kompozisyon, malzeme planlama ve kalite standardizasyonuna katkı sunar.\n\n6. Tablo: AI_Tanim_Firma_Listesi\n\nGenel Tanım:\nAI_Tanim_Firma_Listesi tablosu, kurumun ticari ilişkide bulunduğu tüm firmaların temel tanımlayıcı bilgilerini içerir. Bu firmalar; müşteri, tedarikçi, fason üretici ya da dış hizmet sağlayıcı olabilir. Erp süreçlerinde üretim, satın alma, satış ve sevkiyat gibi operasyonel iş akışlarında muhatap olarak tanımlanan firmaların sistemdeki kayıtlarını standardize etmek ve ilişkisel veri tabanında izlenebilirlik sağlamak amacıyla kullanılır.\n\nSütun Tanımları ve Anlamları:\n- FirmaKodu: Her firmaya sistem tarafından atanmış benzersiz tanımlayıcı koddur. Tüm diğer tablolarda firma bilgisiyle ilişki kurarken referans alınır.\n- FirmaAdi: Firmanın ticaret unvanıdır. İnsan tarafından okunabilir ve raporlamada görünen firma adıdır.\n- Tur: Firmanın sistemdeki işlevsel rolünü belirtir. Örnek değerler: müşteri, tedarikçi, fasoncu, apre tedarikçisi gibi. Operasyonların sınıflandırılmasını sağlar.\n- FirmaGrubu: Firma ile ilişkili yüksek seviye sınıflandırmadır. Örnek: yerli, yabancı, holding grubu gibi tanımlar sayesinde pazar analizleri ve tedarikçi segmentasyonu yapılabilir.\n- SirketAdi: Bu firma ile ilişkili olan şirket ya da Erp sistemindeki iş birimi bilgisini içerir. Çoklu şirket yapılanmalarında kurum içi ayrımı ifade eder.\n- Ulke: Firmanın faaliyet gösterdiği veya yasal olarak kayıtlı olduğu ülke bilgisidir. Dış ticaret, lojistik ve gümrük süreçleri için önemlidir.\n- SatisBolgesi: Firmanın coğrafi satış bölgesini tanımlar. Örnek: Avrupa, Orta Doğu, İç Anadolu. Pazarlama stratejilerinin bölgesel dağılım analizlerinde kullanılır.\n\nFonksiyonel Kullanım ve İlişkiler:\n- FirmaKodu, sistem genelinde sipariş, sevkiyat, stok, üretim veya satın alma tablolarında yabancı anahtar (foreign key) olarak kullanılır.\n- Tur ve FirmaGrubu, sistemde firma filtrelemelerinde, yetkilendirme yapılarında ve dashboard segmentasyonlarında kullanılır.\n- SirketAdi, kurum içi dağılımı göstererek firma-şirket ilişkisini şeffaf hale getirir.\n- Ulke ve SatisBolgesi sütunları dış ticaret ve ihracat/iç pazar ayrımlarında kritik rol oynar.\n\n7. Tablo: AI_Tanim_Tezgah_Listesi\n\nGenel Tanım:\nAI_Tanim_Tezgah_Listesi tablosu, firmanın üretim altyapısında yer alan tüm tezgahların teknik ve operasyonel özelliklerini kayıt altında tutar. Bu bilgiler sayesinde üretim planlaması, verimlilik ölçümü, performans analizi, bakım yönetimi ve kapasite değerlendirmesi gibi kritik karar destek süreçleri yürütülür. Tezgahlar fiziksel olarak üretimin kalbidir ve bu tablo, o kalbin nabzını dijital olarak izlemeyi sağlar.\n\nSütun Tanımları ve Anlamları:\n- TezgahKodu: Her bir tezgah için sistemde tanımlı olan benzersiz koddur. Diğer üretim tabloları (örneğin: iş emirleri, planlama) ile ilişki kurmak için anahtar alan olarak kullanılır.\n- En: Tezgahın kumaşı tek en (tek taraflı) mi, çift en (her iki taraflı) mi, üç en mi dokunacağı ve örüleceğini belirtir. Bu bilgi üretim tipi seçiminde kullanılır.\n- Markasi: Tezgahın üretici markasını belirtir. Örneğin: Dornier, Picanol, Smit gibi makine markaları olabilir.\n- Tipi: Tezgahın teknik kullanım tipini belirtir. Örneğin: saten, örme, yuvarlak örme gibi kumaş türüne göre ayrım yapar.\n- Cinsi: Tezgahın çalıştığı dokuma türünü tanımlar. Örneğin: jakarlı, armürlü, örme vb. Bu bilgi, kumaş türüyle uyum açısından kritiktir.\n- Grup: Tezgahın dahil olduğu tezgah grubunu ifade eder. Raporlama ve grup bazlı analizlerde kullanılır. Örneğin; Y13-Y16 tezgah grubunu ifade eder.\n- SubeAdi: Tezgahın fiziksel olarak bulunduğu şubenin adıdır. Özellikle birden fazla üretim tesisi olan firmalarda, lokasyon bazlı yönetim için önemlidir.\n- Konum: Tezgahın fiziksel olarak kaçıncı katta bulunduğu yer bilgisidir. (örnek: 1. Kat, 2. Kat, Boğaziçi vb.)\n- TarakEni: Tezgahın çalışabileceği maksimum kumaş genişliğini gösterir. (cm cinsinden)\n- ReelCozguTeli: Tezgahta fiilen kullanılan toplam çözgü teli adedidir. Kumaş yoğunluğu ve dokuma optimizasyonu açısından kritik bir parametredir.\n- MakinaDevri: Tezgahın ortalama çalışma hızı (rpm: devir/dakika) bilgisidir. Hız ve kalite dengesi bu alana bağlıdır.\n- OrtRandiman: Tezgahın belirli bir dönem için ölçülmüş ortalama verimlilik yüzde değeridir. Performans ölçümlerinde kullanılır.\n- GunlukTCalisma: Tezgahın günlük ortalama çalışma saat süre bilgisidir. Üretim kapasitesi analizlerinde referans alınır.\n- CalismaDurumu: Tezgahın mevcut durumu hakkında bilgi verir. Örnek değerler: Aktif, Pasif, Kapalı, Sanal olabilir.\n\nFonksiyonel Kullanım ve İlişkiler:\n- TezgahKodu, iş emri, üretim takibi ve planlama tablolarında foreign key olarak kullanılır.\n- Tipi, Cinsi ve Grup, kumaş türüne göre doğru tezgah atamasını yapabilmek için eşleştirme kriteridir.\n- TarakEni, ReelCozguTeli ve MakinaDevri gibi teknik sütunlar, randıman optimizasyonu ve rota planlamasında rol oynar.\n- CalismaDurumu ve OrtRandiman, bakım periyodu takibi ve yatırım planlamalarında analiz kriteridir.\n\n8. Tablo: AI_Iplik_SatinalmaSiparis_Durum\n\nGenel Tanım:\nAI_Iplik_SatinalmaSiparis_Durum tablosu, kumaş üretim süreci için tedarik edilen ipliklerin sipariş süreçlerine dair tüm kritik verileri içerir. Hangi ipliğin, hangi firmadan, ne zaman ve ne miktarda sipariş edildiğini gösterir. Tablodaki bilgiler, tedarik zinciri yönetimi, termin uygunluk takibi ve maliyet analizleri için kullanılmakta olup, satın alma planlaması ve stok giriş süreçlerinin temelini oluşturur. Ayrıca geciken siparişlerin, teslim edilen miktarların ve kalan ihtiyaçların takibi bu tablo üzerinden yapılır.\n\nSütun Tanımları ve Anlamları:\n- SiparisID: Her bir satın alma siparişinin sistemdeki benzersiz kimlik numarasıdır. Anahtar (primary key) alan olarak kullanılır.\n- SipNo: Satın alma siparişin sistem tarafından otomatik atanan takip numarasıdır. Operasyonel takibin yapılmasında referans niteliğindedir.\n- Tarih: Satın alma siparişin tarih bilgisini ifade eder.\n- GirisTarihi: Satın alma siparişin sisteme giriş yapıldığı tarihi gösterir.\n- FirmaAdi: Satın alma siparişi verilen ipliğin tedarik edildiği firma adıdır. AI_Tanim_Firma_Listesi ile ilişkilidir.\n- Kayit_Kimin: Satın alma siparişinin hangi şirkete ait olduğunu gösterir. Grup şirketleri veya çoklu organizasyon yapılarında ayrımı sağlar.\n- IplikKodu: Satın alma siparişi verilen ipliğin sistemsel kodudur. AI_Tanim_Iplik_Listesi tablosu ile ilişkilidir.\n- Cins: Satın alma siparişi verilen ipliğin cins bilgisidir. Örnek: polyester, pamuk vb. İplik sınıflandırmasında kullanılır.\n- Renk: Satın alma sipariş edilen ipliğin sistemsel renk kodudur.\n- RenkAdi: Satın alma renk alanının açıklayıcı adıdır. İnsan tarafından daha anlaşılır hale getirilmiş tanımıdır.\n- Miktar: Satın alma yapılacak olan ipliğin sipariş edilen miktarını belirtir.\n- GelenMiktar: Satın alma siparişinin teslim alınan miktarını gösterir. Satın alma siparişi farklı zamanlarda parçalı şekilde teslim alınabilir. Karşılaştırmalı analizlerde kullanılır.\n- TerminTarihi: Satın alma sipariş edilen ipliğin beklenen teslim tarihidir. Tedarik performans analizleri için önemlidir.\n- TerminUygunDurum: Siparişin zamanında teslim edilip edilmediğini belirtir. Zamanında teslimat KPI’si bu alandan hesaplanır.\n- BirimFiyati: Satın alma siparişindeki her bir ipliğin satın alma birim fiyatı içerir.\n- OdemeSekli: Ödeme para birimini ve KDV dahil mi belirtir. Döviz bazlı muhasebe işlemlerinde kullanılır.\n- TeslimatYeri: İpliğin teslim edilmesi gereken yeri lokasyonu tanımlar (örnek: Merkez Depo, Boyahane Girişi).\n- SiparisKapandi: Siparişin tamamlanıp tamamlanmadığını gösterir. (Evet/Hayır gibi değer alabilir)\n\n9. Tablo: AI_Iplik_ImalEmri_Durum\n\nGenel Tanım:\nAI_Iplik_ImalEmri_Durum tablosu, firmanın iplik üretim süreci kapsamında oluşturulan tüm imalat emirlerine ait detayları kayıt altına alır. Bu tablo, üretilecek ipliğin teknik tanımı, miktarı, kullanılan hammadde çıkışları, üretim girişi ve fire değerleri gibi üretimsel verileri içerir. Tablodaki bilgiler, üretim planlama, termin yönetimi, stok takibi, fire kontrolü ve üretim performans analizlerinde kritik rol oynar. Özellikle fason üretim süreçlerinde geri dönüşlerin takibi ve üretimle karşılaştırılması açısından merkezi bir kontrol mekanizması sunar.\n\nSütun Tanımları ve Anlamları:\n- ImID: Her imalat emrine sistem tarafından atanan benzersiz tanımlayıcıdır. (Primary key)\n- IIENo: İmalat emrinin sistemdeki takip numarasıdır. Operasyonel izleme ve raporlama süreçlerinde referans kod olarak kullanılır.\n- Tarih: İmalat emrinin sisteme kaydedildiği tarihi ifade eder. Zamansal raporlamalar için referans alınır.\n- FirmaAdi: İpliğin tedarik edildiği firma adıdır. Tedarikçi takibi ve performans ölçümünde kullanılır.\n- IplikKodu: Üretilmesi planlanan ipliğin sistemsel hammadde kodudur. AI_Tanim_Iplik_Listesi ile ilişkilidir.\n- Cins: Üretilmesi planlanan ipliğin cins bilgisidir. Örnek: polyester, pamuk vb. İplik sınıflandırmasında kullanılır.\n- UstGrup1: İpliğin ait olduğu ana ürün grubunu belirtir. Kategori bazlı sınıflandırmalarda kullanılır.\n- UstGrup2: İpliğin bağlı olduğu daha alt seviye grup bilgisidir.\n- Birim: Tanımlı olan hammaddenin numara birim bilgisini belirtir (örneğin: Nm, NeB, den).\n- RenkAdi: Üretilecek hammaddenin renk adını belirtir.\n- HarmanNo: Üretilen ipliğe ait harman (lot) numarasıdır. Takip, izlenebilirlik ve kalite kontrol süreçlerinde kullanılır. Depo girişi yapılırken hammaddenin lot numarası olarak kullanılır.\n- Miktar: İmal emri kapsamında üretilecek toplam iplik miktarını ifade eder. (kg bazında)\n- ELCikis: Elyaf olarak üretimden çıkan hammaddenin miktarını gösterir. Elyaf kullanımı ile ilgili hammadde çıkışlarını izlemek için kullanılır.\n- IPCikis: İmal emri üretimi için iplik işletmelerine gönderilen hammadde veya yarı mamül iplik miktarıdır. \n- HamMaddeCikis: ELCikis ve IPCikis toplamı olup, üretimde kullanılan toplam hammadde çıkışını ifade eder.\n- IPGiris: İmal emri için üretilmiş ve depoya girmiş olan ipliğin miktarıdır.\n- UretilenKg: İplik işletmelerinde imal emri için üretilmiş olan iplik miktarıdır. Bu bilgi sahadan toplanıyor olup depo girişi yapılma zorunluluğu bulunmamaktadır. \n- BakiyeKg: İmal emri oluşturulan miktardan henüz üretilmemiş, eksik kalan iplik miktarıdır.\n- Fire: Üretim sürecinde oluşan kayıp miktarıdır. (kg bazında)\n- TerminTarihi: İmalat emrinin üretiminin tamamlanmasının planlandığı tarih bilgisidir.\n- Senil: Üretilen ipliğin şönil li iplik olup olmadığını belirtir. (Evet/Hayır gibi değerler alır)\n\n10. Tablo: AI_Iplik_FasonSiparis_Durum\n\nGenel Tanım:\nAI_Iplik_FasonSiparis_Durum tablosu, firma dışı üretim yöntemi olan fason iplik siparişlerine ilişkin tüm verileri içerir. Bu yapı, dış üreticiye (fason firmaya) yaptırılan ipliklerin tedarik sürecini, miktarlarını, teslimat zamanlarını ve maliyetlerini izlemek amacıyla kullanılır. İplik üretiminin tamamının ya da bir kısmının dış kaynakla yürütüldüğü durumlarda, sipariş detaylarının sistematik takibini sağlar. Böylece satın alma ve üretim ekipleri, fason üretim performansını ölçebilir, stok kontrolü ve termin yönetimi yapabilir.\n\nSütun Tanımları ve Anlamları:\n- FasonSipNo: Her bir fason iplik siparişi için sistem tarafından oluşturulan benzersiz takip numarasıdır. Bu alan üzerinden fason siparişin tamamı izlenir.\n- Tarih: Fason siparişin sisteme kaydedildiği tarihi ifade eder. Operasyonel süreç takibi için önemlidir.\n- GirisTarihi: Fason siparişi Üretilen ipliğin firmaya fiziksel olarak giriş yaptığı tarih bilgisidir.\n- FirmaAdi: Fason üretimi gerçekleştiren tedarikçi firmanın ticari adıdır. AI_Tanim_Firma_Listesi tablosuyla ilişkilidir.\n- Kayit_Kimin: İlgili siparişin hangi şirket adına açıldığını belirtir. Çoklu şirket yapılanmalarında ayırıcı kimlik görevi görür.\n- IplikKodu: Fason siparişe konu olan ipliğin sistemdeki tanımlı hammadde kodudur. AI_Tanim_Iplik_Listesi ile ilişkilidir.\n- Cins: Fason sipariş edilen ipliğin cinsini belirtir. Örneğin; polyester, pamuk gibi sınıflandırmalar içerir.\n- Renk: Fason sipariş edilen ipliğin sistemsel renk kodudur. Teknik ve görsel ayrım açısından kullanılır.\n- RenkAdi: Fason sipariş edilen renk kodunun açıklayıcı adıdır. Kullanıcı dostu tanım sağlar (örneğin: Koyu Mavi, Krem).\n- Miktar: Fason sipariş edilen iplik miktarıdır. Genellikle kilogram (kg) cinsindendir.\n- GelenMiktar: Fason sipariş edilen ipliğin teslimat miktarını gösterir.\n- TerminTarihi: Fason siparişin üretilip teslim edileceği tarihi bilgisidir. Tedarik kontrolü ve teslimat uyum analizinde kullanılır.\n- BirimFiyati: Fason sipariş kapsamında iplik başına belirlenen birim fiyat bilgisidir. Maliyet analizleri için gereklidir.\n- OdemeSekli: Fason siparişin ödeme birimini belirtir. (Örn: TL, USD, EUR) Döviz cinsinden raporlama yapılabilmesi için gereklidir.\n- SiparisKapandi: Fason siparişin tamamlanıp tamamlanmadığını ifade eder. Evet/Hayır veya 1/0 gibi mantıksal veri içerir.\n\n11. Tablo: AI_Iplik_BoyahaneSiparis_Durum\n\nGenel Tanım:\nAI_Iplik_BoyahaneSiparis_Durum tablosu, dış kaynak (fason) üretim yoluyla boyahaneye verilen iplik siparişlerine ilişkin tüm operasyonel bilgilerin takip edildiği temel veri kaynağıdır. Bu yapı, boyahane süreçlerinde üretimi yapılan ipliklerin takibini kolaylaştırmak amacıyla oluşturulmuştur. Hangi iplik cinsinin, hangi renkte ve miktarda boyanmak üzere hangi firmaya ne zaman sipariş edildiğini kayıt altına alır. Ayrıca teslimat durumu, depoya giriş miktarı, termin tarihleri, kazan bilgisi gibi detaylar da tabloda tutulur. Tablodaki bilgiler sayesinde planlama, depo yönetimi, tedarikçi performans takibi ve stok kontrol süreçleri entegre biçimde yürütülür. Sipariş kabul durumu ve kalan miktar takibi gibi kontrol noktaları bu tablo üzerinden izlenebilir.\n\nSütun Tanımları ve Anlamları:\n- BoyahaneSipID: Boyahane siparişine ait sistemdeki benzersiz tanımlayıcı (ID).\n- SiparisNo: Boyahane sisteminden gelen senkron sipariş numarası.\n- BoyahaneSipNO: İplik siparişinin boyahaneye atanan sipariş numarası.\n- BoyaSiparisTarihi: Boyahane siparişinin oluşturulduğu tarih.\n- FirmaAdi: Boyahane siparişinin tedarikçi firmanın ticari adıdır. AI_Tanim_Firma_Listesi tablosuyla ilişkilidir.\n- IplikKodu: Boyahane siparişe konu olan ipliğin sistemdeki tanımlı kodu.\n- IplikCinsi: Boyahane Sipariş verilen ipliğin hammadde cinsi. Örn: polyester, pamuk vb.\n- RenkKodu: İpliğe ait sistemsel renk kodu.\n- RenkAdi: Boyahane Siparişi verilen hammaddenin renk kodunun açıklayıcı adıdır. Kullanıcı dostu tanım sağlar (örneğin: Koyu Mavi, Krem).\n- UstGrup1: İpliğin ait olduğu birinci seviye kategori veya ana grup.\n- UstGrup2: İpliğin ait olduğu ikinci seviye kategori (UstGrup1’in alt grubu).\n- KabulDurum: Boyahaneden alınan siparişin kabul edilme durumu.\n- Miktar: Toplam sipariş miktarı. (Tekrar KadifeSipMiktari ile aynı olabilir)\n- GirisMiktari: Depoya fiziksel olarak giren toplam iplik miktarı.\n- Aciklama: Boyahane Siparişine ilişkin özel not ya da açıklama alanı.\n- TerminTarihi: Boyahane siparişi için planlanan teslim tarihi.\n- KazanNo: Boyama işleminin yapıldığı kazan numarası.\n- Kayit_Kimin: Siparişin hangi şirkete (holding, birim) ait olduğunu belirtir.\n- Durum: Siparişin genel durum bilgisidir. (Aktif, pasif vb.)\n\n12. Tablo: AI_Iplik_Depo_Durum_Listesi\n\nGenel Tanım:\nAI_Iplik_Depo_Durum_Listesi tablosu, iplik depolarında bulunan tüm hammadde stoklarının detaylı ve anlık takibini sağlayan referans veri kaynağıdır. Bu tablo sayesinde ipliğin hangi renkte, hangi partide (lot), hangi firmadan temin edildiği ve fiziksel olarak depo içindeki konumu izlenebilir. Ayrıca hammaddenin üretim durumu, kalite sınıfı ve varsa boyahane süreciyle olan ilişkisi gibi kritik bilgiler sistematik olarak saklanır. İpliklerin depo miktarı, hangi iş emirlerine tahsis edildiği (rezerve miktar) ve geriye kalan kullanılabilir miktarı da bu yapı üzerinden yönetilir. Stok yönetimi, üretim planlama, lot bazlı izlenebilirlik ve depo içi yerleşim gibi süreçler için hayati öneme sahiptir.\n\nSütun Tanımları ve Anlamları:\n- IplikKodu: İpliğin sistemde kayıtlı olan teknik ve benzersiz hammadde kodudur. Malzeme takibi ve süreç ilişkilerinde anahtar rol oynar.\n- RenkAdi: Depoda bulunan ipliğin görsel tanımını sunan renk adıdır. Kullanıcıya daha anlaşılır bir renk bilgisi sağlar.\n- Cins: İpliğin hammaddesel türünü belirtir. Örnek: polyester, pamuk, viskon. İplik gruplaması ve kalite kontrol süreçleri için önemlidir.\n- LotNo: İpliğe ait üretim partisini (lot) belirtir. Aynı ipliğin farklı lotları fiziksel farklılık gösterebileceğinden izlenebilirlik açısından zorunludur.\n- FirmaAdi: İpliği tedarik eden veya üreten firmanın adıdır. Kendi üretimleri için genellikle “KADİFETEKS” sabit ifadesi kullanılır.\n- DepoAdi: Hangi fiziksel depoda saklandığını ifade eder. Çok lokasyonlu depo sistemlerinde konum yönetimi sağlar.\n- Ack: Depodaki ipliğe dair açıklayıcı not veya durum bilgisidir. Üretim aşaması, kalite dışı durumlar, iade, hasar gibi notları içerebilir.\n- Koordinat: Depo içinde ipliğin fiziksel yerini tanımlar. Genellikle raf sistemine göre tanımlanır (örnek: A2-RF3).\n- Kalite: Depodaki ipliğin kalite sınıfını belirtir. Örneğin: A Kalite, 2. Kalite, Fire gibi üretim uygunluğuna göre sınıflamalar içerir.\n- BanyoNo: Eğer iplik boya işleminden geçmişse, hangi reçeteyle boyandığını gösteren boyahane reçete numarasıdır. Boyanmış ipliklerin takibinde kritik veridir.\n- DepoMiktari: İpliğin depoda fiziksel olarak mevcut olan toplam miktarını (kg cinsinden) belirtir.\n- ReserveMiktari: Dokuma veya üretim iş emirlerine tahsis edilmiş (rezerve edilmiş) iplik miktarıdır. Bu miktar üretim için ayrılmış ama henüz kullanılmamış olabilir.\n- KalanDepoMiktari: Kullanılabilir net miktarı gösterir. Yani DepoMiktari - ReserveMiktari hesabıyla elde edilen, henüz tahsis edilmemiş kullanılabilir stok bilgisidir.\n\n13. Tablo: AI_Iplik_Depo_Hareket_Listesi\n\nGenel Tanım:\nAI_Iplik_Depo_Hareket_Listesi tablosu, iplik deposunda gerçekleşen tüm hareketlerin (giriş, çıkış, transfer, red vs.) ayrıntılı olarak takip edilmesini sağlar. Her bir hareket, iplik kodu, lot bilgisi, miktar, tarih, hangi kullanıcı tarafından işlendiği ve hareketin nedeni gibi operasyonel detayları içerir. Bu tablo, depo yönetimi, stok takibi, kalite kontrol ve red yönetimi gibi süreçlerde kritik rol oynar. Aynı zamanda fason ilişkili hareketlerin, üretim emirlerine bağlı giriş-çıkışların ve depo koordinat bilgilerinin izlenmesini sağlar. Parti bazlı ve detaylı izlenebilirlik için temel veri kaynağıdır.\n\nSütun Tanımları ve Anlamları:\n- IpDepoHrkSubID: İplik depo hareketi yapılan iplik için atanmış olan barkod numarasıdır.\n- FisNo: İplik depo hareket emrini ait fiş numarasıdır. Bu numara ile ipliklerin nereye ne zaman hareket edileceği belirlenir.\n- Tarih: İplik depo hareketine ait tarih bilgisini ifade eder. \n- FirmaAdi: İplik depo hareketine kayıtlı olan firmanın ticari adını belirtir. Depo girişi yapılırken tedarikçi, Depo çıkışı yapılırken müşteri olarak değerlendirilir.\n- HarSebebi: İpliğin depo haretinin ne amaçla yapıldığını açıklar. Satın alma, Üretime çıkış, Devir, Sayım vb.\n- IplikKodu: İplik depo hareket yapılan hammaddenin sistemsel kodunu belirtir.\n- RenkAdi: İplik depo hareket yapılan hammaddenin renk adını belirtir.\n- Cins: İplik depo hareket yapılan hammaddenin cinsini belirtir. Örneğin; polyester, pamuk, viskon vb.\n- DepoAdi: Hangi fiziksel depoda saklandığını ifade eder. Çok lokasyonlu depo sistemlerinde konum yönetimi sağlar.\n- Koordinat: Depo içinde ipliğin fiziksel yerini tanımlar. Genellikle raf sistemine göre tanımlanır (örnek: A2-RF3).\n- Kalite: Depo hareketindeki hammaddenin kalite sınıfını belirtir. Örneğin: A Kalite, 2. Kalite, Fire gibi üretim uygunluğuna göre sınıflamalar içerir.\n- UstGrup1: İpliğin ait olduğu birinci seviye kategori veya ana grup.\n- UstGrup2: İpliğin ait olduğu ikinci seviye kategori (UstGrup1’in alt grubu).\n- LotNo: Depo hareketine ait hammaddenin lot (parti) numarasını belirtir.\n- Sonil: Depo hareketindeki ipliğin şönil li iplik olup olmadığını belirtir.\n- Miktar: Depo hareketindeki ipliğin hareket miktarını ifade eder. Depo çıkışı yapılıyorsa Çıkış Miktarını, Depo girişi yapılıyorsa Giriş Miktarını ifade eder.\n- IIENo: Hangi imalat emri üzerinden sisteme geldiğini ifade eder. AI_Iplik_ImalEmri_Durum tablosu ile ilişkilidir.\n- FasonSipNo: Hangi fason sipariş üzerinden sisteme geldiğini ifade eder. AI_Iplik_FasonSiparis_Durum tablosu ile ilişkilidir.\n- GirenKullanici: Depo hareketi yapan kullanıcının adını gösterir.\n- Kayit_Kimin: Depo hareketin hangi şirkete (holding, birim) ait olduğunu belirtir.\n- Aciklama: Depo Hareketine ait Açıklama bilgisini gösterir\n- HrkTuru: Ç olanlar Depo Çıkışları G harfi olanlar Depo Girişleri ifade etmektedir. \n\n14. Tablo: AI_Iplik_Ihtiyac_Listesi\n\nGenel Tanım: \nAI_Iplik_Ihtiyac_Listesi tablosu, kumaş siparişleri doğrultusunda ihtiyaç duyulan iplik miktarlarını takip eden temel veri kaynağıdır. Bu tablo, belirli kumaş siparişlerinin hangi iplik türlerini (atkı, çözgü, hav) ve miktarlarını gerektirdiğini gösterir. İhtiyaçların karşılanma durumu, tahmini teslim tarihleri ve iplik tipi gibi önemli bilgilerle, üretim ve tedarik süreçlerinin daha verimli yönetilmesine yardımcı olur. \n\nSütun Tanımları ve Anlamları:\nIhtiyacID: Kumaş siparişinden doğan iplik ihtiyacı için verilen benzersiz barkod numarasıdır. Her bir iplik ihtiyacı kaydının takibini sağlar.\nTarih: Hammadde ihtiyacı kaydının oluşturulduğu tarihtir. İhtiyaçların ne zaman doğduğunu ve kaydedildiğini belirler.\nGrup: Oluşan hammadde ihtiyacının tipi veya kategorisidir. Örneğin, atkı, çözgü veya hav gibi gruplar.\nIplikKodu: Oluşan hammadde ihtiyacının belirli bir iplik türüne ait sistemsel kodudur. Bu, hangi iplik türünün gerektiğini belirtir.\nMiktar: Oluşan hammadde ihtiyacının miktarını belirtir. İhtiyaç duyulan iplik miktarının kilogram veya diğer ölçü birimindeki değerini ifade eder.\nAtamaMik: Karşılanan hammadde ihtiyacını belirtir. Hangi miktar ihtiyacın tedarik edildiğini gösterir.\nAtamaBakiye: Henüz karşılanmamış olan iplik ihtiyacını ifade eder. Yani, henüz tedarik edilmemiş miktarı belirtir.\nKapanmaTarihi: Hammadde ihtiyacının tamamının karşılanması durumunda, ihtiyacın kapanma tarihini ifade eder. Tedarik süreci tamamlandığında bu tarih belirlenir.\nTeorikIplikTermin: Hammadde ihtiyacının karşılanması planlanan tarihtir. İhtiyacın ne zaman tamamlanacağına dair tahmini teslim tarihini belirtir.\nSiparisNo: Kumaş siparişine ait benzersiz numaradır. Her siparişin takibi için sistem tarafından otomatik olarak atanır.\nFirmaAdi: Kumaş siparişi veren firmanın ticari adıdır. Hangi firmaya ait bir sipariş olduğunu belirtir.\nKaliteKodu: Kumaşın kalite kodunu belirtir. Bu alan, kalite sınıflandırması yapmak için kullanılır ve AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\nKaliteAdi: Kumaşın kalitesine verilen ticari veya teknik adıdır. Kullanıcıların kumaş kalitesini anlaması için açıklayıcı bir ad sağlar.\nDesenNo: Kumaş siparişine ait benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\nDesenAdi: Kumaş siparişine ait benzersiz desen adıdır. Bu ad tasarımcı tarafından verilen isim veya sistemde kayıtlı olan ad olabilir.\nVaryantNo: Aynı desenin farklı renk kombinasyonlarını ayırt etmek için kullanılan varyant numarasıdır.\nProsesKodu: Kumaşın üretim sürecinde geçtiği işlemleri tanımlayan koddur. Bu, kumaşın boyama, apre, yıkama gibi işlemlerden geçtiği rotayı gösterir.\n\n15. Tablo: AI_Kumas_Siparis_Paz_Listesi\n\nGenel Tanım:\nAI_Kumas_Siparis_Paz_Listesi tablosu, pazarlama birimi tarafından oluşturulan kumaş siparişlerinin tüm süreç bilgilerini içeren bir referans tablosudur. Bu tablo, siparişin türünden, müşteri temsilcisine, kalite tanımlarından, çözgü yapısı ve cağar kodlarına kadar geniş bir yelpazede teknik ve ticari detayları barındırır. Siparişin üretime geçiş durumu, müşteri talepleri ve üretimle koordinasyon sağlanabilmesi için kritik bir kaynaktır. Ayrıca, sipariş sürecinin her aşamasını takip etmeye olanak tanır, böylece üretim hazırlığı ve siparişin gerçekleştirilmesi arasında bağlantı kurar.\n\nSütun Tanımları ve Anlamları:\n- SiparisNo: Kumaş Siparişin fişine ait sistemde otomatik oluşturulan benzersiz numarasıdır. Siparişlerin takibi ve raporlanması için kullanılır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, firma bazlı raporlama ve analizler için kullanılır. AI_Tanim_Firma_Listesi tablosu ile ilişkilidir.\n- SipTarihi: Kumaş siparişin verildiği tarihi belirtir. Siparişin zamanlamasını ve teslimat takibini sağlamak için önemlidir.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- Ulke: Kumaş siparişi veren firmanın kayıtlı olduğu ülkeyi belirtir. Siparişlerin yerel ve uluslararası takibini sağlar.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır. \n- ProsesKodu: Kumaş siparişine ait kumaşın üretim sürecinde geçtiği işlemleri rotasını tanımlayan koddur. Örneğin; boyama, apre, yıkama gibi işlemler.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- Kompozisyon: Kumaş siparişi verilen kumaşta kullanılan hammadde yüzdelerini belirtir. \n- CozKodu: Kumaş siparişi verilen kumaştaki çözgü kodunu belirtir.\n- CozAdi: Kumaş siparişi verilen kumaştaki çözgü adını belirtir.\n- CagarKodu: Kumaş siparişi verilen kumaştaki cağarlık kodunu belirtir. Sadece Kadife olan Kalite Tipleri için geçerlidir.\n- UretimeGecti: Kumaş siparişin süreç olarak müşteriden alındığını ancak üretime geçip geçmediğini belirten sütundur. Siparişin üretim aşamasına ne zaman geçtiğini takip eder.\n- SipMiktar: Kumaş sipariş verilen kumaşın sipariş miktarını ifade eder. Bu, üretim sürecindeki siparişin büyüklüğünü belirler.\n- Kayit_Kimin: Kumaşın hangi firmaya ait olduğunu gösterir. Bu, tedarikçi ya da müşteri bazlı sahiplik bilgisini içerir.\n\n16. Tablo: AI_Kumas_Siparis_Listesi\n\nGenel Tanım:\nAI_Kumas_Siparis_Listesi tablosu, pazarlama biriminde yazılan kumaş siparişlerinin üretim sürecine alınmış siparişlerin temel veri kaynağıdır. Tabloda, kumaş sipariş edilen kumaşın kalite adı, desen adı, varyantı, sipariş metrajı, siparişin mevcut durumu ve termin tarihleri gibi bilgileri içerir. Ayrıca, kumaş siparişin hangi aşamada olduğu (örneğin: sanalda, üretimde, depoda, aprede) ve kumaş siparişin tamamlanıp tamamlanmadığı gibi bilgiler de bu tabloda yer almaktadır. Bu yapı, kumaş siparişlerin takibi ve üretim süreçlerinin verimli yönetilmesi için kritik öneme sahiptir.\n\nSütun Tanımları ve Anlamları:\n- SiparisNo: Kumaş siparişin sistemdeki benzersiz numarasıdır. Her siparişin takip edilmesi ve raporlanması için kullanılır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- SiparisYeri: Kumaş siparişin açıldığı yeri belirtir. Örneğin: üretimde, depoda aprede veya sanalda\n- SiparisSekli: Kumaş siparişin alım şekli belirtir. Örneğin: regüle (seri üretim), kesmece, sanal, contract (sözleşmeli), parti gibi sipariş türleri bulunur.\n- SiparisGrubu: Kumaş siparişin üretim şeklini belirtir. Örneğin: express (hızlı teslimat), 2. kalite, normal sipariş gibi kategoriler.\n- SipTarihi: Kumaş sipariş verildiği tarihtir. Siparişin zamanlamasını ve teslimatın takibini sağlar.\n- TerminTarihi: Kumaş siparişin genel termin tarihidir. Kumaş sipariş edilen kumaşın, üretim sürecinde tamamlanıp teslim edilmesi planlanan tarihi ifade eder.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- SatisBolgesi: Kumaş siparişi veren firmanın satış bölgesini belirtir. Örneğin: Orta Doğu, Avrupa, İç Anadolu gibi coğrafi bölgeler.\n- Ulke: Kumaş siparişi veren firmanın ülkesini belirtir. Siparişin kaynağını ve coğrafi takibini sağlar.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır. \n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KapKaliteGrubu: Kumaş siparişi verilen kumaşın ait olduğu teknik kalite grubunu belirtir. Örneğin; örme, 4800 class, 9600 gibi üretim gruplarını içerir.\n- ApreIslemiTipi: Kumaş siparişi verilen kumaşın hangi apre işlemine tabi tutulduğunu belirtir. Örneğin; boyama, proses, dijital baskı gibi işlemleri kapsar.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- CozKodu: Kumaş siparişi verilen kumaştaki çözgü kodunu belirtir.\n- CozAdi: Kumaş siparişi verilen kumaştaki çözgü adını belirtir.\n- SipMiktar: Kumaş sipariş verilen kumaşın sipariş miktarını ifade eder. Bu, üretim sürecindeki siparişin büyüklüğünü belirler.\n- ProsesKodu: Kumaş sipariş verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan koddur. Örneğin; boyama, yıkama, apre gibi işlemler.\n- TeorikYuklemeTarihi: Kumaş siparişi verilen kumaşın teorik olarak sevk edilmesi planlanan tarih bilgisidir. Sevk planlamasında önemli bir referans tarihidir.\n- Kapandi: Kumaş siparişin tamamlanıp tamamlanmadığını belirten durum bilgisidir. (Evet/Hayır, 1/0 gibi mantıksal veri içerir.)\n\n17. Tablo: AI_Dokuma_IsEmri_Listesi\n\nGenel Tanım:\nAI_Dokuma_IsEmri_Listesi tablosu, kumaş üretim sürecinde yapılan dokuma iş emirlerinin tüm detaylarını içerir. Her bir iş emri, kumaş siparişine dayalı olarak başlatılır ve tablonun içeriği, bu iş emirlerinin zaman çizelgesi, kalite bilgileri, kullanılan materyaller ve üretimle ilgili teknik parametreleri kapsamlı bir şekilde takip eder. Bu tablo, üretim planlaması, kalite kontrolü, dokuma takibi ve süreç izlenebilirliği açısından kritik bir veri kaynağıdır.\n\nSütun Tanımları ve Anlamları:\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- Tarih: Dokuma iş emrinin tanımlandığı tarihtir.\n- SiparisNo: Dokuma iş emri ait sistemdeki benzersiz numaradır.\n- FirmaAdi: Dokuma iş emri veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- TezgahNo: Dokuma iş emrinin dokunacağı veya örüleceği tezgahın numarasını belirtir.\n- PUrBasTar: Dokuma iş emrinin üretime başlama tarihidir.\n- PUrBitTar: Dokuma iş emrinin üretime bitiş tarihidir.\n- PlanMetraj: Dokuma iş emrinin plan metresidir.\n- ToplamHamMetre: Dokuma iş emrine ait üretimi yapılıp ham kalite kontrolde sarılmış toplam metredir.\n- Kalite: Dokuma iş emri verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Dokuma iş emri verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- KaliteTipi: Dokuma iş emri verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- DesenNo: Dokuma iş emri ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Dokuma iş emri ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: KDokuma iş emri ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- CozKodu: Dokuma iş emri verilen kumaştaki çözgü kodunu belirtir.\n- CozAdi: Dokuma iş emri verilen kumaştaki çözgü adını belirtir.\n- CagarKodu: Dokuma iş emri verilen kumaştaki cağarlık kodunu belirtir.\n- ProsesKodu: Dokuma iş emri verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Durumu: Dokuma iş emrinin son durumunu gösterir.\n\n18. Tablo: AI_Apre_HamToplar_Listesi\n\nGenel Tanım:\nAI_Apre_HamToplar_Listesi tablosu, üretim sürecindeki ham kumaşlara ait kalite, desen, varyant, iş emri ve üretim aşamalarına dair teknik bilgileri kayıt altına alır. Kumaşın ham kalite ve desen bilgileri, iş emri numarası, ölçülen metrajı ve üretim sırasında (iğneleme, apre gibi) oluşan fire miktarları gibi kritik veriler bu tabloda yer alır. Ayrıca kumaşta tespit edilen hataların tanımı da bu yapı içinde tutulur. Ham kumaşın üretim ve işlem geçmişini izlemek, kalite kontrol ve stok planlama gibi süreçlerde referans olarak kullanılır.\n\nSütun Tanımları ve Anlamları:\n- TopID: Ham kumaşa ait atanan benzersiz kimlik ID bilgisidir.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- TezgahNo: Dokuma iş emrinin dokunacağı veya örüleceği tezgahın numarasını belirtir.\n- K_Tarih: Ham kumaş sarım yapılıp metrelendiği tarihi belirtir.\n- SiparisNo: Kumaş siparişine ait sistemdeki benzersiz numaradır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- CozAdi: Kumaş siparişi verilen kumaştaki çözgü adını belirtir.\n- AprePartiNo: Ham kumaşın apre işlemi sırasında kullanılan benzersiz (uniq) parti numarasıdır.\n- HamMetre: Ham kumaşın sarılmasından sonra ham metraj bilgisini belirtir (metre cinsinden).\n\n19. Tablo: AI_Apre_MamulToplar_Listesi_Kalite\n\nGenel Tanım:\nAI_Apre_MamulToplar_Listesi_Kalite tablosu, firma tarafından üretilen kumaşların son kontrollerinin yapıldığı mamül sarım makinelerinden alınan verileri içerir. Bu tablodaki sütunlar, kumaşın kalite durumu, metre bilgisi, kalite desen ve varyantı gibi kritik verileri içerir.\n\nSütun Tanımları ve Anlamları:\n- TopID: Mamul kumaşa sistem tarafından atanan benzersiz kimlik ID bilgisidir.\n- KontrolTarihi: Mamul kumaşın kontrol edildiği tarih bilgisini içerir.\n- HamID: Ham kumaşın ham sarımında tüm topa atanan benzersiz (uniq) koddur.\n- SiparisNo: Kumaş siparişe ait benzersiz numaradır. Sistem tarafından tanımlanır.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- K_Tarih: Mamul kumaşın sarıldığı tarihtir.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- K_Kont: Mamul kumaşı kontrol eden operatörün adını belirtir.\n- K_En: Mamul kumaşın kontrol esnasında ölçülen kumaş enini belirtir.\n- K_grm: Mamul kumaşın gramaj bilgisini (g/m²) ifade eder.\n- K_Kalite: Mamul kumaşın kalite durumunu belirtir. Örneğin: 1. Kalite, İç Piyasa, Sorunlu, Bekleme, Parti Hazırlama, Baskı, Tamir.\n- ReelKaliteDurumu: Mamul kumaşın kalite durumunu harf olarak derecesini belirtir (örneğin: A, B, C, D).\n- K_Kg: Mamul kumaşın kontrol sırasında ölçülen kumaş kilosunu belirtir.\n- Net_Mt: Mamul kumaşın ölçülen net uzunluğunu (metre cinsinden) belirtir.\n- Isk: Mamul kumaş üzerindeki hatalı bölgelerin toplam uzunluğunu belirtir. Bazı hatalar noktasal bazı hatalar sürekli olabilir.\n- ParcaIskonto: Mamul kumaşın hatalı bölgelerden kesilerek çıkarılan parçaların toplam uzunluğunu belirtir.\n- ParcaMt: Mamul kumaştan alınan parçaların toplam uzunluğunu belirtir.\n- MknPayi: Mamul kumaşın kontrol makinesinde oluşan fire miktarını ifade eder.\n\n20. Tablo: AI_Apre_ReserveToplar_Listesi_Top\n\nGenel Tanım:\nAI_Apre_ReserveToplar_Listesi_Top tablosu, tekstil kumaş üretim sürecine dahil olan sipariş, kalite, firma ve sevkiyat bilgilerinin detaylı şekilde takibini sağlar. Tablo, her bir kumaşa ait kalite kodları, desen ve varyant bilgileri, teknik kalite grupları ve üretim süreçleri ile ilgili tanımlar içerir. Ayrıca, siparişin hangi firmaya ait olduğu, müşteri temsilcisi bilgisi, sipariş tarihi, yükleme yapılacak depo ve sevkiyat planlaması gibi lojistik bilgileri de yer alır. Bu yapı, üretim planlama, kalite yönetimi, müşteri hizmetleri ve depo operasyonları arasında bilgi bütünlüğü ve operasyonel izlenebilirlik sağlar.\n\nSütun Tanımları ve Anlamları:\n- ReserveID: Müşteri siparişlerinden oluşan mamul topların depoda hazır hale getirilmiş topların benzersiz fiş numarasıdır.\n- KayitEden: Rezerv kaydını oluşturan kullanıcının adını belirtir. Tedarikçi ya da müşteri olabilir.\n- TopID: Mamul kumaşın kumaşa sistem tarafından atanan benzersiz kimlik ID bilgisidir.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- SiparisNo: Kumaş siparişine ait benzersiz numaradır. Sistem tarafından tanımlanır.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Kayit_Kimin: Rezervin hangi şirkete ait olduğunu gösterir. Erp süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- K_Kalite: Mamul kumaşın kalite durumunu belirtir. Örneğin: 1. Kalite, İç Piyasa, Sorunlu, Bekleme, Parti Hazırlama, Baskı, Tamir.\n- GercekKalite: Mamul kumaşın kalite durumunu harf olarak derecesini belirtir (örneğin: A, B, C, D).\n- DepoYeri: Rezervin hangi depodan yükleneceğini belirtir. Depo adı veya kodu olabilir.\n- TeorikYuklemeTarihi: Rezervin sevk edilmesi planlanan tarih bilgisidir.\n\n21. Tablo: AI_Apre_CikisToplar_Listesi_Top\n\nGenel Tanım:\nAI_Apre_CikisToplar_Listesi_Top tablosu, tekstil kumaş üretim sürecine dahil olan sipariş, kalite, firma ve sevkiyat bilgilerinin detaylı şekilde takibini sağlar. Tablo, her bir kumaşa ait kalite kodları, desen ve varyant bilgileri, teknik kalite grupları ve üretim süreçleri ile ilgili tanımları içerir. Ayrıca, siparişin hangi firmaya ait olduğu, müşteri temsilcisi bilgisi, sipariş tarihi, yükleme yapılacak depo ve sevkiyat planlaması gibi lojistik bilgiler de yer alır. Bu yapı, üretim planlama, kalite yönetimi, müşteri hizmetleri ve depo operasyonları arasında bilgi bütünlüğü ve operasyonel izlenebilirlik sağlar.\n\nSütun Tanımları ve Anlamları:\n- KETSCekiNo: Mamul çıkış sevkiyat yapılan çıkışa ait benzersiz fiş numarasıdır.\n- KayitEden: Mamul çıkış sevkiyat kaydını oluşturan kullanıcının adını belirtir. Tedarikçi ya da müşteri olabilir.\n- TopID: Mamul kumaşın kumaşa sistem tarafından atanan benzersiz kimlik ID bilgisidir.\n- FirmaAdi: Kumaş siparişini veren firmanın ticari adıdır. Bu alan, siparişlerin hangi firmaya ait olduğunu belirler.\n- MusTemsilcisi: Kumaş siparişi ile şirkette ilgilenecek müşteri temsilcisinin adıdır. Müşteri ilişkileri yönetimi için kullanılır.\n- SiparisNo: Kumaş siparişine ait benzersiz numaradır. Sistem tarafından tanımlanır.\n- DIsEmriID: Dokuma iş emrine ait benzersiz kimlik (ID) numarasıdır.\n- KaliteTipi: Kumaş siparişi verilen kumaşın kalite tipini belirtir. Örneğin: saten, döşemelik, halı, peluş gibi kalite sınıflandırmaları içerir.\n- KaliteKodu: Kumaş siparişi verilen kumaşın kalite kodunu belirtir. AI_Tanim_Kalite_Listesi tablosu ile ilişkilidir.\n- KaliteAdi: Kumaş siparişi verilen kumaşın kalite adını belirtir. Kumaşa verilen ticari veya teknik kalite adıdır.\n- DesenNo: Kumaş siparişine ait kumaşın benzersiz desen numarasıdır. Tasarım takibi ve üretim kontrolü için kullanılır.\n- DesenAdi: Kumaş siparişine ait kumaşın benzersiz desen adıdır. Tasarımcının verdiği isim ya da sistemde kayıtlı bir ad olabilir.\n- VaryantNo: Kumaş siparişi ait kumaşın farklı renk kombinasyonlarını ayırmak için kullanılan varyant numarasıdır.\n- ProsesKodu: Kumaş siparişi verilen kumaşın üretim sürecinde geçtiği işlemleri tanımlayan rotanın koddur. Örneğin; boyama, yıkama, apre gibi üretim aşamalarını belirtir.\n- Kayit_Kimin: Mamul çıkış hangi şirkete ait olduğunu gösterir. Erp süreçlerinde birden fazla şirket tanımlaması bulunmaktadır.\n- K_Kalite: Mamul kumaşın kalite durumunu belirtir. Örneğin: 1. Kalite, İç Piyasa, Sorunlu, Bekleme, Parti Hazırlama, Baskı, Tamir.\n- GercekKalite: Mamul kumaşın kalite durumunu harf olarak derecesini belirtir (örneğin: A, B, C, D).\n- DepoYeri: Mamul çıkış sevkiyat hangi depodan yükleneceğini belirtir. Depo adı veya kodu olabilir.\n- TeorikYuklemeTarihi: Mamul çıkış sevkiyat sevk edilmesi planlanan tarih bilgisidir." } }, "type": "@n8n/n8n-nodes-langchain.agent", diff --git a/configs/deployment/docker-compose-data.yml b/configs/deployment/docker-compose-data.yml index 70a61323..f816cc39 100644 --- a/configs/deployment/docker-compose-data.yml +++ b/configs/deployment/docker-compose-data.yml @@ -36,15 +36,19 @@ services: - db sql: image: mcr.microsoft.com/mssql/server:2022-CU19-ubuntu-22.04 + container_name: kurs-platform-data-sql profiles: ["sql"] user: root environment: - SA_PASSWORD=NvQp8s@l - ACCEPT_EULA=Y - - MSSQL_PID=Web + - MSSQL_PID=Developer ports: - - 1433:1433 + - "1433:1433" volumes: - mssql:/var/opt/mssql networks: - - db + db: + aliases: + - sql + restart: unless-stopped diff --git a/configs/deployment/scripts/4-production-build.sh b/configs/deployment/scripts/4-production-build.sh index d07a4596..ac918b79 100644 --- a/configs/deployment/scripts/4-production-build.sh +++ b/configs/deployment/scripts/4-production-build.sh @@ -2,6 +2,7 @@ set -e cd ~/kurs-platform +git restore ui/public/version.json 2>/dev/null || git checkout -- ui/public/version.json ./configs/deployment/scripts/build/api.sh ./configs/deployment/scripts/build/migrator.sh diff --git a/ui/src/components/layouts/PublicLayout.tsx b/ui/src/components/layouts/PublicLayout.tsx index 12353033..cffa50c9 100644 --- a/ui/src/components/layouts/PublicLayout.tsx +++ b/ui/src/components/layouts/PublicLayout.tsx @@ -401,7 +401,7 @@ const PublicLayout = () => {

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

    diff --git a/ui/src/constants/app.constant.ts b/ui/src/constants/app.constant.ts index 0fc7455e..d19bf571 100644 --- a/ui/src/constants/app.constant.ts +++ b/ui/src/constants/app.constant.ts @@ -1,6 +1,6 @@ const { VITE_CDN_URL } = import.meta.env -export const APP_NAME = 'Sözsoft Kurs Platform' +export const APP_NAME = 'Erp Platform' export const PERSIST_STORE_NAME = 'admin' export const REDIRECT_URL_KEY = 'redirectUrl' export const DEFAULT_API_NAME = 'Default' diff --git a/ui/src/mocks/mockActivities.ts b/ui/src/mocks/mockActivities.ts index 20689763..fa72e5fe 100644 --- a/ui/src/mocks/mockActivities.ts +++ b/ui/src/mocks/mockActivities.ts @@ -74,7 +74,7 @@ export const mockActivities: CrmActivity[] = [ activityType: CrmActivityTypeEnum.Demo, subject: "Yazılım Demo Sunumu", description: - "ERP sisteminin demo sunumu müşteri lokasyonunda gerçekleştirilecek.", + "Erp sisteminin demo sunumu müşteri lokasyonunda gerçekleştirilecek.", customerId: "5", customer: mockBusinessParties.find((cust) => cust.id === "5"), activityDate: new Date("2024-01-26T13:00:00"), diff --git a/ui/src/mocks/mockOpportunities.ts b/ui/src/mocks/mockOpportunities.ts index 1ff25525..a6e9861c 100644 --- a/ui/src/mocks/mockOpportunities.ts +++ b/ui/src/mocks/mockOpportunities.ts @@ -34,7 +34,7 @@ export const mockOpportunities: CrmOpportunity[] = [ { id: "opp2", opportunityNumber: "OPP-2024-002", - title: "XYZ Kurumu ERP Sistemi", + title: "XYZ Kurumu Erp Sistemi", customerId: "6", customer: mockBusinessParties.find((c) => c.id === "6"), stage: OpportunityStageEnum.ClosedLost, diff --git a/ui/src/mocks/mockProjectCostTracking.ts b/ui/src/mocks/mockProjectCostTracking.ts index af170ea2..37fb2a48 100644 --- a/ui/src/mocks/mockProjectCostTracking.ts +++ b/ui/src/mocks/mockProjectCostTracking.ts @@ -4,7 +4,7 @@ export const mockProjectCostTracking: PsProjectCostTracking[] = [ { id: '1', projectId: '1', - projectName: 'ERP Sistemi Geliştirme', + projectName: 'Erp Sistemi Geliştirme', projectCode: 'PRJ-2024-001', plannedBudget: 500000, actualCost: 325000, diff --git a/ui/src/mocks/mockProjectTasks.ts b/ui/src/mocks/mockProjectTasks.ts index 6e6ac06e..85d649a9 100644 --- a/ui/src/mocks/mockProjectTasks.ts +++ b/ui/src/mocks/mockProjectTasks.ts @@ -11,7 +11,7 @@ export const mockProjectTasks: PsProjectTask[] = [ phase: mockProjectPhases.find((phase) => phase.id === "1"), taskCode: "TSK-001", name: "Veritabanı Tasarımı", - description: "ERP sistemi için veritabanı şemasının tasarlanması", + description: "Erp sistemi için veritabanı şemasının tasarlanması", taskType: TaskTypeEnum.Development, status: TaskStatusEnum.InProgress, priority: PriorityEnum.High, diff --git a/ui/src/mocks/mockProjects.ts b/ui/src/mocks/mockProjects.ts index fee5fec2..14262c36 100644 --- a/ui/src/mocks/mockProjects.ts +++ b/ui/src/mocks/mockProjects.ts @@ -17,7 +17,7 @@ export const mockProjects: PsProject[] = [ { id: "1", code: "PRJ-2024-001", - name: "ERP Sistemi Geliştirme", + name: "Erp Sistemi Geliştirme", description: "Kurumsal kaynak planlama sistemi geliştirilmesi", projectType: ProjectTypeEnum.Internal, status: ProjectStatusEnum.Active, diff --git a/ui/src/mocks/mockWaybills.ts b/ui/src/mocks/mockWaybills.ts index 7d08ef74..3cb79040 100644 --- a/ui/src/mocks/mockWaybills.ts +++ b/ui/src/mocks/mockWaybills.ts @@ -75,7 +75,7 @@ export const mockWaybills: FiWaybill[] = [ { id: "3", waybillId: "2", - description: "Yazılım Lisansı - ERP Modülü", + description: "Yazılım Lisansı - Erp Modülü", quantity: 1, unit: "Adet", unitPrice: 15000, diff --git a/ui/src/utils/subdomain.ts b/ui/src/utils/subdomain.ts index ce806164..e07ab344 100644 --- a/ui/src/utils/subdomain.ts +++ b/ui/src/utils/subdomain.ts @@ -1,4 +1,4 @@ -const defaultSubDomain = 'KURS' +export const defaultDomain = 'Erp' export const getSubdomain = (): string | null => { if (typeof window === 'undefined') return null @@ -12,7 +12,7 @@ export const getSubdomain = (): string | null => { } // Default subdomain ise null döndür - if (parts[0].toUpperCase() === defaultSubDomain) { + if (parts[0].toUpperCase() === defaultDomain) { return null } diff --git a/ui/src/views/AccessDenied.tsx b/ui/src/views/AccessDenied.tsx index 2cdb5ada..6e95b56d 100644 --- a/ui/src/views/AccessDenied.tsx +++ b/ui/src/views/AccessDenied.tsx @@ -17,9 +17,9 @@ const AccessDenied = () => { return (
    { return ( <> diff --git a/ui/src/views/NotFound.tsx b/ui/src/views/NotFound.tsx index 4f8ad272..8e7e64fa 100644 --- a/ui/src/views/NotFound.tsx +++ b/ui/src/views/NotFound.tsx @@ -13,9 +13,9 @@ const NotFoundPage = () => { return (
    diff --git a/ui/src/views/admin/activityLog/ActivityLog.tsx b/ui/src/views/admin/activityLog/ActivityLog.tsx index 365c618b..66250a2d 100644 --- a/ui/src/views/admin/activityLog/ActivityLog.tsx +++ b/ui/src/views/admin/activityLog/ActivityLog.tsx @@ -82,9 +82,9 @@ const ActivityLog = () => { return ( diff --git a/ui/src/views/admin/files/FileManager.tsx b/ui/src/views/admin/files/FileManager.tsx index 58e37916..c2c1a457 100644 --- a/ui/src/views/admin/files/FileManager.tsx +++ b/ui/src/views/admin/files/FileManager.tsx @@ -677,9 +677,9 @@ const FileManager = () => { return ( {/* Enhanced Unified Toolbar */} diff --git a/ui/src/views/admin/listForm/Wizard.tsx b/ui/src/views/admin/listForm/Wizard.tsx index a99835d2..3e3470a5 100644 --- a/ui/src/views/admin/listForm/Wizard.tsx +++ b/ui/src/views/admin/listForm/Wizard.tsx @@ -131,9 +131,9 @@ const Wizard = () => { return (
    diff --git a/ui/src/views/admin/listForm/edit/FormEdit.tsx b/ui/src/views/admin/listForm/edit/FormEdit.tsx index e8a16df6..3a754b1c 100644 --- a/ui/src/views/admin/listForm/edit/FormEdit.tsx +++ b/ui/src/views/admin/listForm/edit/FormEdit.tsx @@ -170,9 +170,9 @@ const FormEdit = () => { return listFormCode && listFormValues && customizations && roleList && userList ? (
    diff --git a/ui/src/views/admin/organization-unit/OrganizationUnits.tsx b/ui/src/views/admin/organization-unit/OrganizationUnits.tsx index 99ab8299..489b2644 100644 --- a/ui/src/views/admin/organization-unit/OrganizationUnits.tsx +++ b/ui/src/views/admin/organization-unit/OrganizationUnits.tsx @@ -456,9 +456,9 @@ const OrganizationUnits = () => { return ( <> diff --git a/ui/src/views/admin/profile/Profile.tsx b/ui/src/views/admin/profile/Profile.tsx index 739d3c0d..2d0495c9 100644 --- a/ui/src/views/admin/profile/Profile.tsx +++ b/ui/src/views/admin/profile/Profile.tsx @@ -68,9 +68,9 @@ const Profile = () => { return ( onTabChange(val)}> diff --git a/ui/src/views/admin/role-management/Roles.tsx b/ui/src/views/admin/role-management/Roles.tsx index c3ebb342..be78942f 100644 --- a/ui/src/views/admin/role-management/Roles.tsx +++ b/ui/src/views/admin/role-management/Roles.tsx @@ -37,9 +37,9 @@ const Roles = () => { return ( <>