ISEbd-21_Pyatkin_I.A_Precas.../PrecastConcretePlant/PrecastConcretePlantClientApp/Views/Home/Create.cshtml

54 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

@{
ViewData["Title"] = "Create";
}
<div class="text-center">
<h2 class="display-4">Создание заказа</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">ЖБИ:</div>
<div class="col-8">
<select id="reinforced" name="reinforced" class="form-control" asp-items="@(new SelectList(@ViewBag.Reinforceds,"Id", "ReinforcedName"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Количество:</div>
<div class="col-8"><input type="text" name="count" id="count" /></div>
</div>
<div class="row">
<div class="col-4">Сумма:</div>
<div class="col-8"><input type="text" id="sum" name="sum" readonly /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
</div>
</form>
@section Scripts
{
<script>
$('#reinforced').on('change', function () {
check();
});
$('#count').on('change', function () {
check();
});
function check() {
var count = $('#count').val();
var reinforced = $('#reinforced').val();
if (count && reinforced) {
$.ajax({
method: "POST",
url: "/Home/Calc",
data: { count: count, reinforced: reinforced },
success: function (result) {
$("#sum").val(result);
}
});
};
}
</script>
}