CourseWork_KPO/CandidateReviewClientApp/Views/Vacancy/EditVacancy.cshtml

94 lines
4.1 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
@using CandidateReviewDataModels.Enums
@model VacancyViewModel
@{
var title = @Model.Id <= 0 ? "Создать вакансию" : "Редактировать вакансию";
}
<div class="container">
<h1>@title</h1>
<form method="post" class="row g-3 needs-validation" novalidate>
<input type="hidden" name="id" value="@Model?.Id" />
<input type="hidden" name="CompanyId" value="@Model?.CompanyId" />
<div class="col-md-6">
<label for="JobTitle" class="form-label">Название должности <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="JobTitle" name="JobTitle" value="@Model?.JobTitle" required placeholder="Введите название должности">
<div class="invalid-feedback">Пожалуйста, введите название должности.</div>
</div>
<div class="col-md-6">
<label for="requirements" class="form-label">Требования <span class="text-danger">*</span></label>
<textarea class="form-control" id="requirements" name="requirements" rows="3" placeholder="Введите требования к вакансии">@Model?.Requirements</textarea>
</div>
<div class="col-md-6">
<label for="Responsibilities" class="form-label">Обязанности <span class="text-danger">*</span></label>
<textarea class="form-control" id="Responsibilities" name="Responsibilities" rows="3" placeholder="Введите обязанности">@Model?.Responsibilities</textarea>
</div>
<div class="col-md-6">
<label for="description" class="form-label">Описание</label>
<textarea class="form-control" id="description" name="description" rows="3" placeholder="Введите описание вакансии">@Model?.Description</textarea>
</div>
<div class="col-md-6">
<label asp-for="JobType" class="form-label">Тип занятости</label>
<select asp-for="JobType" class="form-control" asp-items="@GetJobTypeSelectList()"></select>
</div>
<div class="col-md-6">
<label for="salary" class="form-label">Заработная плата (руб.)</label>
<input type="text" class="form-control" id="salary" name="salary" value="@Model?.Salary" placeholder="Введите заработную плату или поставьте '-'">
</div>
<div class="col-md-6">
<label asp-for="Status" class="form-label">Статус вакансии</label>
<select asp-for="Status" class="form-control" asp-items="@GetStatusSelectList()"></select>
</div>
<div class="col-md-6">
<label for="tags" class="form-label">Тэги</label>
<input type="text" class="form-control" id="tags" name="tags" value="@Model?.Tags" placeholder="Введите тэги через пробел">
</div>
<div class="d-flex justify-content-between">
<button type="submit" class="btn btn-primary">Сохранить</button>
<button class="btn btn-secondary" onclick="window.history.back();">Назад</button>
</div>
</form>
</div>
@functions {
public SelectList GetJobTypeSelectList()
{
return new SelectList(Enum.GetValues(typeof(JobTypeEnum)).Cast<JobTypeEnum>());
}
public SelectList GetStatusSelectList()
{
return new SelectList(Enum.GetValues(typeof(VacancyStatusEnum)).Cast<VacancyStatusEnum>());
}
}
<script>
(function () {
'use strict'
var forms = document.querySelectorAll('.needs-validation')
Array.prototype.slice.call(forms)
.forEach(function (form) {
form.addEventListener('submit', function (event) {
if (!form.checkValidity()) {
event.preventDefault()
event.stopPropagation()
}
form.classList.add('was-validated')
}, false)
})
})()
</script>