141 lines
6.9 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 CompanyViewModel
@{
ViewData["Title"] = "Профиль компании";
}
<div class="container mt-5">
<div class="row g-4">
<div class="col-md-4">
<div class="card shadow-sm">
<img src="@(Model.LogoFilePath ?? "https://static.thenounproject.com/png/2504969-200.png")"
class="card-img-top img-fluid rounded-circle mx-auto d-block" alt="Логотип компании"
style="max-width: 150px; max-height: 150px;">
<div class="card-body text-center">
<h5 class="card-title">@Model.Name</h5>
<input type="hidden" name="id" value="@Model?.Id" />
<p class="card-text">@((Model.Description ?? "Описание отсутствует"))</p>
<a href="@(Model.Website ?? "#")"
target="_blank"
class="btn btn-primary mt-2 @(Model.Website == null ? "disabled" : "")"
@(Model.Website == null ? "aria-disabled=\"true\"" : "")>
@(Model.Website != null ? "Официальный сайт" : "Веб-сайт отсутствует")
</a>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card mb-4 shadow-sm">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>Информация о компании</h2>
<a asp-action="EditCompanyProfile" asp-controller="Company" asp-route-id="@Model.Id"
class="btn btn-warning">Редактировать</a>
</div>
<div class="card-body">
<dl class="row">
<dt class="col-sm-3">Адрес:</dt>
<dd class="col-sm-9">@((Model.Address?.ToString() ?? "Адрес не указан"))</dd>
<dt class="col-sm-3">Контакты:</dt>
<dd class="col-sm-9">@((Model.Contacts?.ToString() ?? "Контакты не указаны"))</dd>
</dl>
</div>
</div>
<div class="card mb-4 shadow-sm">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>Вакансии компании</h2>
<a asp-action="EditVacancy" asp-controller="Vacancy" asp-route-companyId="@Model.Id"
class="btn btn-success">Добавить вакансию</a>
</div>
<div class="card-body">
@if (Model.Vacancies != null && Model.Vacancies.Any())
{
@await Html.PartialAsync("_VacanciesTable", Model.Vacancies.Take(5))
@if (Model.Vacancies.Count() > 5)
{
<button id="showAllVacanciesBtn" class="btn btn-primary" onclick="toggleVacancies()">Показать все</button>
}
<div id="allVacancies" style="display:none;">
@await Html.PartialAsync("_VacanciesTable", Model.Vacancies)
</div>
}
else
{
<p>Вакансий нет.</p>
}
</div>
</div>
<div class="card shadow-sm">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>Сотрудники компании</h2>
<a asp-action="UserProfileEdit" asp-controller="User" asp-route-companyId="@Model.Id"
class="btn btn-success">Добавить сотрудника</a>
</div>
<div class="card-body">
@if (Model.Employees != null && Model.Employees.Any())
{
<table class="table table-striped">
<thead>
<tr>
<th>Фамилия</th>
<th>Имя</th>
<th>Эл. почта</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
@foreach (var employee in Model.Employees)
{
<tr>
<td>@employee.Surname</td>
<td>@employee.Name</td>
<td>
<a asp-action="UserProfile" asp-controller="User" asp-route-id="@employee.Id" class="btn btn-info btn-sm rounded-pill" title="Просмотр">
<i class="bi bi-eye"></i> Просмотр
</a>
<a asp-action="UserProfileEdit" asp-controller="User" asp-route-id="@employee.Id" class="btn btn-warning btn-sm rounded-pill" title="Редактировать">
<i class="bi bi-pencil"></i> Редактировать
</a>
<a asp-action="DeleteEmployee" asp-controller="User" asp-route-id="@employee.Id" class="btn btn-danger btn-sm rounded-pill" title="Удалить" onclick="return confirm('Вы уверены, что хотите удалить сотрудника?');">
<i class="bi bi-trash"></i> Удалить
</a>
</td>
</tr>
}
</tbody>
</table>
}
else
{
<p>Сотрудников нет.</p>
}
</div>
</div>
</div>
</div>
</div>
@section Scripts {
<script>
function toggleVacancies() {
var allVacancies = document.getElementById('allVacancies');
var button = document.getElementById('showAllVacanciesBtn');
if (allVacancies.style.display === 'none') {
allVacancies.style.display = 'block';
button.innerText = 'Скрыть';
} else {
allVacancies.style.display = 'none';
button.innerText = 'Показать все';
}
}
</script>
}