93 lines
2.7 KiB
Plaintext

@using HotelContracts.ViewModels;
@using HotelDataModels.Models;
@{
ViewData["Title"] = "UpdateMealPlan";
}
<form method="post">
<div class="text-center">
<h2 class="display-4">Изменение плана питания</h2>
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">План питания: </label>
<div class="u-input u-input-rectangle">
<select id="mealplan" name="mealplan" class="form-control">
@foreach (var mealplan in ViewBag.MealPlans)
{
<option value="@mealplan.Id">@(mealplan.MealPlanName)</option>
}
</select>
</div>
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Название плана питания</label>
<input type="text"
id="mealPlanName"
placeholder="Введите название плана питания"
name="mealPlanName"
class="form-control" />
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Стоимость</label>
<input type="number"
id="mealPlanPrice"
placeholder="Введите стоимость плана питания"
name="mealPlanPrice"
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-grey-50 u-table-cell">
Фамилия
</th>
<th class="u-border-1 u-border-grey-50 u-table-cell">
Имя
</th>
<th class="u-border-1 u-border-grey-50 u-table-cell">
Отчество
</th>
<th class="u-border-1 u-border-grey-50 u-table-cell">
Номер телефона
</th>
</tr>
</thead>
<tbody class="u-table-body" id="table-elements">
</tbody>
</table>
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" /></div>
</div>
</form>
@section Scripts
{
<script>
function check() {
var mealPlan = $('#mealplan').val();
if (mealPlan) {
$.ajax({
method: "GET",
url: "/Home/GetMealPlan",
data: { mealPlanId: mealPlan },
success: function (result) {
$('#mealPlanName').val(result.item1.mealPlanName);
$('#mealPlanPrice').val(result.item1.mealPlanPrice);
$('#table-elements').html(result.item2);
}
});
};
}
check();
$('#mealPlan').on('change', function () {
check();
});
</script>
}