56 lines
1.4 KiB
Plaintext
56 lines
1.4 KiB
Plaintext
@{
|
|
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="lesson" name="lesson" class="form-control" asp-items="@(new SelectList(@ViewBag.Lessons, "Id", "LessonName"))"></select>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-4">Дата:</div>
|
|
<div class="col-8"><input type="date" name="date" id="date" /></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-4">Имя сотрудника:</div>
|
|
<div class="col-8"><input type="text" id="employee" name="employee" 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>
|
|
$('#lesson').on('change', function () {
|
|
check();
|
|
});
|
|
$('#date').on('change', function () {
|
|
check();
|
|
});
|
|
|
|
function check() {
|
|
var date = $('#date').val();
|
|
var lesson = $('#lesson').val();
|
|
var employee = $('#employee').val();
|
|
if (date && lesson ) {
|
|
$.ajax({
|
|
method: "POST",
|
|
url: "/Home/Calc",
|
|
data: { date: date, lesson: lesson },
|
|
success: function (result) {
|
|
$("#sum").val(result);
|
|
}
|
|
});
|
|
};
|
|
}
|
|
</script>
|