Get Freistellung to work
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
|
||||
|
||||
namespace Jugenddienst_Stunden {
|
||||
public partial class App : Application {
|
||||
public App() {
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
|
||||
MainPage = new AppShell();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//protected override Window CreateWindow(IActivationState activationState) =>
|
||||
//new Window(new AppShell()) {
|
||||
// Width = 500,
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
<ApplicationId>com.danielpichler.jugenddienststunden</ApplicationId>
|
||||
<ApplicationDisplayVersion>1.0.1</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>2</ApplicationVersion>
|
||||
<DefineConstants>$(DefineConstants);DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android34.0|AnyCPU'">
|
||||
@@ -100,6 +101,7 @@
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-windows10.0.19041.0|AnyCPU'">
|
||||
<ApplicationVersion>2</ApplicationVersion>
|
||||
<DefineConstants>$(DefineConstants);DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-windows10.0.19041.0|AnyCPU'">
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
//using BarcodeScanning;
|
||||
|
||||
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Maui.LifecycleEvents;
|
||||
using ZXing.Net.Maui.Controls;
|
||||
|
||||
@@ -11,8 +11,6 @@ namespace Jugenddienst_Stunden.Models {
|
||||
|
||||
class Auth {
|
||||
|
||||
public Hours hours;
|
||||
|
||||
|
||||
public static async Task<string> GetApiDataWithAuthAsync(string url, string token) {
|
||||
// Erstellen eines HttpClient-Objekts
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Jugenddienst_Stunden.Models {
|
||||
internal class Stunde : ObservableObject {
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
private static Hours Hours { get; set; }
|
||||
|
||||
//Default-Werte zum Testen
|
||||
|
||||
|
||||
19
Jugenddienst Stunden/Types/Base.cs
Normal file
19
Jugenddienst Stunden/Types/Base.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jugenddienst_Stunden.Types {
|
||||
public class Base {
|
||||
public Collection<Projekt> Projekte { get; set; }
|
||||
public Collection<Gemeinde> Gemeinden { get; set; }
|
||||
public Collection<Freistellung> Freistellungen { get; set; }
|
||||
public int EmployeeId { get; set; }
|
||||
|
||||
public Hours Hours { get; set; }
|
||||
public List<DayTime> daytime { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Jugenddienst_Stunden.Types {
|
||||
public class Freistellung {
|
||||
public string Identifier { get; set; }
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,9 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
public DayTime Stunde { get => _stunde; }
|
||||
|
||||
|
||||
|
||||
public event EventHandler<string> AlertEvent;
|
||||
public event EventHandler<string> InfoEvent;
|
||||
|
||||
public Collection<Projekt> Projekte { get; set; }
|
||||
public Collection<Gemeinde> Gemeinden { get; set; }
|
||||
public Collection<Freistellung> Freistellungen { get; set; }
|
||||
|
||||
public ObservableCollection<Gemeinde> OptionsGemeinde { get; private set; }
|
||||
public ObservableCollection<Projekt> OptionsProjekt { get; private set; }
|
||||
@@ -58,7 +54,7 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
}
|
||||
}
|
||||
|
||||
//private string selectedFreistellung;
|
||||
//private Freistellung _selectedFreistellung;
|
||||
public Freistellung SelectedOptionFreistellung {
|
||||
get => _stunde.FreistellungAktiv;
|
||||
set {
|
||||
@@ -80,12 +76,10 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
public StundeViewModel() {
|
||||
_stunde = new DayTime();
|
||||
|
||||
|
||||
SaveCommand = new AsyncRelayCommand(Save);
|
||||
DeleteCommand = new AsyncRelayCommand(Delete);
|
||||
|
||||
|
||||
_ = LoadData();
|
||||
}
|
||||
|
||||
public StundeViewModel(DayTime stunde) {
|
||||
@@ -152,7 +146,7 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
SelectedOptionProjekt = OptionsProjekt.FirstOrDefault(Projekt => Projekt.Id == _stunde.projekt) ?? new Projekt();
|
||||
OnPropertyChanged(nameof(SelectedOptionProjekt));
|
||||
|
||||
SelectedOptionFreistellung = OptionsFreistellung.FirstOrDefault(Freistellung => Freistellung.Identifier == _stunde.free) ?? new Freistellung();
|
||||
SelectedOptionFreistellung = OptionsFreistellung.FirstOrDefault(Freistellung => Freistellung.Id == _stunde.free) ?? new Freistellung();
|
||||
OnPropertyChanged(nameof(SelectedOptionFreistellung));
|
||||
|
||||
OnPropertyChanged(nameof(Stunde));
|
||||
@@ -162,6 +156,7 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
if (query.ContainsKey("date")) {
|
||||
SubTitle = DateTime.ParseExact((string)query["date"], "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture).ToString("dddd, d. MMM. yyyy");
|
||||
_stunde.day = DateTime.ParseExact((string)query["date"], "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
|
||||
_ = LoadData();
|
||||
OnPropertyChanged(nameof(SubTitle));
|
||||
}
|
||||
|
||||
|
||||
@@ -142,11 +142,6 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private async Task LoadData() {
|
||||
try {
|
||||
_hour = await Models.Stunde.LoadData();
|
||||
@@ -156,7 +151,7 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadDay(DateTime date) {
|
||||
public async Task LoadDay(DateTime date) {
|
||||
try {
|
||||
_hour.daytime = await Models.Stunde.LoadDay(date);
|
||||
////if (_hour.zeit_total_daily_api != null) {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
</Picker>
|
||||
<Picker x:Name="pick_projekt" Title="Projekt" ItemsSource="{Binding OptionsProjekt}" SelectedItem="{Binding SelectedOptionProjekt, Mode=TwoWay}" ItemDisplayBinding="{Binding Name}" Grid.Column="1" >
|
||||
</Picker>
|
||||
<Picker x:Name="pick_freistellung" Title="Freistellung" ItemsSource="{Binding OptionsFreistellung}" SelectedItem="{Binding SelectedOptionFreistellung, Mode=TwoWay}" Grid.Column="2" >
|
||||
<Picker x:Name="pick_freistellung" Title="Freistellung" ItemsSource="{Binding OptionsFreistellung}" SelectedItem="{Binding SelectedOptionFreistellung, Mode=TwoWay}" ItemDisplayBinding="{Binding Name}" Grid.Column="2" >
|
||||
</Picker>
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
<Label Text="{Binding end}"/>
|
||||
<Label Text="{Binding GemeindeAktiv.Name}" Margin="10,0,0,0"/>
|
||||
<Label Text="{Binding ProjektAktiv.Name}" Margin="10,0,0,0"/>
|
||||
<Label Text="{Binding FreistellungAktiv.Name}" Margin="10,0,0,0"/>
|
||||
</HorizontalStackLayout>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding description}" Padding="0,0,0,15"/>
|
||||
@@ -63,10 +64,8 @@
|
||||
|
||||
</CollectionView>
|
||||
|
||||
|
||||
<BoxView HeightRequest="1" Color="Red"/>
|
||||
|
||||
|
||||
<Button Text="{Binding LoadOverview}" Command="{Binding LoadDataCommand}" />
|
||||
|
||||
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,*" ColumnDefinitions="Auto,*" Margin="10">
|
||||
|
||||
Reference in New Issue
Block a user