EnVisageOnline/Main-RMO/Source/EnVisage/Views/UnitOfMeasure/Edit.cshtml

69 lines
2.7 KiB
Plaintext

@model EnVisage.Models.UOMModel
@{
ViewBag.Title = Model != null && Model.Id != Guid.Empty ? "Edit " + Model.Name : "Add New Unit of Measure";
}
@section Scripts
{
<script type="text/javascript">
emulateNavUrl = "/UnitOfMeasure";
</script>
<script type="text/javascript">
init.push(function() {
@if (Model.Id != Guid.Empty)
{
<text>
StartEdit('UnitOfMeasure', '@Model.Id', "#btnDelete", "#btnsave", "erorMsgPlaceholder");
</text>
}
$('#btnsave').click(function () {
if ($(this).parents('form').valid())
blockUI();
});
});
</script>
}
<div id="erorMsgPlaceholder"></div>
@using (Html.BeginForm("Edit", "UnitOfMeasure", FormMethod.Post, new { @class = "panel form-horizontal" }))
{
@Html.AntiForgeryToken()
@Html.HiddenFor(t=>t.Id)
<div class="panel-body">
<div class="form-group">
@Html.LabelFor(model => model.Name, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
@Html.TextBoxFor(model => model.Name, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Name)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.UOMValue, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
@Html.TextBoxFor(model => model.UOMValue, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.UOMValue)
</div>
</div>
@Html.ValidationSummary(false, "The unit of measure could not be saved due to the following errors:")
<div class="form-group" style="margin-bottom: 0;">
<div class="col-sm-offset-2 col-sm-10">
<a class="btn btn-primary" href="@Url.Action("Index", "UnitOfMeasure")"><i class="fa fa-backward"></i> Back to list</a>
<button type="submit" class="btn btn-success" id="btnsave"><i class="fa fa-save"></i> Save</button>
@if (Model != null && Model.Id != Guid.Empty)
{
if (Model.ExpenditureCategoryCount > 0)
{
<a id="btnDelete" class="btn btn-danger disabled" href="javascript:void(0);"><i class="fa fa-trash-o"></i> Delete</a>
}
else
{
<a id="btnDelete" class="btn btn-danger" href="@Url.Action("Delete", "UnitOfMeasure", new { @id = Model.Id })"><i class="fa fa-trash-o"></i> Delete</a>
}
}
</div>
</div>
</div>
}