ISEbd-22_Alimova_M.S._Confe.../Confectionery/ConfectioneryClientApp/Views/Home/Create.cshtml

50 lines
1.2 KiB
Plaintext
Raw Permalink Normal View History

2024-05-03 20:06:17 +04:00
@{
ViewData["Title"] = "Create";
2024-05-03 19:55:51 +04:00
}
2024-05-03 20:06:17 +04:00
<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="pastry" name="pastry" class="form-control" asp-items="@(new SelectList(@ViewBag.Pastrys,"Id", "PastryName"))"></select>
2024-05-03 20:06:17 +04:00
</div>
</div>
<div class="row">
<div class="col-4">Количество:</div>
<div class="col-8"><input type="text" name="count" id="count" /></div>
2024-05-03 20:06:17 +04:00
</div>
<div class="row">
<div class="col-4">Сумма:</div>
<div class="col-8"><input type="text" id="sum" name="sum" readonly /></div>
2024-05-03 20:06:17 +04:00
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
2024-05-03 20:06:17 +04:00
</div>
</form>
2024-05-03 20:06:17 +04:00
<script>
$('#pastry').on('change', function () {
check();
});
$('#count').on('change', function () {
check();
});
2024-05-03 20:06:17 +04:00
function check() {
var count = $('#count').val();
var pastry = $('#pastry').val();
if (count && pastry) {
2024-05-03 20:06:17 +04:00
$.ajax({
method: "POST",
url: "/Home/Calc",
data: { count: count, pastry: pastry },
success: function (result) {
$("#sum").val(result);
}
});
};
}
</script>