EnVisageOnline/Main/Source/EnVisage/Views/Status/Edit.cshtml

207 lines
9.0 KiB
Plaintext

@model EnVisage.Models.StatusModel
@using EnVisage.Code;
@{
ViewBag.Title = Model != null ? "Edit " + Model.Name : "Add New Status";
}
@section Scripts
{
<script type="text/javascript">
emulateNavUrl = "/Status";
</script>
<script type="text/javascript">
init.push(function () {
@if (Model.Id != Guid.Empty)
{
<text>
StartEdit('Project Statuses', '@Model.Id', "#btnDelete", "#btnsave", "erorMsgPlaceholder");
</text>
}
$('#btnsave').click(function () {
if ($(this).parents('form').valid())
blockUI();
});
});
$('.changecontacts_sw').switcher({
on_state_content: 'Notify on change',
off_state_content: 'Ignore changes'
}).switcher().change(function () {
if ($(this).is(':checked')) {
$('.int-changecontacts').show();
} else {
$('.int-changecontacts').hide();
}
}).parent().css("width", "200px");
$('.createcontacts_sw').switcher({
on_state_content: 'Notify on Create',
off_state_content: 'Ignore Creation'
}).change(function () {
if ($(this).is(':checked')) {
$('.int-createcontacts').show();
} else {
$('.int-createcontacts').hide();
}
}).switcher().parent().css("width", "200px");
$('.deletecontacts_sw').switcher({
on_state_content: 'Notify on Delete',
off_state_content: 'Ignore Delete'
}).switcher().change(function () {
if ($(this).is(':checked')) {
$('.int-deletecontacts').show();
} else {
$('.int-deletecontacts').hide();
}
}).parent().css("width", "200px");
$('#@Html.IdFor(x=> x.ChangeNotificationContacts)').select2({
placeholder: "Select User(s)/Group(s) to notifiy when projects get updated"
});
$('#@Html.IdFor(x=> x.DeleteNotificationContacts)').select2({
placeholder: "Select User(s)/Group(s) to notifiy when projects get deleted",
});
$('#@Html.IdFor(x=> x.CreateNotificationContacts)').select2({
placeholder: "Select User(s)/Group(s) to notifiy when projects get created",
});
$('#@Html.IdFor(x=> x.ResetScenariosToInactive)').switcher({
on_state_content: 'DeActivate Active Scenaro',
off_state_content: 'Leave Scenaro Active'
}).switcher().parent().css("width", "200px");
@if (!Model.NotifyOnProjectDelete)
{
<text>
$('.int-deletecontacts').hide();
</text>
}
else
{
<text>
$('.int-deletecontacts').show();
</text>
}
@if (!Model.NotifyOnProjectCreate)
{
<text>
$('.int-createcontacts').hide();
</text>
}
else
{
<text>
$('.int-createcontacts').show();
</text>
}
@if (!Model.NotifyOnProjectChange)
{
<text>
$('.int-changecontacts').hide();
</text>
}
else
{
<text>
$('.int-changecontacts').show();
</text>
}
</script>
}
<div id="erorMsgPlaceholder"></div>
@using (Html.BeginForm("Edit", "Status", FormMethod.Post, new { @class = "panel form-horizontal" }))
{
@Html.AntiForgeryToken()
@Html.HiddenFor(model => model.Id)
<div class="grid-gutter-margin-b">
<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.Color, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
@Html.TextBoxFor(model => model.Color, new { @class = "form-control", @id = "input-color" })
@Html.ValidationMessageFor(model => model.Color)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Probability100, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
@Html.DropDownListFor(model => model.Probability100, Utils.GetYesNo(), new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Probability100)
</div>
</div>
<div class="form-group">
@Html.Label("Project change notifications", new { @class = "col-sm-2 control-label",@Id= "NotifyOnProjectChangeLbl" })
<div class="col-sm-10">
@Html.CheckBoxFor(model => model.NotifyOnProjectChange, new { @class = "control-label changecontacts_sw" })
@Html.ListBoxFor(model => model.ChangeNotificationContacts, EnVisage.Code.Utils.GetWorkFlowContacts(Model.Id), new { @class = "int-changecontacts form-control forselect2" })
@Html.ValidationMessageFor(model => model.ChangeNotificationContacts)
</div>
</div>
<div class="form-group">
@Html.Label("Project deleted notifications", new { @class = "col-sm-2 control-label", @Id = "NotifyOnProjectdeleteLbl" })
<div class="col-sm-10">
@Html.CheckBoxFor(model => model.NotifyOnProjectDelete, new { @class = "control-label deletecontacts_sw" })
@Html.ListBoxFor(model => model.DeleteNotificationContacts, EnVisage.Code.Utils.GetWorkFlowContacts(Model.Id), new { @class = "int-deletecontacts form-control forselect2" })
@Html.ValidationMessageFor(model => model.DeleteNotificationContacts)
</div>
</div>
<div class="form-group">
@Html.Label("Project created notifications", new { @class = "col-sm-2 control-label", @Id = "NotifyOnProjectcreateLbl" })
<div class="col-sm-10">
@Html.CheckBoxFor(model => model.NotifyOnProjectCreate, new { @class = "control-label createcontacts_sw" })
@Html.ListBoxFor(model => model.CreateNotificationContacts, EnVisage.Code.Utils.GetWorkFlowContacts(Model.Id), new { @class = "int-createcontacts form-control forselect2" })
@Html.ValidationMessageFor(model => model.CreateNotificationContacts)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.ResetScenariosToInactive, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
@Html.CheckBoxFor(model => model.ResetScenariosToInactive, new { @class = "control-label" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.WorkflowState, new { @class = "col-sm-2 control-label" })
<div class="col-sm-10">
@Html.DropDownListFor(model => model.WorkflowState, Utils.GetAllWorkFlowStates(), new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.WorkflowState)
</div>
</div>
@Html.ValidationSummary(false, "The Status 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", "Status")"><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.Id == Guid.Empty)
{
<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", "Status", new { @id = Model.Id })"><i class="fa fa-trash-o"></i> Delete</a>
}
}
</div>
</div>
</div>
<div><span class="h1">&nbsp;</span></div>
<div><span class="h1">&nbsp;</span></div>
</div>
}
<script type="text/javascript">
init.push(function () {
$('#input-color').minicolors({
control: 'hue',
position: 'bottom left',
theme: 'bootstrap'
});
});
</script>