diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/HostData.json b/api/src/Kurs.Platform.DbMigrator/Seeds/HostData.json index e8c51d17..87c1ad43 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/HostData.json +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/HostData.json @@ -7839,6 +7839,18 @@ "tr": "Harcama Talepleri", "en": "Expense Requests" }, + { + "resourceName": "Platform", + "key": "App.Hr.Survey", + "tr": "Anketler", + "en": "Surveys" + }, + { + "resourceName": "Platform", + "key": "App.Hr.SurveyQuestion", + "tr": "Anket Soruları", + "en": "Survey Questions" + }, { "resourceName": "Platform", "key": "App.Intranet.Meal", @@ -15460,7 +15472,7 @@ "DisplayName": "App.Hr.Performance360", "Order": 13, "Url": "/admin/list/list-performance360", - "Icon": "FcSurvey", + "Icon": "FcFeedback", "RequiredPermissionName": "App.Hr.Performance360", "IsDisabled": false }, @@ -15474,6 +15486,16 @@ "RequiredPermissionName": "App.Hr.Training", "IsDisabled": false }, + { + "ParentCode": "App.Hr", + "Code": "App.Hr.Survey", + "DisplayName": "App.Hr.Survey", + "Order": 15, + "Url": "/admin/list/list-survey", + "Icon": "FcSurvey", + "RequiredPermissionName": "App.Hr.Survey", + "IsDisabled": false + }, { "ParentCode": null, "Code": "App.Mrp", @@ -24957,6 +24979,141 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.Survey", + "ParentName": null, + "DisplayName": "App.Hr.Survey", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.Survey.Create", + "ParentName": "App.Hr.Survey", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.Survey.Update", + "ParentName": "App.Hr.Survey", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.Survey.Delete", + "ParentName": "App.Hr.Survey", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.Survey.Export", + "ParentName": "App.Hr.Survey", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.Survey.Import", + "ParentName": "App.Hr.Survey", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.Survey.Activity", + "ParentName": "App.Hr.Survey", + "DisplayName": "Activity", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.Survey.Widget", + "ParentName": "App.Hr.Survey", + "DisplayName": "Widget", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.SurveyQuestion", + "ParentName": null, + "DisplayName": "App.Hr.SurveyQuestion", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.SurveyQuestion.Create", + "ParentName": "App.Hr.SurveyQuestion", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.SurveyQuestion.Update", + "ParentName": "App.Hr.SurveyQuestion", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.SurveyQuestion.Delete", + "ParentName": "App.Hr.SurveyQuestion", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.SurveyQuestion.Export", + "ParentName": "App.Hr.SurveyQuestion", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.SurveyQuestion.Import", + "ParentName": "App.Hr.SurveyQuestion", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Hr", + "Name": "App.Hr.SurveyQuestion.Activity", + "ParentName": "App.Hr.SurveyQuestion", + "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 438012e2..a33dc954 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder.cs +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormSeeder.cs @@ -2386,6 +2386,380 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency } #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 = JsonSerializer.Serialize(new LayoutDto() + { + Grid = true, + Card = true, + Pivot = true, + Chart = true, + DefaultLayout = "grid", + CardLayoutColumn = 3 + }), + SubFormsJson = JsonSerializer.Serialize(new List() { + new { + TabTitle = "Questions", + TabType = ListFormTabTypeEnum.List, + Code = ListFormCodes.Lists.SurveyQuestion, + 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 = "\"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.Survey + ".Create", + R = AppCodes.Hr.Survey, + U = AppCodes.Hr.Survey + ".Update", + D = AppCodes.Hr.Survey + ".Delete", + E = AppCodes.Hr.Survey + ".Export", + I = AppCodes.Hr.Survey + ".Import", + A = AppCodes.Hr.Survey + ".Activity", + }), + 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 = 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 Form", + 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, + 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.Intranet.Announcement + ".Create", + R = AppCodes.Intranet.Announcement, + U = AppCodes.Intranet.Announcement + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = formSurvey.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Title", + Width = 200, + ListOrderNo = 2, + 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.Survey + ".Create", + R = AppCodes.Hr.Survey, + U = AppCodes.Hr.Survey + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = formSurvey.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "Deadline", + Width = 100, + ListOrderNo = 3, + 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.Survey + ".Create", + R = AppCodes.Hr.Survey, + U = AppCodes.Hr.Survey + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = formSurvey.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Responses", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = JsonSerializer.Serialize(new ColumnCustomizationDto + { + AllowReordering = true, + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Hr.Survey + ".Create", + R = AppCodes.Hr.Survey, + U = AppCodes.Hr.Survey + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = formSurvey.ListFormCode, + RoleId = null, + UserId = null, + 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 = 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.Survey + ".Create", + R = AppCodes.Hr.Survey, + U = AppCodes.Hr.Survey + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = formSurvey.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsAnonymous", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = JsonSerializer.Serialize(new ColumnCustomizationDto + { + AllowReordering = true, + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Hr.Survey + ".Create", + R = AppCodes.Hr.Survey, + U = AppCodes.Hr.Survey + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + ]); + #endregion + } + #endregion + #endregion #region List @@ -40346,7 +40720,7 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency new ListForm() { ListFormType = ListFormTypeEnum.List, - IsSubForm = true, + IsSubForm = false, LayoutJson = JsonSerializer.Serialize(new LayoutDto() { Grid = true, @@ -40891,7 +41265,7 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency new ListForm() { ListFormType = ListFormTypeEnum.List, - IsSubForm = true, + IsSubForm = false, LayoutJson = JsonSerializer.Serialize(new LayoutDto() { Grid = true, @@ -41449,6 +41823,757 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency } #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 = JsonSerializer.Serialize(new LayoutDto() + { + Grid = true, + Card = true, + Pivot = true, + Chart = true, + DefaultLayout = "grid", + CardLayoutColumn = 3 + }), + 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 = "\"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.Survey + ".Create", + R = AppCodes.Hr.Survey, + U = AppCodes.Hr.Survey + ".Update", + D = AppCodes.Hr.Survey + ".Delete", + E = AppCodes.Hr.Survey + ".Export", + I = AppCodes.Hr.Survey + ".Import", + A = AppCodes.Hr.Survey + ".Activity", + }), + 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 = 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 Form", + 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 = "Questions", + Text ="Questions", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Survey + ".Update", + Url="/admin/form/form-survey/@Id" + }, + new() { + Hint = "Responses", + Text ="Responses", + UrlTarget="_blank", + AuthName = AppCodes.Hr.Survey + ".Update", + Url="/admin/form/form-survey/@Id" + }, + }), + } + ); + + #region Survey Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listFormSurvey.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.Intranet.Announcement + ".Create", + R = AppCodes.Intranet.Announcement, + U = AppCodes.Intranet.Announcement + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = listFormSurvey.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Title", + Width = 200, + ListOrderNo = 2, + 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.Survey + ".Create", + R = AppCodes.Hr.Survey, + U = AppCodes.Hr.Survey + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = listFormSurvey.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "Deadline", + Width = 100, + ListOrderNo = 3, + 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.Survey + ".Create", + R = AppCodes.Hr.Survey, + U = AppCodes.Hr.Survey + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = listFormSurvey.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Responses", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = JsonSerializer.Serialize(new ColumnCustomizationDto + { + AllowReordering = true, + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Hr.Survey + ".Create", + R = AppCodes.Hr.Survey, + U = AppCodes.Hr.Survey + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = listFormSurvey.ListFormCode, + RoleId = null, + UserId = null, + 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 = 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.Survey + ".Create", + R = AppCodes.Hr.Survey, + U = AppCodes.Hr.Survey + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = listFormSurvey.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsAnonymous", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = JsonSerializer.Serialize(new ColumnCustomizationDto + { + AllowReordering = true, + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Hr.Survey + ".Create", + R = AppCodes.Hr.Survey, + U = AppCodes.Hr.Survey + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + ]); + #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 = JsonSerializer.Serialize(new LayoutDto() + { + Grid = true, + Card = true, + Pivot = true, + Chart = true, + DefaultLayout = "grid", + CardLayoutColumn = 3 + }), + 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 = "\"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.SurveyQuestion + ".Create", + R = AppCodes.Hr.SurveyQuestion, + U = AppCodes.Hr.SurveyQuestion + ".Update", + D = AppCodes.Hr.SurveyQuestion + ".Delete", + E = AppCodes.Hr.SurveyQuestion + ".Export", + I = AppCodes.Hr.SurveyQuestion + ".Import", + A = AppCodes.Hr.SurveyQuestion + ".Activity", + }), + 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 = 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 Question 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 = "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, + 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.Intranet.Announcement + ".Create", + R = AppCodes.Intranet.Announcement, + U = AppCodes.Intranet.Announcement + ".Update", + E = true, + I = true, + Deny = false + }), + PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto + { + IsPivot = true + }) + }, + new() { + ListFormCode = listFormSurveyQuestion.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 = listFormSurveyQuestion.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Order", + Width = 100, + ListOrderNo = 3, + 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.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 = listFormSurveyQuestion.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "QuestionText", + Width = 300, + 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.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 = listFormSurveyQuestion.ListFormCode, + RoleId = null, + UserId = null, + 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 = 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 = listFormSurveyQuestion.ListFormCode, + RoleId = null, + UserId = null, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsRequired", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + 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 + }) + }, + ]); + #endregion + } + #endregion + #endregion } } diff --git a/api/src/Kurs.Platform.Domain.Shared/Enums/LookUpQueryValues.cs b/api/src/Kurs.Platform.Domain.Shared/Enums/LookUpQueryValues.cs index def533b5..b8f9cd3c 100644 --- a/api/src/Kurs.Platform.Domain.Shared/Enums/LookUpQueryValues.cs +++ b/api/src/Kurs.Platform.Domain.Shared/Enums/LookUpQueryValues.cs @@ -292,5 +292,12 @@ public static class LookUpQueryValues $"\"Id\" AS \"Key\", " + $"\"Name\" AS \"Name\" " + $"FROM \"{FullNameTable(TableNameEnum.Template360)}\" " + - $"WHERE \"IsDeleted\" = 'false' "; + $"WHERE \"IsDeleted\" = 'false' "; + + public static string SurveyValues = + $"SELECT " + + $"\"Id\" AS \"Key\", " + + $"\"Title\" AS \"Name\" " + + $"FROM \"{FullNameTable(TableNameEnum.Survey)}\" " + + $"WHERE \"IsDeleted\" = 'false' "; } \ No newline at end of file diff --git a/api/src/Kurs.Platform.Domain.Shared/Enums/TableNameEnum.cs b/api/src/Kurs.Platform.Domain.Shared/Enums/TableNameEnum.cs index db3c41cd..97295a25 100644 --- a/api/src/Kurs.Platform.Domain.Shared/Enums/TableNameEnum.cs +++ b/api/src/Kurs.Platform.Domain.Shared/Enums/TableNameEnum.cs @@ -123,5 +123,10 @@ public enum TableNameEnum ShuttleRoute, Announcement, Visitor, - Expense + Expense, + Survey, + SurveyQuestion, + SurveyQuestionOption, + SurveyResponse, + SurveyAnswer } \ No newline at end of file diff --git a/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs b/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs index cc7d4f84..3fc6d6b8 100644 --- a/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs +++ b/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs @@ -430,6 +430,7 @@ public static class PlatformConsts public const string FormTenant = "form-tenant"; public const string FormQuestionPool = "form-questionpool"; public const string FormBank = "form-bank"; + public const string FormSurvey = "form-survey"; } public static class Lists @@ -534,6 +535,9 @@ public static class PlatformConsts public const string Announcement = "list-announcement"; public const string Visitor = "list-visitor"; public const string Expense = "list-expense"; + public const string Survey = "list-survey"; + public const string SurveyQuestion = "list-surveyquestion"; + public const string SurveyQuestionOption = "list-surveyquestionoption"; } } diff --git a/api/src/Kurs.Platform.Domain.Shared/TableNameResolver.cs b/api/src/Kurs.Platform.Domain.Shared/TableNameResolver.cs index adcc843a..cfdf8370 100644 --- a/api/src/Kurs.Platform.Domain.Shared/TableNameResolver.cs +++ b/api/src/Kurs.Platform.Domain.Shared/TableNameResolver.cs @@ -131,6 +131,11 @@ public static class TableNameResolver { nameof(TableNameEnum.Template360), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Hr) }, { nameof(TableNameEnum.Performance360), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Hr) }, { nameof(TableNameEnum.Expense), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Hr) }, + { nameof(TableNameEnum.Survey), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Hr) }, + { nameof(TableNameEnum.SurveyQuestion), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Hr) }, + { nameof(TableNameEnum.SurveyQuestionOption), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Hr) }, + { nameof(TableNameEnum.SurveyAnswer), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Hr) }, + { nameof(TableNameEnum.SurveyResponse), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Hr) }, // Intranet { nameof(TableNameEnum.EventCategory), (PlatformConsts.TablePrefix.TenantByName, MenuPrefix.Intranet) }, diff --git a/api/src/Kurs.Platform.Domain/Data/SeedConsts.cs b/api/src/Kurs.Platform.Domain/Data/SeedConsts.cs index ccb7feca..44faf772 100644 --- a/api/src/Kurs.Platform.Domain/Data/SeedConsts.cs +++ b/api/src/Kurs.Platform.Domain/Data/SeedConsts.cs @@ -476,6 +476,9 @@ public static class SeedConsts public const string Payroll = Default + ".Payroll"; public const string Template360 = Default + ".Template360"; public const string Performance360 = Default + ".Performance360"; + public const string Survey = Default + ".Survey"; + public const string SurveyQuestion = Default + ".SurveyQuestion"; + public const string SurveyQuestionOption = Default + ".SurveyQuestionOption"; } public static class Accounting diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Employee.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Employee.cs index 95c078d9..62eb7050 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Employee.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Employee.cs @@ -73,4 +73,5 @@ public class Employee : FullAuditedEntity, IMultiTenant public ICollection Reservations { get; set; } public ICollection Certificates { get; set; } public ICollection ExpenseRequests { get; set; } + public ICollection SurveyResponses { get; set; } } diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Survey.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Survey.cs new file mode 100644 index 00000000..14b36ffe --- /dev/null +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Survey.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Kurs.Platform.Entities; + +public class Survey : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Title { get; set; } + public string Description { get; set; } + public DateTime Deadline { get; set; } + public int Responses { get; set; } + public string Status { get; set; } // draft | active | closed + public bool IsAnonymous { get; set; } + + public ICollection Questions { get; set; } + public ICollection SurveyResponses { get; set; } +} + +public class SurveyQuestion : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public Guid SurveyId { get; set; } + public Survey Survey { get; set; } + + public string QuestionText { get; set; } + public string Type { get; set; } // rating | multiple-choice | text | textarea | yes-no + public int Order { get; set; } + public bool IsRequired { get; set; } + + public ICollection Options { get; set; } +} + +public class SurveyQuestionOption : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public Guid QuestionId { get; set; } + public SurveyQuestion Question { get; set; } + + public string Text { get; set; } + public int Order { get; set; } +} + +public class SurveyResponse : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public Guid SurveyId { get; set; } + public Survey Survey { get; set; } + + public Guid? EmployeeId { get; set; } + public Employee? Employee { get; set; } + + public DateTime SubmissionTime { get; set; } + + public ICollection Answers { get; set; } +} + +public class SurveyAnswer : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public Guid ResponseId { get; set; } + public SurveyResponse Response { get; set; } + + public Guid QuestionId { get; set; } + public SurveyQuestion Question { get; set; } + + public string QuestionType { get; set; } // rating | multiple-choice | text | textarea | yes-no + public string Value { get; set; } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index 2acbd12a..c547781d 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -184,6 +184,11 @@ public class PlatformDbContext : public DbSet Announcements { get; set; } public DbSet Visitors { get; set; } public DbSet ExpenseRequests { get; set; } + public DbSet Surveys { get; set; } + public DbSet SurveyQuestions { get; set; } + public DbSet SurveyQuestionOptions { get; set; } + public DbSet SurveyResponses { get; set; } + public DbSet SurveyAnswers { get; set; } #endregion @@ -2023,5 +2028,82 @@ public class PlatformDbContext : .HasPrincipalKey(e => e.Id) .OnDelete(DeleteBehavior.Restrict); }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.Survey)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.Title).IsRequired().HasMaxLength(250); + b.Property(x => x.Description).HasMaxLength(2000); + b.Property(x => x.Deadline).IsRequired(); + b.Property(x => x.Responses).HasDefaultValue(0); + b.Property(x => x.Status).IsRequired().HasMaxLength(10); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.SurveyQuestion)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.QuestionText).IsRequired().HasMaxLength(1000); + b.Property(x => x.Type).IsRequired().HasMaxLength(50); + + b.HasOne(x => x.Survey) + .WithMany(x => x.Questions) + .HasForeignKey(x => x.SurveyId) + .OnDelete(DeleteBehavior.Cascade); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.SurveyQuestionOption)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.Text).IsRequired().HasMaxLength(500); + b.Property(x => x.Order).IsRequired(); + + b.HasOne(x => x.Question) + .WithMany(x => x.Options) + .HasForeignKey(x => x.QuestionId) + .OnDelete(DeleteBehavior.Cascade); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.SurveyResponse)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.SubmissionTime).IsRequired(); + + b.HasOne(x => x.Survey) + .WithMany(x => x.SurveyResponses) + .HasForeignKey(x => x.SurveyId) + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne(x => x.Employee) + .WithMany(x => x.SurveyResponses) + .HasForeignKey(x => x.EmployeeId) + .OnDelete(DeleteBehavior.Restrict); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.SurveyAnswer)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.QuestionType).IsRequired().HasMaxLength(50); + b.Property(x => x.Value).IsRequired(); + + b.HasOne(x => x.Response) + .WithMany(x => x.Answers) + .HasForeignKey(x => x.ResponseId) + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne(x => x.Question) + .WithMany() + .HasForeignKey(x => x.QuestionId) + .OnDelete(DeleteBehavior.Restrict); + }); } } diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251026200120_Initial.Designer.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251027142130_Initial.Designer.cs similarity index 96% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251026200120_Initial.Designer.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251027142130_Initial.Designer.cs index e09f49ec..a381a28f 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251026200120_Initial.Designer.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251027142130_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Kurs.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251026200120_Initial")] + [Migration("20251027142130_Initial")] partial class Initial { /// @@ -7930,6 +7930,317 @@ namespace Kurs.Platform.Migrations b.ToTable("T_Prt_Source", (string)null); }); + modelBuilder.Entity("Kurs.Platform.Entities.Survey", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("Deadline") + .HasColumnType("datetime2"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.Property("IsAnonymous") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Responses") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Status") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.HasKey("Id"); + + b.ToTable("T_Hr_Survey", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyAnswer", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("QuestionId") + .HasColumnType("uniqueidentifier"); + + b.Property("QuestionType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ResponseId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("QuestionId"); + + b.HasIndex("ResponseId"); + + b.ToTable("T_Hr_SurveyAnswer", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyQuestion", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsRequired") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("QuestionText") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("SurveyId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("SurveyId"); + + b.ToTable("T_Hr_SurveyQuestion", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyQuestionOption", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("QuestionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.HasKey("Id"); + + b.HasIndex("QuestionId"); + + b.ToTable("T_Hr_SurveyQuestionOption", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyResponse", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EmployeeId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("SubmissionTime") + .HasColumnType("datetime2"); + + b.Property("SurveyId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("SurveyId"); + + b.ToTable("T_Hr_SurveyResponse", (string)null); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Template360", b => { b.Property("Id") @@ -11322,6 +11633,65 @@ namespace Kurs.Platform.Migrations b.Navigation("SkillType"); }); + modelBuilder.Entity("Kurs.Platform.Entities.SurveyAnswer", b => + { + b.HasOne("Kurs.Platform.Entities.SurveyQuestion", "Question") + .WithMany() + .HasForeignKey("QuestionId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Kurs.Platform.Entities.SurveyResponse", "Response") + .WithMany("Answers") + .HasForeignKey("ResponseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Question"); + + b.Navigation("Response"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyQuestion", b => + { + b.HasOne("Kurs.Platform.Entities.Survey", "Survey") + .WithMany("Questions") + .HasForeignKey("SurveyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Survey"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyQuestionOption", b => + { + b.HasOne("Kurs.Platform.Entities.SurveyQuestion", "Question") + .WithMany("Options") + .HasForeignKey("QuestionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Question"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyResponse", b => + { + b.HasOne("Kurs.Platform.Entities.Employee", "Employee") + .WithMany("SurveyResponses") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Kurs.Platform.Entities.Survey", "Survey") + .WithMany("SurveyResponses") + .HasForeignKey("SurveyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Survey"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Uom", b => { b.HasOne("Kurs.Platform.Entities.UomCategory", "UomCategory") @@ -11596,6 +11966,8 @@ namespace Kurs.Platform.Migrations b.Navigation("Reservations"); + b.Navigation("SurveyResponses"); + b.Navigation("Visitors"); }); @@ -11667,6 +12039,23 @@ namespace Kurs.Platform.Migrations b.Navigation("Skills"); }); + modelBuilder.Entity("Kurs.Platform.Entities.Survey", b => + { + b.Navigation("Questions"); + + b.Navigation("SurveyResponses"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyQuestion", b => + { + b.Navigation("Options"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyResponse", b => + { + b.Navigation("Answers"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Template360", b => { b.Navigation("Performans360s"); diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251026200120_Initial.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251027142130_Initial.cs similarity index 96% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251026200120_Initial.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251027142130_Initial.cs index a226473a..b82127cb 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251026200120_Initial.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251027142130_Initial.cs @@ -1789,6 +1789,31 @@ namespace Kurs.Platform.Migrations table.PrimaryKey("PK_T_Hr_Payroll", x => x.Id); }); + migrationBuilder.CreateTable( + name: "T_Hr_Survey", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Title = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Description = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + Deadline = table.Column(type: "datetime2", nullable: false), + Responses = table.Column(type: "int", nullable: false, defaultValue: 0), + Status = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: false), + IsAnonymous = table.Column(type: "bit", nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Hr_Survey", x => x.Id); + }); + migrationBuilder.CreateTable( name: "T_Hr_Template360", columns: table => new @@ -3283,6 +3308,36 @@ namespace Kurs.Platform.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "T_Hr_SurveyQuestion", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + SurveyId = table.Column(type: "uniqueidentifier", nullable: false), + QuestionText = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: false), + Type = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Order = table.Column(type: "int", nullable: false), + IsRequired = table.Column(type: "bit", nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Hr_SurveyQuestion", x => x.Id); + table.ForeignKey( + name: "FK_T_Hr_SurveyQuestion_T_Hr_Survey_SurveyId", + column: x => x.SurveyId, + principalTable: "T_Hr_Survey", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "T_Net_Event", columns: table => new @@ -3723,6 +3778,34 @@ namespace Kurs.Platform.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "T_Hr_SurveyQuestionOption", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + QuestionId = table.Column(type: "uniqueidentifier", nullable: false), + Text = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false), + Order = table.Column(type: "int", nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Hr_SurveyQuestionOption", x => x.Id); + table.ForeignKey( + name: "FK_T_Hr_SurveyQuestionOption_T_Hr_SurveyQuestion_QuestionId", + column: x => x.QuestionId, + principalTable: "T_Hr_SurveyQuestion", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "T_Adm_EventComment", columns: table => new @@ -4241,6 +4324,40 @@ namespace Kurs.Platform.Migrations onDelete: ReferentialAction.Restrict); }); + migrationBuilder.CreateTable( + name: "T_Hr_SurveyResponse", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + SurveyId = table.Column(type: "uniqueidentifier", nullable: false), + EmployeeId = table.Column(type: "uniqueidentifier", nullable: true), + SubmissionTime = table.Column(type: "datetime2", nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Hr_SurveyResponse", x => x.Id); + table.ForeignKey( + name: "FK_T_Hr_SurveyResponse_T_Hr_Employee_EmployeeId", + column: x => x.EmployeeId, + principalTable: "T_Hr_Employee", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_T_Hr_SurveyResponse_T_Hr_Survey_SurveyId", + column: x => x.SurveyId, + principalTable: "T_Hr_Survey", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "T_Net_Announcement", columns: table => new @@ -4384,6 +4501,41 @@ namespace Kurs.Platform.Migrations onDelete: ReferentialAction.Restrict); }); + migrationBuilder.CreateTable( + name: "T_Hr_SurveyAnswer", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ResponseId = table.Column(type: "uniqueidentifier", nullable: false), + QuestionId = table.Column(type: "uniqueidentifier", nullable: false), + QuestionType = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Value = table.Column(type: "nvarchar(max)", nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Hr_SurveyAnswer", x => x.Id); + table.ForeignKey( + name: "FK_T_Hr_SurveyAnswer_T_Hr_SurveyQuestion_QuestionId", + column: x => x.QuestionId, + principalTable: "T_Hr_SurveyQuestion", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_T_Hr_SurveyAnswer_T_Hr_SurveyResponse_ResponseId", + column: x => x.ResponseId, + principalTable: "T_Hr_SurveyResponse", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateIndex( name: "IX_AbpAuditLogActions_AuditLogId", table: "AbpAuditLogActions", @@ -5043,6 +5195,36 @@ namespace Kurs.Platform.Migrations table: "T_Hr_Performance360", column: "TemplateId"); + migrationBuilder.CreateIndex( + name: "IX_T_Hr_SurveyAnswer_QuestionId", + table: "T_Hr_SurveyAnswer", + column: "QuestionId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Hr_SurveyAnswer_ResponseId", + table: "T_Hr_SurveyAnswer", + column: "ResponseId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Hr_SurveyQuestion_SurveyId", + table: "T_Hr_SurveyQuestion", + column: "SurveyId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Hr_SurveyQuestionOption_QuestionId", + table: "T_Hr_SurveyQuestionOption", + column: "QuestionId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Hr_SurveyResponse_EmployeeId", + table: "T_Hr_SurveyResponse", + column: "EmployeeId"); + + migrationBuilder.CreateIndex( + name: "IX_T_Hr_SurveyResponse_SurveyId", + table: "T_Hr_SurveyResponse", + column: "SurveyId"); + migrationBuilder.CreateIndex( name: "IX_T_Net_Announcement_EmployeeId", table: "T_Net_Announcement", @@ -5415,6 +5597,12 @@ namespace Kurs.Platform.Migrations migrationBuilder.DropTable( name: "T_Hr_Performance360"); + migrationBuilder.DropTable( + name: "T_Hr_SurveyAnswer"); + + migrationBuilder.DropTable( + name: "T_Hr_SurveyQuestionOption"); + migrationBuilder.DropTable( name: "T_Net_Announcement"); @@ -5559,6 +5747,12 @@ namespace Kurs.Platform.Migrations migrationBuilder.DropTable( name: "T_Hr_Template360"); + migrationBuilder.DropTable( + name: "T_Hr_SurveyResponse"); + + migrationBuilder.DropTable( + name: "T_Hr_SurveyQuestion"); + migrationBuilder.DropTable( name: "T_Net_Training"); @@ -5598,6 +5792,9 @@ namespace Kurs.Platform.Migrations migrationBuilder.DropTable( name: "T_Crd_QuestionPool"); + migrationBuilder.DropTable( + name: "T_Hr_Survey"); + migrationBuilder.DropTable( name: "T_Sas_ReportCategory"); diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index 5e6ce1b8..2d5b53e2 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -7927,6 +7927,317 @@ namespace Kurs.Platform.Migrations b.ToTable("T_Prt_Source", (string)null); }); + modelBuilder.Entity("Kurs.Platform.Entities.Survey", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("Deadline") + .HasColumnType("datetime2"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.Property("IsAnonymous") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Responses") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Status") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.HasKey("Id"); + + b.ToTable("T_Hr_Survey", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyAnswer", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("QuestionId") + .HasColumnType("uniqueidentifier"); + + b.Property("QuestionType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ResponseId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("QuestionId"); + + b.HasIndex("ResponseId"); + + b.ToTable("T_Hr_SurveyAnswer", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyQuestion", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsRequired") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("QuestionText") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("SurveyId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("SurveyId"); + + b.ToTable("T_Hr_SurveyQuestion", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyQuestionOption", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("QuestionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.HasKey("Id"); + + b.HasIndex("QuestionId"); + + b.ToTable("T_Hr_SurveyQuestionOption", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyResponse", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EmployeeId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("SubmissionTime") + .HasColumnType("datetime2"); + + b.Property("SurveyId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("SurveyId"); + + b.ToTable("T_Hr_SurveyResponse", (string)null); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Template360", b => { b.Property("Id") @@ -11319,6 +11630,65 @@ namespace Kurs.Platform.Migrations b.Navigation("SkillType"); }); + modelBuilder.Entity("Kurs.Platform.Entities.SurveyAnswer", b => + { + b.HasOne("Kurs.Platform.Entities.SurveyQuestion", "Question") + .WithMany() + .HasForeignKey("QuestionId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Kurs.Platform.Entities.SurveyResponse", "Response") + .WithMany("Answers") + .HasForeignKey("ResponseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Question"); + + b.Navigation("Response"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyQuestion", b => + { + b.HasOne("Kurs.Platform.Entities.Survey", "Survey") + .WithMany("Questions") + .HasForeignKey("SurveyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Survey"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyQuestionOption", b => + { + b.HasOne("Kurs.Platform.Entities.SurveyQuestion", "Question") + .WithMany("Options") + .HasForeignKey("QuestionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Question"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyResponse", b => + { + b.HasOne("Kurs.Platform.Entities.Employee", "Employee") + .WithMany("SurveyResponses") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Kurs.Platform.Entities.Survey", "Survey") + .WithMany("SurveyResponses") + .HasForeignKey("SurveyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Survey"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Uom", b => { b.HasOne("Kurs.Platform.Entities.UomCategory", "UomCategory") @@ -11593,6 +11963,8 @@ namespace Kurs.Platform.Migrations b.Navigation("Reservations"); + b.Navigation("SurveyResponses"); + b.Navigation("Visitors"); }); @@ -11664,6 +12036,23 @@ namespace Kurs.Platform.Migrations b.Navigation("Skills"); }); + modelBuilder.Entity("Kurs.Platform.Entities.Survey", b => + { + b.Navigation("Questions"); + + b.Navigation("SurveyResponses"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyQuestion", b => + { + b.Navigation("Options"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.SurveyResponse", b => + { + b.Navigation("Answers"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Template360", b => { b.Navigation("Performans360s"); diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json index 260a39c6..69cdda8b 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json @@ -3709,5 +3709,170 @@ "approverCode": "EMP-005", "approvalDate": "05-10-2024" } + ], + "Surveys": [ + { + "Title": "Çalışan Memnuniyet Anketi 2024", + "Description": "Yıllık çalışan memnuniyeti ve bağlılık araştırması", + "Deadline": "2024-10-31T00:00:00", + "Responses": 45, + "Status": "active", + "IsAnonymous": true + }, + { + "Title": "Eğitim İhtiyaç Analizi", + "Description": "2025 yılı eğitim planlaması için ihtiyaç tespiti", + "Deadline": "2024-11-15T00:00:00", + "Responses": 28, + "Status": "active", + "IsAnonymous": false + }, + { + "Title": "Kafeterya Memnuniyet Anketi", + "Description": "Yemek kalitesi ve servis değerlendirmesi", + "Deadline": "2024-09-30T00:00:00", + "Responses": 62, + "Status": "closed", + "IsAnonymous": true + } + ], + "SurveyQuestions": [ + { + "SurveyTitle": "Çalışan Memnuniyet Anketi 2024", + "QuestionText": "Genel memnuniyet düzeyiniz nedir?", + "Type": "rating", + "Order": 1, + "IsRequired": true + }, + { + "SurveyTitle": "Çalışan Memnuniyet Anketi 2024", + "QuestionText": "Hangi departmanda çalışıyorsunuz?", + "Type": "multiple-choice", + "Order": 2, + "IsRequired": true + }, + { + "SurveyTitle": "Çalışan Memnuniyet Anketi 2024", + "QuestionText": "Görüş ve önerileriniz", + "Type": "textarea", + "Order": 3, + "IsRequired": false + }, + { + "SurveyTitle": "Çalışan Memnuniyet Anketi 2024", + "QuestionText": "Çalışma ortamından memnun musunuz?", + "Type": "yes-no", + "Order": 4, + "IsRequired": true + }, + { + "SurveyTitle": "Eğitim İhtiyaç Analizi", + "QuestionText": "Hangi teknoloji konularında eğitim almak istiyorsunuz?", + "Type": "multiple-choice", + "Order": 1, + "IsRequired": true + }, + { + "SurveyTitle": "Eğitim İhtiyaç Analizi", + "QuestionText": "Eğitim formatı tercihiniz nedir?", + "Type": "multiple-choice", + "Order": 2, + "IsRequired": true + }, + { + "SurveyTitle": "Eğitim İhtiyaç Analizi", + "QuestionText": "Eğitim için haftalık ne kadar zaman ayırabilirsiniz?", + "Type": "rating", + "Order": 3, + "IsRequired": true + }, + { + "SurveyTitle": "Kafeterya Memnuniyet Anketi", + "QuestionText": "Yemek kalitesini nasıl değerlendiriyorsunuz?", + "Type": "rating", + "Order": 1, + "IsRequired": true + }, + { + "SurveyTitle": "Kafeterya Memnuniyet Anketi", + "QuestionText": "Hangi yemekleri daha sık görmek istiyorsunuz?", + "Type": "textarea", + "Order": 2, + "IsRequired": false + }, + { + "SurveyTitle": "Kafeterya Memnuniyet Anketi", + "QuestionText": "Servis hızından memnun musunuz?", + "Type": "yes-no", + "Order": 3, + "IsRequired": true + } + ], + "SurveyQuestionOptions": [ + { + "QuestionText": "Hangi departmanda çalışıyorsunuz?", + "Text": "Bilgi Teknolojileri", + "Order": 1 + }, + { + "QuestionText": "Hangi departmanda çalışıyorsunuz?", + "Text": "İnsan Kaynakları", + "Order": 2 + }, + { + "QuestionText": "Hangi departmanda çalışıyorsunuz?", + "Text": "Finans", + "Order": 3 + }, + { + "QuestionText": "Hangi departmanda çalışıyorsunuz?", + "Text": "Satış", + "Order": 4 + }, + { + "QuestionText": "Hangi departmanda çalışıyorsunuz?", + "Text": "Pazarlama", + "Order": 5 + }, + { + "QuestionText": "Hangi teknoloji konularında eğitim almak istiyorsunuz?", + "Text": "React / Frontend", + "Order": 1 + }, + { + "QuestionText": "Hangi teknoloji konularında eğitim almak istiyorsunuz?", + "Text": "Node.js / Backend", + "Order": 2 + }, + { + "QuestionText": "Hangi teknoloji konularında eğitim almak istiyorsunuz?", + "Text": "Database / SQL", + "Order": 3 + }, + { + "QuestionText": "Hangi teknoloji konularında eğitim almak istiyorsunuz?", + "Text": "DevOps / Cloud", + "Order": 4 + }, + { + "QuestionText": "Hangi teknoloji konularında eğitim almak istiyorsunuz?", + "Text": "Mobile Development", + "Order": 5 + }, + { + "QuestionText": "Eğitim formatı tercihiniz nedir?", + "Text": "Online Eğitim", + "Order": 1 + }, + { + "QuestionText": "Eğitim formatı tercihiniz nedir?", + "Text": "Yüz Yüze Eğitim", + "Order": 2 + }, + { + "QuestionText": "Eğitim formatı tercihiniz nedir?", + "Text": "Hibrit (Karma)", + "Order": 3 + } ] } \ No newline at end of file diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs index 6ffca2ab..e00637e3 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs @@ -80,6 +80,9 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency private readonly IRepository _announcementRepository; private readonly IRepository _visitorRepository; private readonly IRepository _expenseRepository; + private readonly IRepository _surveyRepository; + private readonly IRepository _surveyQuestionRepository; + private readonly IRepository _surveyQuestionOptionRepository; public TenantDataSeeder( IRepository repositoryUser, @@ -142,7 +145,10 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IRepository shuttleRouteRepository, IRepository announcementRepository, IRepository visitorRepository, - IRepository expenseRepository + IRepository expenseRepository, + IRepository surveyRepository, + IRepository surveyQuestionRepository, + IRepository surveyQuestionOptionRepository ) { _repositoryUser = repositoryUser; @@ -206,6 +212,10 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency _announcementRepository = announcementRepository; _visitorRepository = visitorRepository; _expenseRepository = expenseRepository; + _expenseRepository = expenseRepository; + _surveyRepository = surveyRepository; + _surveyQuestionRepository = surveyQuestionRepository; + _surveyQuestionOptionRepository = surveyQuestionOptionRepository; } private static IConfigurationRoot BuildConfiguration() @@ -1290,7 +1300,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency }); } - foreach (var item in items.Visitors) { var exists = await _visitorRepository.AnyAsync(x => x.FullName == item.FullName); @@ -1336,5 +1345,57 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency ApprovalDate = item.ApprovalDate }); } + + foreach (var item in items.Surveys) + { + var exists = await _surveyRepository.AnyAsync(x => x.Title == item.Title); + if (exists) + continue; + + await _surveyRepository.InsertAsync(new Survey + { + Title = item.Title, + Description = item.Description, + Deadline = item.Deadline, + Responses = item.Responses, + Status = item.Status, + IsAnonymous = item.IsAnonymous + }, autoSave: true); + } + + foreach (var item in items.SurveyQuestions) + { + var exists = await _surveyQuestionRepository.AnyAsync(x => x.QuestionText == item.QuestionText); + if (exists) + continue; + + var survey = await _surveyRepository.FirstOrDefaultAsync(x => x.Title == item.SurveyTitle); + await _surveyQuestionRepository.InsertAsync(new SurveyQuestion + { + SurveyId = survey != null ? survey.Id : Guid.Empty, + QuestionText = item.QuestionText, + Type = item.Type, + Order = item.Order, + IsRequired = item.IsRequired + }, autoSave: true); + } + + foreach (var item in items.SurveyQuestionOptions) + { + var surveyQuestion = await _surveyQuestionRepository.FirstOrDefaultAsync(x => x.QuestionText == item.QuestionText); + if (surveyQuestion == null) + continue; + + var exists = await _surveyQuestionOptionRepository.AnyAsync(x => x.QuestionId == surveyQuestion.Id && x.Text == item.Text); + if (exists) + continue; + + await _surveyQuestionOptionRepository.InsertAsync(new SurveyQuestionOption + { + QuestionId = surveyQuestion.Id, + Text = item.Text, + Order = item.Order + }, autoSave: true); + } } } diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs index 942f36c3..ce172e19 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs @@ -68,6 +68,35 @@ public class TenantSeederDto public List Announcements { get; set; } public List Visitors { get; set; } public List ExpenseRequests { get; set; } + public List Surveys { get; set; } + public List SurveyQuestions { get; set; } + public List SurveyQuestionOptions { get; set; } +} + +public class SurveySeedDto +{ + public string Title { get; set; } + public string Description { get; set; } + public DateTime Deadline { get; set; } + public int Responses { get; set; } + public string Status { get; set; } + public bool IsAnonymous { get; set; } +} + +public class SurveyQuestionSeedDto +{ + public string QuestionText { get; set; } + public string SurveyTitle { get; set; } + public string Type { get; set; } + public int Order { get; set; } + public bool IsRequired { get; set; } +} + +public class SurveyQuestionOptionSeedDto +{ + public string QuestionText { get; set; } + public string Text { get; set; } + public int Order { get; set; } } public class ExpenseRequestSeedDto diff --git a/ui/src/mocks/mockIntranet.ts b/ui/src/mocks/mockIntranet.ts index aa1c6eb2..d3acf368 100644 --- a/ui/src/mocks/mockIntranet.ts +++ b/ui/src/mocks/mockIntranet.ts @@ -14,181 +14,6 @@ import { SocialPost, } from '@/types/intranet' -export const mockSurveys: Survey[] = [ - { - id: 'survey1', - title: 'Çalışan Memnuniyet Anketi 2024', - description: 'Yıllık çalışan memnuniyeti ve bağlılık araştırması', - creatorId: mockEmployees[0], - creationTime: new Date('2024-10-01'), - deadline: new Date('2024-10-31'), - questions: [ - { - id: 'q1', - surveyId: 'survey1', - questionText: 'Genel memnuniyet düzeyiniz nedir?', - type: 'rating', - order: 1, - isRequired: true, - ratingConfig: { - min: 1, - max: 5, - labels: { - 1: 'Çok Kötü', - 2: 'Kötü', - 3: 'Orta', - 4: 'İyi', - 5: 'Çok İyi', - }, - }, - }, - { - id: 'q2', - surveyId: 'survey1', - questionText: 'Hangi departmanda çalışıyorsunuz?', - type: 'multiple-choice', - order: 2, - isRequired: true, - options: [ - { id: 'opt1', text: 'Bilgi Teknolojileri', order: 1 }, - { id: 'opt2', text: 'İnsan Kaynakları', order: 2 }, - { id: 'opt3', text: 'Finans', order: 3 }, - { id: 'opt4', text: 'Satış', order: 4 }, - { id: 'opt5', text: 'Pazarlama', order: 5 }, - ], - }, - { - id: 'q3', - surveyId: 'survey1', - questionText: 'Görüş ve önerileriniz', - type: 'textarea', - order: 3, - isRequired: false, - }, - { - id: 'q4', - surveyId: 'survey1', - questionText: 'Çalışma ortamından memnun musunuz?', - type: 'yes-no', - order: 4, - isRequired: true, - }, - ], - responses: 45, - targetAudience: ['Tüm Çalışanlar'], - status: 'active', - isAnonymous: true, - }, - { - id: 'survey2', - title: 'Eğitim İhtiyaç Analizi', - description: '2025 yılı eğitim planlaması için ihtiyaç tespiti', - creatorId: mockEmployees[2], - creationTime: new Date('2024-10-10'), - deadline: new Date('2024-11-15'), - questions: [ - { - id: 'q5', - surveyId: 'survey2', - questionText: 'Hangi teknoloji konularında eğitim almak istiyorsunuz?', - type: 'multiple-choice', - order: 1, - isRequired: true, - options: [ - { id: 'opt6', text: 'React / Frontend', order: 1 }, - { id: 'opt7', text: 'Node.js / Backend', order: 2 }, - { id: 'opt8', text: 'Database / SQL', order: 3 }, - { id: 'opt9', text: 'DevOps / Cloud', order: 4 }, - { id: 'opt10', text: 'Mobile Development', order: 5 }, - ], - }, - { - id: 'q6', - surveyId: 'survey2', - questionText: 'Eğitim formatı tercihiniz nedir?', - type: 'multiple-choice', - order: 2, - isRequired: true, - options: [ - { id: 'opt11', text: 'Online Eğitim', order: 1 }, - { id: 'opt12', text: 'Yüz Yüze Eğitim', order: 2 }, - { id: 'opt13', text: 'Hibrit (Karma)', order: 3 }, - ], - }, - { - id: 'q7', - surveyId: 'survey2', - questionText: 'Eğitim için haftalık ne kadar zaman ayırabilirsiniz?', - type: 'rating', - order: 3, - isRequired: true, - ratingConfig: { - min: 1, - max: 10, - labels: { - 1: '1 saat', - 5: '5 saat', - 10: '10+ saat', - }, - }, - }, - ], - responses: 28, - targetAudience: ['Yazılım Geliştirme', 'Ürün Yönetimi'], - status: 'active', - isAnonymous: false, - }, - { - id: 'survey3', - title: 'Kafeterya Memnuniyet Anketi', - description: 'Yemek kalitesi ve servis değerlendirmesi', - creatorId: mockEmployees[4], - creationTime: new Date('2024-09-15'), - deadline: new Date('2024-09-30'), - questions: [ - { - id: 'q8', - surveyId: 'survey3', - questionText: 'Yemek kalitesini nasıl değerlendiriyorsunuz?', - type: 'rating', - order: 1, - isRequired: true, - ratingConfig: { - min: 1, - max: 5, - labels: { - 1: 'Çok Kötü', - 2: 'Kötü', - 3: 'Orta', - 4: 'İyi', - 5: 'Mükemmel', - }, - }, - }, - { - id: 'q9', - surveyId: 'survey3', - questionText: 'Hangi yemekleri daha sık görmek istiyorsunuz?', - type: 'textarea', - order: 2, - isRequired: false, - }, - { - id: 'q10', - surveyId: 'survey3', - questionText: 'Servis hızından memnun musunuz?', - type: 'yes-no', - order: 3, - isRequired: true, - }, - ], - responses: 62, - targetAudience: ['Tüm Çalışanlar'], - status: 'closed', - isAnonymous: true, - }, -] - export const mockSocialPosts: SocialPost[] = [ { id: '1', @@ -1065,4 +890,179 @@ export const mockDocuments: Document[] = [ downloadCount: 89, tags: ['development', 'standards', 'coding'], }, -] \ No newline at end of file +] + +export const mockSurveys: Survey[] = [ + { + id: 'survey1', + title: 'Çalışan Memnuniyet Anketi 2024', + description: 'Yıllık çalışan memnuniyeti ve bağlılık araştırması', + creatorId: mockEmployees[0], + creationTime: new Date('2024-10-01'), + deadline: new Date('2024-10-31'), + questions: [ + { + id: 'q1', + surveyId: 'survey1', + questionText: 'Genel memnuniyet düzeyiniz nedir?', + type: 'rating', + order: 1, + isRequired: true, + ratingConfig: { + min: 1, + max: 5, + labels: { + 1: 'Çok Kötü', + 2: 'Kötü', + 3: 'Orta', + 4: 'İyi', + 5: 'Çok İyi', + }, + }, + }, + { + id: 'q2', + surveyId: 'survey1', + questionText: 'Hangi departmanda çalışıyorsunuz?', + type: 'multiple-choice', + order: 2, + isRequired: true, + options: [ + { id: 'opt1', text: 'Bilgi Teknolojileri', order: 1 }, + { id: 'opt2', text: 'İnsan Kaynakları', order: 2 }, + { id: 'opt3', text: 'Finans', order: 3 }, + { id: 'opt4', text: 'Satış', order: 4 }, + { id: 'opt5', text: 'Pazarlama', order: 5 }, + ], + }, + { + id: 'q3', + surveyId: 'survey1', + questionText: 'Görüş ve önerileriniz', + type: 'textarea', + order: 3, + isRequired: false, + }, + { + id: 'q4', + surveyId: 'survey1', + questionText: 'Çalışma ortamından memnun musunuz?', + type: 'yes-no', + order: 4, + isRequired: true, + }, + ], + responses: 45, + targetAudience: ['Tüm Çalışanlar'], + status: 'active', + isAnonymous: true, + }, + { + id: 'survey2', + title: 'Eğitim İhtiyaç Analizi', + description: '2025 yılı eğitim planlaması için ihtiyaç tespiti', + creatorId: mockEmployees[2], + creationTime: new Date('2024-10-10'), + deadline: new Date('2024-11-15'), + questions: [ + { + id: 'q5', + surveyId: 'survey2', + questionText: 'Hangi teknoloji konularında eğitim almak istiyorsunuz?', + type: 'multiple-choice', + order: 1, + isRequired: true, + options: [ + { id: 'opt6', text: 'React / Frontend', order: 1 }, + { id: 'opt7', text: 'Node.js / Backend', order: 2 }, + { id: 'opt8', text: 'Database / SQL', order: 3 }, + { id: 'opt9', text: 'DevOps / Cloud', order: 4 }, + { id: 'opt10', text: 'Mobile Development', order: 5 }, + ], + }, + { + id: 'q6', + surveyId: 'survey2', + questionText: 'Eğitim formatı tercihiniz nedir?', + type: 'multiple-choice', + order: 2, + isRequired: true, + options: [ + { id: 'opt11', text: 'Online Eğitim', order: 1 }, + { id: 'opt12', text: 'Yüz Yüze Eğitim', order: 2 }, + { id: 'opt13', text: 'Hibrit (Karma)', order: 3 }, + ], + }, + { + id: 'q7', + surveyId: 'survey2', + questionText: 'Eğitim için haftalık ne kadar zaman ayırabilirsiniz?', + type: 'rating', + order: 3, + isRequired: true, + ratingConfig: { + min: 1, + max: 10, + labels: { + 1: '1 saat', + 5: '5 saat', + 10: '10+ saat', + }, + }, + }, + ], + responses: 28, + targetAudience: ['Yazılım Geliştirme', 'Ürün Yönetimi'], + status: 'active', + isAnonymous: false, + }, + { + id: 'survey3', + title: 'Kafeterya Memnuniyet Anketi', + description: 'Yemek kalitesi ve servis değerlendirmesi', + creatorId: mockEmployees[4], + creationTime: new Date('2024-09-15'), + deadline: new Date('2024-09-30'), + questions: [ + { + id: 'q8', + surveyId: 'survey3', + questionText: 'Yemek kalitesini nasıl değerlendiriyorsunuz?', + type: 'rating', + order: 1, + isRequired: true, + ratingConfig: { + min: 1, + max: 5, + labels: { + 1: 'Çok Kötü', + 2: 'Kötü', + 3: 'Orta', + 4: 'İyi', + 5: 'Mükemmel', + }, + }, + }, + { + id: 'q9', + surveyId: 'survey3', + questionText: 'Hangi yemekleri daha sık görmek istiyorsunuz?', + type: 'textarea', + order: 2, + isRequired: false, + }, + { + id: 'q10', + surveyId: 'survey3', + questionText: 'Servis hızından memnun musunuz?', + type: 'yes-no', + order: 3, + isRequired: true, + }, + ], + responses: 62, + targetAudience: ['Tüm Çalışanlar'], + status: 'closed', + isAnonymous: true, + }, +] diff --git a/ui/src/types/intranet.ts b/ui/src/types/intranet.ts index c23e7b66..156a2102 100644 --- a/ui/src/types/intranet.ts +++ b/ui/src/types/intranet.ts @@ -161,6 +161,21 @@ export interface ShuttleRoute { type: 'morning' | 'evening' } +// Anket +export interface Survey { + id: string + title: string + description: string + creatorId: HrEmployee + creationTime: Date + deadline: Date + questions: SurveyQuestion[] + responses: number + targetAudience: string[] + status: 'draft' | 'active' | 'closed' + isAnonymous: boolean +} + // Anket Sorusu export interface SurveyQuestion { id: string @@ -184,21 +199,6 @@ export interface SurveyQuestionOption { order: number } -// Anket -export interface Survey { - id: string - title: string - description: string - creatorId: HrEmployee - creationTime: Date - deadline: Date - questions: SurveyQuestion[] - responses: number - targetAudience: string[] - status: 'draft' | 'active' | 'closed' - isAnonymous: boolean -} - // Anket Cevabı export interface SurveyResponse { id: string diff --git a/ui/src/views/intranet/Dashboard.tsx b/ui/src/views/intranet/Dashboard.tsx index a892cbf3..87195961 100644 --- a/ui/src/views/intranet/Dashboard.tsx +++ b/ui/src/views/intranet/Dashboard.tsx @@ -98,7 +98,9 @@ const IntranetDashboard: React.FC = () => { {checkPermission('App.Intranet.Reservation.Widget') && ( setShowReservationModal(true)} /> )} - + {checkPermission('App.Intranet.Survey.Widget') && ( + + )} {checkPermission('App.Intranet.Visitor.Widget') && } {checkPermission('App.Hr.Expense.Widget') && ( setShowExpenseModal(true)} />