1.0.4
This commit is contained in:
@@ -87,6 +87,8 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.26100.0</TargetFrameworks>
|
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.26100.0</TargetFrameworks>
|
||||||
|
<IncludeSymbols>True</IncludeSymbols>
|
||||||
|
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android|AnyCPU'">
|
||||||
@@ -97,6 +99,7 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android|AnyCPU'">
|
||||||
<ApplicationDisplayVersion>1.0.4</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>1.0.4</ApplicationDisplayVersion>
|
||||||
<ApplicationVersion>5</ApplicationVersion>
|
<ApplicationVersion>5</ApplicationVersion>
|
||||||
|
<DebugSymbols>True</DebugSymbols>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-windows10.0.19041.0|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-windows10.0.19041.0|AnyCPU'">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Jugenddienst_Stunden.Types;
|
using Jugenddienst_Stunden.Types;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
namespace Jugenddienst_Stunden.Models;
|
namespace Jugenddienst_Stunden.Models;
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ internal class Stunde : ObservableObject {
|
|||||||
name = Preferences.Default.Get("name", "Johannes");
|
name = Preferences.Default.Get("name", "Johannes");
|
||||||
surname = Preferences.Default.Get("surname", "Fink");
|
surname = Preferences.Default.Get("surname", "Fink");
|
||||||
apiUrl = Preferences.Default.Get("apiUrl", "http://hours.dauni.mine.nu:81/appapi");
|
apiUrl = Preferences.Default.Get("apiUrl", "http://hours.dauni.mine.nu:81/appapi");
|
||||||
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(apiKey)) {
|
if (string.IsNullOrEmpty(apiKey)) {
|
||||||
throw new Exception("Kein APIKEY, bitte zuerst Login durchführen");
|
throw new Exception("Kein APIKEY, bitte zuerst Login durchführen");
|
||||||
@@ -107,39 +108,38 @@ internal class Stunde : ObservableObject {
|
|||||||
/// <param name="date"></param>
|
/// <param name="date"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="Exception"></exception>
|
/// <exception cref="Exception"></exception>
|
||||||
public static async Task<List<DayTime>> LoadDay(DateTime date) {
|
public static async Task<ObservableCollection<DayTime>> LoadDay(DateTime date) {
|
||||||
if (string.IsNullOrEmpty(apiKey)) {
|
if (string.IsNullOrEmpty(apiKey)) {
|
||||||
throw new Exception("Kein APIKEY, bitte zuerst Login durchführen");
|
throw new Exception("Kein APIKEY, bitte zuerst Login durchführen");
|
||||||
}
|
}
|
||||||
List<DayTime> daytimes = new List<DayTime>();
|
|
||||||
|
|
||||||
if (Connectivity.Current.NetworkAccess == NetworkAccess.None) {
|
if (Connectivity.Current.NetworkAccess == NetworkAccess.None) {
|
||||||
throw new Exception("Bitte überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut.");
|
throw new Exception("Bitte überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut.");
|
||||||
//await App.Current.MainPage.DisplayAlert("Keine Internetverbindung",
|
//await App.Current.MainPage.DisplayAlert("Keine Internetverbindung",
|
||||||
// "Bitte überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut.",
|
// "Bitte überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut.",
|
||||||
// "OK");
|
// "OK");
|
||||||
} else {
|
|
||||||
var tokendata = new TokenData(apiKey);
|
|
||||||
|
|
||||||
//string data = await Auth.GetApiDataWithAuthAsync(requestUrl, apiKey);
|
|
||||||
string? data = await Auth.GetApiDataWithAuthAsync(tokendata.url + "?date=" + date.ToString("yyyy-MM-dd"), tokendata.apiKey);
|
|
||||||
|
|
||||||
if (data == "null") {
|
|
||||||
throw new Exception("Keine Daten für " + date.ToString("ddd. dd. MMM") + " erhalten");
|
|
||||||
}
|
|
||||||
if (data == "\"Lalala\"") {
|
|
||||||
throw new Exception("Problem mit Token");
|
|
||||||
}
|
|
||||||
if (data == null) {
|
|
||||||
throw new Exception("Keine Daten erhalten");
|
|
||||||
}
|
|
||||||
//daytimes = System.Text.Json.JsonSerializer.Deserialize<List<DayTime>>(data);
|
|
||||||
daytimes = JsonConvert.DeserializeObject<List<DayTime>>(data) ?? throw new Exception("Fehler beim Deserialisieren der Daten");
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//Hours = hours;
|
|
||||||
|
var tokendata = new TokenData(apiKey);
|
||||||
|
string? data = await Auth.GetApiDataWithAuthAsync(tokendata.url + "?date=" + date.ToString("yyyy-MM-dd"), tokendata.apiKey);
|
||||||
|
|
||||||
|
if (data == "null") {
|
||||||
|
throw new Exception("Keine Daten für " + date.ToString("ddd. dd. MMM") + " erhalten");
|
||||||
|
}
|
||||||
|
if (data == "\"Lalala\"") {
|
||||||
|
throw new Exception("Problem mit Token");
|
||||||
|
}
|
||||||
|
if (data == null) {
|
||||||
|
throw new Exception("Keine Daten erhalten");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ObservableCollection<DayTime> daytimes = System.Text.Json.JsonSerializer.Deserialize<ObservableCollection<DayTime>>(data) ?? throw new Exception("Fehler beim Deserialisieren der Daten");
|
||||||
|
//daytimes = JsonConvert.DeserializeObject<List<DayTime>>(data);
|
||||||
|
//List<DayTime> daytimes = JsonConvert.DeserializeObject<List<DayTime>>(data) ?? throw new Exception("Fehler beim Deserialisieren der Daten");
|
||||||
|
|
||||||
return daytimes;
|
return daytimes;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -7,38 +7,38 @@ namespace Jugenddienst_Stunden.Types;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class DayTime {
|
public class DayTime {
|
||||||
public int? id { get; set; }
|
public int? id { get; set; }
|
||||||
public int? EmployeeId { get; set; }
|
public int EmployeeId { get; set; }
|
||||||
public DateTime day { get; set; }
|
public DateTime day { get; set; }
|
||||||
public int? wday { get; set; }
|
public int wday { get; set; }
|
||||||
public TimeOnly begin { get; set; }
|
public TimeOnly begin { get; set; }
|
||||||
public TimeOnly end { get; set; }
|
public TimeOnly end { get; set; }
|
||||||
public string? description { get; set; }
|
public string description { get; set; }
|
||||||
public string? free { get; set; }
|
public string? free { get; set; }
|
||||||
public bool? approved { get; set; }
|
public bool? approved { get; set; }
|
||||||
public int? type { get; set; }
|
public int? type { get; set; }
|
||||||
public int? projekt { get; set; }
|
public int? projekt { get; set; }
|
||||||
public int? gemeinde { get; set; }
|
public int? gemeinde { get; set; }
|
||||||
public TimeOnly? night { get; set; }
|
public TimeOnly night { get; set; }
|
||||||
public Dictionary<string, TimeOnly>? total { get; set; }
|
public Dictionary<string, TimeOnly> total { get; set; }
|
||||||
public TimeOnly? end_print { get; set; }
|
public TimeOnly end_print { get; set; }
|
||||||
public TimeSpan? TimeSpanVon { get; set; }
|
public TimeSpan TimeSpanVon { get; set; }
|
||||||
public TimeSpan? TimeSpanBis { get; set; }
|
public TimeSpan TimeSpanBis { get; set; }
|
||||||
public Collection<Projekt>? Projekte { get; set; }
|
public Collection<Projekt> Projekte { get; set; }
|
||||||
public Collection<Gemeinde>? Gemeinden { get; set; }
|
public Collection<Gemeinde> Gemeinden { get; set; }
|
||||||
public Collection<Freistellung>? Freistellungen { get; set; }
|
public Collection<Freistellung> Freistellungen { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the active Gemeinde based on the gemeinde ID.
|
/// Gets the active Gemeinde based on the gemeinde ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Gemeinde? GemeindeAktiv { get; set; }
|
public Gemeinde GemeindeAktiv { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the active Projekt based on the projekt ID.
|
/// Gets the active Projekt based on the projekt ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Projekt? ProjektAktiv { get; set; }
|
public Projekt ProjektAktiv { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the active Freistellung based on the Freistellung ID
|
/// Gets the active Freistellung based on the Freistellung ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Freistellung? FreistellungAktiv { get; set; }
|
public Freistellung FreistellungAktiv { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class Hours : ObservableObject {
|
|||||||
//public Dictionary<int,decimal> zeit_total_daily;
|
//public Dictionary<int,decimal> zeit_total_daily;
|
||||||
|
|
||||||
public List<TimeDay> zeit_total_daily_api;
|
public List<TimeDay> zeit_total_daily_api;
|
||||||
public List<DayTime> daytime;
|
public List<DayTime>? daytime;
|
||||||
//public List<string> wochensumme;
|
//public List<string> wochensumme;
|
||||||
public string overtime_month;
|
public string overtime_month;
|
||||||
public string overtime;
|
public string overtime;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ internal class StundeViewModel : ObservableObject, IQueryAttributable {
|
|||||||
public ObservableCollection<Gemeinde> OptionsGemeinde { get; private set; }
|
public ObservableCollection<Gemeinde> OptionsGemeinde { get; private set; }
|
||||||
public ObservableCollection<Projekt> OptionsProjekt { get; private set; }
|
public ObservableCollection<Projekt> OptionsProjekt { get; private set; }
|
||||||
public ObservableCollection<Freistellung> OptionsFreistellung { get; private set; }
|
public ObservableCollection<Freistellung> OptionsFreistellung { get; private set; }
|
||||||
|
public ObservableCollection<DayTime> DayTimes { get; set; }
|
||||||
|
|
||||||
//private Gemeinde _selectedGemeinde;
|
//private Gemeinde _selectedGemeinde;
|
||||||
public Gemeinde SelectedOptionGemeinde {
|
public Gemeinde SelectedOptionGemeinde {
|
||||||
@@ -62,7 +63,7 @@ internal class StundeViewModel : ObservableObject, IQueryAttributable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DayTime> DayTimes { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public ICommand SaveCommand { get; private set; }
|
public ICommand SaveCommand { get; private set; }
|
||||||
@@ -78,7 +79,6 @@ internal class StundeViewModel : ObservableObject, IQueryAttributable {
|
|||||||
//DeleteCommand = new AsyncRelayCommand(Delete);
|
//DeleteCommand = new AsyncRelayCommand(Delete);
|
||||||
DeleteConfirmCommand = new Command(async () => await DeleteConfirm());
|
DeleteConfirmCommand = new Command(async () => await DeleteConfirm());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public StundeViewModel(DayTime stunde) {
|
public StundeViewModel(DayTime stunde) {
|
||||||
|
|||||||
@@ -1,89 +1,72 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using System.Windows.Input;
|
using Jugenddienst_Stunden.Types;
|
||||||
using Microsoft.Maui.Controls;
|
|
||||||
using Microsoft.Maui.Networking;
|
|
||||||
using ZXing.Net.Maui;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using Jugenddienst_Stunden.Types;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Globalization;
|
using System.Windows.Input;
|
||||||
using System;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Jugenddienst_Stunden.ViewModels;
|
namespace Jugenddienst_Stunden.ViewModels;
|
||||||
internal class StundenViewModel : ObservableObject, IQueryAttributable {
|
internal class StundenViewModel : ObservableObject, IQueryAttributable, INotifyPropertyChanged {
|
||||||
public string Name => AppInfo.Name;
|
public string Name => AppInfo.Name;
|
||||||
public string Surname => AppInfo.VersionString;
|
public string Surname => AppInfo.VersionString;
|
||||||
public string MoreInfoUrl => "https://aka.ms/maui";
|
public string MoreInfoUrl => "https://aka.ms/maui";
|
||||||
public string Message => "Hier werden deine geleisteten Arbeitsstunden aufgelistet";
|
public string Message => "Hier werden deine geleisteten Arbeitsstunden aufgelistet";
|
||||||
public string LoadOverview => "Lade Summen für " + DateTime.Today.ToString("MMMM");
|
public string LoadOverview => "Lade Summen für " + DateTime.Today.ToString("MMMM");
|
||||||
public static DateTime GetDay = DateTime.Today;
|
public static DateTime GetDay = DateTime.Today;
|
||||||
public string ShowDay => "Zeit an Tag " + GetDay.ToString("ddd d. MMM") + ": ";
|
//public string ShowDay => "Zeit an Tag " + GetDay.ToString("ddd d. MMM") + ": ";
|
||||||
|
|
||||||
public int id { get; set; }
|
|
||||||
public ICommand NewEntryCommand { get; }
|
public ICommand NewEntryCommand { get; }
|
||||||
public ICommand SelectEntryCommand { get; }
|
public ICommand SelectEntryCommand { get; }
|
||||||
|
|
||||||
public ICommand LoadDataCommand { get; private set; }
|
public ICommand LoadDataCommand { get; private set; }
|
||||||
|
|
||||||
public event EventHandler<string> AlertEvent;
|
public event EventHandler<string> AlertEvent;
|
||||||
public event EventHandler<string> InfoEvent;
|
public event EventHandler<string> InfoEvent;
|
||||||
|
|
||||||
|
|
||||||
public object Stunden { get; }
|
private string _title = Preferences.Default.Get("name", "") + " " + Preferences.Default.Get("surname", "");
|
||||||
|
public string Title {
|
||||||
|
get => _title;
|
||||||
private List<DayTime> _stunde;
|
set => SetProperty(ref _title, value);
|
||||||
public List<DayTime> Stunde {
|
|
||||||
get => _stunde;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Hours _hour;
|
private Hours _hour;
|
||||||
public Hours Hours {
|
public Hours Hours {
|
||||||
get => _hour;
|
get => _hour;
|
||||||
}
|
}
|
||||||
public string ZeitDone {
|
|
||||||
get => _hour.zeit;
|
|
||||||
}
|
|
||||||
public string ZeitCalculated {
|
|
||||||
get => _hour.zeit_total;
|
|
||||||
}
|
|
||||||
public string Nominal {
|
|
||||||
get => _hour.nominal;
|
|
||||||
}
|
|
||||||
public string Overtime {
|
|
||||||
get => _hour.overtime;
|
|
||||||
}
|
|
||||||
public string OvertimeMonth {
|
|
||||||
get => _hour.overtime_month;
|
|
||||||
}
|
|
||||||
public string Holiday {
|
|
||||||
get => _hour.holiday;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gesamtstunden an einem Tag
|
||||||
|
/// </summary>
|
||||||
public TimeOnly DayTotal { get; set; }
|
public TimeOnly DayTotal { get; set; }
|
||||||
|
|
||||||
public List<DayTime> DayTimes {
|
/// <summary>
|
||||||
get => _hour.daytime;
|
/// Liste der Tageszeiten
|
||||||
set {
|
/// </summary>
|
||||||
if (_hour.daytime != value) {
|
private ObservableCollection<DayTime> _dayTimes = new ObservableCollection<DayTime>();
|
||||||
_hour.daytime = value;
|
public ObservableCollection<DayTime> DayTimes {
|
||||||
OnPropertyChanged();
|
get => _dayTimes;
|
||||||
}
|
set => SetProperty(ref _dayTimes, value);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime MinimumDate {
|
/// <summary>
|
||||||
//get => _hour.MinDate;
|
/// Mindest-Datum für den Datepicker
|
||||||
//get => DateTime.Today.AddDays(-21);
|
/// </summary>
|
||||||
|
public static DateTime MinimumDate {
|
||||||
get => DateTime.Today.AddDays(-365);
|
get => DateTime.Today.AddDays(-365);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime MaximumDate {
|
/// <summary>
|
||||||
//get => _hour.MaxDate;
|
/// Höchst-Datum für den Datepicker
|
||||||
|
/// </summary>
|
||||||
|
public static DateTime MaximumDate {
|
||||||
get => DateTime.Today.AddDays(60);
|
get => DateTime.Today.AddDays(60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Heutiges Datum, wenn das Datum geändert wird, wird auch der Tag geladen
|
||||||
|
/// </summary>
|
||||||
private DateTime dateToday = DateTime.Today;
|
private DateTime dateToday = DateTime.Today;
|
||||||
public DateTime DateToday {
|
public DateTime DateToday {
|
||||||
get => dateToday;
|
get => dateToday;
|
||||||
@@ -91,62 +74,96 @@ internal class StundenViewModel : ObservableObject, IQueryAttributable {
|
|||||||
if (dateToday != value) {
|
if (dateToday != value) {
|
||||||
dateToday = value;
|
dateToday = value;
|
||||||
GetDay = value;
|
GetDay = value;
|
||||||
OnPropertyChanged();
|
//OnPropertyChanged();
|
||||||
_ = LoadDay(value); // Use discard operator to explicitly ignore the returned Task
|
_ = LoadDay(value);
|
||||||
//RefreshProperties();
|
|
||||||
OnPropertyChanged(nameof(TimeDay));
|
|
||||||
OnPropertyChanged(nameof(ShowDay));
|
|
||||||
OnPropertyChanged(nameof(DayTimes));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime Date {
|
/// <summary>
|
||||||
get => _hour.Date;
|
/// Monatsübersicht: Geleistete Stunden
|
||||||
|
/// </summary>
|
||||||
|
public string? ZeitCalculated {
|
||||||
|
get => _hour.zeit_total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
public List<TimeDay> ZeitTotalDaily {
|
/// Monatsübersicht: Sollstunden
|
||||||
get => _hour.zeit_total_daily_api;
|
/// </summary>
|
||||||
|
public string? Nominal {
|
||||||
|
get => _hour.nominal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Title { get; set; } = Preferences.Default.Get("name", "") + " " + Preferences.Default.Get("surname", "");
|
/// <summary>
|
||||||
|
/// Monatsübersicht: Differenz zwischen Soll und geleisteten Stunden
|
||||||
|
/// </summary>
|
||||||
|
public string? Overtime {
|
||||||
|
get => _hour.overtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Monatsübersicht: Restüberstunden insgesamt
|
||||||
|
/// </summary>
|
||||||
|
public string OvertimeMonth {
|
||||||
|
get => _hour.overtime_month;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Monatsübersicht: Resturlaub
|
||||||
|
/// </summary>
|
||||||
|
public string Holiday {
|
||||||
|
get => _hour.holiday;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public List<TimeDay> TimeDay { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public static string apiKey = Preferences.Default.Get("apiKey", "");
|
/// <summary>
|
||||||
|
/// CTOR
|
||||||
|
/// </summary>
|
||||||
public StundenViewModel() {
|
public StundenViewModel() {
|
||||||
|
|
||||||
|
|
||||||
_hour = new Types.Hours();
|
_hour = new Types.Hours();
|
||||||
LoadDataCommand = new AsyncRelayCommand(LoadData);
|
LoadDataCommand = new AsyncRelayCommand(LoadData);
|
||||||
|
|
||||||
NewEntryCommand = new AsyncRelayCommand(NewEntryAsync);
|
NewEntryCommand = new AsyncRelayCommand(NewEntryAsync);
|
||||||
SelectEntryCommand = new AsyncRelayCommand<DayTime>(SelectEntryAsync);
|
SelectEntryCommand = new AsyncRelayCommand<DayTime>(SelectEntryAsync);
|
||||||
|
|
||||||
_ = LoadDay(DateTime.Today);
|
Task task = LoadDay(DateTime.Today);
|
||||||
OnPropertyChanged(nameof(DayTimes));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Öffnet eine neue Stundeneingabe
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
private async Task NewEntryAsync() {
|
private async Task NewEntryAsync() {
|
||||||
//Hier muss das Datum übergeben werden
|
//Hier muss das Datum übergeben werden
|
||||||
//await Shell.Current.GoToAsync(nameof(Views.StundePage));
|
//await Shell.Current.GoToAsync(nameof(Views.StundePage));
|
||||||
await Shell.Current.GoToAsync($"{nameof(Views.StundePage)}?date={dateToday.ToString("yyyy-MM-dd")}");
|
await Shell.Current.GoToAsync($"{nameof(Views.StundePage)}?date={dateToday:yyyy-MM-dd}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Öffnet eine bestehende Stundeneingabe
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entry"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private async Task SelectEntryAsync(DayTime entry) {
|
private async Task SelectEntryAsync(DayTime entry) {
|
||||||
if (entry != null && entry.id != null) {
|
if (entry != null && entry.id != null) {
|
||||||
var navigationParameters = new Dictionary<string, object> {{ "load", entry.id }};
|
var navigationParameters = new Dictionary<string, object> { { "load", entry.id } };
|
||||||
//await Shell.Current.GoToAsync($"{nameof(Views.StundePage)}?load={entry.id}");
|
//await Shell.Current.GoToAsync($"{nameof(Views.StundePage)}?load={entry.id}");
|
||||||
await Shell.Current.GoToAsync($"{nameof(Views.StundePage)}", navigationParameters);
|
await Shell.Current.GoToAsync($"{nameof(Views.StundePage)}", navigationParameters);
|
||||||
} else AlertEvent?.Invoke(this, "Auswahl enthält keine Daten");
|
} else AlertEvent?.Invoke(this, "Auswahl enthält keine Daten");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Lädt die Monatssummen für die Übersicht
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
private async Task LoadData() {
|
private async Task LoadData() {
|
||||||
try {
|
try {
|
||||||
_hour = await Models.Stunde.LoadData();
|
_hour = await Models.Stunde.LoadData();
|
||||||
@@ -156,54 +173,67 @@ internal class StundenViewModel : ObservableObject, IQueryAttributable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Lädt die Arbeitszeiten für einen Tag
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="date"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public async Task LoadDay(DateTime date) {
|
public async Task LoadDay(DateTime date) {
|
||||||
try {
|
DayTotal = new TimeOnly(0);
|
||||||
_hour.daytime = await Models.Stunde.LoadDay(date);
|
|
||||||
////if (_hour.zeit_total_daily_api != null) {
|
|
||||||
////TimeDay = _hour.zeit_total_daily_api.Where(static p => p.Day == GetDay.Day).ToList() ?? new List<TimeDay> { new TimeDay { Day = GetDay.Day, Hours = 0 } };
|
|
||||||
//RefreshProperties();
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
DayTimes = await Models.Stunde.LoadDay(date);
|
||||||
|
|
||||||
|
//TODO: Hier muss noch die Berechnung der Stunden erfolgen
|
||||||
//Hier werden im Moment noch nur die eingetragenen Stunden gezählt
|
//Hier werden im Moment noch nur die eingetragenen Stunden gezählt
|
||||||
//Auf der Website bekommt der Benutzer die berechneten Stunden angezeigt (Nachstunden außerhalb des Stundenplanes zählen mehr ...)
|
//Auf der Website bekommt der Benutzer die berechneten Stunden angezeigt (Nachstunden außerhalb des Stundenplanes zählen mehr ...)
|
||||||
|
|
||||||
TimeSpan span = TimeSpan.Zero;
|
TimeSpan span = TimeSpan.Zero;
|
||||||
foreach (DayTime dt in _hour.daytime) {
|
foreach (DayTime dt in DayTimes) {
|
||||||
span += dt.end - dt.begin;
|
span += dt.end - dt.begin;
|
||||||
}
|
}
|
||||||
DayTotal = TimeOnly.FromTimeSpan(span);
|
DayTotal = TimeOnly.FromTimeSpan(span);
|
||||||
OnPropertyChanged(nameof(ShowDay));
|
|
||||||
OnPropertyChanged(nameof(TimeDay));
|
} catch (Exception e) {
|
||||||
|
DayTimes = new ObservableCollection<DayTime>();
|
||||||
|
//TODO: hier könnte auch ein Fehler kommen, dann wäre InfoEvent falsch.
|
||||||
|
InfoEvent?.Invoke(this, e.Message);
|
||||||
|
} finally {
|
||||||
OnPropertyChanged(nameof(DayTotal));
|
OnPropertyChanged(nameof(DayTotal));
|
||||||
OnPropertyChanged(nameof(DayTimes));
|
OnPropertyChanged(nameof(DayTimes));
|
||||||
////}
|
|
||||||
} catch (Exception e) {
|
|
||||||
DayTimes = new List<DayTime>();
|
|
||||||
DayTotal = new TimeOnly(0);
|
|
||||||
OnPropertyChanged(nameof(DayTotal));
|
|
||||||
InfoEvent?.Invoke(this, e.Message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async void IQueryAttributable.ApplyQueryAttributes(IDictionary<string, object> query) {
|
async void IQueryAttributable.ApplyQueryAttributes(IDictionary<string, object> query) {
|
||||||
if (query.ContainsKey("date")) {
|
if (query.ContainsKey("date")) {
|
||||||
await LoadDay(Convert.ToDateTime(query["date"]));
|
await LoadDay(Convert.ToDateTime(query["date"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Refreshes all properties
|
||||||
|
/// </summary>
|
||||||
private void RefreshProperties() {
|
private void RefreshProperties() {
|
||||||
OnPropertyChanged(nameof(Nominal));
|
OnPropertyChanged(nameof(Nominal));
|
||||||
OnPropertyChanged(nameof(Overtime));
|
OnPropertyChanged(nameof(Overtime));
|
||||||
OnPropertyChanged(nameof(OvertimeMonth));
|
OnPropertyChanged(nameof(OvertimeMonth));
|
||||||
OnPropertyChanged(nameof(ZeitCalculated));
|
OnPropertyChanged(nameof(ZeitCalculated));
|
||||||
OnPropertyChanged(nameof(ZeitDone));
|
|
||||||
OnPropertyChanged(nameof(Holiday));
|
OnPropertyChanged(nameof(Holiday));
|
||||||
OnPropertyChanged(nameof(Hours));
|
OnPropertyChanged(nameof(Hours));
|
||||||
OnPropertyChanged(nameof(Title));
|
OnPropertyChanged(nameof(Title));
|
||||||
OnPropertyChanged(nameof(ZeitTotalDaily));
|
|
||||||
OnPropertyChanged(nameof(TimeDay));
|
|
||||||
OnPropertyChanged(nameof(MinimumDate));
|
OnPropertyChanged(nameof(MinimumDate));
|
||||||
OnPropertyChanged(nameof(MaximumDate));
|
OnPropertyChanged(nameof(MaximumDate));
|
||||||
OnPropertyChanged(nameof(ShowDay));
|
}
|
||||||
//OnPropertyChanged(nameof(DateToday));
|
|
||||||
|
protected void OnPropertyChanged([CallerMemberName] string propertyName = null) {
|
||||||
|
try {
|
||||||
|
base.OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
|
||||||
|
} catch (Exception ex) {
|
||||||
|
AlertEvent?.Invoke(this, ex.Message);
|
||||||
|
//Console.WriteLine($"Fehler bei OnPropertyChanged: {ex.Message}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,10 +46,7 @@
|
|||||||
|
|
||||||
<CollectionView.ItemTemplate>
|
<CollectionView.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
|
|
||||||
|
|
||||||
<Grid Padding="5,10,5,0">
|
<Grid Padding="5,10,5,0">
|
||||||
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
<VisualStateManager.VisualStateGroups>
|
||||||
<VisualStateGroup Name="CommonStates">
|
<VisualStateGroup Name="CommonStates">
|
||||||
<VisualState Name="Normal">
|
<VisualState Name="Normal">
|
||||||
@@ -84,7 +81,6 @@
|
|||||||
</HorizontalStackLayout>
|
</HorizontalStackLayout>
|
||||||
|
|
||||||
<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding description}" Padding="0,0,0,15"/>
|
<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding description}" Padding="0,0,0,15"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</CollectionView.ItemTemplate>
|
</CollectionView.ItemTemplate>
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ using Jugenddienst_Stunden.ViewModels;
|
|||||||
|
|
||||||
namespace Jugenddienst_Stunden.Views;
|
namespace Jugenddienst_Stunden.Views;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Code-Behind f<>r die Stunden-<2D>bersicht
|
||||||
|
/// </summary>
|
||||||
public partial class StundenPage : ContentPage {
|
public partial class StundenPage : ContentPage {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user