Skip to content

Commit

Permalink
Login and timetable
Browse files Browse the repository at this point in the history
  • Loading branch information
kajetan-kazimierczak committed Aug 18, 2024
1 parent 00e5551 commit ebe1913
Show file tree
Hide file tree
Showing 10 changed files with 247 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Skolplattformen.ElevApp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\README.md = ..\README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Skolplattformen.Elevapp.InfomentorStockholmApi", "Skolplattformen.Elevapp.InfomentorStockholmApi\Skolplattformen.Elevapp.InfomentorStockholmApi.csproj", "{C4318B91-DBD1-46CA-8853-F29D9DA44E0E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Skolplattformen.ElevApp.InfomentorStockholmApi", "Skolplattformen.Elevapp.InfomentorStockholmApi\Skolplattformen.ElevApp.InfomentorStockholmApi.csproj", "{C4318B91-DBD1-46CA-8853-F29D9DA44E0E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
6 changes: 6 additions & 0 deletions src/Skolplattformen.ElevApp/Data/SkolplattformenService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Globalization;
using Skolplattformen.ElevApp.ApiInterface;
using Skolplattformen.ElevApp.ApiInterface.Models;
//using Skolplattformen.Elevapp.InfomentorStockholmApi;
using Skolplattformen.ElevApp.SkolplattformenApi;


Expand All @@ -11,6 +12,7 @@ public enum ApiKind
Skolplattformen = 1,
FakeData = 2,
Dexter = 3,
InfoMentorStockholm = 4
}


Expand Down Expand Up @@ -48,6 +50,10 @@ public void LogOut()
{
_api = new DexterApi.DexterApi();
}
else if (_apiKind == ApiKind.InfoMentorStockholm)
{
_api = new InfomentorStockholmApi.InfomentorApi();
}
else
{
_api = new FakeApi.FakeApi();
Expand Down
26 changes: 26 additions & 0 deletions src/Skolplattformen.ElevApp/Pages/LoginPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
FontSize="32"
HorizontalOptions="Center" />

<!-- Skolplattformen login form-->
<VerticalStackLayout
Grid.Row="2"
Padding="18,0,18,12"
Expand Down Expand Up @@ -95,6 +96,31 @@
Unfocused="Entry_Unfocused"/>
</VerticalStackLayout>

<VerticalStackLayout
Grid.Row="2"
Padding="18,0,18,12"
Spacing="6"
VerticalOptions="End"
IsVisible="{Binding Source={x:Reference blaj},
Path=Text,Converter={StaticResource IsEqualConverter}, ConverterParameter=2 }">

<Entry
MaxLength="200"
Text="{Binding Username}"
Placeholder="Användarnamn"
Focused="Entry_Focused"
Unfocused="Entry_Unfocused"/>
<Entry
MaxLength="200"
Text="{Binding Password}"
IsPassword="true"
Placeholder="Lösenord"
Focused="Entry_Focused"
Unfocused="Entry_Unfocused"/>
</VerticalStackLayout>



<VerticalStackLayout
Grid.Row="3"
Padding="18,0"
Expand Down
1 change: 1 addition & 0 deletions src/Skolplattformen.ElevApp/Skolplattformen.ElevApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<ItemGroup>
<ProjectReference Include="..\Skolplattformen.ElevApp.ApiInterface\Skolplattformen.ElevApp.ApiInterface.csproj" />
<ProjectReference Include="..\Skolplattformen.ElevApp.DexterApi\Skolplattformen.ElevApp.DexterApi.csproj" />
<ProjectReference Include="..\Skolplattformen.Elevapp.InfomentorStockholmApi\Skolplattformen.ElevApp.InfomentorStockholmApi.csproj" />
<ProjectReference Include="..\Skolplattformen.ElevApp.FakeApi\Skolplattformen.ElevApp.FakeApi.csproj" />
<ProjectReference Include="..\Skolplattformen.ElevApp.SkolplattformenApi\Skolplattformen.ElevApp.SkolplattformenApi.csproj" />
</ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions src/Skolplattformen.ElevApp/ViewModels/LoginViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public LoginViewModel(SkolplattformenService skolplattformenService)
{
"Skolplattformen Stockholm",
"IST Dexter",
"InfoMentor Stockholm",
"Demo",
};
PlatformSelectedIndex = 0;
Expand Down Expand Up @@ -79,6 +80,7 @@ async Task Login()
{
0 => ApiKind.Skolplattformen,
1 => ApiKind.Dexter,
2 => ApiKind.InfoMentorStockholm,
_ => ApiKind.FakeData
};
if (PlatformSelectedIndex != -1)
Expand Down Expand Up @@ -107,6 +109,7 @@ async Task Login()
{
ApiKind.Skolplattformen => new SkolplattformenApi.LoginCredentials() {Email = email, Username = username, Password = password },
ApiKind.Dexter => new DexterApi.LoginCredentials() {Username = username, Password = password, InstallationId = SelectedDexterInstallation.Id },
ApiKind.InfoMentorStockholm => new InfomentorStockholmApi.LoginCredentials() {Username = username, Password = password },
_ => new { username, password }
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,29 @@
using Skolplattformen.ElevApp.ApiInterface.Models;
using System.Globalization;
using System.Text.Json;
using Skolplattformen.Elevapp.InfomentorStockholmApi.Models;
using Skolplattformen.ElevApp.InfomentorStockholmApi.Models;

namespace Skolplattformen.Elevapp.InfomentorStockholmApi
namespace Skolplattformen.ElevApp.InfomentorStockholmApi
{
public partial class InfomentorApi : IApi
{


public async Task<ApiUser?> GetUserAsync()
{
return new ApiUser();
throw new NotImplementedException();
}

public async Task<List<Teacher>> GetTeachersAsync()
{
return new List<Teacher>();
throw new NotImplementedException();
}

public async Task<SchoolDetails?> GetSchoolDetailsAsync(Guid schoolId)
{
return new SchoolDetails();
throw new NotImplementedException();
}

Expand Down Expand Up @@ -65,11 +68,13 @@ public async Task<List<TimeTableLesson>> GetTimetableAsync(int year, int week)

public async Task<List<CalendarItem>> GetCalendarAsync(DateOnly date)
{
return new List<CalendarItem>();
throw new NotImplementedException();
}

public async Task<List<PlannedAbsenceItem>> GetPlannedAbsenceListAsync()
{
return new List<PlannedAbsenceItem>();
throw new NotImplementedException();
}

Expand All @@ -90,26 +95,31 @@ public void EnrichTeachersWithSubjects(List<Teacher> teachers, List<TimeTableLes

public async Task<List<Meal>> GetMealsAsync(int year, int week)
{
return new List<Meal>();
throw new NotImplementedException();
}

public async Task<List<KalendariumItem>> GetKalendariumAsync()
{
return new List<KalendariumItem>();
throw new NotImplementedException();
}

public async Task RefreshLoginAsync()
{
return;
throw new NotImplementedException();
}

public ApiReadSuccessIndicator GetStatus(string part)
{
return ApiReadSuccessIndicator.Unknown;
throw new NotImplementedException();
}

public Dictionary<string, ApiReadSuccessIndicator> GetStatusAll()
{
return new Dictionary<string, ApiReadSuccessIndicator>();
throw new NotImplementedException();
}

Expand Down
Loading

0 comments on commit ebe1913

Please sign in to comment.