91 lines
4.2 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="@(APIClient.User?.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="JobType" class="form-label">Тип занятости</label>
<select id="JobType" name="JobType" class="form-control" asp-items="@(new SelectList(Enum.GetValues(typeof(JobTypeEnum)).Cast<JobTypeEnum>()))"></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 for="description" class="form-label">Описание</label>
<input type="text" class="form-control" id="description" name="description" value="@Model?.Description" placeholder="Введите описание вакансии">
</div>
<div class="col-md-6">
<label for="Status" class="form-label">Статус вакансии</label>
<select id="Status" name="Status" class="form-control" asp-items="@(new SelectList(Enum.GetValues(typeof(VacancyStatusEnum)).Cast<VacancyStatusEnum>()))"></select>
</div>
<input type="hidden" name="createdAt" value="@Model?.CreatedAt" />
@{
var tagsString = @Model?.Tags;
var displayedTags = string.IsNullOrEmpty(tagsString) ? "" : string.Join(", ", tagsString.Split(',').Select(t => t.Trim()));
}
<div class="col-md-6">
<label for="tags" class="form-label">Тэги</label>
<input type="text" class="form-control" id="tags" name="tags" value="@displayedTags" placeholder="Введите тэги через запятую">
</div>
@* <input type="hidden" name="createdAt" value="@(APIClient.Company?.Vacancies.Add(Model))" />
*@
<div class="col-12">
<button type="submit" class="btn btn-primary">Сохранить</button>
</div>
</form>
</div>
<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>