@{
	ViewData["Title"] = "CreateVaccination";
}

<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="animal" name="animal" class="form-control" asp-items="@(new SelectList(@ViewBag.Animals, "Id", "AnimalName"))"></select>
		</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-4">Цена:</div>
		<div class="col-8">
			<input type="text" name="cost" />
		</div>
	</div>
<div class="row">
		<div class="col-4">Дата:</div>
		<div class="col-8">
			<input type="date" id="date" name="date"/>
		</div>
	</div>
	<div class="row">
		<div class="col-8"></div>
		<div class="col-4">
			<input type="submit" value="Создать" class="btn btn-primary" />
		</div>
	</div>
	<script src="~/lib/jquery/dist/jquery.min.js"></script>
</form>
<script>
	$('#animal').on('change', function () {
		check();
	});
	function check() {
		if (snack) {
			$.ajax({
				method: "POST",
				url: "/Home/GetAnimal",
				data: { animal: animal },
				success: function (result) {
					$("#animal").val(result);
				}
			});
		};
	}
</script>

