Edit Form: Move description to the bottom. Add RichTextEditor and AspNetCore.InputDate instead of HTML Input.
This commit is contained in:
parent
939b42a90d
commit
e5d955370a
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user