73 lines
2.7 KiB
Plaintext
73 lines
2.7 KiB
Plaintext
@using CandidateReviewContracts.ViewModels
|
|
@model List<VacancyViewModel?>
|
|
|
|
@{
|
|
ViewData["Title"] = "Поиск вакансий";
|
|
}
|
|
|
|
<div class="container mt-5">
|
|
<div class="row justify-content-center">
|
|
<div class="col-md-8">
|
|
<h1>Поиск вакансий</h1>
|
|
<form asp-action="SearchVacancies" asp-controller="Vacancy" asp-route-tags="tags" method="get">
|
|
<div class="input-group mb-3">
|
|
<input type="text" class="form-control" name="tags" id="tags" placeholder="Введите поисковый запрос">
|
|
<button class="btn btn-primary" type="submit">Поиск</button>
|
|
</div>
|
|
@if (ViewBag.Message != null)
|
|
{
|
|
<p class="alert alert-warning">@ViewBag.Message</p>
|
|
}
|
|
</form>
|
|
|
|
@if (Model != null)
|
|
{
|
|
<h2>Результаты поиска:</h2>
|
|
@if (Model.Any(v => v != null))
|
|
{
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>Название вакансии</th>
|
|
<th>Тип работы</th>
|
|
<th>Зарплата</th>
|
|
<th>Тэги</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var vacancy in Model.Where(v => v != null))
|
|
{
|
|
<tr>
|
|
<td>@vacancy.JobTitle</td>
|
|
<td>@vacancy.JobType</td>
|
|
<td>@vacancy.Salary</td>
|
|
<td>@vacancy.Tags</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
}
|
|
else
|
|
{
|
|
<p>Вакансий не найдено.</p>
|
|
}
|
|
}
|
|
else
|
|
{
|
|
<p>Произошла ошибка при получении данных.</p>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.querySelector('form').addEventListener('submit', function (event) {
|
|
const tagsInput = document.getElementById('tags');
|
|
if (tagsInput.value.trim() === "") {
|
|
alert("Пожалуйста, введите поисковый запрос.");
|
|
event.preventDefault();
|
|
}
|
|
});
|
|
</script>
|
|
|