CourseWork_Hotel/Hotel/HostrelHeadwaiterApp/Views/Home/UpdateConferenceBooking.cshtml

73 lines
2.3 KiB
Plaintext

@using HotelContracts.ViewModels;
@using HotelDataModels.Models;
@{
ViewData["Title"] = "UpdateConferenceBooking";
}
<form method="post">
<div class="container d-flex justify-content-center align-items-center">
<div class="card-body">
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Бронирование: </label>
<select id="conferenceBooking" name="conferenceBooking" class="form-control" asp-items="@(new SelectList(@ViewBag.ConferenceBookings, "Id", "NameHall"))"></select>
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Название зала</label>
<input
type="text"
id="nameHall"
placeholder="Введите название зала"
name="nameHall"
class="form-control"/>
</div>
<div class="u-table u-table-responsive u-table-1">
<label class="u-label u-text-custom-color-1 u-label-1">Обеды для бронирования</label>
<table class="table">
<thead class="thead-dark">
<tr style="height: 44px">
<th class="u-border-1 u-border-black u-table-cell">
Обед
</th>
<th class="u-border-1 u-border-black u-table-cell">
Цена
</th>
</tr>
</thead>
<tbody class="u-table-body" id="table-elements">
</tbody>
</table>
</div>
<br>
<div class="u-container-layout u-container-layout-2">
<input type="submit" value="Сохранить" class="btn btn-outline-dark text-center d-flex justify-content-md-center" />
</div>
</div>
</div>
</form>
@section Scripts
{
<script>
function check() {
var conferenceBooking = $('#conferenceBooking').val();
if (conferenceBooking) {
$.ajax({
method: "GET",
url: "/Home/GetConferenceBooking",
data: { conferenceBookingId: conferenceBooking },
success: function (result) {
$('#nameHall').val(result.item1.nameHall);
$('#table-elements').html(result.item2);
}
});
};
}
check();
$('#conferenceBooking').on('change', function () {
check();
});
</script>
}