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>
|
||||
/// Freistellung genehmigt?
|
||||
/// </summary>
|
||||
public bool? Approved { get; set; }
|
||||
public bool Approved { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -91,4 +91,6 @@ public class DayTime {
|
||||
/// </summary>
|
||||
public Freistellung? FreistellungAktiv { get; set; }
|
||||
|
||||
public int TimeTable { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -28,4 +28,6 @@ public class Settings {
|
||||
/// Liste der Freistellungen
|
||||
/// </summary>
|
||||
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>
|
||||
public bool ProjektAktivSet { get; set; }
|
||||
|
||||
public bool FreistellungEnabled { get; 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();
|
||||
|
||||
FreistellungEnabled = !_dayTime.Approved;
|
||||
|
||||
OnPropertyChanged(nameof(FreistellungEnabled));
|
||||
OnPropertyChanged(nameof(DayTime));
|
||||
|
||||
OnPropertyChanged(nameof(SubTitle));
|
||||
|
||||
@@ -31,7 +31,7 @@ internal class StundenViewModel : ObservableObject, IQueryAttributable, INotifyP
|
||||
private HoursBase HoursBase = new HoursBase();
|
||||
internal Settings Settings = new Settings();
|
||||
|
||||
|
||||
public TimeOnly Sollstunden { get; set; }
|
||||
|
||||
private string _title = HoursBase.name + " " + HoursBase.surname;
|
||||
public string Title {
|
||||
@@ -226,22 +226,31 @@ internal class StundenViewModel : ObservableObject, IQueryAttributable, INotifyP
|
||||
try {
|
||||
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;
|
||||
bool merker = false;
|
||||
foreach (DayTime dt in DayTimes) {
|
||||
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);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
DayTimes = new List<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(Sollstunden));
|
||||
//OnPropertyChanged(nameof(DayTimes));
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</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>
|
||||
<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>
|
||||
</Grid>
|
||||
</Frame>
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
<Grid ColumnDefinitions="*,*" ColumnSpacing="4">
|
||||
<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>
|
||||
|
||||
<BoxView HeightRequest="1" Margin="5,10"/>
|
||||
|
||||
@@ -30,7 +30,11 @@
|
||||
MaximumDate="{Binding MaximumDate}"
|
||||
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">
|
||||
<Label Text="{Binding DayTotal,StringFormat='{}{0:HH:mm}'}" VerticalOptions="Center"></Label>
|
||||
<HorizontalStackLayout>
|
||||
<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>
|
||||
</Grid>
|
||||
|
||||
@@ -89,7 +93,7 @@
|
||||
|
||||
</CollectionView>
|
||||
|
||||
<BoxView HeightRequest="1" />
|
||||
<BoxView HeightRequest="1" />
|
||||
|
||||
<Button Text="{Binding LoadOverview}" Command="{Binding LoadDataCommand}" />
|
||||
<Frame Padding="2" HeightRequest="125">
|
||||
@@ -111,7 +115,7 @@
|
||||
</Frame>
|
||||
|
||||
|
||||
</VerticalStackLayout>
|
||||
</VerticalStackLayout>
|
||||
|
||||
</RefreshView>
|
||||
</ContentPage>
|
||||
Reference in New Issue
Block a user