75 lines
2.0 KiB
Plaintext
75 lines
2.0 KiB
Plaintext
|
@using IceCreamShopContracts.ViewModels;
|
|||
|
|
|||
|
@{
|
|||
|
ViewData["Title"] = "Update";
|
|||
|
}
|
|||
|
|
|||
|
<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="shop" name="shop" class="form-control" asp-items="@(new SelectList(@ViewBag.Shops, "Id", "ShopName"))"></select>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div class="row">
|
|||
|
<div class="col-4">Название:</div>
|
|||
|
<div class="col-8"><input type="text" name="name" id="name" class="form-control" /></div>
|
|||
|
</div>
|
|||
|
<div class="row">
|
|||
|
<div class="col-4">Адрес:</div>
|
|||
|
<div class="col-8"><input type="text" id="address" name="address" class="form-control" /></div>
|
|||
|
</div>
|
|||
|
<div class="row">
|
|||
|
<div class="col-4">Дата открытия:</div>
|
|||
|
<div class="col-8"><input type="datetime-local" id="dateopen" name="dateopen" class="form-control" required /></div>
|
|||
|
</div>
|
|||
|
<div class="row">
|
|||
|
<div class="col-4">Вместимость:</div>
|
|||
|
<div class="col-8"><input type="number" id="maxcapacity" name="maxcapacity" class="form-control" /></div>
|
|||
|
</div>
|
|||
|
|
|||
|
<table class="table">
|
|||
|
<thead>
|
|||
|
<tr>
|
|||
|
<th>
|
|||
|
Мороженое
|
|||
|
</th>
|
|||
|
<th>
|
|||
|
Количество
|
|||
|
</th>
|
|||
|
</tr>
|
|||
|
</thead>
|
|||
|
<tbody id="table-elements">
|
|||
|
</tbody>
|
|||
|
</table>
|
|||
|
<div class="row">
|
|||
|
<div class="col-8"></div>
|
|||
|
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script>
|
|||
|
$('#shop').on('change', function () {
|
|||
|
check();
|
|||
|
});
|
|||
|
function check() {
|
|||
|
var shop = $('#shop').val();
|
|||
|
if (shop) {
|
|||
|
$.ajax({
|
|||
|
method: "GET",
|
|||
|
url: "/Home/GetShop",
|
|||
|
data: { shopId: shop },
|
|||
|
success: function (result) {
|
|||
|
$('#name').val(result.item1.shopName);
|
|||
|
$('#address').val(result.item1.address);
|
|||
|
$('#dateopen').val(result.item1.dateOpen);
|
|||
|
$('#maxcapacity').val(result.item1.maxCapacity);
|
|||
|
$('#table-elements').html(result.item2);
|
|||
|
}
|
|||
|
});
|
|||
|
};
|
|||
|
}
|
|||
|
</script>
|