Detailseite Anpassungen

This commit is contained in:
2024-09-18 20:26:09 +02:00
parent cf89527585
commit d9cca07550
8 changed files with 64 additions and 46 deletions

View File

@@ -13,12 +13,7 @@
Icon="{OnPlatform 'icon_watch.png', iOS='icon_watch_ios.png', MacCatalyst='icon_watch_ios.png'}" /> Icon="{OnPlatform 'icon_watch.png', iOS='icon_watch_ios.png', MacCatalyst='icon_watch_ios.png'}" />
<ShellContent <ShellContent
Title="Stunde" Title="Notizen"
ContentTemplate="{DataTemplate views:StundePage}"
Icon="{OnPlatform 'icon_watch.png', iOS='icon_watch_ios.png', MacCatalyst='icon_watch_ios.png'}" />
<ShellContent
Title="Notes"
ContentTemplate="{DataTemplate views:AllNotesPage}" ContentTemplate="{DataTemplate views:AllNotesPage}"
Icon="{OnPlatform 'icon_notes.png', iOS='icon_notes_ios.png', MacCatalyst='icon_notes_ios.png'}" /> Icon="{OnPlatform 'icon_notes.png', iOS='icon_notes_ios.png', MacCatalyst='icon_notes_ios.png'}" />

View File

@@ -1,5 +1,6 @@
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using Jugenddienst_Stunden.Types;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -13,6 +14,8 @@ namespace Jugenddienst_Stunden.ViewModels {
public int id { get; set; } public int id { get; set; }
private Types.DayTime _stunde; private Types.DayTime _stunde;
public DayTime Stunde { get => _stunde; }
public string Description { public string Description {
get => _stunde.description; get => _stunde.description;
set { set {
@@ -56,9 +59,8 @@ namespace Jugenddienst_Stunden.ViewModels {
if (query.ContainsKey("load")) { if (query.ContainsKey("load")) {
//DateTime heute = DateTime.Now; //DateTime heute = DateTime.Now;
_stunde = await Models.Stunde.LoadEntry(Convert.ToInt32(query["load"])); _stunde = await Models.Stunde.LoadEntry(Convert.ToInt32(query["load"]));
//_stunde = await Models.Stunde.LoadData();
//_note = Models.Note.Load(query["load"].ToString()); OnPropertyChanged(nameof(Stunde));
//RefreshProperties();
} }
} }
} }

View File

@@ -25,7 +25,7 @@ namespace Jugenddienst_Stunden.ViewModels {
public ICommand LoadDataCommand { get; private set; } public ICommand LoadDataCommand { get; private set; }
public object Stunden { get; } public object Stunden { get; }
private List<DayTime> _stunde; private List<DayTime> _stunde;
public List<DayTime> Stunde { public List<DayTime> Stunde {
get => _stunde; get => _stunde;
@@ -74,7 +74,7 @@ namespace Jugenddienst_Stunden.ViewModels {
GetDay = value; GetDay = value;
OnPropertyChanged(); OnPropertyChanged();
_ = LoadDay(value); // Use discard operator to explicitly ignore the returned Task _ = LoadDay(value); // Use discard operator to explicitly ignore the returned Task
//RefreshProperties(); //RefreshProperties();
OnPropertyChanged(nameof(TimeDay)); OnPropertyChanged(nameof(TimeDay));
OnPropertyChanged(nameof(ShowDay)); OnPropertyChanged(nameof(ShowDay));
OnPropertyChanged(nameof(DayTimes)); OnPropertyChanged(nameof(DayTimes));
@@ -114,22 +114,22 @@ namespace Jugenddienst_Stunden.ViewModels {
public StundenViewModel() { public StundenViewModel() {
// Options = new ObservableCollection<string> { // Options = new ObservableCollection<string> {
// "Gemeinde 1", // "Gemeinde 1",
// "Gemeinde 2", // "Gemeinde 2",
// "Gemeinde 3", // "Gemeinde 3",
// "Gemeinde 4" // "Gemeinde 4"
//}; //};
// OptionsProjekt = new ObservableCollection<string> { // OptionsProjekt = new ObservableCollection<string> {
// "Projekt 1", // "Projekt 1",
// "Projekt 2", // "Projekt 2",
// "Projekt 3" // "Projekt 3"
//}; //};
// OptionsFreistellung = new ObservableCollection<string> { // OptionsFreistellung = new ObservableCollection<string> {
// "Urlaub", // "Urlaub",
// "Krankheit", // "Krankheit",
// "Elternzeit" // "Elternzeit"
//}; //};
_hour = new Types.Hours(); _hour = new Types.Hours();
LoadDataCommand = new AsyncRelayCommand(LoadData); LoadDataCommand = new AsyncRelayCommand(LoadData);
@@ -138,8 +138,10 @@ namespace Jugenddienst_Stunden.ViewModels {
} }
private async Task SelectEntryAsync(DayTime entry) { private async Task SelectEntryAsync(DayTime entry) {
if (entry != null)
if (entry != null && entry.id != null)
await Shell.Current.GoToAsync($"{nameof(Views.StundePage)}?load={entry.id}"); await Shell.Current.GoToAsync($"{nameof(Views.StundePage)}?load={entry.id}");
else AlertEvent?.Invoke(this, "Auswahl enthält keine Daten");
} }
@@ -160,11 +162,11 @@ namespace Jugenddienst_Stunden.ViewModels {
try { try {
_hour.daytime = await Models.Stunde.LoadDay(date); _hour.daytime = await Models.Stunde.LoadDay(date);
////if (_hour.zeit_total_daily_api != null) { ////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 } }; ////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(); //RefreshProperties();
OnPropertyChanged(nameof(ShowDay)); OnPropertyChanged(nameof(ShowDay));
OnPropertyChanged(nameof(TimeDay)); OnPropertyChanged(nameof(TimeDay));
OnPropertyChanged(nameof(DayTimes)); OnPropertyChanged(nameof(DayTimes));
////} ////}
} catch (Exception e) { } catch (Exception e) {
AlertEvent?.Invoke(this, e.Message); AlertEvent?.Invoke(this, e.Message);

View File

@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:viewModels="clr-namespace:Jugenddienst_Stunden.ViewModels" xmlns:viewModels="clr-namespace:Jugenddienst_Stunden.ViewModels"
x:Class="Jugenddienst_Stunden.Views.AllNotesPage" x:Class="Jugenddienst_Stunden.Views.AllNotesPage"
Title="Your Notes" Title="Deine Notizen"
NavigatedTo="ContentPage_NavigatedTo"> NavigatedTo="ContentPage_NavigatedTo">
<ContentPage.BindingContext> <ContentPage.BindingContext>
<viewModels:NotesViewModel /> <viewModels:NotesViewModel />
@@ -14,6 +14,7 @@
<ToolbarItem Text="Add" Command="{Binding NewCommand}" IconImageSource="{FontImage Glyph='+', Color=Black, Size=22}" /> <ToolbarItem Text="Add" Command="{Binding NewCommand}" IconImageSource="{FontImage Glyph='+', Color=Black, Size=22}" />
</ContentPage.ToolbarItems> </ContentPage.ToolbarItems>
<Label Text="Werden nur lokal gespeichert"/>
<!-- Display notes in a list --> <!-- Display notes in a list -->
<CollectionView x:Name="notesCollection" <CollectionView x:Name="notesCollection"
ItemsSource="{Binding AllNotes}" ItemsSource="{Binding AllNotes}"

View File

@@ -11,7 +11,7 @@
<Editor x:Name="TextEditor" <Editor x:Name="TextEditor"
Placeholder="Enter your note" Placeholder="Enter your note"
Text="{Binding Text}" Text="{Binding Text}"
HeightRequest="100" /> HeightRequest="80" />
<Grid ColumnDefinitions="*,*" ColumnSpacing="4"> <Grid ColumnDefinitions="*,*" ColumnSpacing="4">
<Button Text="Save" <Button Text="Save"

View File

@@ -8,16 +8,30 @@
<ContentPage.BindingContext> <ContentPage.BindingContext>
<models:StundeViewModel /> <models:StundeViewModel />
</ContentPage.BindingContext> </ContentPage.BindingContext>
<VerticalStackLayout> <VerticalStackLayout Spacing="10" Margin="10">
<Label
x:Name="StundeDescription"
Text="Welcome to .NET MAUI!" <Grid Padding="15,10,0,10">
VerticalOptions="Center" <Grid.RowDefinitions>
HorizontalOptions="Center" /> <RowDefinition Height="Auto" />
<Label x:Name="DescBinding" Text="{Binding Stunde.description}"/> <RowDefinition Height="Auto" />
<Label x:Name="BeginBinding" Text="{Binding Stunde.begin}"/> </Grid.RowDefinitions>
<Label x:Name="EndBinding" Text="{Binding Stunde.end}"/> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<HorizontalStackLayout Grid.Row="0" Grid.Column="0">
<Label Grid.Row="0" Grid.Column="0" Text="{Binding Stunde.begin}"/>
<Label Text="bis" Padding="10,0,10,0"/>
<Label Grid.Row="0" Grid.Column="1" Text="{Binding Stunde.end}"/>
</HorizontalStackLayout>
<!--<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding Stunde.description}" Padding="0,0,0,5"/>-->
<Editor Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Placeholder="Beschreibung" Text="{Binding Stunde.description}" HeightRequest="40" />
</Grid>
<Grid ColumnDefinitions="*,*" ColumnSpacing="4"> <Grid ColumnDefinitions="*,*" ColumnSpacing="4">
<Button Text="Save" Clicked="GetDayTime" /> <Button Text="Save" Clicked="GetDayTime" />

View File

@@ -19,7 +19,7 @@ public partial class StundePage : ContentPage
_stunde = await Models.Stunde.LoadEntry(4096); _stunde = await Models.Stunde.LoadEntry(4096);
//_stunde = new DayTime(); //_stunde = new DayTime();
//_stunde.description = "asd"; //_stunde.description = "asd";
StundeDescription.Text = _stunde.description; //StundeDescription.Text = _stunde.description;
} }
private void GetDayTime(object sender, EventArgs e) { private void GetDayTime(object sender, EventArgs e) {

View File

@@ -9,6 +9,10 @@
<models:StundenViewModel /> <models:StundenViewModel />
</ContentPage.BindingContext> </ContentPage.BindingContext>
<ContentPage.ToolbarItems>
<ToolbarItem Text="Add" Command="{Binding NewCommand}" IconImageSource="{FontImage Glyph='+', Color=Black, Size=22}" />
</ContentPage.ToolbarItems>
<ScrollView Margin="5"> <ScrollView Margin="5">
<VerticalStackLayout Spacing="10" Margin="10"> <VerticalStackLayout Spacing="10" Margin="10">