117 lines
4.3 KiB
Plaintext
117 lines
4.3 KiB
Plaintext
@model EnVisage.Models.TeamModel
|
|
@using EnVisage.Code.HtmlHelpers
|
|
@using EnVisage.Code
|
|
@{
|
|
ViewBag.Title = Model != null ? "Edit " + Model.Name : "Add New Team";
|
|
}
|
|
|
|
@section Scripts
|
|
{
|
|
<script type="text/javascript">
|
|
emulateNavUrl = "/Team";
|
|
</script>
|
|
@if (Model != null)
|
|
{
|
|
<script type="text/javascript">
|
|
init.push(function () {
|
|
StartEdit('Team', '@Model.Id', "#btnDelete", "#btnsave", "erorMsgPlaceholder");
|
|
$('#btnsave').click(function () {
|
|
if ($(this).parents('form').valid())
|
|
blockUI();
|
|
});
|
|
@if(Model.UserId != null)
|
|
{
|
|
foreach (var userId in Model.UserId)
|
|
{
|
|
@:$("#userId_@userId")[0].checked = true;
|
|
}
|
|
}
|
|
@if(Model.ViewId != null)
|
|
{
|
|
foreach (var itemId in Model.ViewId)
|
|
{
|
|
@:$("#viewId_@itemId")[0].checked = true;
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
|
|
}
|
|
}
|
|
|
|
<div id="erorMsgPlaceholder"></div>
|
|
|
|
@using (Html.BeginForm("Edit", "Team", FormMethod.Post, new { @class = "panel form-horizontal" }))
|
|
{
|
|
@Html.AntiForgeryToken()
|
|
|
|
<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.CompanyId, "Company", new { @class = "control-label col-sm-2" })
|
|
<div class="col-sm-10">
|
|
@Html.DropDownListFor(model => model.CompanyId, Utils.GetCompanies(), new { @class = "form-control" })
|
|
@Html.ValidationMessageFor(model => model.CompanyId)
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
@Html.LabelFor(model => model.CostCenterId, "Cost Center", new { @class = "control-label col-sm-2" })
|
|
<div class="col-sm-10">
|
|
@Html.DropDownListFor(model => model.CostCenterId, Utils.GetCreditDepartments(), new { @class = "form-control" })
|
|
@Html.ValidationMessageFor(model => model.CostCenterId)
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
@Html.LabelFor(model => model.ReportToId, "Report to", new { @class = "control-label col-sm-2" })
|
|
<div class="col-sm-10">
|
|
@Html.DropDownListFor(model => model.ReportToId, Utils.GetTeamContacts(Model.CompanyId), new { @class = "form-control" })
|
|
@Html.ValidationMessageFor(model => model.ReportToId)
|
|
</div>
|
|
</div>
|
|
<fieldset id="fsUsers">
|
|
<legend class="text-bold">Contributors</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="fsViews">
|
|
<legend class="text-bold">Views</legend>
|
|
<div class="row">
|
|
<div class="col-md-12 form-group-margin">
|
|
<div style="overflow-y: auto;max-height: 300px;">
|
|
@Html.Partial("_views", Model.AllViews)
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
@Html.ValidationSummary(false, "The user 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)
|
|
{
|
|
@*if (Model.Projects.Count > 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", "Team", new {@id = Model.Id})"><i class="fa fa-trash-o"></i> Delete</a>
|
|
//}
|
|
}
|
|
</div>
|
|
@if (Model != null) { Html.HiddenFor(model => model.Id); }
|
|
</div>
|
|
</div>
|
|
} |