Skip to content

Commit

Permalink
✨🚩🍻Show description for trainings if set
Browse files Browse the repository at this point in the history
  • Loading branch information
TDroogers committed Sep 18, 2024
1 parent b71230e commit 77a7c42
Show file tree
Hide file tree
Showing 39 changed files with 505 additions and 70 deletions.
9 changes: 9 additions & 0 deletions src/Client/Drogecode.Knrm.Oefenrooster.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>UserRolesEdit.nl-NL.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Resources\Pages\Planner\Components\TrainingMessageDialog.nl-NL.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>TrainingMessageDialog.nl-NL.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -136,6 +140,11 @@
<AutoGen>True</AutoGen>
<DependentUpon>UserRolesEdit.nl-NL.resx</DependentUpon>
</Compile>
<Compile Update="Resources\Pages\Planner\Components\TrainingMessageDialog.nl-NL.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>TrainingMessageDialog.nl-NL.resx</DependentUpon>
</Compile>
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions src/Client/GlobalUsing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
global using Microsoft.AspNetCore.Components.Authorization;
global using MudBlazor;
global using System;
global using Drogecode.Knrm.Oefenrooster.Client.Repositories;
global using Microsoft.Extensions.Localization;
40 changes: 21 additions & 19 deletions src/Client/Pages/Configuration/UserRolesEdit.razor
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,31 @@ Changes to this file may cause incorrect behavior and will be lost if the code i
}
<MudTextField T="Guid?" @bind-Value="_userRole.Role.ExternalId" Label="@L["ExternalId"]"/>
<MudText Typo="Typo.h6">@L["Configuration"]</MudText>
<MudSwitch Label="@L[AccessesNames.AUTH_configure_training_types]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_configure_training_types" ValueChanged="@(isChecked => { _userRole.Role.AUTH_configure_training_types = isChecked; _saved = null; })"/>
<MudSwitch Label="@L[AccessesNames.AUTH_configure_user_roles]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_configure_user_roles" ValueChanged="@(isChecked => { _userRole.Role.AUTH_configure_user_roles = isChecked; _saved = null; })"/>
<MudSwitch Label="@L[AccessesNames.AUTH_configure_default_schedule]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_configure_default_schedule" ValueChanged="@(isChecked => { _userRole.Role.AUTH_configure_default_schedule = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["configure_training-types"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_configure_training_types" ValueChanged="@(isChecked => { _userRole.Role.AUTH_configure_training_types = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["configure_user_roles"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_configure_user_roles" ValueChanged="@(isChecked => { _userRole.Role.AUTH_configure_user_roles = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["configure_default_schedule"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_configure_default_schedule" ValueChanged="@(isChecked => { _userRole.Role.AUTH_configure_default_schedule = isChecked; _saved = null; })"/>
<MudText Typo="Typo.h6">@L["Scheduler"]</MudText>
<MudSwitch Label="@L[AccessesNames.AUTH_scheduler]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler = isChecked; _saved = null; })"/>
<MudSwitch Label="@L[AccessesNames.AUTH_scheduler_in_table_view]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler_in_table_view" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler_in_table_view = isChecked; _saved = null; })"/>
<MudSwitch Label="@L[AccessesNames.AUTH_scheduler_history]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler_history" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler_history = isChecked; _saved = null; })"/>
<MudSwitch Label="@L[AccessesNames.AUTH_scheduler_edit_past]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler_edit_past" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler_edit_past = isChecked; _saved = null; })"/>
<MudSwitch Label="@L[AccessesNames.AUTH_scheduler_dayitem]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler_dayitem" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler_dayitem = isChecked; _saved = null; })"/>
<MudSwitch Label="@L[AccessesNames.AUTH_scheduler_monthitem]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler_monthitem" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler_monthitem = isChecked; _saved = null; })"/>
<MudSwitch Label="@L[AccessesNames.AUTH_scheduler_other_user]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler_other_user" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler_other_user = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["scheduler"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["scheduler_table"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler_in_table_view" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler_in_table_view = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["scheduler_history"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler_history" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler_history = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["scheduler_past"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler_edit_past" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler_edit_past = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["scheduler_dayitem"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler_dayitem" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler_dayitem = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["scheduler_monthitem"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler_monthitem" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler_monthitem = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["scheduler_other"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler_other_user" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler_other_user = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["scheduler_description_edit"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler_description_edit" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler_description_edit = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["scheduler_description_read"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_scheduler_description_read" ValueChanged="@(isChecked => { _userRole.Role.AUTH_scheduler_description_read = isChecked; _saved = null; })"/>
<MudText Typo="Typo.h6">@L["User"]</MudText>
<MudSwitch Label="@L[AccessesNames.AUTH_users_details]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_users_details" ValueChanged="@(isChecked => { _userRole.Role.AUTH_users_details = isChecked; _saved = null; })"/>
<MudSwitch Label="@L[AccessesNames.AUTH_users_counter]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_users_counter" ValueChanged="@(isChecked => { _userRole.Role.AUTH_users_counter = isChecked; _saved = null; })"/>
<MudSwitch Label="@L[AccessesNames.AUTH_users_settigns]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_users_settigns" ValueChanged="@(isChecked => { _userRole.Role.AUTH_users_settigns = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["users_details"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_users_details" ValueChanged="@(isChecked => { _userRole.Role.AUTH_users_details = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["users_counter"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_users_counter" ValueChanged="@(isChecked => { _userRole.Role.AUTH_users_counter = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["users_settings"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_users_settigns" ValueChanged="@(isChecked => { _userRole.Role.AUTH_users_settigns = isChecked; _saved = null; })"/>
<MudText Typo="Typo.h6">@L["Dashboard"]</MudText>
<MudSwitch Label="@L[AccessesNames.AUTH_action_history_full]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_action_history_full" ValueChanged="@(isChecked => { _userRole.Role.AUTH_action_history_full = isChecked; _saved = null; })"/>
<MudSwitch Label="@L[AccessesNames.AUTH_training_history_full]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_training_history_full" ValueChanged="@(isChecked => { _userRole.Role.AUTH_training_history_full = isChecked; _saved = null; })"/>
<MudSwitch Label="@L[AccessesNames.AUTH_dashboard_Statistics]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_dashboard_Statistics" ValueChanged="@(isChecked => { _userRole.Role.AUTH_dashboard_Statistics = isChecked; _saved = null; })"/>
<MudSwitch Label="@L[AccessesNames.AUTH_dashboard_holidays]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_dashboard_holidays" ValueChanged="@(isChecked => { _userRole.Role.AUTH_dashboard_holidays = isChecked; _saved = null; })"/>
<MudSwitch Label="@L[AccessesNames.AUTH_dashboard_qr]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_dashboard_qr" ValueChanged="@(isChecked => { _userRole.Role.AUTH_dashboard_qr = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["full_action_history"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_action_history_full" ValueChanged="@(isChecked => { _userRole.Role.AUTH_action_history_full = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["full_training_history"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_training_history_full" ValueChanged="@(isChecked => { _userRole.Role.AUTH_training_history_full = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["full_dashboard_statistics2"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_dashboard_Statistics" ValueChanged="@(isChecked => { _userRole.Role.AUTH_dashboard_Statistics = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["dashboard_hol"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_dashboard_holidays" ValueChanged="@(isChecked => { _userRole.Role.AUTH_dashboard_holidays = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["dashboard_qr"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_dashboard_qr" ValueChanged="@(isChecked => { _userRole.Role.AUTH_dashboard_qr = isChecked; _saved = null; })"/>
<MudText Typo="Typo.h6">@L["Global"]</MudText>
<MudSwitch Label="@L[AccessesNames.AUTH_show_c_footer]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_show_c_footer" ValueChanged="@(isChecked => { _userRole.Role.AUTH_show_c_footer = isChecked; _saved = null; })"/>
<MudSwitch Label="@L["showCfooter"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_show_c_footer" ValueChanged="@(isChecked => { _userRole.Role.AUTH_show_c_footer = isChecked; _saved = null; })"/>
<MudButton Color="Color.Primary" OnClick="Submit">
@LApp["Submit"]
@switch (_saved)
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Pages/Dashboard/Components/ActionsTab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@if (_reportActions?.Actions is not null)
{
<AuthorizeView Roles="@AccessesNames.AUTH_Taco">
@_reportActions.ElapsedMilliseconds
<MudChip T="string">@_reportActions.ElapsedMilliseconds</MudChip>
</AuthorizeView>
<MudText Typo="Typo.h5">@L["Actions from SharePoint"]</MudText>
<SelectMultipleUsers Users="@Users" Functions="@Functions" Selection="@_selectedUsersAction" SelectionChanged="OnSelectionChanged" MultiSelection="_multiSelection"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@if (_renderChart && _data is not null && _data.Any())
{
<AuthorizeView Roles="@AccessesNames.AUTH_Taco">
@_elapsedMilliseconds
<MudChip T="string">@_elapsedMilliseconds</MudChip>
</AuthorizeView>
<ApexChart @ref=_chart TItem="StatisticsTab.ChartMonth" Title="@L["actions"]" Options="_options">

Expand All @@ -14,8 +14,7 @@
Name="@data.Name"
SeriesType="SeriesType.Line"
XValue="e => e.Month"
YValue="e => e.Count"
/>
YValue="e => e.Count"/>
}
</ApexChart>
}
Expand Down
4 changes: 4 additions & 0 deletions src/Client/Pages/Dashboard/Components/StatisticsTab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<SelectMultipleUsers Users="@Users" Functions="@Functions" Selection="@_selectedUsers" SelectionChanged="OnSelectionChanged" MultiSelection="true"/>
<MudSwitch Label="@L["Analyze all years"]" Color="Color.Primary" T="bool" Value="@_allYears" ValueChanged="@(async (isChecked) => await AllYearsChanged(isChecked))"/>
<MudSwitch Label="@L["Total"]" Color="Color.Primary" T="bool" Value="@_total" ValueChanged="@(async (isChecked) => await TotalChanged(isChecked))"/>
@if (_showHistoricalIncorrectWarning)
{
<MudAlert Severity="Severity.Info">@L["Data from 2021 and before could be incorrect or incomplete"]</MudAlert>
}
<MudPaper Elevation="0" Class="flex align-content-start flex-wrap flex-grow-1 gap-4 mx-2 my-4">
<div class="flex-1">
<StatisticsActionsAll @ref="_statisticsActionsAll" StatisticsTab="this" SelectedUsers="_selectedUsers" AllYears="@_allYears"/>
Expand Down
18 changes: 14 additions & 4 deletions src/Client/Pages/Dashboard/Components/StatisticsTab.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public sealed partial class StatisticsTab
private string[]? _xAxisLabels;
private bool _allYears;
private bool _total;
private bool _showHistoricalIncorrectWarning;

protected override void OnAfterRender(bool firstRender)
{
Expand Down Expand Up @@ -53,11 +54,24 @@ private async Task TotalChanged(bool newValue)

public List<ChartYear> DrawLineChartAll(AnalyzeYearChartAllResponse? analyzeData, bool allYears)
{
if (_showHistoricalIncorrectWarning)
{
_showHistoricalIncorrectWarning = false;
StateHasChanged();
}

var data = new List<ChartYear>();
if (analyzeData is null) return data;
var yearCount = 0;
foreach (var year in analyzeData.Years.OrderByDescending(x => x.Year))
{
if (!allYears && yearCount >= 5)
break;
if (year.Year <= 2021)
{
_showHistoricalIncorrectWarning = true;
StateHasChanged();
}
var month = new List<ChartMonth>();
var count = 0;
for (var i = 0; i < 12; i++)
Expand All @@ -81,17 +95,13 @@ public List<ChartYear> DrawLineChartAll(AnalyzeYearChartAllResponse? analyzeData
});
}
}

if (!allYears && yearCount >= 5)
break;
data.Add(new ChartYear()
{
Name = year.Year.ToString(),
Months = month,
});
yearCount++;
}

return data;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@if (_renderChart && _data is not null && _data.Any())
{
<AuthorizeView Roles="@AccessesNames.AUTH_Taco">
@_elapsedMilliseconds
<MudChip T="string">@_elapsedMilliseconds</MudChip>
</AuthorizeView>
<ApexChart @ref=_chart TItem="StatisticsTab.ChartMonth" Title="@L["trainings"]" Options="_options">

Expand Down
2 changes: 1 addition & 1 deletion src/Client/Pages/Dashboard/Components/TrainingsTab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@if (_reportTrainings != null)
{
<AuthorizeView Roles="@AccessesNames.AUTH_Taco">
@_reportTrainings.ElapsedMilliseconds
<MudChip T="string">@_reportTrainings.ElapsedMilliseconds</MudChip>
</AuthorizeView>
<MudText Typo="Typo.h5">@L["Trainings from SharePoint"]</MudText>
<SelectMultipleUsers Users="@Users" Functions="@Functions" Selection="@_selectedUsersTraining" SelectionChanged="OnSelectionChanged" MultiSelection="_multiSelection"/>
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Pages/Dashboard/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
</MudPaper>
@if (_trainings.TotalCount >= _total)
{
<MudButton OnClick="LoadMore">@LApp["Load more"]</MudButton>
<MudButton OnClick="LoadMore" Color="Color.Primary">@LApp["Load more"]</MudButton>
}
}
else
Expand Down
6 changes: 2 additions & 4 deletions src/Client/Pages/Planner/Components/EditTrainingDialog.razor
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@
{
<MudForm @ref="_form" @bind-IsValid="@_success" @bind-Errors="@_errors" Disabled="@(!_canEdit)">
<MudTextField Label="@L["Name"]" @bind-Value="_training.Name" Counter="@DefaultSettingsHelper.MAX_LENGTH_TRAINING_TITLE" MaxLength="@DefaultSettingsHelper.MAX_LENGTH_TRAINING_TITLE" Immediate="true"/>
@if (_isTaco)
{
@* Comming soon! But do not enable configuration untill it is visible on other places *@
<AuthorizeView Roles="@AccessesNames.AUTH_scheduler_description_edit">
<MudTextField T="string" Label="@L["Description - Markdown"]" @bind-Value="_training.Description" Lines="5" Counter="@DefaultSettingsHelper.MAX_LENGTH_TRAINING_DESCRIPTION" MaxLength="@DefaultSettingsHelper.MAX_LENGTH_TRAINING_DESCRIPTION" Immediate="true"/>
<MudMarkdown Value="@_training.Description" />
}
</AuthorizeView>
<MudDatePicker Label="@L["Date"]" @bind-Date="_training.Date" Validation="@(new Func<DateTime?, string?>(DateValidation))" Required Disabled="!_training.IsNew"/>

@if (!_training.ShowTime || _startedWithShowNoTime)
Expand Down
11 changes: 7 additions & 4 deletions src/Client/Pages/Planner/Components/ScheduleCard.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
<CalendarBaseCard ReplaceEmptyName="@ReplaceEmptyName" Width="@Width" MaxWidth="@MaxWidth" MinWidth="@MinWidth" Training="@Planner" OnClickCallback="@OpenScheduleDialog" OnClickSettings="@OpenConfigDialog" OnClickHistory="_showHistory ? OpenHistoryDialog : null!" ShowDate="@ShowDate" ShowDayOfWeek="@ShowDayOfWeek" @bind-ShowPastBody="@_showPastBody" MoreMessage="@L["Show attendees"]">

<ChipContent>
<AuthorizeView Roles="@AccessesNames.AUTH_Hide">
<div @onclick:stopPropagation="true" @onclick:preventDefault="true">
<MudChip T="string" OnClick="@OpenMessageDialog" Icon="@Icons.Material.Filled.Person" Color="Color.Primary">Account</MudChip>
</div>
<AuthorizeView Roles="@AccessesNames.AUTH_scheduler_description_read">
@if (Planner.HasDescription)
{
<div @onclick:stopPropagation="true" @onclick:preventDefault="true">
<MudChip T="string" OnClick="@OpenMessageDialog" Icon="@Icons.Material.Filled.Description" Color="Color.Primary">@L["Read more"]</MudChip>
</div>
}
</AuthorizeView>
</ChipContent>
<ChildContent>
Expand Down
Loading

0 comments on commit 77a7c42

Please sign in to comment.