100 lines
3.5 KiB
Plaintext
100 lines
3.5 KiB
Plaintext
@using EnVisage.Code
|
||
@model EnVisage.Models.CompanyModel
|
||
|
||
@{
|
||
ViewBag.Title = Model.Id != Guid.Empty ? "Edit " + Model.Name : "Add New Company";
|
||
}
|
||
|
||
@section Scripts
|
||
{
|
||
<script type="text/javascript">
|
||
emulateNavUrl = "/Company";
|
||
</script>
|
||
@if (Model.Id != Guid.Empty)
|
||
{
|
||
<script type="text/javascript">
|
||
init.push(function() {
|
||
StartEdit('Company', '@Model.Id', "#btnDelete", "#btnsave", "erorMsgPlaceholder");
|
||
@if (Model.ClientId != null)
|
||
{
|
||
foreach(var clientId in Model.ClientId)
|
||
{
|
||
@:$("#clientId_@clientId")[0].checked = true;
|
||
}
|
||
}
|
||
@if (Model.ViewId != null)
|
||
{
|
||
foreach (var viewId in Model.ViewId)
|
||
{
|
||
@:$("#ViewId_@viewId")[0].checked = true;
|
||
}
|
||
}
|
||
$('#btnsave').click(function () {
|
||
if ($(this).parents('form').valid())
|
||
blockUI();
|
||
});
|
||
});
|
||
</script>
|
||
}
|
||
}
|
||
|
||
<div id="erorMsgPlaceholder"></div>
|
||
|
||
@using (Html.BeginForm("Edit", "Company", FormMethod.Post, new { @class = "panel form-horizontal innerForm" }))
|
||
{
|
||
@Html.AntiForgeryToken()
|
||
@Html.HiddenFor(model => model.Id)
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||
<h4 class="modal-title">@ViewBag.Title</h4>
|
||
</div>
|
||
<div class="modal-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", @id = "IDDDD" })
|
||
@Html.ValidationMessageFor(model => model.Name)
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
@Html.LabelFor(model => model.ParentCompanyId, "Parent Company", new { @class = "control-label col-sm-2" })
|
||
<div class="col-sm-10">
|
||
@Html.DropDownListFor(model => model.ParentCompanyId, Utils.GetParentCompanies(), new { @class = "form-control disabled" })
|
||
@Html.ValidationMessageFor(model => model.ParentCompanyId)
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
@Html.LabelFor(model => model.Clients, new { @class = "col-sm-2 control-label" })
|
||
<div class="col-sm-10">
|
||
@Html.Partial("_clients", Model.Clients)
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
@Html.LabelFor(model => model.Views, new { @class = "col-sm-2 control-label" })
|
||
<div class="col-sm-10">
|
||
@Html.Partial("_views", Model.Views)
|
||
</div>
|
||
</div>
|
||
@Html.ValidationSummary(false, "The company could not be saved due to the following errors:")
|
||
<div class="modal-footer" style="margin-bottom: 0;">
|
||
<div class="col-sm-offset-2 col-sm-10">
|
||
@*<a class="btn btn-primary" href="@Url.Action("Index", "Company")"><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.ProjectsCount > 0 || Model.CompaniesCount > 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", "Company", new {@id = Model.Id})"><i class="fa fa-trash-o"></i> Delete</a>
|
||
}
|
||
}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
}
|