Skip to content

Commit

Permalink
πŸŽ‰πŸš§πŸš©βœ¨ Multiple things
Browse files Browse the repository at this point in the history
  • Loading branch information
TDroogers committed Sep 21, 2024
1 parent 1a63a3b commit d83f95b
Show file tree
Hide file tree
Showing 46 changed files with 3,282 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<DialogContent>
@if (Functions != null)
{
<MudTextField @bind-Value="_user.Name" Label="@L["Name"]" Variant="Variant.Text"/>
<MudTextField @bind-Value="_user.Name" Label="@L["Name"]" Variant="Variant.Text" Counter="@DefaultSettingsHelper.MAX_LENGTH_DAY_ITEM_TEXT" MaxLength="@DefaultSettingsHelper.MAX_LENGTH_DAY_ITEM_TEXT"/>
<MudSelect T="Guid?" Label="@L["Function"]" AnchorOrigin="Origin.BottomCenter" @bind-Value="_user.UserFunctionId">
@foreach (var function in Functions.Where(x => !x.TrainingOnly).OrderBy(x => x.Order))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<DialogContent>
@if (MonthItem is not null)
{
<MudTextField @bind-Value="MonthItem.Text" Label="@L["Description"]"/>
<MudTextField @bind-Value="MonthItem.Text" Label="@L["Description"]" Counter="@DefaultSettingsHelper.MAX_LENGTH_MONTH_ITEM_TEXT" MaxLength="@DefaultSettingsHelper.MAX_LENGTH_MONTH_ITEM_TEXT"/>
<MudSelect T="Severity" Variant="Variant.Text" @bind-Value="MonthItem.Severity" Label="@L["Severity"]">
<MudSelectItem T="Severity" Value="Severity.Normal">@L["Normal"]</MudSelectItem>
<MudSelectItem T="Severity" Value="Severity.Info">@L["Info"]</MudSelectItem>
Expand Down
2 changes: 2 additions & 0 deletions src/Client/Pages/Configuration/UserRolesEdit.razor
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Changes to this file may cause incorrect behavior and will be lost if the code i
<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["Mail"]</MudText>
<MudSwitch Label="@L["mail_invite_external"]" Color="Color.Primary" T="bool" Value="@_userRole.Role.AUTH_mail_invite_external" ValueChanged="@(isChecked => { _userRole.Role.AUTH_mail_invite_external = isChecked; _saved = null; })"/>
<MudText Typo="Typo.h6">@L["Global"]</MudText>
<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">
Expand Down
37 changes: 21 additions & 16 deletions src/Client/Pages/Dashboard/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@
var color = DayItemHelper.DayItemTypeColor(item.Type);
<MudItem xs="12" sm="6" md="4" lg="3">
<div class="d-flex gap-1">
<MudIcon Icon="@Icons.Material.Filled.Circle" Color="color" Size="Size.Small" />
<DateToString DateTimeLocal="item.DateStart" @key="@(item.DateStart?.Ticks + DateTime.Today.Day)" />
<MudIcon Icon="@Icons.Material.Filled.Circle" Color="color" Size="Size.Small"/>
<DateToString DateTimeLocal="item.DateStart" @key="@(item.DateStart?.Ticks + DateTime.Today.Day)"/>
@if (item.DateEnd is not null && !item.DateEnd.Equals(item.DateStart))
{
<div> - </div>
<DateToString DateTimeLocal="item.DateEnd" @key="@(item.DateEnd?.Ticks + DateTime.Today.Day)"/>
}
@item.Text
</div>
</MudItem>
Expand All @@ -47,18 +52,18 @@
@foreach (var training in _pinnedTrainings)
{
<div class="flex-1">
<CalendarCard MinWidth="300px" MaxWidth="600px" Training="training" ShowDate="true" ShowDayOfWeek="true" />
<CalendarCard MinWidth="300px" MaxWidth="600px" Training="training" ShowDate="true" ShowDayOfWeek="true"/>
</div>
}
</MudPaper>
}
}
else if (_loading)
{
<MudSkeleton />
<MudSkeleton />
<MudSkeleton />
<MudSkeleton />
<MudSkeleton/>
<MudSkeleton/>
<MudSkeleton/>
<MudSkeleton/>
}
<MudText Typo="Typo.h5">@L["Future trainings"]</MudText>
@if (_trainings?.Trainings != null)
Expand All @@ -69,7 +74,7 @@
@foreach (var training in _trainings.Trainings)
{
<div class="flex-1">
<IndexCard MinWidth="300px" MaxWidth="600px" User="_user" Training="training" Functions="_functions" Users="_users" TrainingTypes="_trainingTypes" Vehicles="_vehicles" ShowDayOfWeek="true" />
<IndexCard MinWidth="300px" MaxWidth="600px" User="_user" Training="training" Functions="_functions" Users="_users" TrainingTypes="_trainingTypes" Vehicles="_vehicles" ShowDayOfWeek="true"/>
</div>
}
</MudPaper>
Expand All @@ -85,10 +90,10 @@
}
else if (_loading)
{
<MudSkeleton />
<MudSkeleton />
<MudSkeleton />
<MudSkeleton />
<MudSkeleton/>
<MudSkeleton/>
<MudSkeleton/>
<MudSkeleton/>
}
<AuthorizeView Roles="@AccessesNames.AUTH_dashboard_holidays">
@if (_futureHolidays != null)
Expand All @@ -113,18 +118,18 @@
</AuthorizeView>
<AuthorizeView Roles="@AccessesNames.AUTH_dashboard_qr">
<MudText Typo="Typo.h5">@L["hui.nu QR code"]</MudText>
<MudBarcode Value="https://hui.nu" ForceHeight="1" BarcodeFormat="BarcodeFormat.QR_CODE" />
<MudBarcode Value="https://hui.nu" ForceHeight="1" BarcodeFormat="BarcodeFormat.QR_CODE"/>
</AuthorizeView>
</MudTabPanel>
<MudTabPanel Text="@L["Actions"]">
<ActionsTab User="@_user" Users="@_users" Functions="@_functions" />
<ActionsTab User="@_user" Users="@_users" Functions="@_functions"/>
</MudTabPanel>
<MudTabPanel Text="@L["Trainings"]">
<TrainingsTab User="@_user" Users="@_users" Functions="@_functions" />
<TrainingsTab User="@_user" Users="@_users" Functions="@_functions"/>
</MudTabPanel>
<AuthorizeView Roles="@AccessesNames.AUTH_dashboard_Statistics">
<MudTabPanel Text="@L["Statistics"]">
<StatisticsTab User="@_user" Users="@_users" Functions="@_functions" />
<StatisticsTab User="@_user" Users="@_users" Functions="@_functions"/>
</MudTabPanel>
</AuthorizeView>
</MudTabs>
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Pages/User/Components/GroupDialog.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<DialogContent>
@if (DefaultGroup is not null)
{
<MudTextField T="string" Label="@L["Name"]" @bind-Value="DefaultGroup.Name" Placeholder="@L["Give a name"]"></MudTextField>
<MudTextField T="string" Label="@L["Name"]" @bind-Value="DefaultGroup.Name" Placeholder="@L["Give a name"]" Counter="@DefaultSettingsHelper.MAX_LENGTH_TRAINING_GROUP_NAME" MaxLength="@DefaultSettingsHelper.MAX_LENGTH_TRAINING_GROUP_NAME"></MudTextField>
<MudDatePicker Label="@LApp["ValidFrom"]" @bind-Date="DefaultGroup.ValidFrom" Required Disabled="@(IsNew != true && (DefaultGroup.ValidFrom?.InPast() ?? false))" Validation="@(new Func<DateTime?, string?>(ValidateStartDate))" />
<MudDatePicker Label="@LApp["ValidUntil"]" @bind-Date="DefaultGroup.ValidUntil" Required Disabled="@(IsNew != true && (DefaultGroup.ValidUntil?.InPast() ?? false))" Validation="@(new Func<DateTime?, string?>(ValidateTillDate))" />
}
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Pages/User/Components/VacationAdd.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
<MudAlert Severity="Severity.Warning">@_error</MudAlert>
}
<MudTextField Label="@L["Description"]" @bind-Value="_holiday.Description" MaxLength="@DefaultSettingsHelper.MAX_LENGTH_TRAINING_TITLE"/>
<MudTextField Label="@L["Description"]" @bind-Value="_holiday.Description" Counter="@DefaultSettingsHelper.MAX_LENGTH_HOLIDAY_NAME" MaxLength="@DefaultSettingsHelper.MAX_LENGTH_HOLIDAY_NAME"/>
<MudDatePicker Label="@L["Valid from"]" @bind-Date="_holiday.ValidFrom" Validation="@(new Func<DateTime?, string?>(ValidateStartDate))" Disabled="@(_originalHoliday?.ValidFrom?.InPast() ?? false)" Required/>
<MudDatePicker Label="@L["Valid till"]" @bind-Date="_holiday.ValidUntil" Validation="@(new Func<DateTime?, string?>(ValidateTillDate))" Disabled="@(_originalHoliday?.ValidUntil?.InPast() ?? false)" Required/>

Expand Down
25 changes: 20 additions & 5 deletions src/Client/Pages/User/Profile.razor
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,25 @@
}
</AuthorizeView>
<MudText>
<p>@L["Client version:"] @DefaultSettingsHelper.CURRENT_VERSION</p>
@if (_updateDetails is not null)
{
<p>@L["Server version:"] @_updateDetails.CurrentVersion </p>
}
<table class="table-auto">
<tbody>
<tr>
<td>@L["Client version:"]</td>
<td>@DefaultSettingsHelper.CURRENT_VERSION</td>
</tr>
@if (_updateDetails is not null)
{
<tr>
<td>@L["Server version:"]</td>
<td>@_updateDetails.CurrentVersion</td>
</tr>
}
</tbody>
</table>
</MudText>
<AuthorizeView Roles="@AccessesNames.AUTH_Taco"><!-- Remove when ready -->
<AuthorizeView Roles="@AccessesNames.AUTH_mail_invite_external" Context="inner">
<MudText>@L["Mails to invite to your trainings"]</MudText>
</AuthorizeView>
</AuthorizeView>
</MudPaper>
3 changes: 3 additions & 0 deletions src/Client/Resources/Pages/User/Profile.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@
<data name="Setting training to calendar" xml:space="preserve">
<value>Setting training to calendar</value>
</data>
<data name="Mails to invite to your trainings" xml:space="preserve">
<value>Mails to invite to your trainings</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/Client/Resources/Pages/User/Profile.nl-NL.resx
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@
<data name="Setting training to calendar" xml:space="preserve">
<value>Instelling training naar calender</value>
</data>
<data name="Mails to invite to your trainings" xml:space="preserve">
<value>Mails die worden uitgenodigd tot jouw oefeningen</value>
</data>
</root>
6 changes: 3 additions & 3 deletions src/Client/Shared/Layout/CultureSelector.razor
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<p>
<label>
@L["Select your locale"]
<select @bind="Culture">
<MudSelect T="CultureInfo" @bind-Value="Culture">
@foreach (var culture in supportedCultures)
{
<option value="@culture">@culture.DisplayName</option>
<MudSelectItem T="CultureInfo" value="@culture">@culture.DisplayName</MudSelectItem>
}
</select>
</MudSelect>
</label>
</p>

Expand Down
3 changes: 3 additions & 0 deletions src/Client/wwwroot/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
User-agent: *
User-agent: AdsBot-Google
Disallow: /
42 changes: 42 additions & 0 deletions src/ClientGenerator/Clients/UserLinkedMailsClient.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//----------------------
// <auto-generated>
// Generated using the NSwag toolchain v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
// </auto-generated>
//----------------------

#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended."
#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword."
#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?'
#pragma warning disable 612 // Disable "CS0612 '...' is obsolete"
#pragma warning disable 649 // Disable "CS0649 Field is never assigned to, and will always have its default value null"
#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ...
#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..."
#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'"
#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant"
#pragma warning disable 8603 // Disable "CS8603 Possible null reference return"
#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter"
#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type"
#pragma warning disable 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)."

namespace Drogecode.Knrm.Oefenrooster.ClientGenerator.Client
{
using System = global::System;






}

#pragma warning restore 108
#pragma warning restore 114
#pragma warning restore 472
#pragma warning restore 612
#pragma warning restore 1573
#pragma warning restore 1591
#pragma warning restore 8073
#pragma warning restore 3016
#pragma warning restore 8603
#pragma warning restore 8604
#pragma warning restore 8625
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
<OutputPath>../Clients/UserClient.g.cs</OutputPath>
<Options>/GenerateClientInterfaces:true /GenerateDtoTypes:false /UseBaseUrl:false /AdditionalNamespaceUsages:Drogecode.Knrm.Oefenrooster.Shared.Models.User</Options>
</OpenApiReference>
<OpenApiReference Include="OpenAPIs\UserLinkedMails.json" CodeGenerator="NSwagCSharp" Namespace="Drogecode.Knrm.Oefenrooster.ClientGenerator.Client" ClassName="UserLinkedMailsClient">
<OutputPath>../Clients/UserLinkedMailsClient.g.cs</OutputPath>
<Options>/GenerateClientInterfaces:true /GenerateDtoTypes:false /UseBaseUrl:false</Options>
</OpenApiReference>
<OpenApiReference Include="OpenAPIs\UserRole.json" CodeGenerator="NSwagCSharp" Namespace="Drogecode.Knrm.Oefenrooster.ClientGenerator.Client" ClassName="UserRoleClient">
<OutputPath>../Clients/UserRoleClient.g.cs</OutputPath>
<Options>/GenerateClientInterfaces:true /GenerateDtoTypes:false /UseBaseUrl:false /AdditionalNamespaceUsages:Drogecode.Knrm.Oefenrooster.Shared.Models.UserRole</Options>
Expand Down
3 changes: 2 additions & 1 deletion src/ClientGenerator/OpenAPIs/Audit.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@
6,
7,
8,
9
9,
10
],
"type": "integer",
"format": "int32"
Expand Down
2 changes: 2 additions & 0 deletions src/ClientGenerator/OpenAPIs/MonthItem.json
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@
"$ref": "#/components/schemas/Severity"
},
"text": {
"maxLength": 150,
"minLength": 0,
"type": "string",
"nullable": true
},
Expand Down
9 changes: 9 additions & 0 deletions src/ClientGenerator/OpenAPIs/UserLinkedMails.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"openapi": "3.0.1",
"info": {
"title": "UserLinkedMails",
"version": "v1"
},
"paths": { },
"components": { }
}
9 changes: 9 additions & 0 deletions src/ClientGenerator/OpenAPIs/UserRole.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@
"autH_scheduler_other_user": {
"type": "boolean"
},
"autH_scheduler_description_edit": {
"type": "boolean"
},
"autH_scheduler_description_read": {
"type": "boolean"
},
"autH_users_details": {
"type": "boolean"
},
Expand All @@ -245,6 +251,9 @@
"autH_dashboard_qr": {
"type": "boolean"
},
"autH_mail_invite_external": {
"type": "boolean"
},
"autH_show_c_footer": {
"type": "boolean"
}
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public async Task<ActionResult<SyncAllUsersResponse>> SyncAllUsers(CancellationT
var a = await _userService.UpdateUser(newUserResponse, userId, customerId);
}
}
if (users.OdataNextLink != null)
if (users.OdataNextLink is not null)
users = await _graphService.NextUsersPage(users);
else break;
}
Expand Down
30 changes: 30 additions & 0 deletions src/Server/Controllers/UserLinkedMailsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ο»Ώusing Drogecode.Knrm.Oefenrooster.Server.Hubs;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Identity.Web.Resource;

namespace Drogecode.Knrm.Oefenrooster.Server.Controllers;

[Authorize]
[ApiController]
[Route("api/[controller]")]
[ApiExplorerSettings(GroupName = "UserLinkedMails")]
public class UserLinkedMailsController
{
private readonly ILogger<UserController> _logger;
private readonly IUserService _userService;
private readonly IAuditService _auditService;
private readonly IGraphService _graphService;
private readonly IFunctionService _functionService;
private readonly RefreshHub _refreshHub;

public UserLinkedMailsController(ILogger<UserController> logger, IUserService userService, IAuditService auditService, IGraphService graphService, IFunctionService functionService, RefreshHub refreshHub)
{
_logger = logger;
_userService = userService;
_auditService = auditService;
_graphService = graphService;
_functionService = functionService;
_refreshHub = refreshHub;
}
}
6 changes: 6 additions & 0 deletions src/Server/Database/DataContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class DataContext : DbContext, IDataProtectionKeyContext
public DbSet<DbUserHolidays> UserHolidays { get; set; }
public DbSet<DbUserOnVersion> UserOnVersions { get; set; }
public DbSet<DbUserSettings> UserSettings { get; set; }
public DbSet<DbUserLinkedMails> UserLinkedMails { get; set; }
public DbSet<DbCustomers> Customers { get; set; }
public DbSet<DbCustomerSettings> CustomerSettings { get; set; }
public DbSet<DbRoosterDefault> RoosterDefaults { get; set; }
Expand Down Expand Up @@ -110,6 +111,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.Entity<DbUserSettings>(e => { e.Property(en => en.Id).IsRequired(); });
modelBuilder.Entity<DbUserSettings>().HasOne(p => p.Customer).WithMany(g => g.UserSettings).HasForeignKey(s => s.CustomerId).IsRequired();
modelBuilder.Entity<DbUserSettings>().HasOne(p => p.User).WithMany(g => g.UserSettings).HasForeignKey(s => s.UserId).IsRequired();

//UserLinkedMails
modelBuilder.Entity<DbUserLinkedMails>(e => { e.Property(en => en.Id).IsRequired(); });
modelBuilder.Entity<DbUserLinkedMails>().HasOne(p => p.Customer).WithMany(g => g.UserLinkedMails).HasForeignKey(s => s.CustomerId).IsRequired();
modelBuilder.Entity<DbUserLinkedMails>().HasOne(p => p.User).WithMany(g => g.UserLinkedMails).HasForeignKey(s => s.UserId).IsRequired();

// Rooster available
modelBuilder.Entity<DbRoosterAvailable>(e => { e.Property(en => en.Id).IsRequired(); });
Expand Down
Loading

0 comments on commit d83f95b

Please sign in to comment.