diff --git a/Jugenddienst Stunden/Models/Stunde.cs b/Jugenddienst Stunden/Models/Stunde.cs
index 2a26ea0..dda98c9 100644
--- a/Jugenddienst Stunden/Models/Stunde.cs
+++ b/Jugenddienst Stunden/Models/Stunde.cs
@@ -136,7 +136,7 @@ namespace Jugenddienst_Stunden.Models {
var tokendata = new TokenData(apiKey);
await Auth.SaveItemAsync(tokendata.url, tokendata.apiKey, stunde,false);
- return null;
+ return stunde;
}
}
}
diff --git a/Jugenddienst Stunden/Types/DayTime.cs b/Jugenddienst Stunden/Types/DayTime.cs
index 523fde0..89d8665 100644
--- a/Jugenddienst Stunden/Types/DayTime.cs
+++ b/Jugenddienst Stunden/Types/DayTime.cs
@@ -2,26 +2,38 @@
using System.Collections.ObjectModel;
namespace Jugenddienst_Stunden.Types {
+ ///
+ /// Represents a day time entry for an employee.
+ ///
public class DayTime {
- public int? id;
- public int EmployeeId;
- public DateTime day;
- public int wday;
+ public int? id { get; set; }
+ public int EmployeeId { get; set; }
+ public DateTime day { get; set; }
+ public int wday { get; set; }
public TimeOnly begin { get; set; }
public TimeOnly end { get; set; }
public string description { get; set; }
- public string? free;
- public bool? approved;
- public int? type;
- public int? projekt;
- public int? gemeinde;
- public TimeOnly night;
- public Dictionary total;
- public TimeOnly end_print;
+ public string? free { get; set; }
+ public bool? approved { get; set; }
+ public int? type { get; set; }
+ public int? projekt { get; set; }
+ public int? gemeinde { get; set; }
+ public TimeOnly night { get; set; }
+ public Dictionary total { get; set; }
+ public TimeOnly end_print { get; set; }
public TimeSpan TimeSpanVon { get; set; }
public TimeSpan TimeSpanBis { get; set; }
public Collection Projekte { get; set; }
public Collection Gemeinden { get; set; }
+ ///
+ /// Gets the active Gemeinde based on the gemeinde ID.
+ ///
+ public Gemeinde GemeindeAktiv { get; set; }
+
+ ///
+ /// Gets the active Projekt based on the projekt ID.
+ ///
+ public Projekt ProjektAktiv { get; set; }
}
}
diff --git a/Jugenddienst Stunden/ViewModels/StundeViewModel.cs b/Jugenddienst Stunden/ViewModels/StundeViewModel.cs
index 3676e50..9b20330 100644
--- a/Jugenddienst Stunden/ViewModels/StundeViewModel.cs
+++ b/Jugenddienst Stunden/ViewModels/StundeViewModel.cs
@@ -21,7 +21,6 @@ namespace Jugenddienst_Stunden.ViewModels {
private DayTime _stunde;
public DayTime Stunde { get => _stunde; }
- public int Identifier => (int)_stunde.id;
public event EventHandler AlertEvent;
@@ -29,24 +28,25 @@ namespace Jugenddienst_Stunden.ViewModels {
public ObservableCollection OptionsProjekt { get; private set; }
public ObservableCollection OptionsFreistellung { get; }
- private Gemeinde _selectedGemeinde;
+ //private Gemeinde _selectedGemeinde;
public Gemeinde SelectedOptionGemeinde {
- get => _selectedGemeinde;
+ get => _stunde.GemeindeAktiv;
set {
- if (_selectedGemeinde != value) {
- _selectedGemeinde = value;
+ if (_stunde.GemeindeAktiv != value) {
+ //_selectedGemeinde = value;
+ _stunde.GemeindeAktiv = value;
OnPropertyChanged(nameof(SelectedOptionGemeinde));
}
}
}
- private Projekt _selectedProjekt;
+ //private Projekt _selectedProjekt;
public Projekt SelectedOptionProjekt {
- get => _selectedProjekt;
+ get => _stunde.ProjektAktiv;
set {
- if (_selectedProjekt != value) {
- _selectedProjekt = value;
- //new AsyncRelayCommand(LoadData);
+ if (_stunde.ProjektAktiv != value) {
+ //_selectedProjekt = value;
+ _stunde.ProjektAktiv = value;
OnPropertyChanged(nameof(SelectedOptionProjekt));
}
}
@@ -58,7 +58,6 @@ namespace Jugenddienst_Stunden.ViewModels {
set {
if (selectedFreistellung != value) {
selectedFreistellung = value;
- //new AsyncRelayCommand(LoadData);
OnPropertyChanged(nameof(SelectedOptionFreistellung));
}
}
@@ -93,10 +92,10 @@ namespace Jugenddienst_Stunden.ViewModels {
public StundeViewModel() {
_stunde = new DayTime();
+
SaveCommand = new AsyncRelayCommand(Save);
//DeleteCommand = new AsyncRelayCommand(Delete);
-
OptionsFreistellung = new ObservableCollection {
"Keine",
"Urlaub",
@@ -113,8 +112,6 @@ namespace Jugenddienst_Stunden.ViewModels {
}
async Task Save() {
- //_stunde.day = DateTime.Now;
- //_stunde.Save();
await Models.Stunde.SaveEntry(_stunde);
await Shell.Current.GoToAsync($"..?saved={_stunde.id}");
}
diff --git a/Jugenddienst Stunden/ViewModels/StundenViewModel.cs b/Jugenddienst Stunden/ViewModels/StundenViewModel.cs
index a8a02bb..ab7fd26 100644
--- a/Jugenddienst Stunden/ViewModels/StundenViewModel.cs
+++ b/Jugenddienst Stunden/ViewModels/StundenViewModel.cs
@@ -53,6 +53,7 @@ namespace Jugenddienst_Stunden.ViewModels {
public string Holiday {
get => _hour.holiday;
}
+
public TimeOnly DayTotal { get; set; }
public List DayTimes {
@@ -154,6 +155,8 @@ namespace Jugenddienst_Stunden.ViewModels {
////if (_hour.zeit_total_daily_api != null) {
////TimeDay = _hour.zeit_total_daily_api.Where(static p => p.Day == GetDay.Day).ToList() ?? new List { new TimeDay { Day = GetDay.Day, Hours = 0 } };
//RefreshProperties();
+
+
TimeSpan span = TimeSpan.Zero;
foreach (DayTime dt in _hour.daytime) {
span += dt.end - dt.begin;
diff --git a/Jugenddienst Stunden/Views/StundePage.xaml b/Jugenddienst Stunden/Views/StundePage.xaml
index 8934328..df49027 100644
--- a/Jugenddienst Stunden/Views/StundePage.xaml
+++ b/Jugenddienst Stunden/Views/StundePage.xaml
@@ -14,13 +14,13 @@
-
+
-
+
diff --git a/Jugenddienst Stunden/Views/StundenPage.xaml b/Jugenddienst Stunden/Views/StundenPage.xaml
index e31843b..1b9fe60 100644
--- a/Jugenddienst Stunden/Views/StundenPage.xaml
+++ b/Jugenddienst Stunden/Views/StundenPage.xaml
@@ -49,9 +49,11 @@
-
-
-
+
+
+
+
+
@@ -61,32 +63,6 @@
-
-