92 lines
3.5 KiB
Plaintext
92 lines
3.5 KiB
Plaintext
@using ServiceStationContracts.ViewModels
|
||
|
||
@model List<CarViewModel>
|
||
@{
|
||
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="worktype" placeholder="Введите тип то" name="worktype" class="form-control" />
|
||
</div>
|
||
<div class="form-group">
|
||
<label>Цена</label>
|
||
<input type="number" min="100" step="100" id="workPrice" placeholder="Введите цену" name="workPrice" class="form-control" />
|
||
</div>
|
||
<h5>Уже привязанные машины</h5>
|
||
<table class="table">
|
||
<thead>
|
||
<tr>
|
||
<th scope="col">Номер машины</th>
|
||
<th scope="col">Марка машины</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody id="table-elements">
|
||
@* полученные машины *@
|
||
</tbody>
|
||
</table>
|
||
<h5>Изменить машины</h5>
|
||
<table class="table">
|
||
<thead>
|
||
<tr>
|
||
<th scope="col"></th>
|
||
<th scope="col">Номер машины</th>
|
||
<th scope="col">Марка машины</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
@foreach (var car in Model)
|
||
{
|
||
<tr>
|
||
<td class="align-middle">
|
||
<div class="form-check">
|
||
<input type="checkbox" class="form-check-input" name="car[]" value="@car.Id" id="@car.Id">
|
||
</div>
|
||
</td>
|
||
<td class="align-middle">@Html.DisplayFor(modelItem => car.CarNumber)</td>
|
||
<td class="align-middle">@Html.DisplayFor(modelItem => car.CarBrand)</td>
|
||
</tr>
|
||
}
|
||
</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) {
|
||
$('#worktype').val(result.item1.workType);
|
||
$('#workPrice').val(result.item1.workPrice);
|
||
$('#table-elements').html(result.item2);
|
||
}
|
||
});
|
||
};
|
||
}
|
||
check();
|
||
$('#technicalWork').on('change', function () {
|
||
check();
|
||
});
|
||
</script>
|
||
}
|
||
|
||
|