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

66 lines
2.4 KiB
Plaintext
Raw Normal View History

2024-04-30 16:28:34 +04:00
@*
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>
2024-04-30 16:28:34 +04:00
</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">
2024-04-30 16:28:34 +04:00
@* полученные машины *@
</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>
}