657 lines
22 KiB
C#
657 lines
22 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using BeWo.SchulbegleitenderDienst.View;
|
|
using BS.Shared;
|
|
using BS.Shared.Extensions;
|
|
|
|
using BeWo.ServiceProxy;
|
|
using BeWo.View.Detail;
|
|
using BeWo.ViewModel;
|
|
using BeWo.ViewModel.ListViewModel;
|
|
using DevExpress.Xpf.Accordion;
|
|
using BeWo.View.Detail.Administration;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Threading;
|
|
using System.Runtime.Remoting.Messaging;
|
|
using BeWo.View.Detail.AI;
|
|
using BeWo.ViewModel.View.Administration;
|
|
|
|
namespace BeWo.View.Master
|
|
{
|
|
public partial class AdministrationView
|
|
{
|
|
private readonly Dictionary<string, BeWoView> _OpenViews = new Dictionary<string, BeWoView>();
|
|
|
|
private BeWoView _SelectedView;
|
|
|
|
private MandatorVM _MandatorVM;
|
|
|
|
public AdministrationView()
|
|
{
|
|
InitializeComponent();
|
|
//GenerateNewView(TabitemMandator);
|
|
|
|
MouseMove += (s, e) =>
|
|
{
|
|
var p = e.GetPosition(btnSave);
|
|
|
|
if (p.X >= 0 && p.X < btnSave.ActualWidth && p.Y >= 0 && p.Y < btnSave.ActualHeight)
|
|
{
|
|
Root.Focus();
|
|
}
|
|
};
|
|
|
|
#region Rechte
|
|
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.AssessmentSheet_View))
|
|
{
|
|
TabitemAssessmentSheetValues.Visibility = Visibility.Collapsed;
|
|
TabitemAssessmentSheetCategories.Visibility = Visibility.Collapsed;
|
|
}
|
|
|
|
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.AdditionalService_View))
|
|
{
|
|
TabitemAdditionalServices.Visibility = Visibility.Collapsed;
|
|
TabitemAdditionalServiceRegions.Visibility = Visibility.Collapsed;
|
|
}
|
|
|
|
TabitemAuszahlungsarten.Visibility = BeWoApp.LoggedOnUser.HasRight(UserRightType.OvertimeView)
|
|
? Visibility.Visible
|
|
: Visibility.Collapsed;
|
|
|
|
if (!BeWoApp.AppSettings.IsMedicationAllowed)
|
|
{
|
|
TabitemMedikamentenarten.Visibility = Visibility.Collapsed;
|
|
}
|
|
|
|
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.TextbausteineAlleAnsehen) &&
|
|
!BeWoApp.LoggedOnUser.HasRight(UserRightType.TextbausteineAlleBearbeiten))
|
|
{
|
|
TabitemTextbausteine.Visibility = Visibility.Collapsed;
|
|
}
|
|
|
|
if (BeWoApp.Mandator != null && BeWoApp.Mandator.AllowSbd)
|
|
{
|
|
TabitemSbd.Visibility = Visibility.Visible;
|
|
}
|
|
else
|
|
{
|
|
TabitemSbd.Visibility = Visibility.Collapsed;
|
|
}
|
|
#if DEBUG
|
|
TabitemSbd.Visibility = Visibility.Visible;
|
|
#endif
|
|
if (BeWoApp.AppSettings.ShowDienstplanung)
|
|
{
|
|
TabitemDienste.Visibility = Visibility.Visible;
|
|
}
|
|
else
|
|
{
|
|
TabitemDienste.Visibility = Visibility.Collapsed;
|
|
}
|
|
//if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.ChatAdminSettings) || !BeWoApp.AppSettings.ShowOwnChatSettings)
|
|
//{
|
|
// TabitemOwnChatSettings.Visibility = Visibility.Collapsed;
|
|
//}
|
|
|
|
#if DEBUG
|
|
TabitemDienste.Visibility = Visibility.Visible;
|
|
#endif
|
|
|
|
if (!BeWoApp.AppSettings.ShowWohnhilfe)
|
|
{
|
|
TabitemFalldaten.Visibility = Visibility.Collapsed;
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
|
|
|
|
public override bool IsDirty => SelectedView != null &&
|
|
SelectedView.IsDirty;
|
|
public BeWoView SelectedView
|
|
{
|
|
get => _SelectedView;
|
|
set
|
|
{
|
|
if (value == null) return;
|
|
|
|
_SelectedView = value;
|
|
ContentBorder.Child = value;
|
|
}
|
|
}
|
|
public MandatorVM MandatorVM
|
|
{
|
|
get => _MandatorVM;
|
|
set
|
|
{
|
|
_MandatorVM = value;
|
|
|
|
if (_OpenViews.TryGetValue(TabitemMandator.Header.ToString(), out var cachedView) && cachedView is MandatorView mandatorView)
|
|
{
|
|
mandatorView.ViewModel = value;
|
|
}
|
|
|
|
if (_OpenViews.TryGetValue(TabitemSozioTherapie.Header.ToString(), out var cachedView2) && cachedView2 is SoziotherapieSettingsView soziotherapieSettingsView)
|
|
{
|
|
soziotherapieSettingsView.ViewModel = value;
|
|
}
|
|
}
|
|
}
|
|
internal override DependencyObject ValidationOnSaveRootElement =>
|
|
SelectedView.ValidationOnSaveRootElement;
|
|
|
|
private void AdministrationView_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
ExpandItems();
|
|
}
|
|
private void Tabitem_Selected(object sender, RoutedEventArgs e)
|
|
{
|
|
if (!(sender is AccordionItem selectedAccordionItem))
|
|
return;
|
|
|
|
var header = selectedAccordionItem.Header.ToString();
|
|
if (_OpenViews.TryGetValue(header, out var view))
|
|
{
|
|
if (view is object)
|
|
SetView(_OpenViews[header]);
|
|
}
|
|
else
|
|
GenerateNewView(selectedAccordionItem);
|
|
|
|
BeWoApp.AppSettings.SelectedAdministrationItem = header;
|
|
}
|
|
|
|
// // ALT - BITTE NICHT ENTFERNEN
|
|
// // Kann verwendet werden, wenn das cachen vom Asynchronen Speichern doch zu Fehlern führt
|
|
//internal override bool DoSaveCheck()
|
|
//{
|
|
// var selected = (AccordionItem)Root.SelectedItem;
|
|
// var header = selected.Header.ToString();
|
|
|
|
// BeWoApp.AppSettings.ExpandedAdministrationItems = "";
|
|
|
|
// if (Root != null)
|
|
// {
|
|
// foreach (AccordionItem ai in Root.Items)
|
|
// {
|
|
// if (ai.IsExpanded)
|
|
// {
|
|
// BeWoApp.AppSettings.ExpandedAdministrationItems += ":" + ai.Header;
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// if (SelectedView is null)
|
|
// return true;
|
|
|
|
// var lDoSave = SelectedView.DoSaveCheck();
|
|
|
|
// // Speicheranfrage abgelehnt
|
|
// if (!lDoSave)
|
|
// return false;
|
|
|
|
// // Synchron gespeichert o. keine Änderung
|
|
// if (!IsDirty)
|
|
// return true;
|
|
|
|
// if (selected == TabitemMandator || selected == TabitemSozioTherapie)
|
|
// {
|
|
// _OpenViews.Remove(TabitemMandator.Header.ToString());
|
|
// _OpenViews.Remove(TabitemSozioTherapie.Header.ToString());
|
|
|
|
// MandatorVM = null;
|
|
// }
|
|
// else
|
|
// {
|
|
// _OpenViews.Remove(header);
|
|
// }
|
|
|
|
// return true;
|
|
//}
|
|
|
|
internal override bool DoSaveCheck()
|
|
{
|
|
var selected = (AccordionItem)Root.SelectedItem;
|
|
var header = selected.Header.ToString();
|
|
|
|
BeWoApp.AppSettings.ExpandedAdministrationItems = "";
|
|
|
|
if (Root != null)
|
|
{
|
|
foreach (AccordionItem ai in Root.Items)
|
|
{
|
|
if (ai.IsExpanded)
|
|
{
|
|
BeWoApp.AppSettings.ExpandedAdministrationItems += ":" + ai.Header;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (SelectedView is null)
|
|
return true;
|
|
|
|
var lDoSave = SelectedView.DoSaveCheck();
|
|
|
|
// Speicheranfrage abgelehnt
|
|
if (!lDoSave)
|
|
return false;
|
|
|
|
// Synchron gespeichert o. keine Änderung
|
|
if (!IsDirty)
|
|
return true;
|
|
|
|
// Asynchrones speichern
|
|
//if (ServiceFacade.IsWaiting())
|
|
if(false)
|
|
{
|
|
//Task.Run(() => ServiceFacade.WaitUntilAsyncIsFinished((s) => DoSaveCheckCallback(s, selected, header)));
|
|
}
|
|
// Verwerfen
|
|
else
|
|
{
|
|
DoSaveCheckCallback(false, selected, header);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
private void DoSaveCheckCallback(bool success, AccordionItem selected, string header)
|
|
{
|
|
Monitor.Enter(_OpenViews);
|
|
|
|
if (!success || _OpenViews[header].IsDirty)
|
|
{
|
|
if (selected == TabitemMandator || selected == TabitemSozioTherapie)
|
|
{
|
|
_OpenViews.Remove(TabitemMandator.Header.ToString());
|
|
_OpenViews.Remove(TabitemSozioTherapie.Header.ToString());
|
|
|
|
_MandatorVM = null;
|
|
}
|
|
else
|
|
{
|
|
_OpenViews.Remove(header);
|
|
}
|
|
}
|
|
|
|
Monitor.Exit(_OpenViews);
|
|
}
|
|
protected override void Save()
|
|
{
|
|
SelectedView.SaveData();
|
|
}
|
|
private void ExpandItems()
|
|
{
|
|
if (!String.IsNullOrEmpty(BeWoApp.AppSettings.ExpandedAdministrationItems))
|
|
{
|
|
foreach (AccordionItem item in Root.Items)
|
|
{
|
|
item.IsExpanded = false;
|
|
if (BeWoApp.AppSettings.ExpandedAdministrationItems.Contains(":" + item.Header))
|
|
{
|
|
item.ExpandSubtree();
|
|
item.IsExpanded = true;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//foreach (AccordionItem item in Root.Items)
|
|
//{
|
|
// item.IsExpanded = true;
|
|
//}
|
|
}
|
|
|
|
if (BeWoApp.AppSettings.SelectedAdministrationItem is string selected)
|
|
{
|
|
Root.SelectedItem = searchAccordionItem(selected);
|
|
}
|
|
else
|
|
{
|
|
Root.SelectedItem = TabitemMandator;
|
|
}
|
|
}
|
|
|
|
private void AddView(AccordionItem pTabItem, BeWoView pView)
|
|
{
|
|
pView.VerticalAlignment = VerticalAlignment.Top;
|
|
|
|
if (ActualHeight > 120 && !(pView is MandatorView))
|
|
{
|
|
pView.MaxHeight = ActualHeight - 120;
|
|
}
|
|
|
|
_OpenViews[pTabItem.Header.ToString()] = pView;
|
|
SetView(pView);
|
|
}
|
|
private void SetView(BeWoView newView)
|
|
{
|
|
if (newView == null || Equals(newView, SelectedView)) return;
|
|
|
|
newView.Margin = new Thickness(0);
|
|
|
|
if (ContentBorder.Child == null || DoSaveCheck())
|
|
{
|
|
SelectedView = newView;
|
|
//ServiceFacade.WaitUntilAsyncIsFinished((s) => Dispatcher.Invoke(() => SelectedView = newView));
|
|
}
|
|
}
|
|
private void GenerateNewView(AccordionItem accordionItem)
|
|
{
|
|
if (accordionItem == null)
|
|
return;
|
|
|
|
|
|
var header = accordionItem.Header.ToString();
|
|
if (_OpenViews.TryGetValue(header, out var view))
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
_OpenViews.Add(header, null);
|
|
}
|
|
|
|
switch (accordionItem.Name)
|
|
{
|
|
case nameof(TabitemMandator):
|
|
CheckMandatorVM(() => AddView(TabitemMandator, new MandatorView(this)));
|
|
return;
|
|
case nameof(TabitemQualificationTypes):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.StaffQualificationsType,
|
|
r => this.Dispatch(() => AddView(TabitemQualificationTypes, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemQualifikationsbedarf):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.QualifikationsBedarf,
|
|
r => this.Dispatch(() => AddView(TabitemQualifikationsbedarf, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemAbsenceCategories):
|
|
VMFactory.CreateAbsenceReasonListVMAsync(r =>
|
|
this.Dispatch(() => AddView(TabitemAbsenceCategories, new AbsenceReasonView(r))));
|
|
return;
|
|
case nameof(TabitemDisablityTypes):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.DisabilityType,
|
|
r => this.Dispatch(() => AddView(TabitemDisablityTypes, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemEmploymentTypes):
|
|
VMFactory.CreateEmploymentTypeListVMAsync(r =>
|
|
this.Dispatch(() => AddView(TabitemEmploymentTypes, new EmploymentTypeView(r))));
|
|
return;
|
|
case nameof(TabitemCustomerCareTypes):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.CustomerCareType,
|
|
r => this.Dispatch(() => AddView(TabitemCustomerCareTypes, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemTerminationReasons):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.TerminationReasonType,
|
|
r => this.Dispatch(() => AddView(TabitemTerminationReasons, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemEinkommenBeginn):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.EinkommenBeginnType,
|
|
r => this.Dispatch(() => AddView(TabitemEinkommenBeginn, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemEinkommenEnde):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.EinkommenEndeType,
|
|
r => this.Dispatch(() => AddView(TabitemEinkommenEnde, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemFremdHilfe):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.FremdHilfeType,
|
|
r => this.Dispatch(() => AddView(TabitemFremdHilfe, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemSozSchwierigkeiten):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.SozSchwierigkeitenType,
|
|
r => this.Dispatch(() => AddView(TabitemSozSchwierigkeiten, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemSozBeziehungen):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.SozBeziehungenType,
|
|
r => this.Dispatch(() => AddView(TabitemSozBeziehungen, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemErstaufnahme):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.ErstaufnahmeType,
|
|
r => this.Dispatch(() => AddView(TabitemErstaufnahme, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemRegion):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.RegionType,
|
|
r => this.Dispatch(() => AddView(TabitemErstaufnahme, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemPlacementObjectives):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.PlacementObjectiveType,
|
|
r => this.Dispatch(() => AddView(TabitemPlacementObjectives, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemTitles):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.TitleType,
|
|
r => this.Dispatch(() => AddView(TabitemTitles, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemFunctions):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.FunctionType,
|
|
personFunctionList => VMFactory.CreateValueListVMAsync(
|
|
ValueListEntryType.OrganisationFunctionType,
|
|
orgFunctionList =>
|
|
this.Dispatch(() => AddView(TabitemFunctions,
|
|
new EnvironmentRoleView(personFunctionList, orgFunctionList)))));
|
|
return;
|
|
case nameof(TabitemNationality):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.Nationality,
|
|
natList =>
|
|
this.Dispatch(() => AddView(TabitemNationality, new ValueListView(natList))));
|
|
return;
|
|
case nameof(TabitemAufenthaltsstatus):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.Aufenthaltsstatus,
|
|
orgList =>
|
|
this.Dispatch(() => AddView(TabitemAufenthaltsstatus, new AufenthaltsView(orgList))));
|
|
return;
|
|
case nameof(TabitemFinazCategories):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.AccountingTransactionType,
|
|
r => this.Dispatch(() => AddView(TabitemFinazCategories, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemServiceCategories):
|
|
VMFactory.CreateServiceCategoryListVMAsync(r =>
|
|
this.Dispatch(() => AddView(TabitemServiceCategories, new ServiceCategoryView(r))));
|
|
return;
|
|
case nameof(TabitemServiceDescriptions):
|
|
VMFactory.CreateServiceDescriptionListVMAsync(r =>
|
|
this.Dispatch(() => AddView(TabitemServiceDescriptions, new ServiceDescriptionView(r))));
|
|
return;
|
|
case nameof(TabitemTextbausteine):
|
|
VMFactory.CreateTextModuleListVMAsync(
|
|
r => this.Dispatch(() => AddView(TabitemTextbausteine, new TextbausteinView(r, true))), true,
|
|
true);
|
|
return;
|
|
case nameof(TabitemMedikamentenarten):
|
|
VMFactory.CreateMedArtListVMAsync(r =>
|
|
this.Dispatch(() => AddView(TabitemMedikamentenarten, new MedikamentenartenView(r))));
|
|
return;
|
|
case nameof(TabitemRoles):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.StaffRoleType,
|
|
r => this.Dispatch(() => AddView(TabitemRoles, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemEnvironmentRoles):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.EnvironmentPersonType,
|
|
personList => VMFactory.CreateValueListVMAsync(ValueListEntryType.RoleInOrganisationType,
|
|
roleInOrgList => VMFactory.CreateValueListVMAsync(
|
|
ValueListEntryType.EnvironmentOrganisationType,
|
|
orgList => VMFactory.CreateValueListVMAsync(ValueListEntryType.RoleInFamily,
|
|
roleInFamily => this.Dispatch(() => AddView(TabitemEnvironmentRoles,
|
|
new EnvironmentRoleView(personList, orgList, roleInOrgList, roleInFamily)))))));
|
|
return;
|
|
case nameof(TabitemActivityFocus):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.StaffActivityFocusType,
|
|
r => this.Dispatch(() => AddView(TabitemActivityFocus, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemResourceCategories):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.ResourceCategory,
|
|
r => this.Dispatch(() => AddView(TabitemResourceCategories, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemResources):
|
|
VMFactory.CreateResourceListVMAsync(r =>
|
|
this.Dispatch(() => AddView(TabitemResources, new RessourceView(r))));
|
|
return;
|
|
case nameof(TabitemGoalcategories):
|
|
VMFactory.CreateGoalCategoryVMAsync(r =>
|
|
this.Dispatch(() => AddView(TabitemGoalcategories, new MassnahmenTreeViewView(r))));
|
|
return;
|
|
case nameof(TabitemMassnahmen):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.MassnahmenKatalog,
|
|
r => this.Dispatch(() => AddView(TabitemMassnahmen, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemNews):
|
|
ServiceFacade.DoEmployeeServiceAsync(s => s.GetAllNewsItems(),
|
|
cb => this.Dispatch(() => AddView(TabitemNews, new NewsItemView(new NewsItemListVM(cb)))));
|
|
return;
|
|
case nameof(TabitemAssessmentSheetValues):
|
|
VMFactory.CreateAssessmentSheetValueListVM(m =>
|
|
this.Dispatch(() => AddView(TabitemAssessmentSheetValues, new AssessmentSheetValueView(m))));
|
|
return;
|
|
case nameof(TabitemAssessmentSheetCategories):
|
|
VMFactory.CreateAssessmentSheetCategoryListVM(m => this.Dispatch(() =>
|
|
AddView(TabitemAssessmentSheetCategories, new AssessmentSheetCategoryView(m))));
|
|
return;
|
|
case nameof(TabitemAdditionalServices):
|
|
VMFactory.CreateAdditionalServiceListVMAsync(r =>
|
|
this.Dispatch(() => AddView(TabitemAdditionalServices, new AdditionalServiceAddView(r))));
|
|
return;
|
|
case nameof(TabitemAdditionalServiceRegions):
|
|
VMFactory.CreateAdditionalServiceRegionListVMAsync(r =>
|
|
this.Dispatch(
|
|
() => AddView(TabitemAdditionalServiceRegions, new AdditionalServiceRegionView(r))));
|
|
return;
|
|
case nameof(TabitemAuszahlungsarten):
|
|
VMFactory.CreateAuszahlungsartenListVMAsync(r =>
|
|
this.Dispatch(() => AddView(TabitemAuszahlungsarten, new AuszahlungsartenAddView(r))));
|
|
return;
|
|
case nameof(TabitemDokumenttype):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.DocumentType,
|
|
r => this.Dispatch(() => AddView(TabitemDokumenttype, new DokumentationstypView(r))));
|
|
return;
|
|
case nameof(TabitemSbd):
|
|
VMFactory.CreateSbdAdminVMAsync(r => this.Dispatch(() => AddView(TabitemSbd, new SbdAdminView(r))));
|
|
return;
|
|
case nameof(TabitemContracttypes):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.ContractType,
|
|
r => this.Dispatch(() => AddView(TabitemContracttypes, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemBudgets):
|
|
VMFactory.CreateBudgetListVMAsync(r =>
|
|
this.Dispatch(() => AddView(TabitemBudgets, new BudgetView(r))));
|
|
return;
|
|
case nameof(TabitemPreise):
|
|
VMFactory.CreatePreisListVMAsync(r =>
|
|
this.Dispatch(() => AddView(TabitemPreise, new PreisView(r))));
|
|
return;
|
|
case nameof(TabitemDienste):
|
|
VMFactory.CreateDienstListVMAsync(r =>
|
|
this.Dispatch(() => AddView(TabitemDienste, new DienstView(r))));
|
|
return;
|
|
case nameof(TabitemNotizenkategorie):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.NotizenKategorieEmployee,
|
|
notizEmpList => VMFactory.CreateValueListVMAsync(ValueListEntryType.NotizenKategorieCustomer,
|
|
notizCosList => this.Dispatch(() => AddView(TabitemNotizenkategorie, new NotizenKategorieView(notizEmpList, notizCosList)))));
|
|
return;
|
|
case nameof(TabitemRatingTypes):
|
|
VMFactory.CreateRatingTypeListVMAsync(r =>
|
|
this.Dispatch(() => AddView(TabitemRatingTypes, new RatingTypeView(r))));
|
|
return;
|
|
case nameof(TabitemAuftragsherkunft):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.Auftragsherkunft,
|
|
r => this.Dispatch(() => AddView(TabitemAuftragsherkunft, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemVermittlungsgrundlage):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.Vermittlungsgrundlage,
|
|
r => this.Dispatch(() => AddView(TabitemVermittlungsgrundlage, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemVerlauf):
|
|
VMFactory.CreateValueListVMAsync(ValueListEntryType.VgAVerlauf,
|
|
r => this.Dispatch(() => AddView(TabitemVerlauf, new ValueListView(r))));
|
|
return;
|
|
case nameof(TabitemSozioTherapie):
|
|
CheckMandatorVM(() => AddView(TabitemSozioTherapie, new SoziotherapieSettingsView(this)));
|
|
return;
|
|
//case nameof(TabitemAiPromptbausteine):
|
|
// VMFactory.CreateAiPromptbausteinListVMAsync(
|
|
// r => this.Dispatch(() => AddView(TabitemAiPromptbausteine, new AiPromptbausteinView(r))));
|
|
// return;
|
|
//case nameof(TabitemAiPr omptbausteineTree):
|
|
// AddView(TabitemAiPromptbausteineTree, new AiPromptbausteinTreeView());
|
|
// return;
|
|
case nameof(TabitemAiPromptbausteineComplexTree1):
|
|
var vm11 = new AiPromptbausteinComplexTreeViewModel(BeWoApp.MainControl.WindowService, AiActionType.ServiceRecordConversation);
|
|
AddView(TabitemAiPromptbausteineComplexTree1, new AiPromptbausteinComplexTreeView(vm11));
|
|
return;
|
|
case nameof(TabitemAiPromptbausteineComplexTree2):
|
|
var vm12 = new AiPromptbausteinComplexTreeViewModel(BeWoApp.MainControl.WindowService, AiActionType.ServiceRecordDocumentation);
|
|
AddView(TabitemAiPromptbausteineComplexTree2, new AiPromptbausteinComplexTreeView(vm12));
|
|
return;
|
|
}
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(accordionItem));
|
|
}
|
|
private void CheckMandatorVM(Action callbackAddView)
|
|
{
|
|
if (MandatorVM is object)
|
|
{
|
|
callbackAddView();
|
|
}
|
|
else
|
|
{
|
|
ServiceFacade.DoAccountingServiceAsync(s => s.LoadInvoiceNumberList(),
|
|
inl => ServiceFacade.DoOperationsServiceAsync(
|
|
s => s.GetMandator(),
|
|
m =>
|
|
this.Dispatch(() =>
|
|
{
|
|
var vmList = new List<InvoiceNumberVM>();
|
|
foreach (var indc in inl)
|
|
{
|
|
vmList.Add(new InvoiceNumberVM(indc));
|
|
}
|
|
MandatorVM = new MandatorVM(vmList, m);
|
|
callbackAddView();
|
|
})));
|
|
}
|
|
}
|
|
|
|
private AccordionItem searchAccordionItem(string header)
|
|
{
|
|
foreach (var item in Root.Items)
|
|
{
|
|
var rtn = searchAccordionItem(item as AccordionItem, header);
|
|
|
|
if (rtn is object)
|
|
return rtn;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
private AccordionItem searchAccordionItem(AccordionItem accordion, string header)
|
|
{
|
|
if (accordion is null)
|
|
return null;
|
|
|
|
if (!accordion.Items.Any())
|
|
{
|
|
if (header == accordion.Header.ToString())
|
|
return accordion;
|
|
else
|
|
return null;
|
|
}
|
|
|
|
foreach (var item in accordion.Items)
|
|
{
|
|
var rtn = searchAccordionItem(item as AccordionItem, header);
|
|
|
|
if (rtn is object)
|
|
return rtn;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
|
{
|
|
//e.Handled = true;
|
|
}
|
|
}
|
|
} |