CourseWork_KPO/CandidateReviewClientApp/Views/User/UserProfile.cshtml
2024-12-13 04:12:54 +04:00

167 lines
7.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@using CandidateReviewContracts.ViewModels
@model UserViewModel
@{
ViewData["Title"] = "Профиль пользователя";
var userRole = APIClient.User?.Role == CandidateReviewDataModels.Enums.RoleEnum.Пользователь || APIClient.User?.Role == CandidateReviewDataModels.Enums.RoleEnum.Администратор ? true : false;
}
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card shadow-lg p-4 rounded">
<div class="text-center">
<img src="https://cdn-icons-png.flaticon.com/512/18/18601.png"
class="card-img-top img-fluid rounded-circle mx-auto d-block"
style="max-width: 150px; max-height: 150px;" alt="Аватар пользователя">
</div>
<div class="card-body text-center">
<h3 class="card-title mb-2">
@(string.IsNullOrEmpty(@Model?.Surname) ? "" : @Model?.Surname)
@Model?.Name
@(string.IsNullOrEmpty(@Model?.LastName) ? "" : @Model?.LastName)
</h3>
<dl class="row mt-3">
<dt class="col-sm-4 text-muted">Email:</dt>
<dd class="col-sm-8">@Model?.Email</dd>
@if (!string.IsNullOrEmpty(@Model?.PhoneNumber))
{
<dt class="col-sm-4 text-muted">Телефон:</dt>
<dd class="col-sm-8">@Model?.PhoneNumber</dd>
}
<dt class="col-sm-4 text-muted">Роль:</dt>
<dd class="col-sm-8">@Model?.Role</dd>
</dl>
<div class="btn-group mt-4" role="group" aria-label="Действия">
<a asp-action="UserProfileEdit" asp-controller="User" asp-route-id="@Model?.Id"
class="btn btn-outline-primary px-4 py-2 me-2">
<i class="bi bi-pencil me-2"></i>Редактировать профиль
</a>
<form asp-action="Delete" asp-controller="User" method="post"
onsubmit="return confirm('Вы уверены, что хотите удалить профиль?');" class="d-inline me-2">
<input type="hidden" name="id" value="@Model?.Id" />
<button type="submit" class="btn btn-outline-danger px-4 py-2">
<i class="bi bi-trash me-2"></i>Удалить профиль
</button>
</form>
<a asp-action="Logout" asp-controller="User" class="btn btn-outline-secondary px-4 py-2">
<i class="bi bi-box-arrow-right me-2"></i>Выйти
</a>
</div>
</div>
</div>
</div>
@if (userRole)
{
<div class="col-md-8 mt-4">
<div class="card shadow-sm mb-4">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>Мои резюме</h2>
</div>
<div class="card-body">
@if (Model.Resumes != null && Model.Resumes.Any())
{
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Название</th>
<th>Вакансия</th>
<th>Статус</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
@foreach (var resume in Model.Resumes)
{
<tr>
<td>@resume.Title</td>
<td>@resume.VacancyName</td>
<td>@resume.Status</td>
<td>
<a asp-action="ResumeDetails" asp-controller="Resume" asp-route-id="@resume.Id" class="btn btn-info btn-sm me-2" title="Просмотр">
<i class="bi bi-eye"></i>
</a>
<a asp-action="EditResume" asp-controller="Resume" asp-route-id="@resume.Id" class="btn btn-warning btn-sm me-2" title="Редактировать">
<i class="bi bi-pencil"></i>
</a>
<a asp-action="Delete" asp-controller="Resume" asp-route-id="@resume.Id" class="btn btn-danger btn-sm me-2" title="Удалить" onclick="return confirm('Вы уверены, что хотите удалить резюме?');">
<i class="bi bi-trash"></i>
</a>
</td>
</tr>
}
</tbody>
</table>
}
else
{
<p class="text-muted">У вас нет резюме.</p>
}
</div>
</div>
</div>
}
</div>
</div>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
h1, h2 {
color: #333;
}
.table {
margin-top: 20px;
}
.table th, .table td {
vertical-align: middle;
}
.btn {
background-color: #0A1128;
color: white;
border: none;
border-radius: 10px;
padding: 12px;
font-size: 16px;
transition: background-color 0.3s ease, transform 0.2s ease;
}
.btn:hover {
background-color: #1C3273;
transform: scale(1.05);
}
.input-group {
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.btn-group .btn {
border-radius: 15px; /* скругление кнопок внутри группы */
}
.btn-group button, .btn-group a {
border-radius: 15px; /* добавлено для кнопок внутри .btn-group */
}
</style>
@section Scripts {
<script>
document.querySelectorAll('form[onsubmit]').forEach(function (form) {
form.addEventListener('submit', function (event) {
if (!confirm('Вы уверены, что хотите удалить?')) {
event.preventDefault();
}
});
});
</script>
}