79 lines
2.1 KiB
Plaintext
79 lines
2.1 KiB
Plaintext
@using CarRepairShopContracts.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>
|
|
|
|
@section Scripts
|
|
{
|
|
<script>
|
|
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);
|
|
}
|
|
});
|
|
};
|
|
}
|
|
check();
|
|
$('#shop').on('change', function () {
|
|
check();
|
|
});
|
|
</script>
|
|
} |