Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/subject registration progress list #206

Merged
merged 12 commits into from
Jun 2, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

<div>
@* div purely for CSS ISOLATION *@
<HxListLayout Title="Postupy registrací studentů" TFilterModel="StudentSubjectRegistrationProgressListFilter" @bind-FilterModel="_filterModel" @bind-FilterModel:after='_grid.RefreshDataAsync'>
<HxListLayout Title="Postupy registrací studentů" TFilterModel="StudentSubjectRegistrationProgressListFilter" @bind-FilterModel="_filterModel" @bind-FilterModel:after="_grid.RefreshDataAsync">
<FilterTemplate>
<GradePicker Label="Ročník" @bind-Value="context.GradeId" />
<StudentPicker Label="Student" @bind-Value="context.StudentId" />
<HxSelect Label="Splněno" TItem="bool?" TValue="bool?" @bind-Value="context.ValidationState" TextSelector="@(v => v.Value ? "Pouze splněné" : "Pouze nesplněné")" NullText='Všechny' Nullable='true' ValueSelector="v => v" Data='[true, false]' />
<HxSelect Label="Splněno" TItem="bool?" TValue="bool?" @bind-Value="context.ValidationState" TextSelector="@(v => v.Value ? "Pouze splněné" : "Pouze nesplněné")" NullText="Všechny" Nullable="true" ValueSelector="v => v" Data="[true, false]" />
</FilterTemplate>
<DataTemplate>
<AuthorizeView Context="_">
<HxGrid
@ref="_grid"
TItem="StudentSubjectRegistrationProgressListItemDto"
DataProvider="DataProvider"
ItemRowCssClassSelector='s => s.IsRegistrationValid ? "valid" : "invalid"'
SelectionEnabled='false'
PageSize='16'>
ItemRowCssClassSelector="@(s => s.IsRegistrationValid ? "valid" : "invalid")"
SelectionEnabled="false"
PageSize="16">
<Columns>
<HxGridColumn HeaderText="Příjmení"
ItemTextSelector="s => GetStudentLastName(s.StudentId)"
<HxGridColumn HeaderText="Jméno"
ItemTextSelector="s => GetStudentName(s.StudentId)"
SortKeySelector="s => GetStudentLastName(s.StudentId)"
IsDefaultSortColumn="true" />

Expand All @@ -35,10 +35,11 @@
HeaderText="Chybí"
SortKeySelector="@(s => s.MissingCriteriaMessages != null ? s.MissingCriteriaMessages.Count : 0)">
<ItemTemplate>
<ul>
@if (context?.MissingCriteriaMessages is not null)
<ul>
@if (context is {IsRegistrationValid: false, MissingCriteriaMessages: not null})
{
@foreach (var message in context.MissingCriteriaMessages)
// Only show missing messages when registration is invalid
@foreach (var message in context.MissingCriteriaMessages)
{
<li>@message</li>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@ private async Task<GridDataProviderResult<StudentSubjectRegistrationProgressList
var data = await ProgressValidationFacade
.GetProgressListAsync(_filterModel, request.CancellationToken);

// Due to serialization, sometimes we receive empty lists,
// Due to deserialization, sometimes we receive empty lists,
// so 'List<>MissingCriteria' may be null

return request.ApplyTo(data);
}

private string GetStudentName(int studentId)
{
return StudentsDataStore.GetByKey(studentId).Name;
hakenr marked this conversation as resolved.
Show resolved Hide resolved
}

private string GetStudentLastName(int studentId)
{
return StudentsDataStore.GetByKey(studentId).LastName ?? "-příjmení nenačteno-";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@


::deep .invalid {
background-color: rgba(var(--bs-danger-rgb), 10%);
/*Don't be so angry :-D*/
/*background-color: rgba(var(--bs-danger-rgb), 10%);*/
}

/* Make sure color applies to HxGrid row children as well (they were overriding it) */
Expand Down