From eb303b975d851b184bc16297d45a6816230d7cc1 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 14 Apr 2025 10:15:45 +0200 Subject: [PATCH] ModuleAiEnabled bei MandatorSetting String + CustomerNavigation --- BeWo/AI/AiChatController.cs | 1 + BeWo/BeWo.csproj | 3 +- BeWo/BeWoApp.xaml.cs | 9 ++ BeWo/MainControl.xaml.cs | 6 +- .../GeneratedOperationsEnhancedService.cs | 6 +- BeWo/Styles/ControlStyles/ButtonStyles.xaml | 83 +++++++++++++++++++ .../GkvAbrechnungDetailControl.xaml.cs | 1 + BeWo/View/Controls/TextViewer.xaml | 43 ++++++---- .../Accounting/GkvAbrechnungOverview.xaml.cs | 1 + BeWo/View/Detail/CustomerView.xaml | 2 +- BeWo/View/Detail/SupportConceptView.xaml.cs | 1 + .../Zeiterfassung/ServiceRecordView2.xaml | 7 +- .../Zeiterfassung/ServiceRecordView2.xaml.cs | 13 +-- BeWo/View/Document/DokumentViewHelper.cs | 1 + .../Navigation/CustomerNavigationView.xaml | 1 + .../Navigation/CustomerNavigationView.xaml.cs | 53 +++++++++++- .../CustomerTeamNavigationView.xaml | 39 ++++----- .../Navigation/EmployeeNavigationView.xaml | 72 +++++++++------- BeWo/View/Navigation/MainNavigationView.xaml | 21 +++++ .../Navigation/MainNavigationView.xaml.cs | 29 ++++++- .../SupportConceptNavigationView.xaml.cs | 1 + BeWo/View/Windows/AiWindowBuilder.cs | 48 +++++++++++ BeWo/View/{ => Windows}/BeWoWindowBuilder.cs | 18 +--- .../ListViewModel/AiConversationListVM.cs | 10 ++- .../ListViewModel/ServiceRecordListVM.cs | 19 +++-- Data/Entities/BeWoEntityReference.cs | 5 +- Data/Mappings/AiConversation.hbm.xml | 2 +- Model/Changes_2025_04_01 AI Feature.txt | 4 +- .../AiConversationDC_AiConversation.cs | 45 +++++++++- .../IOperationsEnhancedService.cs | 3 +- .../OperationsEnhancedServiceImp.cs | 12 +-- Service/ServiceUtils/AiSystemBuilder.cs | 82 +++++++++--------- Shared/Core/SettingsKeys.cs | 6 +- .../Feature/AI/AiConversationDC.cs | 2 +- 34 files changed, 481 insertions(+), 168 deletions(-) create mode 100644 BeWo/View/Windows/AiWindowBuilder.cs rename BeWo/View/{ => Windows}/BeWoWindowBuilder.cs (86%) diff --git a/BeWo/AI/AiChatController.cs b/BeWo/AI/AiChatController.cs index 616133547..437ac29a5 100644 --- a/BeWo/AI/AiChatController.cs +++ b/BeWo/AI/AiChatController.cs @@ -1,5 +1,6 @@ using BeWo.AI.View; using BeWo.View; +using BeWo.View.Windows; using BS.Shared; using BS.Shared.Translation; using System; diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index b01b12908..07e99f71a 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -103,6 +103,7 @@ AiConversationChatModalPopup.xaml + AnimatedBeWoWindow.xaml @@ -1427,7 +1428,7 @@ HilfeplanImportView.xaml - + DPCtrlEmployeeContractTooltip.xaml diff --git a/BeWo/BeWoApp.xaml.cs b/BeWo/BeWoApp.xaml.cs index 1528be858..d8aebf4f4 100644 --- a/BeWo/BeWoApp.xaml.cs +++ b/BeWo/BeWoApp.xaml.cs @@ -544,6 +544,8 @@ namespace BeWo val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, SettingsKeys.DontUpdateApprovalPeriodDates); AppSettings.DontUpdateApprovalPeriodDates = val != null && val.Equals("1"); + // REFACTOR: getUserSetting verwenden? + AppSettings.ModuleAiEnabled = getUserSetting(SettingsKeys.ModuleAiEnabled); switch (_Mandator.BeWoClientType) { @@ -661,6 +663,13 @@ namespace BeWo } } + private static bool getUserSetting(string key) + { + var val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, key); + var allowed = val != null && val.Equals("1"); + return allowed; + } + internal static Uri SiteOfOrigin { get diff --git a/BeWo/MainControl.xaml.cs b/BeWo/MainControl.xaml.cs index 27cd6d357..761f15d7a 100644 --- a/BeWo/MainControl.xaml.cs +++ b/BeWo/MainControl.xaml.cs @@ -58,7 +58,11 @@ namespace BeWo Administration = 16, AiConversation = 17, AiConversationPopup = 18, - ServiceRecord = 19 + // Nur für AI Conversation Zuweisung + ServiceRecord = 19, + CustomerSingle = 20, + PersonSingle = 21, + EmployeeSingle = 22, } public partial class MainControl diff --git a/BeWo/ServiceProxy/GeneratedOperationsEnhancedService.cs b/BeWo/ServiceProxy/GeneratedOperationsEnhancedService.cs index dd57c326e..4967b28de 100644 --- a/BeWo/ServiceProxy/GeneratedOperationsEnhancedService.cs +++ b/BeWo/ServiceProxy/GeneratedOperationsEnhancedService.cs @@ -33,7 +33,7 @@ namespace BeWo.ServiceProxy [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/CreateAiConversation", ReplyAction="http://tempuri.org/IOperationsEnhancedService/CreateAiConversationResponse")] [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsEnhancedService/CreateAiConversationBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] - BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversation(int uicontext, long model, System.Collections.Generic.List> bewoobjects); + BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversation(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, long modell_oid); [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/SendNewMessage", ReplyAction="http://tempuri.org/IOperationsEnhancedService/SendNewMessageResponse")] [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsEnhancedService/SendNewMessageBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] @@ -94,9 +94,9 @@ namespace BeWo.ServiceProxy return base.Channel.GetAiConversations(uicontext); } - public BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversation(int uicontext, long model, System.Collections.Generic.List> bewoobjects) + public BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversation(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, long modell_oid) { - return base.Channel.CreateAiConversation(uicontext, model, bewoobjects); + return base.Channel.CreateAiConversation(conversation, modell_oid); } public System.Collections.Generic.List SendNewMessage(long conversation, string message) diff --git a/BeWo/Styles/ControlStyles/ButtonStyles.xaml b/BeWo/Styles/ControlStyles/ButtonStyles.xaml index 57075f413..d6641b5b1 100644 --- a/BeWo/Styles/ControlStyles/ButtonStyles.xaml +++ b/BeWo/Styles/ControlStyles/ButtonStyles.xaml @@ -231,4 +231,87 @@ + + + + \ No newline at end of file diff --git a/BeWo/View/Controls/GkvAbrechnungDetailControl.xaml.cs b/BeWo/View/Controls/GkvAbrechnungDetailControl.xaml.cs index d32f09161..8ed29012a 100644 --- a/BeWo/View/Controls/GkvAbrechnungDetailControl.xaml.cs +++ b/BeWo/View/Controls/GkvAbrechnungDetailControl.xaml.cs @@ -1,5 +1,6 @@ using BeWo.Core; using BeWo.ServiceProxy; +using BeWo.View.Windows; using BeWo.ViewModel; using BeWo.ViewModel.ListViewModel; using BS.Shared.DataContracts.GkvAbrechnung; diff --git a/BeWo/View/Controls/TextViewer.xaml b/BeWo/View/Controls/TextViewer.xaml index ec0ccf3b5..68f08ec7c 100644 --- a/BeWo/View/Controls/TextViewer.xaml +++ b/BeWo/View/Controls/TextViewer.xaml @@ -1,26 +1,39 @@ - + - + - - + + - - - - + + - diff --git a/BeWo/View/Detail/Zeiterfassung/ServiceRecordView2.xaml.cs b/BeWo/View/Detail/Zeiterfassung/ServiceRecordView2.xaml.cs index 539a6bbb0..d5e564ee9 100644 --- a/BeWo/View/Detail/Zeiterfassung/ServiceRecordView2.xaml.cs +++ b/BeWo/View/Detail/Zeiterfassung/ServiceRecordView2.xaml.cs @@ -53,6 +53,7 @@ using DependencyObject = System.Windows.DependencyObject; using BeWo.AI.View; using BeWo.AI; using BeWo.View.Detail.AI; +using BeWo.View.Windows; namespace BeWo.View.Detail.Zeiterfassung { @@ -5077,12 +5078,7 @@ namespace BeWo.View.Detail.Zeiterfassung var context = ViewModel.GetVisibleInformationReferences(records); - var control = new AiConversationChatView(); - - control.ViewModel.UIContext = (int)(UIContext.ServiceRecord); - control.ViewModel.ContextBeWoObjects = context; - - var window = BeWoWindowBuilder.GetAiConversationZeiterfassungWindow(context); + var window = BeWoWindowBuilder.AiWindowBuilder.GetAiConversationWindow(UIContext.ServiceRecord, context); window.Show(); } @@ -5092,10 +5088,7 @@ namespace BeWo.View.Detail.Zeiterfassung var context = ViewModel.GetVisibleInformationReferences(records); - var control = new AiConversationChatModalPopup(); - - control.ViewModel.UIContext = (int)(UIContext.ServiceRecord); - control.ViewModel.ContextBeWoObjects = context; + var control = BeWoWindowBuilder.AiWindowBuilder.GetAiConversationControl(UIContext.ServiceRecord, context); MainControl.ShowControlAsModalPopup(control); } diff --git a/BeWo/View/Document/DokumentViewHelper.cs b/BeWo/View/Document/DokumentViewHelper.cs index 0cfe3ab83..2536c8a9a 100644 --- a/BeWo/View/Document/DokumentViewHelper.cs +++ b/BeWo/View/Document/DokumentViewHelper.cs @@ -1,4 +1,5 @@ using BeWo.ServiceProxy; +using BeWo.View.Windows; using BeWo.ViewModel; using BS.Shared; using BS.Shared.DataContracts; diff --git a/BeWo/View/Navigation/CustomerNavigationView.xaml b/BeWo/View/Navigation/CustomerNavigationView.xaml index c7bd932f9..c57cf6fc9 100644 --- a/BeWo/View/Navigation/CustomerNavigationView.xaml +++ b/BeWo/View/Navigation/CustomerNavigationView.xaml @@ -5,6 +5,7 @@ xmlns:localNavView="clr-namespace:BeWo.View.Navigation" xmlns:localView="clr-namespace:BeWo.View" xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup" + x:Name="root_view" Loaded="OnLoaded"> diff --git a/BeWo/View/Navigation/CustomerNavigationView.xaml.cs b/BeWo/View/Navigation/CustomerNavigationView.xaml.cs index 41460ddb0..14b452fe7 100644 --- a/BeWo/View/Navigation/CustomerNavigationView.xaml.cs +++ b/BeWo/View/Navigation/CustomerNavigationView.xaml.cs @@ -25,6 +25,11 @@ using BS.Shared.Translation; using Microsoft.Win32; using BeWo.AI; using BeWo.View.Document; +using DevExpress.Mvvm; +using BeWo.View.Detail.AI; +using System; +using BeWo.View.Windows; +using System.Collections; namespace BeWo.View.Navigation { @@ -44,7 +49,10 @@ namespace BeWo.View.Navigation { InitializeComponent(); - mainNavigationView.Sorter = new CustomerSorter(); + mainNavigationView.OpenAiWindowCommand = new DelegateCommand(OpenAiWindow, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView), false); + mainNavigationView.OpenAiPopupCommand = new DelegateCommand(OpenAiPopup, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView2), false); + + mainNavigationView.Sorter = new CustomerSorter(); mainNavigationView.ArchiveButtonVisible = BeWoApp.LoggedOnUser.HasRight(UserRightType.Customer_AllowArchiving); mainNavigationView.ShowArchivedObjectsVisible = true; @@ -169,7 +177,48 @@ namespace BeWo.View.Navigation UpdateCustomFilter(); } - private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs) + public Dictionary GetVisibleInformationReferences() + { + var visible = mainNavigationView.objectListBox.ItemsSource; + + return GetVisibleInformationReferences(visible); + } + + private Dictionary GetVisibleInformationReferences(IEnumerable selected_records) + { + foreach (var record in selected_records) + { + var t = record is CompactCustomerDC; + + + if (record is CompactCustomerDC) + { + + } + } + + return null; + } + + private void OpenAiWindow() + { + var context = GetVisibleInformationReferences(); + + var window = BeWoWindowBuilder.AiWindowBuilder.GetAiConversationWindow(UIContext.Customer, context); + + window.Show(); + } + + private void OpenAiPopup() + { + var context = GetVisibleInformationReferences(); + + var control = BeWoWindowBuilder.AiWindowBuilder.GetAiConversationControl(UIContext.Customer, context); + + MainControl.ShowControlAsModalPopup(control); + } + + private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs) { BeWoApp.AppSettings.CustomerFilterSupportConcepts = ((CustomerFilterItem) supportConceptFilterComboBox.SelectedItem)?.CustomerFilter ?? CustomerFilterEnum.MyCustomer; diff --git a/BeWo/View/Navigation/CustomerTeamNavigationView.xaml b/BeWo/View/Navigation/CustomerTeamNavigationView.xaml index 5eb5d1727..9946b2dd4 100644 --- a/BeWo/View/Navigation/CustomerTeamNavigationView.xaml +++ b/BeWo/View/Navigation/CustomerTeamNavigationView.xaml @@ -1,24 +1,25 @@ - + - + diff --git a/BeWo/View/Navigation/EmployeeNavigationView.xaml b/BeWo/View/Navigation/EmployeeNavigationView.xaml index ea7a7a6c6..e40c17d54 100644 --- a/BeWo/View/Navigation/EmployeeNavigationView.xaml +++ b/BeWo/View/Navigation/EmployeeNavigationView.xaml @@ -1,33 +1,45 @@ - - - + + + - - - - - + + + + + - + \ No newline at end of file diff --git a/BeWo/View/Navigation/MainNavigationView.xaml b/BeWo/View/Navigation/MainNavigationView.xaml index 2838e41ac..d9dfd20d4 100644 --- a/BeWo/View/Navigation/MainNavigationView.xaml +++ b/BeWo/View/Navigation/MainNavigationView.xaml @@ -274,6 +274,27 @@ Content="KI" Style="{StaticResource NavigationToolbarButtonStyle}" Visibility="Collapsed" /> + + + + + + + + +