9 Commits

11 changed files with 134 additions and 96 deletions

View File

@ -11,36 +11,40 @@
<h3>Anmeldung zum Event</h3> <h3>Anmeldung zum Event</h3>
<p>Willst du am Event (@_name) teilnehmen?</p> <p>Willst du am Event (@_name) teilnehmen?</p>
<span>@_eventDate - @_location</span> <span class="mb-6">@_eventDate.ToLocalTime() - @_location</span>
<div> <div>
<p>@_description</p> @((MarkupString)_description)
</div> </div>
@if (PageState.User != null) { @if (PageState.User != null) {
@if (Status != null) @if (Status != null)
{ {
<p class="mt-3 Ueberschrift"> <p class="mt-3"><strong>Status:</strong>
<strong>Status: </strong>
@if (Status == true) @if (Status == true)
{ {
<span class="Underline">@Localizer["Zugesagt"]</span> @Localizer["Zusage"]<br />
<br /> <button class="btn mt-1 AbsageBtn" @onclick="Absage">@Localizer["Absagen"]</button> <button class="btn btn-danger" @onclick="Absage">@Localizer["Absagen"]</button>
} else } else
{ {
<span class="Underline">@Localizer["Abgesagt"]</span> @Localizer["Absage"]<br />
<br /> <button class="btn mt-1 ZusageBtn" @onclick="Zusage">@Localizer["Zusagen"]</button> <button class="btn btn-success" @onclick="Zusage">@Localizer["Zusagen"]</button>
} }
</p> </p>
} else { } else {
<div class="buttons"> <div class="buttons">
<button class="AbsageBtn" @onclick="Zusage">@Localizer["Zusagen"]</button> <button class="btn btn-success" @onclick="Zusage">@Localizer["Zusagen"]</button>
<button class="ZusageBtn" @onclick="Absage">@Localizer["Absagen"]</button> <button class="btn btn-danger" @onclick="Absage">@Localizer["Absagen"]</button>
</div> </div>
} }
} else } else
{ {
<p class="mt-3">Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.</p> <Login /><Register /> <p class="mt-3">Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.</p>
<Login />
@* @if(PageState.Site.AllowRegistration)
{
<Register />
} *@
} }
@code { @code {
@ -64,11 +68,6 @@
private DateTime _eventDate; private DateTime _eventDate;
private string _location; private string _location;
private string _createdby;
private DateTime _createdon;
private string _modifiedby;
private DateTime _modifiedon;
private Response _response; private Response _response;
private bool? Status; private bool? Status;
@ -113,12 +112,8 @@
{ {
_name = currentEvent.Name; _name = currentEvent.Name;
_description = currentEvent.Description; _description = currentEvent.Description;
_eventDate = currentEvent.EventDate.ToLocalTime(); _eventDate = currentEvent.EventDate;
_location = currentEvent.Location; _location = currentEvent.Location;
_createdby = currentEvent.CreatedBy;
_createdon = currentEvent.CreatedOn.ToLocalTime();
_modifiedby = currentEvent.ModifiedBy;
_modifiedon = currentEvent.ModifiedOn.ToLocalTime();
} }
if(rsvp != null) if(rsvp != null)

View File

@ -1,6 +1,7 @@
@using Oqtane.Modules.Controls @using Oqtane.Modules.Controls
@using SZUAbsolventenverein.Module.EventRegistration.Services @using SZUAbsolventenverein.Module.EventRegistration.Services
@using SZUAbsolventenverein.Module.EventRegistration.Models @using SZUAbsolventenverein.Module.EventRegistration.Models
@using Microsoft.AspNetCore.Components.Forms
@namespace SZUAbsolventenverein.Module.EventRegistration @namespace SZUAbsolventenverein.Module.EventRegistration
@inherits ModuleBase @inherits ModuleBase
@ -17,22 +18,21 @@
</div> </div>
</div> </div>
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="description" HelpText="Enter a description" ResourceKey="Description">Description: </Label> <Label Class="col-sm-3" For="location" HelpText="Enter a Location" ResourceKey="Location">Location: </Label>
<div class="col-sm-9"> <div class="col-sm-9">
<input id="description" class="form-control" @bind="@_description" required /> <input id="location" class="form-control" @bind="@_location" required />
</div> </div>
</div> </div>
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="eventdate" HelpText="Enter a Date" ResourceKey="EventDate">EventDate: </Label> <Label Class="col-sm-3" For="eventdate" HelpText="Enter a Date" ResourceKey="EventDate">EventDate: </Label>
<div class="col-sm-9"> <div class="col-sm-9">
<input id="eventdate" class="form-control" @bind="@_eventDate" required /> <!--<input id="eventdate" class="form-control" @bind="@_eventDate" required />-->
<InputDate id="eventdate" class="form-control" @bind-Value="@_eventDate" Type="InputDateType.DateTimeLocal" />
</div> </div>
</div> </div>
<div class="row mb-1 align-items-center"> <div class="mb-1 align-items-center">
<Label Class="col-sm-3" For="location" HelpText="Enter a Location" ResourceKey="Location">Location: </Label> <Label Class="" For="description" HelpText="Enter a description" ResourceKey="Description">Description: </Label>
<div class="col-sm-9"> <RichTextEditor @ref="@RichTextEditorHtml" Content="@_description" Placeholder="Enter a description"/>
<input id="location" class="form-control" @bind="@_location" required />
</div>
</div> </div>
</div> </div>
<button type="button" class="btn btn-success" @onclick="Save">@Localizer["Save"]</button> <button type="button" class="btn btn-success" @onclick="Save">@Localizer["Save"]</button>
@ -56,13 +56,15 @@
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" } new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }
}; };
private RichTextEditor RichTextEditorHtml;
private ElementReference form; private ElementReference form;
private bool validated = false; private bool validated = false;
private int _id; private int _id;
private string _name; private string _name;
private string _description; private string _description;
private DateTime _eventDate; private DateTime _eventDate = DateTime.Now;
private string _location; private string _location;
private string _createdby; private string _createdby;
@ -105,6 +107,10 @@
{ {
validated = true; validated = true;
var interop = new Oqtane.UI.Interop(JSRuntime); var interop = new Oqtane.UI.Interop(JSRuntime);
string content = await RichTextEditorHtml.GetHtml();
content = Utilities.FormatContent(content, PageState.Alias, "save");
if (await interop.FormValid(form)) if (await interop.FormValid(form))
{ {
if (PageState.Action == "Add") if (PageState.Action == "Add")
@ -112,7 +118,7 @@
Event EventRegistration = new Event(); Event EventRegistration = new Event();
EventRegistration.ModuleId = ModuleState.ModuleId; EventRegistration.ModuleId = ModuleState.ModuleId;
EventRegistration.Name = _name; EventRegistration.Name = _name;
EventRegistration.Description = _description; EventRegistration.Description = content;
EventRegistration.EventDate = _eventDate.ToUniversalTime(); EventRegistration.EventDate = _eventDate.ToUniversalTime();
EventRegistration.Location = _location; EventRegistration.Location = _location;
EventRegistration = await EventRegistrationService.AddEventAsync(EventRegistration); EventRegistration = await EventRegistrationService.AddEventAsync(EventRegistration);
@ -122,7 +128,7 @@
{ {
Event EventRegistration = await EventRegistrationService.GetEventAsync(_id, ModuleState.ModuleId); Event EventRegistration = await EventRegistrationService.GetEventAsync(_id, ModuleState.ModuleId);
EventRegistration.Name = _name; EventRegistration.Name = _name;
EventRegistration.Description = _description; EventRegistration.Description = content;
EventRegistration.EventDate = _eventDate.ToUniversalTime(); EventRegistration.EventDate = _eventDate.ToUniversalTime();
EventRegistration.Location = _location; EventRegistration.Location = _location;
await EventRegistrationService.UpdateEventAsync(EventRegistration); await EventRegistrationService.UpdateEventAsync(EventRegistration);

View File

@ -16,24 +16,38 @@ else
<ActionLink Action="Add" Security="SecurityAccessLevel.Edit" Text="Add Event" ResourceKey="Add" /> <ActionLink Action="Add" Security="SecurityAccessLevel.Edit" Text="Add Event" ResourceKey="Add" />
<br /> <br />
<br /> <br />
<p>@Status</p>
@if (@_EventRegistrations.Count != 0) @if (@_EventRegistrations.Count != 0)
{ {
<Pager Items="@_EventRegistrations">
<Header>
<th style="width: 1px;">&nbsp;</th>
<th style="width: 1px;">&nbsp;</th>
<th>@Localizer["Name"]</th>
<th style="width: 1px;">&nbsp;</th>
</Header>
<Row>
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.EventId.ToString())" ResourceKey="Edit" /></td>
<td><ActionDialog Header="Delete EventRegistration" Message="Are You Sure You Wish To Delete This EventRegistration?" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" ResourceKey="Delete" Id="@context.EventId.ToString()" /></td>
<td>@context.Name</td>
<td><ActionLink Action="Details" Parameters="@($"id=" + context.EventId.ToString())" ResourceKey="Details"/></td> <div class="event-list">
</Row> <div class="event-list">
</Pager> @foreach (var context in _EventRegistrations)
{
<div class="event-card">
<h3>@context.Name</h3>
<p><strong>@Localizer["Date"]:</strong> @context.EventDate.ToLocalTime()</p>
<p><strong>@Localizer["Location"]:</strong> @context.Location</p>
<div class="event-actions">
<ActionLink Action="Edit"
Parameters="@($"id={context.EventId}")"
ResourceKey="Edit" />
<ActionDialog Action="Delete"
Security="SecurityAccessLevel.Edit"
Class="btn btn-danger"
OnClick="@(async () => await Delete(context))"
ResourceKey="Delete"
Id="@context.EventId.ToString()" />
<ActionLink Action="Details"
Parameters="@($"id={context.EventId}")"
ResourceKey="Details" />
</div>
</div>
}
</div>
</div>
} }
else else
{ {
@ -42,8 +56,6 @@ else
} }
@code { @code {
private string Status;
public override List<Resource> Resources => new List<Resource>() public override List<Resource> Resources => new List<Resource>()
{ {
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }, new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" },
@ -80,15 +92,4 @@ else
AddModuleMessage(Localizer["Message.DeleteError"], MessageType.Error); AddModuleMessage(Localizer["Message.DeleteError"], MessageType.Error);
} }
} }
private async Task Accept(Event eventRegistration)
{
Status = ("EventRegistration Accepted " + eventRegistration.Name);
await logger.LogInformation("EventRegistration Accepted {EventRegistration}", eventRegistration);
}
private void Reject()
{
Status = "EventRegistration Rejected 1";
}
} }

View File

@ -9,9 +9,9 @@ namespace SZUAbsolventenverein.Module.EventRegistration
{ {
Name = "EventRegistration", Name = "EventRegistration",
Description = "A module to manage registration for events", Description = "A module to manage registration for events",
Version = "1.0.5", Version = "1.0.14",
ServerManagerType = "SZUAbsolventenverein.Module.EventRegistration.Manager.EventRegistrationManager, SZUAbsolventenverein.Module.EventRegistration.Server.Oqtane", ServerManagerType = "SZUAbsolventenverein.Module.EventRegistration.Manager.EventRegistrationManager, SZUAbsolventenverein.Module.EventRegistration.Server.Oqtane",
ReleaseVersions = "1.0.0,1.0.5", ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,1.0.5,1.0.6,1.0.7,1.0.8,1.0.9,1.0.10,1.0.11,1.0.12,1.0.13,1.0.14",
Dependencies = "SZUAbsolventenverein.Module.EventRegistration.Shared.Oqtane", Dependencies = "SZUAbsolventenverein.Module.EventRegistration.Shared.Oqtane",
PackageName = "SZUAbsolventenverein.Module.EventRegistration" PackageName = "SZUAbsolventenverein.Module.EventRegistration"
}; };

View File

@ -127,10 +127,10 @@
<value>Delete</value> <value>Delete</value>
</data> </data>
<data name="Delete.Header" xml:space="preserve"> <data name="Delete.Header" xml:space="preserve">
<value>Delete Event</value> <value>Delete</value>
</data> </data>
<data name="Delete.Message" xml:space="preserve"> <data name="Delete.Message" xml:space="preserve">
<value>Are You Sure You Wish To Delete This Event?</value> <value>Are You Sure You Wish To Delete This Event? If you delete an event, all existing registrations will be deleted as well.</value>
</data> </data>
<data name="Message.DisplayNone" xml:space="preserve"> <data name="Message.DisplayNone" xml:space="preserve">
<value>No Events To Display</value> <value>No Events To Display</value>
@ -142,6 +142,15 @@
<value>Error Deleting Event</value> <value>Error Deleting Event</value>
</data> </data>
<data name="Details.Text" xml:space="preserve"> <data name="Details.Text" xml:space="preserve">
<value>Reject</value> <value>Details</value>
</data>
<data name="Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="Date" xml:space="preserve">
<value>Date</value>
</data>
<data name="Location" xml:space="preserve">
<value>Location</value>
</data> </data>
</root> </root>

View File

@ -13,11 +13,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.5" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="9.0.5" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.3" /> <PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.3" /> <PackageReference Include="Microsoft.Extensions.Http" Version="9.0.8" />
<PackageReference Include="System.Net.Http.Json" Version="9.0.3" /> <PackageReference Include="System.Net.Http.Json" Version="9.0.8" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,5 +1,6 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Oqtane.Services; using Oqtane.Services;
using System.Linq;
using SZUAbsolventenverein.Module.EventRegistration.Services; using SZUAbsolventenverein.Module.EventRegistration.Services;
namespace SZUAbsolventenverein.Module.EventRegistration.Startup namespace SZUAbsolventenverein.Module.EventRegistration.Startup
@ -8,7 +9,10 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Startup
{ {
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddScoped<IEventRegistrationService, EventRegistrationService>(); if (!services.Any(s => s.ServiceType == typeof(IEventRegistrationService)))
{
services.AddScoped<IEventRegistrationService, EventRegistrationService>();
}
} }
} }
} }

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>$projectname$</id> <id>$projectname$</id>
<version>1.0.0</version> <version>1.0.14</version>
<authors>SZUAbsolventenverein</authors> <authors>SZUAbsolventenverein</authors>
<owners>SZUAbsolventenverein</owners> <owners>SZUAbsolventenverein</owners>
<title>EventRegistration</title> <title>EventRegistration</title>
@ -16,7 +16,7 @@
<releaseNotes></releaseNotes> <releaseNotes></releaseNotes>
<summary></summary> <summary></summary>
<dependencies> <dependencies>
<dependency id="Oqtane.Framework" version="6.1.1" /> <dependency id="Oqtane.Framework" version="6.2.0" />
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>

View File

@ -19,10 +19,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.5" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.5" /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.5" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.5" /> <PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.8" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -81,8 +81,8 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
Response = _ResponseRepository.UpdateResponse(Response); Response = _ResponseRepository.UpdateResponse(Response);
Event currentEvent = _EventRepository.GetEvent(Response.EventRegistrationId); Event currentEvent = _EventRepository.GetEvent(Response.EventRegistrationId);
string subject = Response.ResponseType ? $"Du bist erfolgreich für '{currentEvent.Name}' Registriert worden." : $"Du hast erfolgreich für '{currentEvent.Name}' abgesagt."; string subject = Response.ResponseType ? $"Du bist erfolgreich für '{currentEvent.Name}' registriert." : $"Du hast erfolgreich für '{currentEvent.Name}' abgesagt.";
string body = "Hier kann man die Infos des Events hineinpacken (HTML ist erlaubt)"; string body = currentEvent.Description;
SendEventResponseNotification(subject, body); SendEventResponseNotification(subject, body);
_logger.Log(LogLevel.Information, this, LogFunction.Create, "EventRegistration Added {NewEvent}", Response); _logger.Log(LogLevel.Information, this, LogFunction.Create, "EventRegistration Added {NewEvent}", Response);

View File

@ -1,23 +1,46 @@
/* Module Custom Styles */ /* Module Custom Styles */
.AbsageBtn { .mb-6 {
margin-bottom: 6rem;
background-color: #e63946; /* sch<63>nes kr<6B>ftiges Rot */
color: white;
} }
.AbsageBtn:hover {
background-color: #ae262f .mt-3 {
margin-top: 3rem;
} }
.ZusageBtn { .event-list {
background-color: #2a9d8f; /* angenehmes Gr<47>n */ display: flex;
color: white; flex-wrap: wrap;
gap: 1.5rem;
justify-content: center;
} }
.ZusageBtn:hover {
background-color: #20776d .event-card {
/*background-color: var(--bs-gray-dark); */
border: 2px solid rgb(var(--bs-primary-rgb)); /* Umrandung */
border-radius: 12px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
padding: 1.5rem;
width: 280px;
/* color: #ddd; */
transition: all 0.3s ease;
} }
.Ueberschrift {
font-size: 1.5rem; .event-card:hover {
} border-color: #66ccff; /* Heller beim Hover */
.Underline { transform: translateY(-4px);
text-decoration: underline; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5);
}
.event-card h3 {
margin-top: 0;
margin-bottom: 0.5rem;
}
.event-card p {
margin: 0.2rem 0;
}
.event-actions {
margin-top: 1rem;
display: flex;
justify-content: space-between;
} }