небольшие изменения в дизайне)
This commit is contained in:
parent
d45eab6e3b
commit
9d2df1b6ed
@ -219,6 +219,10 @@ namespace EventVisitorClientApp.Controllers
|
||||
[HttpPost]
|
||||
public IActionResult CreateEvent(string name, string description, string type, string phone, string email, string address, string city, string status, int count, DateTime timestart, DateTime timeend)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~Home/Enter");
|
||||
}
|
||||
string returnUrl = HttpContext.Request.Headers["Referer"].ToString();
|
||||
|
||||
if (timestart < DateTime.UtcNow)
|
||||
@ -259,11 +263,20 @@ namespace EventVisitorClientApp.Controllers
|
||||
|
||||
public IActionResult DeleteEvent(int id)
|
||||
{
|
||||
string returnUrl = HttpContext.Request.Headers["Referer"].ToString();
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
APIClient.PostRequest($"api/main/DeleteEvent", new EventBindingModel { Id = id });
|
||||
var visitorList = APIClient.GetRequest<List<VisitorViewModel>>($"api/main/GetVisitorList?EventId={id}");
|
||||
if (visitorList.Count == 0)
|
||||
{
|
||||
APIClient.PostRequest($"api/main/DeleteEvent", new EventBindingModel { Id = id });
|
||||
}
|
||||
else
|
||||
{
|
||||
return RedirectToAction("Error", new { errorMessage = "Íåëüçÿ óäàëèòü ìåðîïðèÿòèå, òàê êàê íà íåãî åñòü çàðåãåñòðèðîâàííûå ïîñåòèòåëè", returnUrl });
|
||||
}
|
||||
return RedirectToAction("MyEvents");
|
||||
}
|
||||
|
||||
@ -283,7 +296,7 @@ namespace EventVisitorClientApp.Controllers
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Íåîáõîäèìà àâòîðèçàöèÿ");
|
||||
return Redirect("~Home/Enter");
|
||||
}
|
||||
var existingEvent = APIClient.GetRequest<EventViewModel>($"api/main/GetEvent?EventId={id}");
|
||||
DateTime start = (timestart.HasValue) ? DateTime.SpecifyKind(timestart.Value, DateTimeKind.Utc) : existingEvent.TimeStart.ToUniversalTime();
|
||||
@ -372,6 +385,10 @@ namespace EventVisitorClientApp.Controllers
|
||||
[HttpPost]
|
||||
public IActionResult Visitors(int id, string action, string searchTerm, [FromForm] List<int> presentIds)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~Home/Enter");
|
||||
}
|
||||
// Ïîëó÷èòå âñåõ ïîñåòèòåëåé
|
||||
var visitors = APIClient.GetRequest<List<VisitorViewModel>>($"api/main/GetVisitorList?EventId={id}");
|
||||
var visitorsFiltered = new List<VisitorViewModel>();
|
||||
@ -458,15 +475,9 @@ namespace EventVisitorClientApp.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> RegistrationOnEventAsync(int id, string name, string phone, string email, DateTime dayBirth)
|
||||
public async Task<IActionResult> RegistrationOnEventAsync(int id, string name, string phone, string email)
|
||||
{
|
||||
var eventDetails = APIClient.GetRequest<EventViewModel>($"api/main/GetEvent?EventId={id}");
|
||||
string returnUrl = HttpContext.Request.Headers["Referer"].ToString();
|
||||
|
||||
if (dayBirth >= DateTime.Now)
|
||||
{
|
||||
return RedirectToAction("Error", new { errorMessage = "Íåâåðíàÿ äàòà ðîæäåíèÿ.", returnUrl });
|
||||
}
|
||||
if (eventDetails != null && eventDetails.FreePlaces > 0)
|
||||
{
|
||||
int updatedFreePlaces = eventDetails.FreePlaces - 1;
|
||||
@ -475,7 +486,7 @@ namespace EventVisitorClientApp.Controllers
|
||||
Name = name,
|
||||
Phone = phone,
|
||||
Email = email,
|
||||
DayBirth = dayBirth.ToUniversalTime(),
|
||||
DayBirth = DateTime.UtcNow,
|
||||
EventId = id,
|
||||
Status = "Çàðåãèñòèðîâàí"
|
||||
});
|
||||
@ -563,7 +574,6 @@ namespace EventVisitorClientApp.Controllers
|
||||
});
|
||||
return RedirectToAction("CancellationSuccess"); // Ïåðåõîä íà ñòðàíèöó óñïåõà
|
||||
}
|
||||
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
@ -577,7 +587,7 @@ namespace EventVisitorClientApp.Controllers
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Íåîáõîäèìà àâòîðèçàöèÿ");
|
||||
return Redirect("~Home/Enter");
|
||||
}
|
||||
var visitorList = APIClient.GetRequest<List<VisitorViewModel>>($"api/main/GetVisitorList?EventId={id}");
|
||||
string returnUrl = HttpContext.Request.Headers["Referer"].ToString();
|
||||
@ -629,7 +639,7 @@ namespace EventVisitorClientApp.Controllers
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Âû êàê ñóäà ïîïàëè? Ñóäà âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
return Redirect("~Home/Enter");
|
||||
}
|
||||
var reportFilePath = $"F:\\EventVisitor\\Report_{id}_{DateTime.Now.ToString("yyyyMMdd_HHmmss")}.xlsx";
|
||||
APIClient.PostRequest("api/main/createreporttoexcelfile", new ReportVisitorsBindingModel
|
||||
@ -647,9 +657,8 @@ namespace EventVisitorClientApp.Controllers
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Âû êàê ñóäà ïîïàëè? Ñóäà âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
return Redirect("~Home/Enter");
|
||||
}
|
||||
|
||||
// Ñîçäàéòå îò÷åò
|
||||
var reportFilePath = $"F:\\EventVisitor\\Report_{id}_{DateTime.Now.ToString("yyyyMMdd_HHmmss")}.docx";
|
||||
APIClient.PostRequest("api/main/createreporttowordfile", new ReportVisitorsBindingModel
|
||||
|
@ -47,14 +47,14 @@
|
||||
<div class="row mb-3">
|
||||
<label for="phone" class="col-sm-4 col-form-label">Контактный телефон:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="tel" class="form-control" id="phone" name="phone" required>
|
||||
<input type="tel" class="form-control" id="phone" name="phone" value="@APIClient.Client.Phone" required>
|
||||
<div class="invalid-feedback">Пожалуйста, введите контактный телефон.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="email" class="col-sm-4 col-form-label">Почта:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="email" class="form-control" id="email" name="email" required>
|
||||
<input type="email" class="form-control" id="email" name="email" value="@APIClient.Client.Email" required>
|
||||
<div class="invalid-feedback">Пожалуйста, введите корректный email.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -68,7 +68,7 @@
|
||||
{
|
||||
<a class="btn btn-success btn-sm" asp-action="UpdateEvent" asp-route-id="@item.Id">Редактировать</a>
|
||||
}
|
||||
<a class="btn btn-danger btn-sm" asp-action="DeleteEvent" asp-route-id="@item.Id" onclick="return confirm('Вы уверены, что хотите удалить посетителя?');">Удалить</a>
|
||||
<a class="btn btn-danger btn-sm" asp-action="DeleteEvent" asp-route-id="@item.Id" onclick="return confirm('Вы уверены, что хотите удалить мероприятие?');">Удалить</a>
|
||||
<a class="btn btn btn-secondary btn-sm" asp-action="ViewEvent" asp-route-id="@item.Id">Посмотреть</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -16,78 +16,82 @@
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/EventVisitorClientApp.styles.css" asp-append-version="true" />
|
||||
</head>
|
||||
<div class="container mt-5">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="card" style="margin: 10px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); border-radius: 10px;">
|
||||
<div class="card-header bg-secondary text-light">
|
||||
<h2>@Html.DisplayFor(model => model.Name)</h2>
|
||||
<body>
|
||||
<div class="container mt-5">
|
||||
<div class="row d-flex align-items-stretch">
|
||||
<div class="col-md-6">
|
||||
<div class="card" style="margin: 10px;">
|
||||
<div class="card-header bg-secondary text-light">
|
||||
<h2>@Html.DisplayFor(model => model.Name)</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h4>Описание:</h4>
|
||||
<p>@Html.DisplayFor(model => model.Description)</p>
|
||||
<h4>Дата начала:</h4>
|
||||
<p>@Html.DisplayFor(model => model.TimeStart)</p>
|
||||
<h4>Дата окончания:</h4>
|
||||
<p>@Html.DisplayFor(model => model.TimeEnd)</p>
|
||||
<h4>Статус:</h4>
|
||||
<p>@Html.DisplayFor(model => model.Status)</p>
|
||||
<h4>Город:</h4>
|
||||
<p>@Html.DisplayFor(model => model.City)</p>
|
||||
<h4>Адрес:</h4>
|
||||
<p>@Html.DisplayFor(model => model.Address)</p>
|
||||
<h4>Всего мест:</h4>
|
||||
<p>@Html.DisplayFor(model => model.CountVisitors)</p>
|
||||
<h4>Свободных мест:</h4>
|
||||
<p>@Html.DisplayFor(model => model.FreePlaces)</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h4>Описание:</h4>
|
||||
<p>@Html.DisplayFor(model => model.Description)</p>
|
||||
<h4>Дата начала:</h4>
|
||||
<p>@Html.DisplayFor(model => model.TimeStart)</p>
|
||||
<h4>Дата окончания:</h4>
|
||||
<p>@Html.DisplayFor(model => model.TimeEnd)</p>
|
||||
<h4>Статус:</h4>
|
||||
<p>@Html.DisplayFor(model => model.Status)</p>
|
||||
<h4>Город:</h4>
|
||||
<p>@Html.DisplayFor(model => model.City)</p>
|
||||
<h4>Адрес:</h4>
|
||||
<p>@Html.DisplayFor(model => model.Address)</p>
|
||||
<h4>Всего мест:</h4>
|
||||
<p>@Html.DisplayFor(model => model.CountVisitors)</p>
|
||||
<h4>Свободных мест:</h4>
|
||||
<p>@Html.DisplayFor(model => model.FreePlaces)</p>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="card" style="margin: 10px;">
|
||||
<div class="card-header bg-secondary text-light">
|
||||
<h2 class="display-4 mb-4">Регистрация на мероприятие</h2>
|
||||
</div>
|
||||
<div class="card-body text-center">
|
||||
<form method="post" id="registrationForm" class="border p-4 rounded">
|
||||
<div class="mb-4">
|
||||
<label for="InputName" class="form-label" style="font-size: 24px;">Введите имя</label>
|
||||
<input type="text" name="name" class="form-control" id="name" required>
|
||||
<div class="invalid-feedback">Пожалуйста, введите имя.</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="InputPhone" class="form-label" style="font-size: 24px">Введите телефон</label>
|
||||
<input type="text" name="phone" class="form-control" id="phone" required>
|
||||
<div class="invalid-feedback">Пожалуйста, введите номер телефона.</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="InputEmail" class="form-label" style="font-size: 24px">Введите e-mail</label>
|
||||
<input type="email" name="email" class="form-control" id="email" required>
|
||||
<div class="invalid-feedback">Пожалуйста, введите e-mail.</div>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<button type="submit" class="btn btn-dark btn-lg w-100">Зарегистрироваться</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="containerenter text-center">
|
||||
<h2 class="display-4 mb-4">Регистрация на мероприятие</h2>
|
||||
</div>
|
||||
|
||||
<form method="post" id="registrationForm" class="border p-4 rounded">
|
||||
<div class="mb-4">
|
||||
<label for="InputName" class="form-label" style="font-size: 24px;">Введите имя</label>
|
||||
<input type="text" name="name" class="form-control" id="name" required>
|
||||
<div class="invalid-feedback">Пожалуйста, введите имя.</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="InputPhone" class="form-label" style="font-size: 24px">Введите телефон</label>
|
||||
<input type="text" name="phone" class="form-control" id="phone" required>
|
||||
<div class="invalid-feedback">Пожалуйста, введите номер телефона.</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="InputEmail" class="form-label" style="font-size: 24px">Введите e-mail</label>
|
||||
<input type="email" name="email" class="form-control" id="email" required>
|
||||
<div class="invalid-feedback">Пожалуйста, введите e-mail.</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="dayBirth" class="form-label" style="font-size: 24px">Введите дату рождения</label>
|
||||
<input type="datetime-local" class="form-control" id="dayBirth" name="dayBirth" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<button type="submit" class="btn btn-dark btn-lg w-100">Зарегистрироваться</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.containerenter {
|
||||
max-width: 500px;
|
||||
margin: auto;
|
||||
background-color: #f8f9fa;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.card {
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
|
||||
height: 100%; /* Задать высоту в 100% для карточек */
|
||||
}
|
||||
|
||||
.card-header {
|
||||
background-color: #6c757d; /* Цвет заголовка карточки */
|
||||
}
|
||||
|
||||
.card-body {
|
||||
background-color: #f8f9fa; /* Цвет фона тела карточки */
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -9,9 +9,6 @@
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Зарегистрированные пользователи</h1>
|
||||
</div>
|
||||
<form method="post" asp-action="ReportWord" asp-controller="Home">
|
||||
<button type="submit" class="btn btn-black btn-block" style="margin-bottom: 20px;">Отчет Word о посетителях</button>
|
||||
</form>
|
||||
<form method="post" action="/Home/Visitors">
|
||||
<input type="hidden" name="id" value="@Model.FirstOrDefault()?.EventId" />
|
||||
|
||||
@ -31,7 +28,6 @@
|
||||
<th>Имя</th>
|
||||
<th>Почта</th>
|
||||
<th>Телефон</th>
|
||||
<th>Дата рождения</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
@ -43,7 +39,6 @@
|
||||
<td>@Html.DisplayFor(modelItem => item.Name)</td>
|
||||
<td>@Html.DisplayFor(modelItem => item.Email)</td>
|
||||
<td>@Html.DisplayFor(modelItem => item.Phone)</td>
|
||||
<td>@Html.DisplayFor(modelItem => item.DayBirth)</td>
|
||||
<td>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input visitor-checkbox" type="checkbox"
|
||||
|
@ -1,5 +1,8 @@
|
||||
@model EventVisitorClientApp.Models.ErrorViewModel
|
||||
|
||||
@{
|
||||
Layout = null;
|
||||
ViewData["Title"] = "Ошибка";
|
||||
}
|
||||
<html>
|
||||
<head>
|
||||
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
@ -13,9 +16,6 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Ошибка</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>@ViewBag.ErrorMessage</p>
|
||||
|
@ -27,10 +27,13 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="MyEvents">Мои мероприятия</a>
|
||||
</li>
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<ul class="navbar-nav ms-auto d-flex align-items-center">
|
||||
<li class="nav-item">
|
||||
<span class="text-dark">Организатор: @APIClient.Client.Surname @APIClient.Client.Name @APIClient.Client.LastName</span>
|
||||
</li>
|
||||
<li class="nav-item me-4">
|
||||
<form method="post" asp-area="" asp-controller="Home" asp-action="Logout" id="logoutForm" class="d-inline">
|
||||
<button type="submit" class="nav-link btn btn-link text-dark">Выход</button>
|
||||
<button type="submit" class="nav-link btn btn-link text-dark fw-bold">Выход</button>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
|
Loading…
x
Reference in New Issue
Block a user