64 lines
2.3 KiB
Plaintext
64 lines
2.3 KiB
Plaintext
@*
|
|
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
|
*@
|
|
@{
|
|
ViewData["Title"] = "UpdateDefect";
|
|
}
|
|
<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="defect" name="defect" class="form-control" asp-items="@(new SelectList(@ViewBag.Defects, "Id", "DefectType", "DefectPrice"))"></select>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Тип неисравности</label>
|
|
<input type="text" id="DefectType" placeholder="Введите тип неисправности" name="DefectType" class="form-control" />
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Цена починки</label>
|
|
<input type="number" min="100" step="100" id="DefectPrice" placeholder="Введите цену" name="DefectPrice" 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 defect = $('#defect').val();
|
|
if (defect) {
|
|
$.ajax({
|
|
method: "GET",
|
|
url: "/Home/GetDefect",
|
|
data: { defectId: defect },
|
|
success: function (result) {
|
|
$('#defectType').val(result.item1.defectType);
|
|
$('#table-elements').html(result.item2);
|
|
}
|
|
});
|
|
};
|
|
}
|
|
check();
|
|
$('#defect').on('change', function () {
|
|
check();
|
|
});
|
|
</script>
|
|
}
|