2023-04-07 18:59:41 +04:00
|
|
|
@{
|
2023-04-08 13:46:24 +04:00
|
|
|
ViewData["Title"] = "CreatePurchase";
|
2023-04-07 18:59:41 +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="component" name="component" class="form-control" asp-items="@(new SelectList(@ViewBag.Components,"Id", "ComponentName"))"></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>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
$('#component').on('change', function () {
|
|
|
|
check();
|
|
|
|
});
|
|
|
|
$('#count').on('change', function () {
|
|
|
|
check();
|
|
|
|
});
|
|
|
|
|
|
|
|
function check() {
|
|
|
|
var count = $('#count').val();
|
|
|
|
var component = $('#component').val();
|
|
|
|
if (count && component) {
|
|
|
|
$.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "/Home/Calc",
|
|
|
|
data: { count: count, component: component },
|
|
|
|
success: function (result) {
|
|
|
|
$("#sum").val(result);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
</script>
|