45 lines
1.2 KiB
Plaintext
45 lines
1.2 KiB
Plaintext
@{
|
|
ViewData["Title"] = "BuildUpdate";
|
|
}
|
|
<div class="text-center">
|
|
<h2 class="display-4 mb-5">Обновить сборку</h2>
|
|
</div>
|
|
<form method="post">
|
|
<div class="row mb-3">
|
|
<div class="col-4">Сборка:</div>
|
|
<div class="col-8">
|
|
<select id="build" name="build" class="form-control" asp-items="@(new SelectList(@ViewBag.Builds,"Id", "Name"))"></select>
|
|
</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-4">Название:</div>
|
|
<div class="col-8"><input type="text" id="name" name="name" /></div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-4">Цена:</div>
|
|
<div class="col-8"><input type="number" id="cost" name="cost" /></div>
|
|
</div>
|
|
<div class="text-center ">
|
|
<input type="submit" value="Обновить" class="btn btn-success ps-5 pe-5" />
|
|
</div>
|
|
</form>
|
|
<<script>
|
|
$('#build').on('change', function () {
|
|
getData();
|
|
});
|
|
|
|
function getData() {
|
|
var buildId = $('#build').val();
|
|
var buildData = @Html.Raw(Json.Serialize(ViewBag.Builds));
|
|
var selectedBuild = buildData.find(function (build) {
|
|
return build.id == buildId;
|
|
});
|
|
|
|
if (selectedBuild) {
|
|
$("#text").val(selectedBuild.address);
|
|
$("#cost").val(selectedBuild.cost);
|
|
}
|
|
}
|
|
|
|
</script>
|