Browse Source

feat: add session

pull/79/head
berkansasmaz 5 years ago
parent
commit
bd8f31b9b2
No known key found for this signature in database GPG Key ID: 884D815C3F32BE00
  1. 6
      src/EventHub.Application.Contracts/Events/AddSessionDto.cs
  2. 2
      src/EventHub.Application.Contracts/Events/TrackDto.cs
  3. 5
      src/EventHub.Application.Contracts/Users/IUserAppService.cs
  4. 6
      src/EventHub.Application.Contracts/Users/UserInListDto.cs
  5. 2
      src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs
  6. 18
      src/EventHub.Application/Events/EventAppService.cs
  7. 23
      src/EventHub.Application/Users/UserAppService.cs
  8. 13
      src/EventHub.Domain/Events/Session.cs
  9. 2
      src/EventHub.Domain/Events/Track.cs
  10. 10
      src/EventHub.Domain/Users/UserWithoutDetails.cs
  11. 10
      src/EventHub.HttpApi/Controllers/Users/UserController.cs
  12. 6
      src/EventHub.Web.Theme/wwwroot/themes/eventhub/style.css
  13. 11
      src/EventHub.Web/Pages/Events/Components/CreateEventArea/CreateEventAreaViewComponent.cs
  14. 190
      src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml
  15. 7
      src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml
  16. 4
      src/EventHub.Web/Pages/Events/Components/CreateEventArea/_modelNullErrorSection.cshtml
  17. 0
      src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.css
  18. 64
      src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js
  19. 10
      src/EventHub.Web/wwwroot/global-styles.css

6
src/EventHub.Application.Contracts/Events/AddSessionDto.cs

@ -11,8 +11,12 @@ public class AddSessionDto
[StringLength(SessionConsts.MaxTitleLength, MinimumLength = SessionConsts.MinTitleLength)] [StringLength(SessionConsts.MaxTitleLength, MinimumLength = SessionConsts.MinTitleLength)]
public string Title { get; set; } public string Title { get; set; }
[Required]
[DataType(DataType.DateTime)]
public DateTime StartTime { get; set; } public DateTime StartTime { get; set; }
[Required]
[DataType(DataType.DateTime)]
public DateTime EndTime { get; set; } public DateTime EndTime { get; set; }
[Required] [Required]

2
src/EventHub.Application.Contracts/Events/TrackDto.cs

@ -7,7 +7,7 @@ namespace EventHub.Events;
public class TrackDto : EntityDto<Guid> public class TrackDto : EntityDto<Guid>
{ {
public string Name { get; set; } public string Name { get; set; }
public List<SessionDto> Sessions { get; set; } public List<SessionDto> Sessions { get; set; }
public TrackDto() public TrackDto()

5
src/EventHub.Application.Contracts/Users/IUserAppService.cs

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using EventHub.Members; using EventHub.Members;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
@ -7,5 +8,7 @@ namespace EventHub.Users
public interface IUserAppService : IApplicationService public interface IUserAppService : IApplicationService
{ {
Task<UserDto> FindByUserNameAsync(string username); Task<UserDto> FindByUserNameAsync(string username);
Task<List<UserInListDto>> GetListByUserName(string username);
} }
} }

6
src/EventHub.Application.Contracts/Users/UserInListDto.cs

@ -0,0 +1,6 @@
namespace EventHub.Users;
public class UserInListDto
{
public string UserName { get; set; }
}

2
src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs

@ -49,6 +49,8 @@ namespace EventHub
CreateMap<Country, CountryLookupDto>(); CreateMap<Country, CountryLookupDto>();
CreateMap<IdentityUser, UserDto>(); CreateMap<IdentityUser, UserDto>();
CreateMap<UserWithoutDetails, UserInListDto>();
} }
} }
} }

18
src/EventHub.Application/Events/EventAppService.cs

@ -252,12 +252,12 @@ namespace EventHub.Events
@event.Language = input.Language; @event.Language = input.Language;
@event.SetTime(input.StartTime, input.EndTime); @event.SetTime(input.StartTime, input.EndTime);
await _eventManager.SetCapacityAsync(@event, input.Capacity); await _eventManager.SetCapacityAsync(@event, input.Capacity);
if (input.CoverImageStreamContent != null && input.CoverImageStreamContent.ContentLength > 0) if (input.CoverImageStreamContent != null && input.CoverImageStreamContent.ContentLength > 0)
{ {
await SaveCoverImageAsync(@event.Id, input.CoverImageStreamContent); await SaveCoverImageAsync(@event.Id, input.CoverImageStreamContent);
} }
await _eventRepository.UpdateAsync(@event); await _eventRepository.UpdateAsync(@event);
} }
@ -266,28 +266,30 @@ namespace EventHub.Events
{ {
var @event = await _eventRepository.GetAsync(id, true); var @event = await _eventRepository.GetAsync(id, true);
await CheckOwnerControlAsync(@event); await CheckOwnerControlAsync(@event);
@event.AddTract( @event.AddTract(
GuidGenerator.Create(), GuidGenerator.Create(),
input.Name input.Name
); );
await _eventRepository.UpdateAsync(@event); await _eventRepository.UpdateAsync(@event);
} }
[Authorize]
public async Task UpdateTrackAsync(Guid id, Guid trackId, UpdateTrackDto input) public async Task UpdateTrackAsync(Guid id, Guid trackId, UpdateTrackDto input)
{ {
var @event = await _eventRepository.GetAsync(id, true); var @event = await _eventRepository.GetAsync(id, true);
await CheckOwnerControlAsync(@event); await CheckOwnerControlAsync(@event);
@event.UpdateTrack( @event.UpdateTrack(
trackId, trackId,
input.Name input.Name
); );
await _eventRepository.UpdateAsync(@event); await _eventRepository.UpdateAsync(@event);
} }
[Authorize]
public async Task DeleteTrackAsync(Guid id, Guid trackId) public async Task DeleteTrackAsync(Guid id, Guid trackId)
{ {
var @event = await _eventRepository.GetAsync(id, true); var @event = await _eventRepository.GetAsync(id, true);
@ -332,7 +334,7 @@ namespace EventHub.Events
await _eventBlobContainer.SaveAsync(blobName, streamContent.GetStream(), overrideExisting: true); await _eventBlobContainer.SaveAsync(blobName, streamContent.GetStream(), overrideExisting: true);
} }
private async Task CheckOwnerControlAsync(Event @event) private async Task CheckOwnerControlAsync(Event @event)
{ {
var organization = await _organizationRepository.GetAsync(@event.OrganizationId); var organization = await _organizationRepository.GetAsync(@event.OrganizationId);
@ -345,7 +347,7 @@ namespace EventHub.Events
); );
} }
} }
private List<EventInListDto> GetEventInListDtoFromEventAndOrganizationTupleList(List<(Event @event, Organization organization)> items) private List<EventInListDto> GetEventInListDtoFromEventAndOrganizationTupleList(List<(Event @event, Organization organization)> items)
{ {
var now = Clock.Now; var now = Clock.Now;

23
src/EventHub.Application/Users/UserAppService.cs

@ -1,7 +1,8 @@
using System; using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using EventHub.Members; using EventHub.Members;
using Volo.Abp.Domain.Repositories; using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Identity; using Volo.Abp.Identity;
namespace EventHub.Users namespace EventHub.Users
@ -21,5 +22,21 @@ namespace EventHub.Users
return ObjectMapper.Map<IdentityUser, UserDto>(user); return ObjectMapper.Map<IdentityUser, UserDto>(user);
} }
[Authorize]
public async Task<List<UserInListDto>> GetListByUserName(string username)
{
var userQueryable = await _userRepository.GetQueryableAsync();
var query = userQueryable
.Where(u => u.UserName.Contains(username))
.Select(x => new UserWithoutDetails
{
Id = x.Id,
UserName = x.UserName
}).Take(10);
return ObjectMapper.Map<List<UserWithoutDetails>, List<UserInListDto>>(await AsyncExecuter.ToListAsync(query));
}
} }
} }

13
src/EventHub.Domain/Events/Session.cs

@ -33,13 +33,15 @@ namespace EventHub.Events
string title, string title,
DateTime startTime, DateTime startTime,
DateTime endTime, DateTime endTime,
string description) string description,
string language)
: base(id) : base(id)
{ {
TrackId = trackId; TrackId = trackId;
SetTitle(title); SetTitle(title);
SetDescription(description); SetDescription(description);
SetTime(startTime, endTime); SetTime(startTime, endTime);
SetLanguage(language);
Speakers = new Collection<Speaker>(); Speakers = new Collection<Speaker>();
} }
@ -66,5 +68,12 @@ namespace EventHub.Events
EndTime = endTime; EndTime = endTime;
return this; return this;
} }
internal Session SetLanguage(string language)
{
Language = Check.NotNullOrWhiteSpace(language, nameof(language), SessionConsts.MaxLanguageLength);
return this;
}
} }
} }

2
src/EventHub.Domain/Events/Track.cs

@ -58,7 +58,7 @@ namespace EventHub.Events
} }
} }
Sessions.Add(new Session(sessionId, Id, title, startTime, endTime, description)); Sessions.Add(new Session(sessionId, Id, title, startTime, endTime, description, language));
return this; return this;
} }

10
src/EventHub.Domain/Users/UserWithoutDetails.cs

@ -0,0 +1,10 @@
using System;
namespace EventHub.Users;
public class UserWithoutDetails
{
public Guid Id { get; set; }
public string UserName { get; set; }
}

10
src/EventHub.HttpApi/Controllers/Users/UserController.cs

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using EventHub.Members; using EventHub.Members;
using EventHub.Users; using EventHub.Users;
@ -10,7 +11,7 @@ namespace EventHub.Controllers.Users
[RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)] [RemoteService(Name = EventHubRemoteServiceConsts.RemoteServiceName)]
[Area("eventhubm")] [Area("eventhubm")]
[ControllerName("User")] [ControllerName("User")]
[Route("/api/eventhub/user")] [Route("/api/eventhub/users")]
public class UserController : EventHubController, IUserAppService public class UserController : EventHubController, IUserAppService
{ {
private readonly IUserAppService _userAppService; private readonly IUserAppService _userAppService;
@ -26,5 +27,12 @@ namespace EventHub.Controllers.Users
{ {
return await _userAppService.FindByUserNameAsync(username); return await _userAppService.FindByUserNameAsync(username);
} }
[HttpGet]
[Route("contains/{username}")]
public async Task<List<UserInListDto>> GetListByUserName(string username)
{
return await _userAppService.GetListByUserName(username);
}
} }
} }

6
src/EventHub.Web.Theme/wwwroot/themes/eventhub/style.css

@ -57,6 +57,10 @@ p {
word-wrap: break-word; word-wrap: break-word;
} }
textarea {
height: 90px!important;
}
/*NAVBAR*/ /*NAVBAR*/
.navbar { .navbar {
box-shadow: 0 5px 10px rgba(0, 4, 74, 0.05) !important; box-shadow: 0 5px 10px rgba(0, 4, 74, 0.05) !important;
@ -1092,4 +1096,4 @@ div.checkbox.switcher label input:checked + span small, div.radio.switcher label
} }
} }
/*This area was made to be able to navigate between pages. It should be removed from the project*/ /*This area was made to be able to navigate between pages. It should be removed from the project*/

11
src/EventHub.Web/Pages/Events/Components/CreateEventArea/CreateEventAreaViewComponent.cs

@ -23,7 +23,8 @@ namespace EventHub.Web.Pages.Events.Components.CreateEventArea;
[Widget( [Widget(
AutoInitialize = true, AutoInitialize = true,
RefreshUrl = "/Widgets/CreateEventArea", RefreshUrl = "/Widgets/CreateEventArea",
ScriptFiles = new[] { "/Pages/Events/Components/CreateEventArea/create-event-area.js" } ScriptFiles = new[] { "/Pages/Events/Components/CreateEventArea/create-event-area.js" },
StyleFiles = new[] { "/Pages/Events/Components/CreateEventArea/create-event-area.css" }
)] )]
public class CreateEventAreaViewComponent : AbpViewComponent public class CreateEventAreaViewComponent : AbpViewComponent
{ {
@ -54,13 +55,13 @@ public class CreateEventAreaViewComponent : AbpViewComponent
ViewData["EventId"] = @event.Id; ViewData["EventId"] = @event.Id;
ViewData["EventUrlCode"] = @event.UrlCode; ViewData["EventUrlCode"] = @event.UrlCode;
} }
model ??= new NewEventViewModel model ??= new NewEventViewModel
{ {
StartTime = DateTime.Now.ClearTime().AddDays(1).AddHours(19), StartTime = DateTime.Now.ClearTime().AddDays(1).AddHours(19),
EndTime = DateTime.Now.ClearTime().AddDays(1).AddHours(21) EndTime = DateTime.Now.ClearTime().AddDays(1).AddHours(21)
}; };
ViewData["StepType"] = stepType.ToString(); ViewData["StepType"] = stepType.ToString();
ViewData["Organizations"] = await GetOrganizationsSelectItemAsync(); ViewData["Organizations"] = await GetOrganizationsSelectItemAsync();
ViewData["Countries"] = await GetCountriesSelectItemAsync(); ViewData["Countries"] = await GetCountriesSelectItemAsync();
@ -81,7 +82,7 @@ public class CreateEventAreaViewComponent : AbpViewComponent
} }
).ToList(); ).ToList();
} }
private async Task<List<SelectListItem>> GetCountriesSelectItemAsync() private async Task<List<SelectListItem>> GetCountriesSelectItemAsync()
{ {
var result = await _eventAppService.GetCountriesLookupAsync(); var result = await _eventAppService.GetCountriesLookupAsync();
@ -169,7 +170,7 @@ public class CreateEventAreaViewComponent : AbpViewComponent
Tracks = new List<TrackDto>(); Tracks = new List<TrackDto>();
} }
} }
public enum ProgressStepType : byte public enum ProgressStepType : byte
{ {
NewEvent = 0, NewEvent = 0,

190
src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addSessionSection.cshtml

@ -1,50 +1,73 @@
@using EventHub.Web.Pages.Events @using EventHub.Web.Pages.Events
@using EventHub.Web.Pages.Events.Components.CreateEventArea @using EventHub.Web.Pages.Events.Components.CreateEventArea
@using EventHub.Events
@using Microsoft.AspNetCore.Http
@model List<EventHub.Events.TrackDto> @model List<EventHub.Events.TrackDto>
<partial name="_progressSection.cshtml" model="@CreateEventAreaViewComponent.ProgressStepType.NewSession"/> @{
var languages = ViewData["Languages"] as IList<SelectListItem>;
if (languages is null || !languages.Any())
{
throw new BadHttpRequestException("There is no language");
}
languages = languages.Select(l =>
{
if (l.Value == "en")
{
l.Selected = true;
}
return l;
}).ToList();
}
<partial name="_progressSection.cshtml" model="@CreateEventAreaViewComponent.ProgressStepType.NewSession" />
@if (Model is not null) @if (Model is not null)
{ {
<div class="row"> <div class="row">
<div class="col-md-10 mx-auto"> <div class="col-md-10 mx-auto">
<div class="card"> <div class="card">
<div class="card-body profile-content p-5" style="min-height: 480px;"> <div class="card-body profile-content p-5" style="min-height: 480px;">
<h2 class="mb-4">Add Session</h2> <h2 class="mb-4">Add Session</h2>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
@foreach (var track in Model) @foreach (var track in Model)
{ {
<th class="text-center" width="25%">@track.Name</th> <th class="text-center" width="25%">
} @track.Name.TruncateWithPostfix(20)
</tr> </th>
}
</tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
@foreach (var track in Model) @foreach (var track in Model)
{ {
<td> <td>
@foreach (var session in track.Sessions) @foreach (var session in track.Sessions)
{ {
<div class="track-item"> <div class="track-item">
<span class="track-name">@session.Title</span> <span class="track-name truncate">@session.Title</span>
<small class="text-primary d-block my-2">@EventDateHelper.GetTimeRangeText(TimeOnly.FromDateTime(session.StartTime), TimeOnly.FromDateTime(session.EndTime)) | @session.Language</small> <small class="text-primary d-block my-2">@EventDateHelper.GetTimeRangeText(TimeOnly.FromDateTime(session.StartTime), TimeOnly.FromDateTime(session.EndTime)) | @session.Language</small>
@foreach (var speaker in session.Speakers) @foreach (var speaker in session.Speakers)
{ {
<span class="d-block mb-2">@speaker.UserName</span> <span class="d-block mb-2">@speaker.UserName</span>
} }
<a href="javascript:;" data-bs-toggle="modal" data-bs-target="#editSessionModal" class="mt-3 d-block text-info"> <a href="javascript:;" data-bs-toggle="modal" data-bs-target="#editSessionModal" class="mt-3 d-block text-info">
<small><i class="fa fa-edit me-1"></i>Edit</small> <small><i class="fa fa-edit me-1"></i>Edit</small>
</a>
</div>
}
<div class="big-square-btn text-center">
<a id="@track.Id-@track.Sessions.GetHashCode()" data-track-id="@track.Id" data-bs-toggle="modal" data-bs-target="#AddSessionModal" class="btn btn-outline-secondary d-block px-2 py-5 add-session-button">
<i class="fa fa-plus mb-3"></i>
<br>Add New Session
</a> </a>
</div> </div>
} </td>
<div class="big-square-btn text-center"> }
<a href="javascript:;" data-bs-toggle="modal" data-bs-target="#addSessionModal" class="btn btn-outline-secondary d-block px-2 py-5"><i class="fa fa-plus mb-3"></i><br>Add New Session</a> </tr>
</div>
</td>
}
</tr>
</tbody> </tbody>
</table> </table>
@ -52,7 +75,10 @@
<div class="card-footer bg-white border-0 p-5 pt-1"> <div class="card-footer bg-white border-0 p-5 pt-1">
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<button id="PreviousStepButtonInSessionSection" data-target-step="@CreateEventAreaViewComponent.ProgressStepType.NewTrack" class="btn btn-secondary step-transition"><i class="fa fa-arrow-left me-2"></i> Previous Step </button> <button id="PreviousStepButtonInSessionSection"
data-target-step="@CreateEventAreaViewComponent.ProgressStepType.NewTrack"
class="btn btn-secondary step-transition"><i class="fa fa-arrow-left me-2"></i> Previous
Step </button>
</div> </div>
<div class="col-6 text-end"> <div class="col-6 text-end">
<button href="#" class="btn btn-success">Publish <i class="fa fa-arrow-right ms-2"></i></button> <button href="#" class="btn btn-success">Publish <i class="fa fa-arrow-right ms-2"></i></button>
@ -62,7 +88,99 @@
</div> </div>
</div> </div>
</div> </div>
}else
<!-- Add Session Modal -->
<div class="modal fade" id="AddSessionModal" tabindex="-1" aria-labelledby="AddSessionModal" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header border-0 p-5 pb-2">
<h5 class="modal-title">Add New Session</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form id="AddNewSessionForm">
<input type="hidden" id="TrackId" name="TrackId" value="TrackIdPlaceHolder" />
<div class="modal-body profile-content px-5">
<div class="form-floating mb-3">
<input type="text" class="form-control" id="TitleInSession" name="Title" placeholder=" "
required minLength=@SessionConsts.MinTitleLength maxLength=@SessionConsts.MaxTitleLength>
<label for="TitleInSession">Title</label>
</div>
<div class="form-floating mb-3">
<textarea type="text" class="form-control" id="DescriptionInSession" name="Description"
placeholder=" " required minLength=@SessionConsts.MinDescriptionLength
maxLength=@SessionConsts.MaxDescriptionLength></textarea>
<label for="DescriptionInSession">Description</label>
</div>
<div class="form-floating mb-3">
<input type="datetime-local" class="form-control" id="StartTimeInSession" name="StartTime"
placeholder=" " required>
<label for="StartTimeInSession">Start Time</label>
</div>
<div class="form-floating mb-3">
<input type="datetime-local" class="form-control" id="EndTimeInSession" name="EndTime"
placeholder=" " required>
<label for="EndTimeInSession">End Time</label>
</div>
<div class="form-floating mb-3">
<select id="LanguageInSession" name="Language" asp-items="languages" aria-label="en" class="form-select" required>
</select>
<label for="LanguageInSession">Language</label>
</div>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="SpeakersInSession" placeholder=" " list="suggestions">
<datalist id="suggestions">
</datalist>
<label for="SpeakersInSession">Speakers</label>
</div>
</div>
<div class="modal-footer border-0 p-5 pt-2">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary"><i class="fa fa-plus me-2"></i>Add</button>
</div>
</form>
</div>
</div>
</div>
<!-- Edit Session Modal -->
<div class="modal fade" id="editSessionModal" tabindex="-1" aria-labelledby="editSessionModal" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header border-0 p-5 pb-2">
<h5 class="modal-title">Edit This Session</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body profile-content px-5">
<div class="form mb-3">
<label for="Title2">Title</label>
<input type="text" class="form-control" id="Title2" placeholder="Lorem Upsym Title">
</div>
<div class="form mb-3">
<label for="StartTime2">Start Time</label>
<input type="text" class="form-control" id="StartTime2" placeholder="09:00">
</div>
<div class="form mb-3">
<label for="EndTime2">End Time</label>
<input type="text" class="form-control" id="EndTime2" placeholder="10:00">
</div>
<div class="form mb-3">
<label for="Language2">Language</label>
<input type="text" class="form-control" id="Language2" placeholder="English">
</div>
<div class="form mb-3">
<label for="Speakers">Speakers</label>
<input type="text" class="form-control" id="Speakers" placeholder="@@hikalkan">
</div>
</div>
<div class="modal-footer border-0 p-5 pt-2">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary"><i class="fa fa-check-circle me-2"></i>Save</button>
</div>
</div>
</div>
</div>
}
else
{ {
<partial name="_modelNullErrorSection.cshtml"/> <partial name="_modelNullErrorSection.cshtml" />
} }

7
src/EventHub.Web/Pages/Events/Components/CreateEventArea/_addTrackSection.cshtml

@ -1,4 +1,5 @@
@using EventHub.Web.Pages.Events.Components.CreateEventArea @using EventHub.Web.Pages.Events.Components.CreateEventArea
@using EventHub.Events
@model List<EventHub.Events.TrackDto> @model List<EventHub.Events.TrackDto>
<partial name="_progressSection.cshtml" model="@CreateEventAreaViewComponent.ProgressStepType.NewTrack"/> <partial name="_progressSection.cshtml" model="@CreateEventAreaViewComponent.ProgressStepType.NewTrack"/>
@ -15,7 +16,7 @@
{ {
<div class="col-md-3"> <div class="col-md-3">
<div class="track-item mb-4"> <div class="track-item mb-4">
<span class="track-name">@track.Name</span> <span class="track-name truncate">@track.Name</span>
<abp-row> <abp-row>
<abp-column> <abp-column>
<a id="@track.Id" data-track-name="@track.Name" href="javascript:;" data-bs-toggle="modal" data-bs-target="#EditTrackModal" class="mt-3 d-block text-info edit-track-button"><small><i class="fa fa-edit me-1"></i>Edit</small></a> <a id="@track.Id" data-track-name="@track.Name" href="javascript:;" data-bs-toggle="modal" data-bs-target="#EditTrackModal" class="mt-3 d-block text-info edit-track-button"><small><i class="fa fa-edit me-1"></i>Edit</small></a>
@ -61,7 +62,7 @@
<form id="AddNewTrackForm" method="post"> <form id="AddNewTrackForm" method="post">
<div class="modal-body profile-content px-5"> <div class="modal-body profile-content px-5">
<div class="form-floating"> <div class="form-floating">
<input type="text" class="form-control" id="TrackNameInput" placeholder=" " required> <input type="text" class="form-control" id="TrackNameInput" placeholder=" " required data-val-length-max="@TrackConsts.MaxNameLength">
<label for="TrackNameInput">Track Name</label> <label for="TrackNameInput">Track Name</label>
</div> </div>
</div> </div>
@ -88,7 +89,7 @@
<div class="modal-body profile-content px-5"> <div class="modal-body profile-content px-5">
<input type="hidden" id="TrackId" value="TrackIdPlaceHolder"/> <input type="hidden" id="TrackId" value="TrackIdPlaceHolder"/>
<label for="TrackNameInput" class="mb-2">Edit Track Name</label> <label for="TrackNameInput" class="mb-2">Edit Track Name</label>
<input type="text" class="form-control" id="TrackNameInput" placeholder="There is a track name here" required> <input type="text" class="form-control" id="TrackNameInput" placeholder="There is a track name here" required data-val-length-max="@TrackConsts.MaxNameLength">
</div> </div>
<div class="modal-footer border-0 p-5 pt-2"> <div class="modal-footer border-0 p-5 pt-2">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>

4
src/EventHub.Web/Pages/Events/Components/CreateEventArea/_modelNullErrorSection.cshtml

@ -1,3 +1,3 @@
<div class="text-center"> <div class="text-center mt-5">
<p><i class="fas fa-exclamation-circle"></i> An unknown error has occurred!</p> <h3><i class="fas fa-exclamation-circle"></i> An unknown error has occurred!</h3>
</div> </div>

0
src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.css

64
src/EventHub.Web/Pages/Events/Components/CreateEventArea/create-event-area.js

@ -1,5 +1,8 @@
(function () { (function () {
abp.widgets.CreateEventArea = function ($wrapper) { abp.widgets.CreateEventArea = function ($wrapper) {
toastr.options.timeOut = 500;
toastr.options.positionClass = "toast-top-right";
var stepType = { var stepType = {
"NewEvent": "NewEvent", "NewEvent": "NewEvent",
"NewTrack": "NewTrack", "NewTrack": "NewTrack",
@ -62,6 +65,9 @@
EditTrackSubmitFormEventHandler(); EditTrackSubmitFormEventHandler();
DeleteTrackButtonClickEventHandler(); DeleteTrackButtonClickEventHandler();
OpenAddNewSessionModalClickEventHandler();
AddNewSessionEventHandler();
PrevieousOrNextStepTransitionEventHandler() PrevieousOrNextStepTransitionEventHandler()
}; };
@ -69,6 +75,9 @@
var addNewTrackForm = $('#AddNewTrackForm'); var addNewTrackForm = $('#AddNewTrackForm');
addNewTrackForm.submit(function (e) { addNewTrackForm.submit(function (e) {
e.preventDefault(); e.preventDefault();
if (!addNewTrackForm.valid()) {
return false;
}
var trackName = addNewTrackForm.find('#TrackNameInput').val().trim(); var trackName = addNewTrackForm.find('#TrackNameInput').val().trim();
eventApiService.addTrack(eventIdInput.val(), {name: trackName}).then(function () { eventApiService.addTrack(eventIdInput.val(), {name: trackName}).then(function () {
$('#AddTrackModal').modal('hide'); $('#AddTrackModal').modal('hide');
@ -99,6 +108,9 @@
var editTrackForm = $('#EditTrackForm'); var editTrackForm = $('#EditTrackForm');
editTrackForm.submit(function (e) { editTrackForm.submit(function (e) {
e.preventDefault(); e.preventDefault();
if (!editTrackForm.valid()) {
return false;
}
var trackId = editTrackForm.find('#TrackId').val(); var trackId = editTrackForm.find('#TrackId').val();
var oldTrackName = $('#' + trackId).data('track-name'); var oldTrackName = $('#' + trackId).data('track-name');
var trackName = editTrackForm.find('#TrackNameInput').val().trim(); var trackName = editTrackForm.find('#TrackNameInput').val().trim();
@ -125,12 +137,64 @@
}); });
} }
function OpenAddNewSessionModalClickEventHandler() {
$('.add-session-button').click(function (e) {
var addSessionModal = $('#AddSessionModal');
var clickedSessionId = this.id;
var trackId = $('#' + clickedSessionId).data('track-id');
addSessionModal.find('#TrackId').val(trackId);
$('#StartTimeInSession').val($('#inputStartdate').val());
$('#EndTimeInSession').val($('#inputEnddate').val());
function delay(callback, ms) {
var timer = 0;
return function() {
var context = this, args = arguments;
clearTimeout(timer);
timer = setTimeout(function () {
callback.apply(context, args);
}, ms || 0);
};
}
$('#SpeakersInSession').keyup(delay(function (e) {
eventHub.controllers.users.user.getListByUserName($(this).val()).then(function (res) {
$.each(res, function (k,v) {
if ( $("#suggestions option[value='" + v.userName + "']").length === 0){
$("#suggestions").append($('<option>', {
value: v.userName,
}));
}
});
});
}, 500));
});
}
function AddNewSessionEventHandler() {
var addNewSessionForm = $('#AddNewSessionForm');
addNewSessionForm.submit(function (e) {
e.preventDefault();
if (!addNewSessionForm.valid()) {
return false;
}
var input = $(this).serializeFormToObject();
eventApiService.addSession(eventIdInput.val(), input).then(function () {
$('#AddSessionModal').modal('hide');
abp.notify.success('Added the session');
FillFilter(stepType.NewSession);
widgetManager.refresh();
});
});
}
function PrevieousOrNextStepTransitionEventHandler() { function PrevieousOrNextStepTransitionEventHandler() {
$('.step-transition').click(function (e) { $('.step-transition').click(function (e) {
var clickedButtonId = this.id; var clickedButtonId = this.id;
var targetStep = $('#' + clickedButtonId).data('target-step'); var targetStep = $('#' + clickedButtonId).data('target-step');
FillFilter(targetStep); FillFilter(targetStep);
widgetManager.refresh(); widgetManager.refresh();
ScrollToWrapperBegin();
}); });
} }

10
src/EventHub.Web/wwwroot/global-styles.css

@ -213,4 +213,12 @@
} }
.rounded-3 { .rounded-3 {
border-radius: 1rem !important; border-radius: 1rem !important;
} }
.truncate {
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
width: 140px;
}

Loading…
Cancel
Save