commit 68ccf23f018a0b63d4089bf59a787eb4db681c2d Author: DaPi Date: Tue Aug 20 01:37:51 2024 +0200 Initial commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8a30d25 --- /dev/null +++ b/.gitignore @@ -0,0 +1,398 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml diff --git a/Jugenddienst Stunden.sln b/Jugenddienst Stunden.sln new file mode 100644 index 0000000..42400d9 --- /dev/null +++ b/Jugenddienst Stunden.sln @@ -0,0 +1,27 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35122.118 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jugenddienst Stunden", "Jugenddienst Stunden\Jugenddienst Stunden.csproj", "{5A59ED84-BFB3-44C4-B23D-00E82ABADB62}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5A59ED84-BFB3-44C4-B23D-00E82ABADB62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5A59ED84-BFB3-44C4-B23D-00E82ABADB62}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5A59ED84-BFB3-44C4-B23D-00E82ABADB62}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {5A59ED84-BFB3-44C4-B23D-00E82ABADB62}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5A59ED84-BFB3-44C4-B23D-00E82ABADB62}.Release|Any CPU.Build.0 = Release|Any CPU + {5A59ED84-BFB3-44C4-B23D-00E82ABADB62}.Release|Any CPU.Deploy.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {93C65FC8-EA57-417C-A314-4073B5A41E74} + EndGlobalSection +EndGlobal diff --git a/Jugenddienst Stunden/App.xaml b/Jugenddienst Stunden/App.xaml new file mode 100644 index 0000000..2e056f0 --- /dev/null +++ b/Jugenddienst Stunden/App.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/Jugenddienst Stunden/App.xaml.cs b/Jugenddienst Stunden/App.xaml.cs new file mode 100644 index 0000000..c46a73a --- /dev/null +++ b/Jugenddienst Stunden/App.xaml.cs @@ -0,0 +1,17 @@ +//using AndroidX.Browser.Trusted; + +namespace Jugenddienst_Stunden { + public partial class App : Application { + public App() { + InitializeComponent(); + + MainPage = new AppShell(); + + //Models.Auth.Main(new string[] { "http://hours.dauni.mine.nu:81/appapi", "OTI6Y1JVUS9RTG1jMTZUbnN2c2JZRm5yRDNiUTZz" }); //Angelika + //Models.Auth.Main(new string[] { "http://hours.dauni.mine.nu:81/appapi", "Njc6cjltcVJ1SmtITUtFZ3llUVpJcWJzc2NDejVZ" }); //Dario + + Models.Auth.Main(new string[] { "http://hours.dauni.mine.nu:81/appapi?hours", "MTQzfEFlMVRjQXdZMnI4RmpxZ0FSY3A0VEN2bVZYVXxodHRwOi8vaG91cnMuZGF1bmkubWluZS5udTo4MS9hcHBhcGk=" }); //Christine + + } + } +} diff --git a/Jugenddienst Stunden/AppShell.xaml b/Jugenddienst Stunden/AppShell.xaml new file mode 100644 index 0000000..41e9097 --- /dev/null +++ b/Jugenddienst Stunden/AppShell.xaml @@ -0,0 +1,26 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/Jugenddienst Stunden/AppShell.xaml.cs b/Jugenddienst Stunden/AppShell.xaml.cs new file mode 100644 index 0000000..1284421 --- /dev/null +++ b/Jugenddienst Stunden/AppShell.xaml.cs @@ -0,0 +1,9 @@ +namespace Jugenddienst_Stunden { + public partial class AppShell : Shell { + public AppShell() { + InitializeComponent(); + + Routing.RegisterRoute(nameof(Views.NotePage), typeof(Views.NotePage)); + } + } +} diff --git a/Jugenddienst Stunden/Jugenddienst Stunden.csproj b/Jugenddienst Stunden/Jugenddienst Stunden.csproj new file mode 100644 index 0000000..6aaf659 --- /dev/null +++ b/Jugenddienst Stunden/Jugenddienst Stunden.csproj @@ -0,0 +1,91 @@ + + + + net8.0-ios;net8.0-maccatalyst;net8.0-android34.0 + $(TargetFrameworks);net8.0-windows10.0.17763.0 + + + + + + + Exe + Jugenddienst_Stunden + true + true + enable + enable + + + Jugenddienst Stunden + + + com.companyname.jugenddienststunden + + + 1.0 + 1 + + 11.0 + 13.1 + 34.0 + 10.0.17763.0 + 10.0.17763.0 + 6.5 + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + AboutPage.xaml + + + + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + + diff --git a/Jugenddienst Stunden/MauiProgram.cs b/Jugenddienst Stunden/MauiProgram.cs new file mode 100644 index 0000000..84a47d6 --- /dev/null +++ b/Jugenddienst Stunden/MauiProgram.cs @@ -0,0 +1,26 @@ +using BarcodeScanning; +using Microsoft.Extensions.Logging; + +using Microsoft.Maui.Hosting; + + +namespace Jugenddienst_Stunden { + public static class MauiProgram { + public static MauiApp CreateMauiApp() { + var builder = MauiApp.CreateBuilder(); + builder + .UseMauiApp() + .ConfigureFonts(fonts => { + fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); + fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); + }) + .UseBarcodeScanning(); + +#if DEBUG + builder.Logging.AddDebug(); +#endif + + return builder.Build(); + } + } +} diff --git a/Jugenddienst Stunden/Models/Auth.cs b/Jugenddienst Stunden/Models/Auth.cs new file mode 100644 index 0000000..1ca2b9b --- /dev/null +++ b/Jugenddienst Stunden/Models/Auth.cs @@ -0,0 +1,52 @@ +using System; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; + +namespace Jugenddienst_Stunden.Models +{ + + class Auth + { + + public Hours hours; + + public static async Task GetApiDataWithAuthAsync(string url, string token) { + using (HttpClient client = new HttpClient()) { + try { + // Hinzufügen des Bearer-Tokens zum Authorization-Header + client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token); + + // Senden der Anfrage und Abrufen der Antwort + HttpResponseMessage response = await client.GetAsync(url); + + // Überprüfen, ob die Anfrage erfolgreich war + response.EnsureSuccessStatusCode(); + + // Lesen und Rückgabe der Antwort als String + string responseData = await response.Content.ReadAsStringAsync(); + return responseData; + } catch (HttpRequestException e) { + // Fehlerbehandlung + Console.WriteLine($"An error occurred: {e.Message}"); + return null; + } + } + } + + public static async Task Main(string[] args) { + string apiUrl = args[0]; // Ersetzen Sie dies durch die tatsächliche URL der API + string bearerToken = args[1]; // Ersetzen Sie hier durch Ihr tatsächliches Token + + string data = await GetApiDataWithAuthAsync(apiUrl, bearerToken); + + if (data != null) { + //Console.WriteLine("API-Daten:"); + //Console.WriteLine(data); + //JOperator operator = Newtonsoft.Json.JsonConvert.DeserializeObject(data); + //var zeug = Newtonsoft.Json.JsonConvert.DeserializeObject(data); + Hours hours = Newtonsoft.Json.JsonConvert.DeserializeObject(data); + } + } + } +} diff --git a/Jugenddienst Stunden/Models/Hours.cs b/Jugenddienst Stunden/Models/Hours.cs new file mode 100644 index 0000000..1b605ea --- /dev/null +++ b/Jugenddienst Stunden/Models/Hours.cs @@ -0,0 +1,24 @@ + +namespace Jugenddienst_Stunden.Models { + public class Hours { + public string zeit; + public string nominal; + public Dictionary nominal_day_api; + public Dictionary nominal_week_api; + //public List time_line; + public string zeit_total; + //public List zeit_total_daily; + //public List wochensumme; + public string overtime_month; + public string overtime; + //public List overtime_day; + public string zeitausgleich; + public string zeitausgleich_month; + public string holiday; + public string krankheit; + public string weiterbildung; + public string bereitschaft; + public string bereitschaft_month; + //public Operator operator_api; + } +} diff --git a/Jugenddienst Stunden/Models/NominalDay.cs b/Jugenddienst Stunden/Models/NominalDay.cs new file mode 100644 index 0000000..c16e1a0 --- /dev/null +++ b/Jugenddienst Stunden/Models/NominalDay.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Jugenddienst_Stunden.Models { + public class NominalDay { + public int day_number; + public int month_number; + public decimal hours; + } +} diff --git a/Jugenddienst Stunden/Models/NominalWeek.cs b/Jugenddienst Stunden/Models/NominalWeek.cs new file mode 100644 index 0000000..4fdee5b --- /dev/null +++ b/Jugenddienst Stunden/Models/NominalWeek.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Jugenddienst_Stunden.Models { + public class NominalWeek { + public int week_number; + public decimal hours; + } +} diff --git a/Jugenddienst Stunden/Models/Note.cs b/Jugenddienst Stunden/Models/Note.cs new file mode 100644 index 0000000..c6d228c --- /dev/null +++ b/Jugenddienst Stunden/Models/Note.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Jugenddienst_Stunden.Models { + internal class Note { + public string Filename { get; set; } + public string Text { get; set; } + public DateTime Date { get; set; } + + public void Save() => +File.WriteAllText(System.IO.Path.Combine(FileSystem.AppDataDirectory, Filename), Text); + + public void Delete() => + File.Delete(System.IO.Path.Combine(FileSystem.AppDataDirectory, Filename)); + + public static Note Load(string filename) { + filename = System.IO.Path.Combine(FileSystem.AppDataDirectory, filename); + + if (!File.Exists(filename)) + throw new FileNotFoundException("Unable to find file on local storage.", filename); + + return + new() { + Filename = Path.GetFileName(filename), + Text = File.ReadAllText(filename), + Date = File.GetLastWriteTime(filename) + }; + } + + public static IEnumerable LoadAll() { + // Get the folder where the notes are stored. + string appDataPath = FileSystem.AppDataDirectory; + + // Use Linq extensions to load the *.notes.txt files. + return Directory + + // Select the file names from the directory + .EnumerateFiles(appDataPath, "*.notes.txt") + + // Each file name is used to load a note + .Select(filename => Note.Load(Path.GetFileName(filename))) + + // With the final collection of notes, order them by date + .OrderByDescending(note => note.Date); + } + + public Note() { + Filename = $"{Path.GetRandomFileName()}.notes.txt"; + Date = DateTime.Now; + Text = ""; + } + } +} diff --git a/Jugenddienst Stunden/Models/Operator.cs b/Jugenddienst Stunden/Models/Operator.cs new file mode 100644 index 0000000..355deb3 --- /dev/null +++ b/Jugenddienst Stunden/Models/Operator.cs @@ -0,0 +1,27 @@ + +namespace Jugenddienst_Stunden.Models { + public class Operator { + public string id; + public string name; + public string surname; + public string email; + public string password; + public string lang; + public string admin; + public string aktiv; + public string department; + public string department_name; + //public List? timetable_begin; + /// + /// TimeTable Num + /// + public string num; + //public List? saved_overtime; + //public List? saved_holiday; + //public TimeOnly overtime; + //public TimeOnly holiday; + public string year; + //public List? timetable; + + } +} diff --git a/Jugenddienst Stunden/Models/Stunde.cs b/Jugenddienst Stunden/Models/Stunde.cs new file mode 100644 index 0000000..a8410cd --- /dev/null +++ b/Jugenddienst Stunden/Models/Stunde.cs @@ -0,0 +1,29 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using Newtonsoft.Json; + +namespace Jugenddienst_Stunden.Models { + internal class Stunde : ObservableObject { + + private static readonly string BaseAddress = "http://hours.dauni.mine.nu:81"; + private static readonly string apiKey = "MTQzfEFlMVRjQXdZMnI4RmpxZ0FSY3A0VEN2bVZYVXxodHRwOi8vaG91cnMuZGF1bmkubWluZS5udTo4MS9hcHBhcGk="; //Christine + private static readonly string requestUrl = $"{BaseAddress}/appapi?hours"; + + public DateTime Date { get; set; } + + + + public static async Task LoadData() { + string data = await Auth.GetApiDataWithAuthAsync(requestUrl, apiKey); + + if(data == null) { + throw new Exception("Keine Daten erhalten"); + } + + Hours hours = JsonConvert.DeserializeObject(data); + + return hours ?? new Hours(); + } + + + } +} diff --git a/Jugenddienst Stunden/Models/Timetable.cs b/Jugenddienst Stunden/Models/Timetable.cs new file mode 100644 index 0000000..74fa77a --- /dev/null +++ b/Jugenddienst Stunden/Models/Timetable.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Jugenddienst_Stunden.Models { + internal class Timetable { + public List timetable; + public decimal wochensumme; + } +} diff --git a/Jugenddienst Stunden/Models/TimetableEntry.cs b/Jugenddienst Stunden/Models/TimetableEntry.cs new file mode 100644 index 0000000..bd45229 --- /dev/null +++ b/Jugenddienst Stunden/Models/TimetableEntry.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Jugenddienst_Stunden.Models { + internal class TimetableEntry { + public List? von; + public List? bis; + public decimal summe { get; set; } + } +} diff --git a/Jugenddienst Stunden/Platforms/Android/AndroidManifest.xml b/Jugenddienst Stunden/Platforms/Android/AndroidManifest.xml new file mode 100644 index 0000000..b82c6af --- /dev/null +++ b/Jugenddienst Stunden/Platforms/Android/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Jugenddienst Stunden/Platforms/Android/MainActivity.cs b/Jugenddienst Stunden/Platforms/Android/MainActivity.cs new file mode 100644 index 0000000..517e9c9 --- /dev/null +++ b/Jugenddienst Stunden/Platforms/Android/MainActivity.cs @@ -0,0 +1,9 @@ +using Android.App; +using Android.Content.PM; +using Android.OS; + +namespace Jugenddienst_Stunden { + [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] + public class MainActivity : MauiAppCompatActivity { + } +} diff --git a/Jugenddienst Stunden/Platforms/Android/MainApplication.cs b/Jugenddienst Stunden/Platforms/Android/MainApplication.cs new file mode 100644 index 0000000..48aa33e --- /dev/null +++ b/Jugenddienst Stunden/Platforms/Android/MainApplication.cs @@ -0,0 +1,17 @@ +using Android.App; +using Android.Runtime; + +namespace Jugenddienst_Stunden { + #if DEBUG + [Application(UsesCleartextTraffic = true)] + #else + [Application] + #endif + public class MainApplication : MauiApplication { + public MainApplication(IntPtr handle, JniHandleOwnership ownership) + : base(handle, ownership) { + } + + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } +} diff --git a/Jugenddienst Stunden/Platforms/Android/Resources/values/colors.xml b/Jugenddienst Stunden/Platforms/Android/Resources/values/colors.xml new file mode 100644 index 0000000..c04d749 --- /dev/null +++ b/Jugenddienst Stunden/Platforms/Android/Resources/values/colors.xml @@ -0,0 +1,6 @@ + + + #512BD4 + #2B0B98 + #2B0B98 + \ No newline at end of file diff --git a/Jugenddienst Stunden/Platforms/MacCatalyst/AppDelegate.cs b/Jugenddienst Stunden/Platforms/MacCatalyst/AppDelegate.cs new file mode 100644 index 0000000..267fb1c --- /dev/null +++ b/Jugenddienst Stunden/Platforms/MacCatalyst/AppDelegate.cs @@ -0,0 +1,8 @@ +using Foundation; + +namespace Jugenddienst_Stunden { + [Register("AppDelegate")] + public class AppDelegate : MauiUIApplicationDelegate { + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } +} diff --git a/Jugenddienst Stunden/Platforms/MacCatalyst/Entitlements.plist b/Jugenddienst Stunden/Platforms/MacCatalyst/Entitlements.plist new file mode 100644 index 0000000..de4adc9 --- /dev/null +++ b/Jugenddienst Stunden/Platforms/MacCatalyst/Entitlements.plist @@ -0,0 +1,14 @@ + + + + + + + com.apple.security.app-sandbox + + + com.apple.security.network.client + + + + diff --git a/Jugenddienst Stunden/Platforms/MacCatalyst/Info.plist b/Jugenddienst Stunden/Platforms/MacCatalyst/Info.plist new file mode 100644 index 0000000..7268977 --- /dev/null +++ b/Jugenddienst Stunden/Platforms/MacCatalyst/Info.plist @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + UIDeviceFamily + + 2 + + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Assets.xcassets/appicon.appiconset + + diff --git a/Jugenddienst Stunden/Platforms/MacCatalyst/Program.cs b/Jugenddienst Stunden/Platforms/MacCatalyst/Program.cs new file mode 100644 index 0000000..7063593 --- /dev/null +++ b/Jugenddienst Stunden/Platforms/MacCatalyst/Program.cs @@ -0,0 +1,13 @@ +using ObjCRuntime; +using UIKit; + +namespace Jugenddienst_Stunden { + public class Program { + // This is the main entry point of the application. + static void Main(string[] args) { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); + } + } +} diff --git a/Jugenddienst Stunden/Platforms/Tizen/Main.cs b/Jugenddienst Stunden/Platforms/Tizen/Main.cs new file mode 100644 index 0000000..947e94f --- /dev/null +++ b/Jugenddienst Stunden/Platforms/Tizen/Main.cs @@ -0,0 +1,14 @@ +using Microsoft.Maui; +using Microsoft.Maui.Hosting; +using System; + +namespace Jugenddienst_Stunden { + internal class Program : MauiApplication { + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + + static void Main(string[] args) { + var app = new Program(); + app.Run(args); + } + } +} diff --git a/Jugenddienst Stunden/Platforms/Tizen/tizen-manifest.xml b/Jugenddienst Stunden/Platforms/Tizen/tizen-manifest.xml new file mode 100644 index 0000000..1fba88f --- /dev/null +++ b/Jugenddienst Stunden/Platforms/Tizen/tizen-manifest.xml @@ -0,0 +1,15 @@ + + + + + + maui-appicon-placeholder + + + + + http://tizen.org/privilege/internet + + + + \ No newline at end of file diff --git a/Jugenddienst Stunden/Platforms/Windows/App.xaml b/Jugenddienst Stunden/Platforms/Windows/App.xaml new file mode 100644 index 0000000..9fce9dd --- /dev/null +++ b/Jugenddienst Stunden/Platforms/Windows/App.xaml @@ -0,0 +1,8 @@ + + + diff --git a/Jugenddienst Stunden/Platforms/Windows/App.xaml.cs b/Jugenddienst Stunden/Platforms/Windows/App.xaml.cs new file mode 100644 index 0000000..a7e1346 --- /dev/null +++ b/Jugenddienst Stunden/Platforms/Windows/App.xaml.cs @@ -0,0 +1,22 @@ +using Microsoft.UI.Xaml; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace Jugenddienst_Stunden.WinUI { + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + public partial class App : MauiWinUIApplication { + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() { + this.InitializeComponent(); + } + + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } + +} diff --git a/Jugenddienst Stunden/Platforms/Windows/Package.appxmanifest b/Jugenddienst Stunden/Platforms/Windows/Package.appxmanifest new file mode 100644 index 0000000..1f2dd1f --- /dev/null +++ b/Jugenddienst Stunden/Platforms/Windows/Package.appxmanifest @@ -0,0 +1,46 @@ + + + + + + + + + $placeholder$ + User Name + $placeholder$.png + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Jugenddienst Stunden/Platforms/Windows/app.manifest b/Jugenddienst Stunden/Platforms/Windows/app.manifest new file mode 100644 index 0000000..5689be5 --- /dev/null +++ b/Jugenddienst Stunden/Platforms/Windows/app.manifest @@ -0,0 +1,15 @@ + + + + + + + + true/PM + PerMonitorV2, PerMonitor + + + diff --git a/Jugenddienst Stunden/Platforms/iOS/AppDelegate.cs b/Jugenddienst Stunden/Platforms/iOS/AppDelegate.cs new file mode 100644 index 0000000..267fb1c --- /dev/null +++ b/Jugenddienst Stunden/Platforms/iOS/AppDelegate.cs @@ -0,0 +1,8 @@ +using Foundation; + +namespace Jugenddienst_Stunden { + [Register("AppDelegate")] + public class AppDelegate : MauiUIApplicationDelegate { + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } +} diff --git a/Jugenddienst Stunden/Platforms/iOS/Info.plist b/Jugenddienst Stunden/Platforms/iOS/Info.plist new file mode 100644 index 0000000..24abae1 --- /dev/null +++ b/Jugenddienst Stunden/Platforms/iOS/Info.plist @@ -0,0 +1,34 @@ + + + + + LSRequiresIPhoneOS + + UIDeviceFamily + + 1 + 2 + + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + NSCameraUsageDescription + This app uses barcode scanning to... + XSAppIconAssets + Assets.xcassets/appicon.appiconset + + diff --git a/Jugenddienst Stunden/Platforms/iOS/Program.cs b/Jugenddienst Stunden/Platforms/iOS/Program.cs new file mode 100644 index 0000000..7063593 --- /dev/null +++ b/Jugenddienst Stunden/Platforms/iOS/Program.cs @@ -0,0 +1,13 @@ +using ObjCRuntime; +using UIKit; + +namespace Jugenddienst_Stunden { + public class Program { + // This is the main entry point of the application. + static void Main(string[] args) { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); + } + } +} diff --git a/Jugenddienst Stunden/Properties/launchSettings.json b/Jugenddienst Stunden/Properties/launchSettings.json new file mode 100644 index 0000000..edf8aad --- /dev/null +++ b/Jugenddienst Stunden/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "Windows Machine": { + "commandName": "MsixPackage", + "nativeDebugging": false + } + } +} \ No newline at end of file diff --git a/Jugenddienst Stunden/Resources/AppIcon/appicon.svg b/Jugenddienst Stunden/Resources/AppIcon/appicon.svg new file mode 100644 index 0000000..9d63b65 --- /dev/null +++ b/Jugenddienst Stunden/Resources/AppIcon/appicon.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Jugenddienst Stunden/Resources/AppIcon/appiconfg.svg b/Jugenddienst Stunden/Resources/AppIcon/appiconfg.svg new file mode 100644 index 0000000..21dfb25 --- /dev/null +++ b/Jugenddienst Stunden/Resources/AppIcon/appiconfg.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Jugenddienst Stunden/Resources/Fonts/OpenSans-Regular.ttf b/Jugenddienst Stunden/Resources/Fonts/OpenSans-Regular.ttf new file mode 100644 index 0000000..d2887c8 Binary files /dev/null and b/Jugenddienst Stunden/Resources/Fonts/OpenSans-Regular.ttf differ diff --git a/Jugenddienst Stunden/Resources/Fonts/OpenSans-Semibold.ttf b/Jugenddienst Stunden/Resources/Fonts/OpenSans-Semibold.ttf new file mode 100644 index 0000000..20060c4 Binary files /dev/null and b/Jugenddienst Stunden/Resources/Fonts/OpenSans-Semibold.ttf differ diff --git a/Jugenddienst Stunden/Resources/Images/dotnet_bot.png b/Jugenddienst Stunden/Resources/Images/dotnet_bot.png new file mode 100644 index 0000000..f93ce02 Binary files /dev/null and b/Jugenddienst Stunden/Resources/Images/dotnet_bot.png differ diff --git a/Jugenddienst Stunden/Resources/Images/icon_about.png b/Jugenddienst Stunden/Resources/Images/icon_about.png new file mode 100644 index 0000000..fa470c2 Binary files /dev/null and b/Jugenddienst Stunden/Resources/Images/icon_about.png differ diff --git a/Jugenddienst Stunden/Resources/Images/icon_about_ios.png b/Jugenddienst Stunden/Resources/Images/icon_about_ios.png new file mode 100644 index 0000000..aaa7b11 Binary files /dev/null and b/Jugenddienst Stunden/Resources/Images/icon_about_ios.png differ diff --git a/Jugenddienst Stunden/Resources/Images/icon_notes.png b/Jugenddienst Stunden/Resources/Images/icon_notes.png new file mode 100644 index 0000000..812cf73 Binary files /dev/null and b/Jugenddienst Stunden/Resources/Images/icon_notes.png differ diff --git a/Jugenddienst Stunden/Resources/Images/icon_notes_ios.png b/Jugenddienst Stunden/Resources/Images/icon_notes_ios.png new file mode 100644 index 0000000..5f02dbe Binary files /dev/null and b/Jugenddienst Stunden/Resources/Images/icon_notes_ios.png differ diff --git a/Jugenddienst Stunden/Resources/Raw/AboutAssets.txt b/Jugenddienst Stunden/Resources/Raw/AboutAssets.txt new file mode 100644 index 0000000..89dc758 --- /dev/null +++ b/Jugenddienst Stunden/Resources/Raw/AboutAssets.txt @@ -0,0 +1,15 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories). Deployment of the asset to your application +is automatically handled by the following `MauiAsset` Build Action within your `.csproj`. + + + +These files will be deployed with your package and will be accessible using Essentials: + + async Task LoadMauiAsset() + { + using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); + using var reader = new StreamReader(stream); + + var contents = reader.ReadToEnd(); + } diff --git a/Jugenddienst Stunden/Resources/Splash/splash.svg b/Jugenddienst Stunden/Resources/Splash/splash.svg new file mode 100644 index 0000000..21dfb25 --- /dev/null +++ b/Jugenddienst Stunden/Resources/Splash/splash.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Jugenddienst Stunden/Resources/Styles/Colors.xaml b/Jugenddienst Stunden/Resources/Styles/Colors.xaml new file mode 100644 index 0000000..30307a5 --- /dev/null +++ b/Jugenddienst Stunden/Resources/Styles/Colors.xaml @@ -0,0 +1,45 @@ + + + + + + + #512BD4 + #ac99ea + #242424 + #DFD8F7 + #9880e5 + #2B0B98 + + White + Black + #D600AA + #190649 + #1f1f1f + + #E1E1E1 + #C8C8C8 + #ACACAC + #919191 + #6E6E6E + #404040 + #212121 + #141414 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Jugenddienst Stunden/Resources/Styles/Styles.xaml b/Jugenddienst Stunden/Resources/Styles/Styles.xaml new file mode 100644 index 0000000..6641e3a --- /dev/null +++ b/Jugenddienst Stunden/Resources/Styles/Styles.xaml @@ -0,0 +1,427 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Jugenddienst Stunden/ViewModels/AboutViewModel.cs b/Jugenddienst Stunden/ViewModels/AboutViewModel.cs new file mode 100644 index 0000000..22e2d59 --- /dev/null +++ b/Jugenddienst Stunden/ViewModels/AboutViewModel.cs @@ -0,0 +1,32 @@ +using CommunityToolkit.Mvvm.Input; +using System.Windows.Input; +using BarcodeScanning; + +namespace Jugenddienst_Stunden.ViewModels { + internal class AboutViewModel { + public string Title => AppInfo.Name; + public string Version => AppInfo.VersionString; + public string MoreInfoUrl => "https://aka.ms/maui"; + public string Message => "This app is written in XAML and C# with .NET MAUI."; + public ICommand ShowMoreInfoCommand { get; } + + + + public AboutViewModel() { + ShowMoreInfoCommand = new AsyncRelayCommand(ShowMoreInfo); + } + + async Task ShowMoreInfo() => + await Launcher.Default.OpenAsync(MoreInfoUrl); + + + + private static void BarcodesDetected(object sender, OnDetectionFinishedEventArg e) { + if (e.BarcodeResults.Length > 0) { + // Hier verarbeiten Sie den erkannten Barcode + Console.WriteLine($"Detected barcode: {e.BarcodeResults.GetType()} {e.BarcodeResults.ToString()}"); + } + } + + } +} diff --git a/Jugenddienst Stunden/ViewModels/NoteViewModel.cs b/Jugenddienst Stunden/ViewModels/NoteViewModel.cs new file mode 100644 index 0000000..e2b336c --- /dev/null +++ b/Jugenddienst Stunden/ViewModels/NoteViewModel.cs @@ -0,0 +1,65 @@ +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.ComponentModel; +using System.Windows.Input; + +namespace Jugenddienst_Stunden.ViewModels { + internal class NoteViewModel : ObservableObject, IQueryAttributable { + private Models.Note _note; + public string Text { + get => _note.Text; + set { + if (_note.Text != value) { + _note.Text = value; + OnPropertyChanged(); + } + } + } + + public DateTime Date => _note.Date; + + public string Identifier => _note.Filename; + + public ICommand SaveCommand { get; private set; } + public ICommand DeleteCommand { get; private set; } + + public NoteViewModel() { + _note = new Models.Note(); + SaveCommand = new AsyncRelayCommand(Save); + DeleteCommand = new AsyncRelayCommand(Delete); + } + + public NoteViewModel(Models.Note note) { + _note = note; + SaveCommand = new AsyncRelayCommand(Save); + DeleteCommand = new AsyncRelayCommand(Delete); + } + + private async Task Save() { + _note.Date = DateTime.Now; + _note.Save(); + await Shell.Current.GoToAsync($"..?saved={_note.Filename}"); + } + + private async Task Delete() { + _note.Delete(); + await Shell.Current.GoToAsync($"..?deleted={_note.Filename}"); + } + + void IQueryAttributable.ApplyQueryAttributes(IDictionary query) { + if (query.ContainsKey("load")) { + _note = Models.Note.Load(query["load"].ToString()); + RefreshProperties(); + } + } + + public void Reload() { + _note = Models.Note.Load(_note.Filename); + RefreshProperties(); + } + + private void RefreshProperties() { + OnPropertyChanged(nameof(Text)); + OnPropertyChanged(nameof(Date)); + } + } +} diff --git a/Jugenddienst Stunden/ViewModels/NotesViewModel.cs b/Jugenddienst Stunden/ViewModels/NotesViewModel.cs new file mode 100644 index 0000000..bd9808f --- /dev/null +++ b/Jugenddienst Stunden/ViewModels/NotesViewModel.cs @@ -0,0 +1,51 @@ +using CommunityToolkit.Mvvm.Input; +using Jugenddienst_Stunden.Models; +using System.Collections.ObjectModel; +using System.Windows.Input; + +namespace Jugenddienst_Stunden.ViewModels; + +internal class NotesViewModel : IQueryAttributable { + public ObservableCollection AllNotes { get; } + public ICommand NewCommand { get; } + public ICommand SelectNoteCommand { get; } + + public NotesViewModel() { + AllNotes = new ObservableCollection(Models.Note.LoadAll().Select(n => new NoteViewModel(n))); + NewCommand = new AsyncRelayCommand(NewNoteAsync); + SelectNoteCommand = new AsyncRelayCommand(SelectNoteAsync); + } + + private async Task NewNoteAsync() { + await Shell.Current.GoToAsync(nameof(Views.NotePage)); + } + + private async Task SelectNoteAsync(ViewModels.NoteViewModel note) { + if (note != null) + await Shell.Current.GoToAsync($"{nameof(Views.NotePage)}?load={note.Identifier}"); + } + + void IQueryAttributable.ApplyQueryAttributes(IDictionary query) { + if (query.ContainsKey("deleted")) { + string noteId = query["deleted"].ToString(); + NoteViewModel matchedNote = AllNotes.Where((n) => n.Identifier == noteId).FirstOrDefault(); + + // If note exists, delete it + if (matchedNote != null) + AllNotes.Remove(matchedNote); + } else if (query.ContainsKey("saved")) { + string noteId = query["saved"].ToString(); + NoteViewModel matchedNote = AllNotes.Where((n) => n.Identifier == noteId).FirstOrDefault(); + + // If note is found, update it + if (matchedNote != null) { + matchedNote.Reload(); + AllNotes.Move(AllNotes.IndexOf(matchedNote), 0); + } + + // If note isn't found, it's new; add it. + else + AllNotes.Insert(0, new NoteViewModel(Note.Load(noteId))); + } + } +} diff --git a/Jugenddienst Stunden/ViewModels/StundenViewModel.cs b/Jugenddienst Stunden/ViewModels/StundenViewModel.cs new file mode 100644 index 0000000..d1f4e3d --- /dev/null +++ b/Jugenddienst Stunden/ViewModels/StundenViewModel.cs @@ -0,0 +1,49 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using System.Windows.Input; + + +namespace Jugenddienst_Stunden.ViewModels { + internal class StundenViewModel : ObservableObject { + public string Name => AppInfo.Name; + public string Surname => AppInfo.VersionString; + public string MoreInfoUrl => "https://aka.ms/maui"; + public string Message => "Hier werden deine geleisteten Arbeitsstunden aufgelistet"; + public ICommand LoadDataCommand { get; private set; } + public object Stunden { get; } + + private Models.Hours _hour; + public Models.Hours Hours { + get => _hour; + } + public string Nominal { + get => _hour.nominal; + } + public string Overtime { + get => _hour.overtime; + } + public string OvertimeMonth { + get => _hour.overtime_month; + } + + public StundenViewModel() { + _hour = new Models.Hours(); + LoadDataCommand = new AsyncRelayCommand(LoadData); + } + + //public async Task LoadData() => + // await Models.Stunde.LoadData(); + + public async Task LoadData() { + _hour = await Models.Stunde.LoadData(); + RefreshProperties(); + } + + private void RefreshProperties() { + OnPropertyChanged(nameof(Nominal)); + OnPropertyChanged(nameof(Overtime)); + OnPropertyChanged(nameof(OvertimeMonth)); + } + + } +} diff --git a/Jugenddienst Stunden/Views/AboutPage.xaml b/Jugenddienst Stunden/Views/AboutPage.xaml new file mode 100644 index 0000000..ec439be --- /dev/null +++ b/Jugenddienst Stunden/Views/AboutPage.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + +