From cc2501efc91faace0171759ef985d3fa4702ee3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Mon, 27 Oct 2025 21:45:39 +0300 Subject: [PATCH] Hr Surveys Response --- .../Seeds/HostData.json | 63 +++ .../Seeds/ListFormSeeder.cs | 365 +++++++++++++++++- .../PlatformConsts.cs | 1 + .../Kurs.Platform.Domain/Data/SeedConsts.cs | 1 + 4 files changed, 417 insertions(+), 13 deletions(-) diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/HostData.json b/api/src/Kurs.Platform.DbMigrator/Seeds/HostData.json index 87c1ad43..f1563fb2 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/HostData.json +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/HostData.json @@ -25114,6 +25114,69 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.SurveyResponse", + "ParentName": null, + "DisplayName": "App.Hr.SurveyResponse", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.SurveyResponse.Create", + "ParentName": "App.Hr.SurveyResponse", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.SurveyResponse.Update", + "ParentName": "App.Hr.SurveyResponse", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.SurveyResponse.Delete", + "ParentName": "App.Hr.SurveyResponse", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.SurveyResponse.Export", + "ParentName": "App.Hr.SurveyResponse", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.SurveyResponse.Import", + "ParentName": "App.Hr.SurveyResponse", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.SurveyResponse.Activity", + "ParentName": "App.Hr.SurveyResponse", + "DisplayName": "Activity", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, { "GroupName": "App.Hr", "Name": "App.Hr.CostCenter", diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder.cs index a33dc954..0b63f36e 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder.cs +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder.cs @@ -2414,6 +2414,17 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency ChildFieldName = "SurveyId" } } + }, + new { + TabTitle = "Responses", + TabType = ListFormTabTypeEnum.List, + Code = ListFormCodes.Lists.SurveyResponse, + Relation = new List() { + new { + ParentFieldName = "Id", + ChildFieldName = "SurveyId" + } + } } }), CultureName = LanguageCodes.En, @@ -40892,9 +40903,9 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency }), PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto { - C = AppCodes.Intranet.Announcement + ".Create", - R = AppCodes.Intranet.Announcement, - U = AppCodes.Intranet.Announcement + ".Update", + C = AppCodes.Intranet.Visitor + ".Create", + R = AppCodes.Intranet.Visitor, + U = AppCodes.Intranet.Visitor + ".Update", E = true, I = true, Deny = false @@ -41442,9 +41453,9 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency }), PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto { - C = AppCodes.Intranet.Announcement + ".Create", - R = AppCodes.Intranet.Announcement, - U = AppCodes.Intranet.Announcement + ".Update", + C = AppCodes.Hr.Expense + ".Create", + R = AppCodes.Hr.Expense, + U = AppCodes.Hr.Expense + ".Update", E = true, I = true, Deny = false @@ -42009,9 +42020,9 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency }), PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto { - C = AppCodes.Intranet.Announcement + ".Create", - R = AppCodes.Intranet.Announcement, - U = AppCodes.Intranet.Announcement + ".Update", + C = AppCodes.Hr.Survey + ".Create", + R = AppCodes.Hr.Survey, + U = AppCodes.Hr.Survey + ".Update", E = true, I = true, Deny = false @@ -42028,7 +42039,7 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency CultureName = LanguageCodes.En, SourceDbType = DbType.String, FieldName = "Title", - Width = 200, + Width = 400, ListOrderNo = 2, Visible = true, IsActive = true, @@ -42373,9 +42384,9 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency }), PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto { - C = AppCodes.Intranet.Announcement + ".Create", - R = AppCodes.Intranet.Announcement, - U = AppCodes.Intranet.Announcement + ".Update", + C = AppCodes.Hr.SurveyQuestion + ".Create", + R = AppCodes.Hr.SurveyQuestion, + U = AppCodes.Hr.SurveyQuestion + ".Update", E = true, I = true, Deny = false @@ -42574,6 +42585,334 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency } #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 = JsonSerializer.Serialize(new LayoutDto() + { + Grid = true, + Card = true, + Pivot = true, + Chart = true, + DefaultLayout = "grid", + CardLayoutColumn = 3 + }), + 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 = "\"IsDeleted\" = 'false'", + 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 = JsonSerializer.Serialize(new SelectionDto + { + Mode = GridOptions.SelectionModeSingle, + AllowSelectAll = false + }), + ColumnOptionJson = JsonSerializer.Serialize(new + { + ColumnFixingEnabled = true, + ColumnAutoWidth = true, + ColumnChooserEnabled = true, + AllowColumnResizing = true, + AllowColumnReordering = true, + ColumnResizingMode = "widget", + }), + PermissionJson = JsonSerializer.Serialize(new PermissionCrudDto + { + C = AppCodes.Hr.SurveyResponse + ".Create", + R = AppCodes.Hr.SurveyResponse, + U = AppCodes.Hr.SurveyResponse + ".Update", + D = AppCodes.Hr.SurveyResponse + ".Delete", + E = AppCodes.Hr.SurveyResponse + ".Export", + I = AppCodes.Hr.SurveyResponse + ".Import", + A = AppCodes.Hr.SurveyResponse + ".Activity", + }), + 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 = JsonSerializer.Serialize(new GridPagerOptionDto + { + Visible = true, + AllowedPageSizes = "10,20,50,100", + ShowPageSizeSelector = true, + ShowNavigationButtons = true, + ShowInfo = false, + InfoText = "Page {0} of {1} ({2} items)", + DisplayMode = GridColumnOptions.PagerDisplayModeAdaptive, + ScrollingMode = GridColumnOptions.ScrollingModeStandard, + LoadPanelEnabled = "auto", + LoadPanelText = "Loading..." + }), + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto() + { + Title = "Survey Response Form", + 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, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] { + new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) } + }), + ColumnCustomizationJson = JsonSerializer.Serialize(new ColumnCustomizationDto + { + AllowReordering = true, + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Hr.SurveyResponse + ".Create", + R = AppCodes.Hr.SurveyResponse, + U = AppCodes.Hr.SurveyResponse + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = listFormSurveyResponse.ListFormCode, + RoleId = null, + UserId = null, + 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 = JsonSerializer.Serialize(new ValidationRuleDto[] { + new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) } + }), + ColumnCustomizationJson = JsonSerializer.Serialize(new ColumnCustomizationDto + { + AllowReordering = true, + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Hr.SurveyQuestion + ".Create", + R = AppCodes.Hr.SurveyQuestion, + U = AppCodes.Hr.SurveyQuestion + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = listFormSurveyResponse.ListFormCode, + RoleId = null, + UserId = null, + 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 = JsonSerializer.Serialize(new ValidationRuleDto[] { + new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) } + }), + ColumnCustomizationJson = JsonSerializer.Serialize(new ColumnCustomizationDto + { + AllowReordering = true, + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Hr.SurveyResponse + ".Create", + R = AppCodes.Hr.SurveyResponse, + U = AppCodes.Hr.SurveyResponse + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = listFormSurveyResponse.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "SubmissionTime", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] { + new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) } + }), + ColumnCustomizationJson = JsonSerializer.Serialize(new ColumnCustomizationDto + { + AllowReordering = true, + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Hr.SurveyResponse + ".Create", + R = AppCodes.Hr.SurveyResponse, + U = AppCodes.Hr.SurveyResponse + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = listFormSurveyResponse.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "CreationTime", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = JsonSerializer.Serialize(new ColumnCustomizationDto + { + AllowReordering = true, + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Hr.SurveyResponse + ".Create", + R = AppCodes.Hr.SurveyResponse, + U = AppCodes.Hr.SurveyResponse + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + ]); + #endregion + } + #endregion + #endregion } } diff --git a/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs b/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs index 3fc6d6b8..b40e50e5 100644 --- a/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs +++ b/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs @@ -538,6 +538,7 @@ public static class PlatformConsts public const string Survey = "list-survey"; public const string SurveyQuestion = "list-surveyquestion"; public const string SurveyQuestionOption = "list-surveyquestionoption"; + public const string SurveyResponse = "list-surveyresponse"; } } diff --git a/api/src/Kurs.Platform.Domain/Data/SeedConsts.cs b/api/src/Kurs.Platform.Domain/Data/SeedConsts.cs index 44faf772..6d426839 100644 --- a/api/src/Kurs.Platform.Domain/Data/SeedConsts.cs +++ b/api/src/Kurs.Platform.Domain/Data/SeedConsts.cs @@ -479,6 +479,7 @@ public static class SeedConsts public const string Survey = Default + ".Survey"; public const string SurveyQuestion = Default + ".SurveyQuestion"; public const string SurveyQuestionOption = Default + ".SurveyQuestionOption"; + public const string SurveyResponse = Default + ".SurveyResponse"; } public static class Accounting