2024-05-08 12:14:52 +04:00
|
|
|
@{
|
|
|
|
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">
|
2024-05-22 02:01:59 +04:00
|
|
|
<select id="pizza" name="pizza" class="form-control" asp-items="@(new SelectList(@ViewBag.Pizzas,"Id", "PizzaName"))"></select>
|
2024-05-08 12:14:52 +04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-4">Количество:</div>
|
2024-05-22 02:01:59 +04:00
|
|
|
<div class="col-8"><input type="text" name="count" id="count" /></div>
|
2024-05-08 12:14:52 +04:00
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-4">Сумма:</div>
|
2024-05-22 02:01:59 +04:00
|
|
|
<div class="col-8"><input type="text" id="sum" name="sum" readonly /></div>
|
2024-05-08 12:14:52 +04:00
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-8"></div>
|
2024-05-22 02:01:59 +04:00
|
|
|
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
|
2024-05-08 12:14:52 +04:00
|
|
|
</div>
|
|
|
|
</form>
|
2024-05-22 02:01:59 +04:00
|
|
|
|
2024-05-08 12:14:52 +04:00
|
|
|
<script>
|
2024-05-22 02:01:59 +04:00
|
|
|
$('#pizza').on('change', function () {
|
2024-05-08 12:14:52 +04:00
|
|
|
check();
|
|
|
|
});
|
|
|
|
$('#count').on('change', function () {
|
|
|
|
check();
|
|
|
|
});
|
2024-05-22 02:01:59 +04:00
|
|
|
|
2024-05-08 12:14:52 +04:00
|
|
|
function check() {
|
|
|
|
var count = $('#count').val();
|
2024-05-22 02:01:59 +04:00
|
|
|
var pizza = $('#pizza').val();
|
|
|
|
if (count && pizza) {
|
2024-05-08 12:14:52 +04:00
|
|
|
$.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "/Home/Calc",
|
2024-05-22 02:01:59 +04:00
|
|
|
data: { count: count, pizza: pizza },
|
2024-05-08 12:14:52 +04:00
|
|
|
success: function (result) {
|
|
|
|
$("#sum").val(result);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
</script>
|