CourseWork_ServiceStation/ServiceStation/ServiceStationExecutorApp/Views/Home/UpdateTechnicalWork.cshtml

66 lines
2.4 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.

@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
ViewData["Title"] = "UpdateTechnicalWork";
}
<form method="post">
<div class="container d-flex justify-content-center align-items-center w-50">
<div class="card-body ">
<div class="form-group">
<label>ТО: </label>
<select id="technicalWork" name="technicalWork" class="form-control" asp-items="@(new SelectList(@ViewBag.TechnicalWorks, "Id", "WorkType", "WorkPrice"))"></select>
</div>
<div class="form-group">
<label>Тип ТО</label>
<input type="text" id="TechnicalWorkType" placeholder="Введите тип то" name="TechnicalWorkType" class="form-control" />
</div>
<div class="form-group">
<label>Цена</label>
<input type="number" min="100" step="100" id="TechnicalWorkPrice" placeholder="Введите цену" name="TechnicalWorkPrice" class="form-control" />
</div>
<table class="table">
<thead>
<tr>
<th scope="col">Номер машины</th>
<th scope="col">Марка машины</th>
</tr>
</thead>
<tbody id="table-elements">
@* полученные машины *@
</tbody>
</table>
<br>
<div>
<input type="submit" value="Сохранить" class="btn btn-secondary text-center" />
</div>
</div>
</div>
</form>
@section Scripts
{
<script>
function check() {
var technicalWork = $('#technicalWork').val();
if (technicalWork) {
$.ajax({
method: "GET",
url: "/Home/GetTechnicalWork",
data: { technicalWorkId: technicalWork },
success: function (result) {
$('#technicalWorkType').val(result.item1.WorkType);
$('#table-elements').html(result.item2);
}
});
};
}
check();
$('#technicalWork').on('change', function () {
check();
});
</script>
}