Feat: Add school subjet and homework management management (still WIP)

This commit is contained in:
Namu
2025-11-30 19:02:29 +01:00
parent 31c15c78bd
commit f333cac61a
15 changed files with 741 additions and 15 deletions

View File

@@ -7,8 +7,10 @@
<h3>SchoolSubjectCreation</h3>
<form method="post" @onsubmit="Submit" @formname="school-subject-creation">
<AntiforgeryToken />
<EditForm Model="@Model" OnValidSubmit="Submit" FormName="school-subject-creation">
<ValidationSummary />
<DataAnnotationsValidator />
<div class="form-group">
<label for="name" class="form-label">Name</label>
<InputText class="form-control" @bind-value="Model!.Name" />
@@ -18,13 +20,23 @@
<InputTextArea class="form-control" @bind-value="Model!.Description"></InputTextArea>
</div>
<button type="submit" class="btn btn-primary">Create School Subject</button>
</form>
</EditForm>
@code {
[SupplyParameterFromForm]
private SchoolSubject? Model { get; set; }
protected override void OnInitialized() => Model ??= new();
protected override void OnInitialized()
{
if (Model is null)
{
Model = new SchoolSubject
{
Name = null!,
Description = null,
};
}
}
private async Task Submit()
{

View File

@@ -23,10 +23,13 @@ else
<ul>
@foreach (var schoolSubject in schoolSubjects)
{
<SchoolSubjectDisplay Id="@schoolSubject.Id" />
<div class="btn-group">
<SchoolSubjectDeletion Id="@schoolSubject.Id" OnDeleted="HandleDeletion" />
</div>
<li>
<SchoolSubjectDisplay Id="@schoolSubject.Id" />
<div class="btn-group">
<SchoolSubjectDeletion Id="@schoolSubject.Id" OnDeleted="HandleDeletion" />
<NavLink href="@($"/homeworks/{schoolSubject.Id}")" class="btn btn-primary">Manage homeworks</NavLink>
</div>
</li>
}
</ul>
}