SUBD_PIbd-23_ZakharovRA/CarShowroom/CarShowroomManagerApp/Views/Home/ClientUpdate.cshtml

54 lines
1.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@using CarShowroomDataModels.Views
@{
ViewData["Title"] = "ClientUpdate";
}
<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 name="client" id="client" class="form-control"
asp-items="@(new SelectList(@ViewBag.Clients, "Id", "Name"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Номер телефона:</div>
<div class="col-8"><input type="text" name="phonenumber" /></div>
</div>
<div class="row">
<div class="col-4">ФИО:</div>
<div class="col-8"><input type="text" name="name" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4">
<input type="submit" value="Cохранить данные"
class="btn btn-primary" />
</div>
</div>
</form>
@section Scripts
{
<script>
function check() {
var client = $('#client').val();
if (client) {
$.ajax({
method: "GET",
url: "/Home/GetClient",
data: { clientId: client },
success: function (result) {
$('#number').val(result.item1.number);
}
});
};
}
check();
$('#client').on('change', function () {
check();
});
</script>
}