EnVisageOnline/Main/Source/EnVisage/Views/User/_editUser.cshtml

178 lines
7.9 KiB
Plaintext

@model EnVisage.Models.UserModel
@using EnVisage.Code.HtmlHelpers
@using EnVisage.Code
@{
var availableCompanies = Utils.GetCompaniesTreeAll();
var availableWfRoles = Utils.GetWorkFlowRoles();
// set Hours/Resources default value to Resources
if (Guid.Empty.Equals(Model.Id))
{
Model.PreferredResourceAllocation = true;
}
}
<div id="erorMsgPlaceholder"></div>
@using (Html.BeginForm("Edit", "User", FormMethod.Post, new { id = "frmEditUser", @class = "panel form-horizontal", onsubmit = "return beforeSubmit();" }))
{
@Html.AntiForgeryToken()
<div class="panel-body">
@Html.Hidden("Id", Model.Id)
<div class="form-group">
@Html.LabelFor(model => model.UserName, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
@Html.TextBoxFor(model => model.UserName, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.UserName)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.FirstName, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
@Html.TextBoxFor(model => model.FirstName, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.FirstName)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.LastName, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
@Html.TextBoxFor(model => model.LastName, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.LastName)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Email, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
@Html.TextBoxFor(model => model.Email, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Email)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Phone, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
@Html.TextBoxFor(model => model.Phone, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Phone)
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="Phone">Preferred Resource Allocation</label>
<div class="col-sm-10">
@Html.CheckBoxFor(model => model.PreferredResourceAllocation, new { @class = "form-control", @checked="checked" })
@Html.ValidationMessageFor(model => model.PreferredResourceAllocation)
</div>
</div>
<div class="form-group" style="margin-top: 20px;margin-bottom: 20px;">
<label class="col-sm-2 control-label" for="Phone">Totals as</label>
<div class="col-sm-10">
@Html.CheckBoxFor(model => model.PreferredTotalsDisplaying, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.PreferredTotalsDisplaying)
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="Phone">@Html.LabelFor(t => t.ShowAutomaticViews)</label>
<div class="col-sm-10">
@Html.CheckBoxFor(model => model.ShowAutomaticViews, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.ShowAutomaticViews)
</div>
</div>
<div class="form-group select2-primary">
@Html.LabelFor(model => model.CompaniesWatcher, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
<select id='@Html.IdFor(model => model.CompaniesWatcher)' multiple='multiple' class="form-control">
@{ foreach (var opt in availableCompanies)
{
<option value="@opt.Value" class='ddl-level-item@(opt.Group != null && !String.IsNullOrEmpty(opt.Group.Name) ? " pad-left" : "")'
@(opt.Group != null && !String.IsNullOrEmpty(opt.Group.Name) ? "data-parent-value=" + opt.Group.Name : "")
@(Model.CompaniesWatcher != null && Model.CompaniesWatcher.Contains(new Guid(opt.Value)) ? "selected" : "")>
@opt.Text</option>
}
}
</select>
</div>
</div>
<div class="form-group select2-primary">
@Html.LabelFor(model => model.CompaniesContributor, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
<select id='@Html.IdFor(model => model.CompaniesContributor)' multiple='multiple' class="form-control">
@{ foreach (var opt in availableCompanies)
{
<option value="@opt.Value" class='ddl-level-item@(opt.Group != null && !String.IsNullOrEmpty(opt.Group.Name) ? " pad-left" : "")'
@(opt.Group != null && !String.IsNullOrEmpty(opt.Group.Name) ? "data-parent-value=" + opt.Group.Name : "")
@(Model.CompaniesContributor != null && Model.CompaniesContributor.Contains(new Guid(opt.Value)) ? "selected" : "")>
@opt.Text
</option>
}
}
</select>
</div>
</div>
@*@if (availableWfRoles.Count() > 0)
{*@
<div class="form-group select2-primary">
@Html.LabelFor(model => model.WorkFlowRoles, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
<select id='@Html.IdFor(model => model.WorkFlowRoles)' multiple='multiple' class="form-control">
@{ foreach (var opt in availableWfRoles)
{
<option value="@opt.Value" class='ddl-level-item'
@(Model.WorkFlowRoles != null && Model.WorkFlowRoles.Contains(new Guid(opt.Value)) ? "selected" : "")>
@opt.Text
</option>
}
}
</select>
</div>
</div>
@* }*@
<div class="form-group">
<span class="col-sm-2 control-label" style="font-weight:600;">Roles</span>
<div class="col-sm-10" style="padding-top:5px;padding-left:11px;">
@Html.GetRolesList(Url, Model)
</div>
</div>
<div class="form-group">
<span class="col-sm-2 control-label" style="font-weight:600;"></span>
<div class="col-sm-10" style="padding-top:5px;padding-left:11px;">
<a class="btn btn-primary" href="javascript:reset();">Reset permissions</a>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="UserName">Permissions</label>
<div class="col-sm-10">
<table cellspacing="0" border="0">
<tbody>
<tr>
<td style="padding-top: 7px; vertical-align:top;">
<table id="areasPermissionTable">
<tbody>
@Html.GetAreaItemsList(Url, Model)
</tbody>
</table>
</td>
<td style="padding:10px;vertical-align:top; padding-left:50px;" id="projectTree"></td>
</tr>
</tbody>
</table>
</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", "User")"><i class="fa fa-backward"></i> Back to list</a>
<button type="button" class="btn btn-success" id="btnsave"><i class="fa fa-save"></i> Save</button>
@if (Model != null)
{
if (Model.Id != Guid.Empty)
{
<a id="btnDelete" class="btn btn-danger" href="@Url.Action("Delete", "User", new { id = Model.Id })"><i class="fa fa-trash-o"></i> Delete</a>
}
}
</div>
@if (Model != null)
{
Html.Hidden("Discriminator", Model.Discriminator);
}
</div>
</div>
}