diff --git a/BeWo/View/Controls/Wohnhilfe/CustomerWohnhilfeControl.xaml b/BeWo/View/Controls/Wohnhilfe/CustomerWohnhilfeControl.xaml index 4a311bcef..750f2cdbd 100644 --- a/BeWo/View/Controls/Wohnhilfe/CustomerWohnhilfeControl.xaml +++ b/BeWo/View/Controls/Wohnhilfe/CustomerWohnhilfeControl.xaml @@ -287,7 +287,7 @@ - + zu Partner/Partnerin zu eigenen minderjährigen Kindern zu volljährigen Kindern, Eltern, Verwandten @@ -296,7 +296,7 @@ sonstige - + zu Partner/Partnerin zu eigenen minderjährigen Kindern zu volljährigen Kindern, Eltern, Verwandten diff --git a/BeWo/View/Detail/CustomerWohnhilfeView.xaml b/BeWo/View/Detail/CustomerWohnhilfeView.xaml index a7e02a0b2..1b6aa4150 100644 --- a/BeWo/View/Detail/CustomerWohnhilfeView.xaml +++ b/BeWo/View/Detail/CustomerWohnhilfeView.xaml @@ -102,8 +102,7 @@ + IsLarge="{Binding DataContext.IsLarge, ElementName=tabcontrol_NotizenKategorien, Mode=TwoWay}" /> diff --git a/BeWo/ViewModel/Wohnhilfe/CustomerWohnhilfeBereichSozialeKontakteVM.cs b/BeWo/ViewModel/Wohnhilfe/CustomerWohnhilfeBereichSozialeKontakteVM.cs index 707a0c38e..815cfd1a6 100644 --- a/BeWo/ViewModel/Wohnhilfe/CustomerWohnhilfeBereichSozialeKontakteVM.cs +++ b/BeWo/ViewModel/Wohnhilfe/CustomerWohnhilfeBereichSozialeKontakteVM.cs @@ -9,6 +9,9 @@ namespace BeWo.ViewModel.Wohnhilfe { public class CustomerWohnhilfeBereichSozialeKontakteVM : AbstractDCMapperVM { + private bool _CanEditBeginnKontakt; + private bool _CanEditEndeKontakt; + private WohnhilfeBoolData _BeginnSozialeKontakte; private bool _BeginnKontaktPartner; private bool _BeginnKontaktMindKinder; @@ -45,6 +48,33 @@ namespace BeWo.ViewModel.Wohnhilfe public IEnumerable KrankenversicherungTypes => Utils.GetAllEnumValues(); public IEnumerable KontaktArztTypes => Utils.GetAllEnumValues(); + + public bool CanEditBeginnKontakt + { + get { return _CanEditBeginnKontakt; } + set + { + if (!AreDifferent(_CanEditBeginnKontakt, value)) + return; + + _CanEditBeginnKontakt = value; + FirePropertyChanged(nameof(CanEditBeginnKontakt)); + } + } + + public bool CanEditEndeKontakt + { + get { return _CanEditEndeKontakt; } + set + { + if (!AreDifferent(_CanEditEndeKontakt, value)) + return; + + _CanEditEndeKontakt = value; + FirePropertyChanged(nameof(CanEditEndeKontakt)); + } + } + public WohnhilfeBoolData BeginnSozialeKontakte { get { return _BeginnSozialeKontakte; } @@ -56,6 +86,8 @@ namespace BeWo.ViewModel.Wohnhilfe _BeginnSozialeKontakte = value; StoreDirtyInformation(AreDifferent(DataContract.BeginnSozialeKontakte, value), nameof(BeginnSozialeKontakte)); FirePropertyChanged(nameof(BeginnSozialeKontakte)); + + CanEditBeginnKontakt = value == WohnhilfeBoolData.Ja; } } @@ -154,6 +186,8 @@ namespace BeWo.ViewModel.Wohnhilfe _EndeSozialeKontakte = value; StoreDirtyInformation(AreDifferent(DataContract.EndeSozialeKontakte, value), nameof(EndeSozialeKontakte)); FirePropertyChanged(nameof(EndeSozialeKontakte)); + + CanEditEndeKontakt = value == WohnhilfeBoolData.Ja; } } diff --git a/BeWo/ViewModel/Wohnhilfe/CustomerWohnhilfeBereichSozialstrukturVM.cs b/BeWo/ViewModel/Wohnhilfe/CustomerWohnhilfeBereichSozialstrukturVM.cs index fac49a0c0..b8c216196 100644 --- a/BeWo/ViewModel/Wohnhilfe/CustomerWohnhilfeBereichSozialstrukturVM.cs +++ b/BeWo/ViewModel/Wohnhilfe/CustomerWohnhilfeBereichSozialstrukturVM.cs @@ -124,6 +124,8 @@ namespace BeWo.ViewModel.Wohnhilfe _Betreuungsbeginn = value; StoreDirtyInformation(AreDifferent(DataContract.Betreuungsbeginn, value), nameof(Betreuungsbeginn)); FirePropertyChanged(nameof(Betreuungsbeginn)); + + UpdateBetreuungsdauerInTagen(); } } @@ -138,6 +140,8 @@ namespace BeWo.ViewModel.Wohnhilfe _Betreuungsende = value; StoreDirtyInformation(AreDifferent(DataContract.Betreuungsende, value), nameof(Betreuungsende)); FirePropertyChanged(nameof(Betreuungsende)); + + UpdateBetreuungsdauerInTagen(); } } @@ -336,5 +340,21 @@ namespace BeWo.ViewModel.Wohnhilfe return pDataContract; } + + private void UpdateBetreuungsdauerInTagen() + { + if (!_Betreuungsbeginn.HasValue || !_Betreuungsende.HasValue) + return; + + var beginn = _Betreuungsbeginn.Value; + var ende = _Betreuungsende.Value; + + if (beginn > ende) + return; + + var timespan = ende - beginn; + + BetreuungsdauerInTagen = (int)timespan.TotalDays + 1; + } } }