Diverse Änderungen
Sollstunden werden jetzt angezeigt. Genehmigte Freistellungen können nicht mehr geändert werden Projekte und Gemeinden werden ausgeblendet, sofern vom Portal so vorgesehen. etc.
This commit is contained in:
@@ -49,7 +49,7 @@ public class DayTime {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Freistellung genehmigt?
|
/// Freistellung genehmigt?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? Approved { get; set; }
|
public bool Approved { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -91,4 +91,6 @@ public class DayTime {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Freistellung? FreistellungAktiv { get; set; }
|
public Freistellung? FreistellungAktiv { get; set; }
|
||||||
|
|
||||||
|
public int TimeTable { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,4 +28,6 @@ public class Settings {
|
|||||||
/// Liste der Freistellungen
|
/// Liste der Freistellungen
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<Freistellung>? Freistellungen { get; set; }
|
public List<Freistellung>? Freistellungen { get; set; }
|
||||||
|
|
||||||
|
public List<Sollstunden> Nominal { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
7
Jugenddienst Stunden/Types/Sollstunden.cs
Normal file
7
Jugenddienst Stunden/Types/Sollstunden.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Jugenddienst_Stunden.Types;
|
||||||
|
|
||||||
|
public class Sollstunden {
|
||||||
|
public int Timetable { get; set; }
|
||||||
|
public int Wochentag { get; set; }
|
||||||
|
public float Zeit { get; set; }
|
||||||
|
}
|
||||||
@@ -64,6 +64,8 @@ public class StundeViewModel : ObservableObject, IQueryAttributable {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ProjektAktivSet { get; set; }
|
public bool ProjektAktivSet { get; set; }
|
||||||
|
|
||||||
|
public bool FreistellungEnabled { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ICommand SaveCommand { get; private set; }
|
public ICommand SaveCommand { get; private set; }
|
||||||
@@ -178,6 +180,9 @@ public class StundeViewModel : ObservableObject, IQueryAttributable {
|
|||||||
|
|
||||||
_dayTime.FreistellungAktiv = OptionsFreistellung.FirstOrDefault(Freistellung => Freistellung.Id == DayTime.Free) ?? new Freistellung();
|
_dayTime.FreistellungAktiv = OptionsFreistellung.FirstOrDefault(Freistellung => Freistellung.Id == DayTime.Free) ?? new Freistellung();
|
||||||
|
|
||||||
|
FreistellungEnabled = !_dayTime.Approved;
|
||||||
|
|
||||||
|
OnPropertyChanged(nameof(FreistellungEnabled));
|
||||||
OnPropertyChanged(nameof(DayTime));
|
OnPropertyChanged(nameof(DayTime));
|
||||||
|
|
||||||
OnPropertyChanged(nameof(SubTitle));
|
OnPropertyChanged(nameof(SubTitle));
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ internal class StundenViewModel : ObservableObject, IQueryAttributable, INotifyP
|
|||||||
private HoursBase HoursBase = new HoursBase();
|
private HoursBase HoursBase = new HoursBase();
|
||||||
internal Settings Settings = new Settings();
|
internal Settings Settings = new Settings();
|
||||||
|
|
||||||
|
public TimeOnly Sollstunden { get; set; }
|
||||||
|
|
||||||
private string _title = HoursBase.name + " " + HoursBase.surname;
|
private string _title = HoursBase.name + " " + HoursBase.surname;
|
||||||
public string Title {
|
public string Title {
|
||||||
@@ -226,22 +226,31 @@ internal class StundenViewModel : ObservableObject, IQueryAttributable, INotifyP
|
|||||||
try {
|
try {
|
||||||
DayTimes = await HoursBase.LoadDay(date);
|
DayTimes = await HoursBase.LoadDay(date);
|
||||||
|
|
||||||
//TODO: Hier muss noch die Berechnung der Stunden erfolgen
|
|
||||||
//Es werden im Moment nur die eingetragenen Stunden gezählt
|
|
||||||
//Auf der Website bekommt der Benutzer hingegen die berechneten Stunden angezeigt (Nachstunden außerhalb des Stundenplanes zählen mehr ...)
|
|
||||||
|
|
||||||
|
List<Sollstunden> _soll;
|
||||||
TimeSpan span = TimeSpan.Zero;
|
TimeSpan span = TimeSpan.Zero;
|
||||||
|
bool merker = false;
|
||||||
foreach (DayTime dt in DayTimes) {
|
foreach (DayTime dt in DayTimes) {
|
||||||
span += dt.End - dt.Begin;
|
span += dt.End - dt.Begin;
|
||||||
|
//Nachtstunden dazurechnen
|
||||||
|
if (dt.Night.Ticks > 0 && !merker) {
|
||||||
|
span += dt.Night.ToTimeSpan() * .5;
|
||||||
|
merker = true;
|
||||||
|
}
|
||||||
|
_soll = Settings.Nominal.Where(w => w.Timetable == dt.TimeTable && w.Wochentag == dt.Wday).ToList();
|
||||||
|
if (_soll.Count > 0)
|
||||||
|
Sollstunden = TimeOnly.FromTimeSpan(TimeSpan.FromHours(_soll[0].Zeit));
|
||||||
}
|
}
|
||||||
DayTotal = TimeOnly.FromTimeSpan(span);
|
DayTotal = TimeOnly.FromTimeSpan(span);
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
DayTimes = new List<DayTime>();
|
DayTimes = new List<DayTime>();
|
||||||
//TODO: hier könnte auch ein Fehler kommen, dann wäre InfoEvent falsch.
|
//TODO: hier könnte auch ein Fehler kommen, dann wäre InfoEvent falsch.
|
||||||
InfoEvent?.Invoke(this, e.Message);
|
InfoEvent?.Invoke(this, e.Message);
|
||||||
} finally {
|
} finally {
|
||||||
OnPropertyChanged(nameof(DayTotal));
|
OnPropertyChanged(nameof(DayTotal));
|
||||||
|
OnPropertyChanged(nameof(Sollstunden));
|
||||||
//OnPropertyChanged(nameof(DayTimes));
|
//OnPropertyChanged(nameof(DayTimes));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
</Picker>
|
</Picker>
|
||||||
<Picker x:Name="pick_projekt" Title="Projekt" ItemsSource="{Binding OptionsProjekt}" SelectedItem="{Binding DayTime.ProjektAktiv, Mode=TwoWay}" ItemDisplayBinding="{Binding Name}" Grid.Column="1" IsVisible="{Binding ProjektAktivSet}">
|
<Picker x:Name="pick_projekt" Title="Projekt" ItemsSource="{Binding OptionsProjekt}" SelectedItem="{Binding DayTime.ProjektAktiv, Mode=TwoWay}" ItemDisplayBinding="{Binding Name}" Grid.Column="1" IsVisible="{Binding ProjektAktivSet}">
|
||||||
</Picker>
|
</Picker>
|
||||||
<Picker x:Name="pick_freistellung" Title="Freistellung" ItemsSource="{Binding OptionsFreistellung}" SelectedItem="{Binding DayTime.FreistellungAktiv, Mode=TwoWay}" ItemDisplayBinding="{Binding Name}" Grid.Column="2" >
|
<Picker x:Name="pick_freistellung" Title="Freistellung" ItemsSource="{Binding OptionsFreistellung}" SelectedItem="{Binding DayTime.FreistellungAktiv, Mode=TwoWay}" ItemDisplayBinding="{Binding Name}" Grid.Column="2" IsEnabled="{Binding FreistellungEnabled}">
|
||||||
</Picker>
|
</Picker>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Frame>
|
</Frame>
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
<Grid ColumnDefinitions="*,*" ColumnSpacing="4">
|
<Grid ColumnDefinitions="*,*" ColumnSpacing="4">
|
||||||
<Button Text="Speichern" Command="{Binding SaveCommand}" />
|
<Button Text="Speichern" Command="{Binding SaveCommand}" />
|
||||||
<Button Grid.Column="1" Text="Löschen" Command="{Binding DeleteConfirmCommand}" IsEnabled="{Binding DayTime.Id, Converter={StaticResource IntBoolConverter}}" />
|
<Button Grid.Column="1" Text="Löschen" Command="{Binding DeleteConfirmCommand}" IsEnabled="{Binding DayTime.Id, Converter={StaticResource IntBoolConverter}}" IsVisible="{Binding FreistellungEnabled}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<BoxView HeightRequest="1" Margin="5,10"/>
|
<BoxView HeightRequest="1" Margin="5,10"/>
|
||||||
|
|||||||
@@ -30,7 +30,11 @@
|
|||||||
MaximumDate="{Binding MaximumDate}"
|
MaximumDate="{Binding MaximumDate}"
|
||||||
Date="{Binding DateToday}" Format="dddd, d. MMMM yyyy" />
|
Date="{Binding DateToday}" Format="dddd, d. MMMM yyyy" />
|
||||||
<Border Grid.Column="1" Margin="15,0,0,0" Padding="15,0,0,0" ToolTipProperties.Text="Tagessumme">
|
<Border Grid.Column="1" Margin="15,0,0,0" Padding="15,0,0,0" ToolTipProperties.Text="Tagessumme">
|
||||||
|
<HorizontalStackLayout>
|
||||||
<Label Text="{Binding DayTotal,StringFormat='{}{0:HH:mm}'}" VerticalOptions="Center"></Label>
|
<Label Text="{Binding DayTotal,StringFormat='{}{0:HH:mm}'}" VerticalOptions="Center"></Label>
|
||||||
|
<Label Text=" / " VerticalOptions="Center"></Label>
|
||||||
|
<Label Text="{Binding Sollstunden,StringFormat='{}{0:HH:mm}'}" VerticalOptions="Center"></Label>
|
||||||
|
</HorizontalStackLayout>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user