CourseWork_Bank/Bank/BankEmployeeApp/Views/Home/Cost.cshtml

39 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

@using Microsoft.AspNetCore.Mvc.TagHelpers
@model BankContracts.ViewModels.CostViewModel?
@{
ViewData["Title"] = Model == null ? "Создание статьи затрат" : "Изменение статьи затрат";
}
<div>
<h2 class="display-4">@ViewData["Title"]</h2>
</div>
<form method="post">
<div class="row mb-2">
<div class="col-2">Название:</div>
<div class="col-sm-10">
<input type="text" class="form-control" name="name" id="input_name" placeholder="Название">
</div>
</div>
<div class="row mb-2">
<div class="col-2">Стоимость:</div>
<div class="col-sm-10">
<input type="number" step="any" class="form-control" name="price" id="price" placeholder="Стоимость">
</div>
</div>
<div class="text-center mb-2">
<input type="submit" value="Создать" class="btn btn-primary" id="submit" />
</div>
</form>
@section Scripts
{
@if (Model != null)
{
<script>
$("#submit").val("Изменить");
$("#input_name").attr('readonly', true);
$("#input_name").val("@Html.Raw(Model.NameOfCost)");
$("#price").val("@Html.Raw(Model.Price)");
</script>
}
}