143 lines
5.6 KiB
Plaintext
143 lines
5.6 KiB
Plaintext
@model EnVisage.Models.ViewModel
|
|
|
|
@{
|
|
ViewBag.Title = Model.Id != Guid.Empty ? "Edit " + Model.Name : "Add New View";
|
|
}
|
|
|
|
@section Scripts
|
|
{
|
|
<script type="text/javascript">
|
|
emulateNavUrl = "/View";
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
init.push(function () {
|
|
|
|
@if (Model.Id != Guid.Empty)
|
|
{
|
|
<text>
|
|
StartEdit('View', '@Model.Id', "#btnDelete", "#btnsave", "erorMsgPlaceholder");
|
|
</text>
|
|
if(Model.CompanyId != null)
|
|
{
|
|
foreach(var companyId in Model.CompanyId)
|
|
{
|
|
@:$("#companyId_@companyId")[0].checked = true;
|
|
}
|
|
}
|
|
if(Model.UserId != null)
|
|
{
|
|
foreach (var userId in Model.UserId)
|
|
{
|
|
@:$("#userId_@userId")[0].checked = true;
|
|
}
|
|
}
|
|
if(Model.CostCenterId != null)
|
|
{
|
|
foreach (var costcenterId in Model.CostCenterId)
|
|
{
|
|
@:$("#costcenterId_@costcenterId")[0].checked = true;
|
|
}
|
|
}
|
|
if(Model.TeamId != null)
|
|
{
|
|
foreach (var teamId in Model.TeamId)
|
|
{
|
|
@:$("#teamId_@teamId")[0].checked = true;
|
|
}
|
|
}
|
|
}
|
|
$('#btnsave').click(function () {
|
|
if ($(this).parents('form').valid())
|
|
blockUI();
|
|
});
|
|
});
|
|
</script>
|
|
}
|
|
|
|
<div id="erorMsgPlaceholder"></div>
|
|
|
|
@using (Html.BeginForm("Edit", "View", FormMethod.Post, new { @class = "panel form-horizontal" }))
|
|
{
|
|
@Html.AntiForgeryToken()
|
|
@Html.HiddenFor(t => t.Id)
|
|
<div class="panel-body">
|
|
<fieldset id="fsBasic">
|
|
<legend class="text-bold">View Information</legend>
|
|
<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.GLNumber, new { @class = "col-sm-2 control-label" })
|
|
<div class="col-sm-10">
|
|
@Html.TextBoxFor(model => model.GLNumber, new { @class = "form-control" })
|
|
@Html.ValidationMessageFor(model => model.GLNumber)
|
|
</div>
|
|
</div>*@
|
|
</fieldset>
|
|
<fieldset id="fsUsers">
|
|
<legend class="text-bold">Users</legend>
|
|
<div class="row">
|
|
<div class="col-md-12 form-group-margin">
|
|
<div style="overflow-y: auto;max-height: 300px;">
|
|
@Html.Partial("_users", Model.Users)
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
<fieldset id="fsCompanies">
|
|
<legend class="text-bold">Companies</legend>
|
|
<div class="row">
|
|
<div class="col-md-12 form-group-margin">
|
|
<div style="overflow-y: auto;max-height: 300px;">
|
|
@Html.Partial("_companies", Model.Companies)
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
<fieldset id="fsCostCenters">
|
|
<legend class="text-bold">Cost Centers</legend>
|
|
<div class="row">
|
|
<div class="col-md-12 form-group-margin">
|
|
<div style="overflow-y: auto;max-height: 300px;">
|
|
@Html.Partial("_costcenters", Model.CostCenters)
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
<fieldset id="fsTeams">
|
|
<legend class="text-bold">Teams</legend>
|
|
<div class="row">
|
|
<div class="col-md-12 form-group-margin">
|
|
<div style="overflow-y: auto;max-height: 300px;">
|
|
@Html.Partial("_editTeams", Model.AllTeams)
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
@Html.ValidationSummary(false, "The View 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", "View")"><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.TeamCount > 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", "View", new { @id = Model.Id })"><i class="fa fa-trash-o"></i> Delete</a>
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
<div><span class="h1"> </span></div>
|
|
<div><span class="h1"> </span></div>
|
|
</div>
|
|
} |