CourseWorkElectronicsShop/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Payment.cshtml

97 lines
1.9 KiB
Plaintext
Raw Normal View History

2024-06-01 03:18:46 +04:00
@using ElectronicsShopContracts.ViewModels
@using ElectronicsShopDataModels.Models
@model (int, Dictionary<int, (IProductModel, int)>)
@{
ViewData["Title"] = "Payment";
}
<div class="text-center">
<h1 class="display-4">Оплата корзины</h1>
</div>
<form method="post">
<div class="row">
<div class="col-4"></div>
<div class="col-8">
<input id="id" type="hidden" name="id" readonly value="@Model.Item1" />
2024-06-01 03:39:57 +04:00
<div class="row">
<div class="col-4">Сумма платежа:</div>
<div class="col-8">
<input type="text" name="paysum" id="paysum" />
<input type="submit" value="Оплатить!" class="btn btn-primary" />
</div>
</div>
2024-06-01 03:18:46 +04:00
</div>
</div>
<div class=" text-center">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Продукт
</th>
<th>
Количество
</th>
<th>
Сумма
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Item2)
{
<tr class="element">
<th>
@Html.DisplayFor(modelItem => item.Key)
</th>
<th>
@Html.DisplayFor(modelItem => item.Value.Item1.ProductName)
</th>
<th class="count">
@Html.DisplayFor(modelItem => item.Value.Item2)
</th>
<th class="countsum">
@Html.DisplayFor(modelItem => item.Value.Item1.Price)
</th>
</tr>
}
</tbody>
</table>
2024-06-01 03:39:57 +04:00
2024-06-01 03:18:46 +04:00
<div class="row">
<div class="col-4"></div>
<div class="col-8">
<input type="submit" value="Заказ готов, вернуться!" class="btn btn-primary" />
</div>
</div>
</div>
2024-06-01 03:39:57 +04:00
</form>
<script>
$('#paysum').on('change', function () {
check();
});
function check() {
var paysum = $('#paysum').val();
if (count && product) {
$.ajax({
method: "POST",
url: "/Home/Calc",
data: { paysum: paysum },
success: function (result) {
$("#sum").val(result);
}
});
};
}
</script>