132 lines
5.2 KiB
Plaintext
132 lines
5.2 KiB
Plaintext
@model EnVisage.Models.TeamModel
|
|
@using EnVisage.Code.HtmlHelpers
|
|
@using EnVisage.Code
|
|
@{
|
|
ViewBag.Title = Model != null ? "Edit " + Model.Name : "Add Team";
|
|
var contributors = string.Join("','", Model.UserId);
|
|
contributors = "'" + contributors + "'";
|
|
}
|
|
|
|
@section Scripts
|
|
{
|
|
<script type="text/javascript">
|
|
emulateNavUrl = "/Team";
|
|
|
|
function fillSelect2(multik, preselected) {
|
|
var selected = [];
|
|
if (preselected != null)
|
|
selected = preselected;
|
|
else {
|
|
|
|
}
|
|
multik.select2('val', selected);
|
|
}
|
|
</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();
|
|
});
|
|
|
|
$(".forselect2").each(function (i, e) {
|
|
$(e).select2({
|
|
allowClear: true,
|
|
placeholder: "Select"
|
|
});
|
|
});
|
|
|
|
$(".formultiselect2").each(function (i, e) {
|
|
$(e).select2({
|
|
allowClear: true,
|
|
placeholder: $(this).attr("id") == "@Html.ClientIdFor(model=>model.UserId)" ? "Select contributors" : "Select watchers"
|
|
});
|
|
});
|
|
|
|
var contributors = [@Html.Raw(contributors)];
|
|
fillSelect2($("#@Html.ClientIdFor(model=>model.UserId)"), contributors);
|
|
});
|
|
</script>
|
|
|
|
}
|
|
}
|
|
|
|
<div id="erorMsgPlaceholder"></div>
|
|
|
|
@using (Html.BeginForm("Edit", "Team", FormMethod.Post, new { @class = "panel form-horizontal" }))
|
|
{
|
|
@Html.AntiForgeryToken()
|
|
|
|
<div class="panel-body">
|
|
<legend class="text-bold small-bottom-margin">@(Model != null ? "Edit " + Model.Name : "Add Team")</legend>
|
|
<div class="row">
|
|
<!--Row1-->
|
|
<div class="col-sm-7 col-lg-5">
|
|
<div class="form-group no-margin-hr">
|
|
@Html.LabelFor(model => model.Name, new { @class = "control-label" })
|
|
@Html.TextBoxFor(model => model.Name, new { @class = "form-control" })
|
|
@Html.ValidationMessageFor(model => model.Name)
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-5 col-lg-4">
|
|
<div class="form-group no-margin-hr">
|
|
@Html.LabelFor(model => model.ReportToId, new { @class = "control-label" })
|
|
@Html.DropDownListFor(model => model.ReportToId, Utils.GetTeamContacts(Model.CompanyId), new { @class = "form-control forselect2" })
|
|
@Html.ValidationMessageFor(model => model.ReportToId)
|
|
</div>
|
|
</div>
|
|
<!--Row2-->
|
|
<div class="col-sm-7 col-lg-5">
|
|
<div class="form-group no-margin-hr">
|
|
@Html.LabelFor(model => model.CostCenterId, new { @class = "control-label" })
|
|
@Html.DropDownListFor(model => model.CostCenterId, Utils.GetCreditDepartments(), new { @class = "form-control forselect2" })
|
|
@Html.ValidationMessageFor(model => model.CostCenterId)
|
|
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-5 col-lg-4">
|
|
<div class="form-group no-margin-hr">
|
|
@Html.LabelFor(model => model.CompanyId, new { @class = "control-label" })
|
|
|
|
@Html.DropDownListFor(model => model.CompanyId, Utils.GetCompanies(), new { @class = "form-control forselect2" })
|
|
@Html.ValidationMessageFor(model => model.CompanyId)
|
|
</div>
|
|
</div>
|
|
<!--Row3-->
|
|
<div class="col-sm-7 col-lg-5">
|
|
<div class="form-group no-margin-hr select2-primary">
|
|
@Html.LabelFor(model => model.UserId, new { @class = "control-label" })
|
|
@Html.EditorFor(model => model.UserId, string.Empty, new { List = Model.Users.OrderBy(x=>x.LastName).Select(x => new SelectListItem() { Value = x.Id.ToString(), Text = x.FirstName }).ToList() })
|
|
@Html.ValidationMessageFor(model => model.UserId)
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-5 col-lg-4"></div>
|
|
</div>
|
|
@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); }
|
|
@Html.HiddenFor(model => model.ActualCapacityScenarioId);
|
|
@Html.HiddenFor(model => model.PlannedCapacityScenarioId);
|
|
|
|
</div>
|
|
</div>
|
|
} |