initial add

This commit is contained in:
Jonathan Ouellette
2022-09-27 14:10:30 -07:00
parent 91fd8a50a9
commit 580e90f6a2
3941 changed files with 954648 additions and 19 deletions

View File

@ -0,0 +1,368 @@
@model IEnumerable<Fab2ApprovalSystem.Models.Role>
@{
ViewBag.Title = "Roles Assignment";
}
@{
Layout = "_AdminLayout.cshtml";
}
<link rel="stylesheet" href="~/Scripts/jqwidgets/styles/jqx.base.css" type="text/css" />
<link rel="stylesheet" href="~/Scripts/jqwidgets/styles/jqx.energyblue.css" type="text/css" />
<link rel="stylesheet" href="~/Scripts/jqwidgets/styles/jqx.arctic.css" type="text/css" />
<link rel="stylesheet" href="/Content/kendo/kendo.blueopal.min.css" />
<script type="text/javascript" src="~/Scripts/jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="~/Scripts/jqwidgets/jqxdata.js"></script>
<script type="text/javascript" src="~/Scripts/jqwidgets/jqxbuttons.js"></script>
<script type="text/javascript" src="~/Scripts/jqwidgets/jqxscrollbar.js"></script>
<script type="text/javascript" src="~/Scripts/jqwidgets/jqxlistbox.js"></script>
<script type="text/javascript" src="~/Scripts/jqwidgets/jqxpanel.js"></script>
<script type="text/javascript" src="~/Scripts/jqwidgets/jqxtree.js"></script>
@*<nav class="navbar navbar-default" role="navigation" style="font-size: 11px">
<div class="container-fluid">
<ul class="nav navbar-nav" id="myTab">
<li><a href=@Url.Action("Index", "Admin")>Manage Users</a></li>
</ul>
<!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>*@
<div class="row">
<div class="col-md-2">
<div class="control-group">
<label for="jqxTreeWidget">WorkFlow Roles</label>
<div class="controls">
<div id='jqxTreeWidget'>
</div>
</div>
<input type="checkbox" id="chkShowInactive"/><label for="chkShowInactive">Show Inactive Roles?</label>
</div>
</div>
<div class="col-md-2">
<div class="control-group">
<label for="lstUserRoles" id="selectionlog" style="font-size: 10px; font-family: Verdana; font-weight: bold; color:crimson">Current Users:</label>
<div class="controls">
<div id='lstUserRoles'>
</div>
</div>
<input style="margin-top: 20px;" type="button" id='jqxButtonRemove' value="Remove selected items" />
</div>
</div>
<div class="col-md-8">
<div class="control-group">
<label for="lstAllUsers">All Users</label>
<div style="font-size: 10px; font-family: Verdana; font-weight: bold; color:crimson" ></div>
<div class="controls">
<div id='lstAllUsers'>
</div>
<input style="margin-top: 20px;" type="button" id='jqxButtonAdd' value="Add selected items" />
</div>
</div>
</div>
</div>
<script language="javascript">
var currentSubRoleID;
$("#chkShowInactive").click(function () {
LoadTree();
});
$(document).ready(function () {
var url = "/Admin/GetAllUserList";
var source =
{
datatype: "json",
datafields: [
{ name: 'UserID' },
{ name: 'FullName' }
],
id: 'id',
url: url
};
var dataAdapter = new $.jqx.dataAdapter(source);
// Create a jqxListBox
$("#lstAllUsers").jqxListBox({
multipleextended: true, theme: "arctic", source: dataAdapter, displayMember: "FullName", valueMember: "UserID", width: 200, height: 250
});
// POPLUATE THE TREE
LoadTree();
});
function LoadTree() {
var newurl = "/Admin/AllSubRoles";
var newsource =
{
datatype: "json",
datafields: [
{ name: 'id' },
{ name: 'parentid' },
{ name: 'text' },
{ name: 'value' }
],
id: 'id',
url: newurl,
data: {
showInactiveRoles: $("#chkShowInactive").is(":checked"),
},
async: false
};
var newdataAdapter = new $.jqx.dataAdapter(newsource);
// perform Data Binding.
newdataAdapter.dataBind();
var records = newdataAdapter.getRecordsHierarchy('id', 'parentid', 'items', [{ name: 'text', map: 'label' }]);
$('#jqxTreeWidget').jqxTree({ theme: "arctic", source: records, height: '400px', width: '200px' })
.on('select', function (event) {
var args = event.args;
var item = $('#jqxTreeWidget').jqxTree('getItem', args.element);
var parentitem = $('#jqxTreeWidget').jqxTree('getItem', item.parentElement);
if (parentitem != undefined) {
//$("#selectionlog").children().remove();
//$("#selectionlog").text('Current Users:' + parentitem.label + ' (' + item.label + ')');
$("#selectionlog").text('Current Users:' + parentitem.label + ' (' + item.label + ')');
displayUserRoles(item.id);
currentSubRoleID = item.id;
//alert(parentitem.label);
}
});
;
// display an empty list box for the selected user roles Listbox.
displayUserRoles(-1);
}
function onSelectRoles(e) {
var data = $('#treeRoles').data('kendoTreeView').dataItem(e.node);
var parent = this.parent(e.node); // `this` refers to the treeview object
if (parent.length) {
var parentText = this.text(parent);
$("#selectionlog").children().remove();
$("#selectionlog").text(parentText + ' (' + data.text + ')');
displayUserRoles(data.id);
currentSubRoleID = data.id
}
}
function displayUserRoles(id) {
var url = "/Admin/GetAllUserListBySubRole?SubRole=" + id;
var source =
{
datatype: "json",
datafields: [
{ name: 'UserID' },
{ name: 'FullName' }
],
id: 'id',
url: url
};
var dataAdapter = new $.jqx.dataAdapter(source);
// Create a jqxListBox
$("#lstUserRoles").jqxListBox({
multipleextended: true, theme: "arctic", source: dataAdapter, displayMember: "FullName", valueMember: "UserID", width: 200, height: 250
});
$("#lstUserRoles").on('select', function (event) {
if (event.args) {
var item = event.args.item;
if (item) {
var valueelement = $("<div></div>");
valueelement.text("Value: " + item.value);
var labelelement = $("<div></div>");
labelelement.text("Label: " + item.label);
}
}
});
}
$("#jqxButtonAdd").jqxButton({
theme: 'energyblue'
});
$("#jqxButtonRemove").jqxButton({
theme: 'energyblue'
});
$('#jqxButtonAdd').on('click', function () {
// get selected items.
var bfound = false;
var userids;
var itemsToAdd = $('#lstAllUsers').jqxListBox('getSelectedItems');
if (itemsToAdd.length > 0) {
for (var i = 0; i < itemsToAdd.length; i++) {
if (itemsToAdd[i].label != undefined) {
var tempvalue = itemsToAdd[i].value;
var templabel = itemsToAdd[i].label;
//if (i < itemsToAdd.length - 1)
//{
// check if the item exists in the role seleced for the user
var itemsAdded = $("#lstUserRoles").jqxListBox('getItems');
for (var x = 0; x < itemsAdded.length; x++) {
if (itemsAdded[x].label == templabel) {
bfound = true;
break;
};
};
if (!bfound) {
$("#lstUserRoles").jqxListBox('addItem', { label: templabel, value: tempvalue });
if (userids == null)
userids = tempvalue;
else
userids += "~" + tempvalue;
}
bfound = false;
}
};
// add the selected item into the DB.
if (currentSubRoleID == undefined) {
alert('Please select a SubRole to add the users to');
return;
}
//
if (userids != null) {
//alert(currentSubRoleID);
//alert("UserIds: " + userids);
AddRoles(currentSubRoleID, userids)
}
}
// unselect all the selected items
$("#lstAllUsers").jqxListBox({ selectedIndex: -1 });
});
$('#jqxButtonRemove').on('click', function () {
// get items.
var userids;
var tempValue;
var items = $("#lstUserRoles").jqxListBox('getSelectedItems');
if (items.length > 0) {
for (var i = items.length - 1; i >= 0; i--) {
tempValue = items[i].value;
$("#lstUserRoles").jqxListBox('removeItem', tempValue);
if (userids == null)
userids = tempValue;
else
userids += "~" + tempValue;
break;
};
if (currentSubRoleID == undefined) {
alert('Please select a SubRole to delete the users from Role');
return;
}
//
if (userids != null) {
//alert(currentSubRoleID);
//alert("UserIds: " + userids);
DeleteRoles(currentSubRoleID, userids)
}
}
});
var AddRoles = function (subRoleID, userids) {
var urlString = '/Admin/AddUserRoles';
//if (arrayOfValues.length == 0)
// return false;
$.ajax({
type: "Post",
url: urlString,
data: {
subRole: subRoleID,
Users: userids
}
});
return false;
};
var DeleteRoles = function (subRoleID, userids) {
var urlString = '/Admin/DeleteUserRoles';
//if (arrayOfValues.length == 0)
// return false;
$.ajax({
type: "Post",
url: urlString,
data: {
subRole: subRoleID,
Users: userids
}
});
return false;
};
</script>

View File

@ -0,0 +1,68 @@
@model Fab2ApprovalSystem.Models.LoginModel
@{
ViewBag.Title = "Add User";
}
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Add User</h4>
<hr />
@Html.ValidationSummary(true)
@*<div class="form-group">
@Html.LabelFor(model => model.UserID, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.UserID)
@Html.ValidationMessageFor(model => model.UserID)
</div>
</div>*@
<div class="form-group">
@Html.LabelFor(model => model.LoginID, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.LoginID)
@Html.ValidationMessageFor(model => model.LoginID)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.FirstName, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.FirstName)
@Html.ValidationMessageFor(model => model.FirstName)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.LastName, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.LastName)
@Html.ValidationMessageFor(model => model.LastName)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.IsAdmin, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.IsAdmin)
@Html.ValidationMessageFor(model => model.IsAdmin)
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>

View File

@ -0,0 +1,65 @@
@model Fab2ApprovalSystem.Models.LoginModel
@{
ViewBag.Title = "Details";
}
<h2>Details</h2>
<div>
<h4>LoginModel</h4>
<hr />
<dl class="dl-horizontal">
<dd>
@Html.HiddenFor(model => model.UserID)
</dd>
<dt>
@Html.DisplayNameFor(model => model.LoginID)
</dt>
<dd>
@Html.DisplayFor(model => model.LoginID)
</dd>
<dt>
@Html.DisplayNameFor(model => model.FirstName)
</dt>
<dd>
@Html.DisplayFor(model => model.FirstName)
</dd>
<dt>
@Html.DisplayNameFor(model => model.LastName)
</dt>
<dd>
@Html.DisplayFor(model => model.LastName)
</dd>
<dt>
@Html.DisplayNameFor(model => model.FullName)
</dt>
<dd>
@Html.DisplayFor(model => model.FullName)
</dd>
<dt>
@Html.DisplayNameFor(model => model.IsAdmin)
</dt>
<dd>
@Html.DisplayFor(model => model.IsAdmin)
</dd>
</dl>
</div>
<p>
@Html.ActionLink("Edit", "Edit", new { /* id = Model.PrimaryKey */ }) |
@Html.ActionLink("Back to List", "Index")
</p>

View File

@ -0,0 +1,64 @@
@model Fab2ApprovalSystem.Models.LoginModel
@{
ViewBag.Title = "Edit";
}
<h2>Edit</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>LoginModel</h4>
<hr />
@Html.ValidationSummary(true)
@Html.HiddenFor(model => model.UserID)
<div class="form-group">
@Html.LabelFor(model => model.LoginID, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.LoginID)
@Html.ValidationMessageFor(model => model.LoginID)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.FirstName, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.FirstName)
@Html.ValidationMessageFor(model => model.FirstName)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.LastName, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.LastName)
@Html.ValidationMessageFor(model => model.LastName)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.IsAdmin, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.IsAdmin)
@Html.ValidationMessageFor(model => model.IsAdmin)
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>

View File

@ -0,0 +1,3 @@
@model DateTime?
@(Html.Kendo().DatePickerFor(m => m))

View File

@ -0,0 +1,791 @@
@model IEnumerable<Fab2ApprovalSystem.Models.LoginModel>
@{
ViewBag.Title = "Index";
}
@{
Layout = "_AdminLayout.cshtml";
}
<link rel="stylesheet" href="/Content/kendo/kendo.blueopal.min.css" />
<link rel="stylesheet" href="~/Content/kendogridcustom.css" />
<style>
.k-grid-edit-row input {
width: 100%;
}
.k-grid .k-grid-header .k-header .k-link {
height: auto;
}
.k-grid .k-grid-header .k-header {
white-space: normal;
}
.k-grid .k-edit-cell input {
width: 100%;
}
/*InLine Edit Mode*/
</style>
<div id="userListdiv" class="k-content">
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.LoginModel>()
.Name("userList")
.Columns(columns =>
{
columns.Bound(l => l.UserID).Visible(false);
columns.Bound(l => l.LoginID);
columns.Bound(l => l.FirstName);
columns.Bound(l => l.LastName);
columns.Bound(l => l.Email);
columns.Bound(l => l.IsActive);
//columns.Template(@<text></text>).ClientTemplate("<input type='checkbox' #= IsActive ? checked='checked':'' # class='chkbx' />");
columns.Bound(l => l.IsAdmin);
columns.Bound(l => l.LastLogin).Format("{0:MM/dd/yy hh:mm:ss}");
// columns.Command(command => { command.Edit(); command.Destroy(); }).Width("200px");
columns.Bound(l => l.OOO);
columns.Bound(l => l.OOOStartDate).Format("{0:MM/dd/yy hh:mm:ss}").Width("150px");
columns.Bound(l => l.OOOExpirationDate).Format("{0:MM/dd/yy hh:mm:ss}").Width("150px");
columns.Bound(l => l.DelegatedTo).Visible(false);
columns.Bound(l => l.DelegatedToFullName);
columns.Bound(p => p.OOOStatusWithUserID).ClientTemplate("#=buildButtons(OOOStatusWithUserID)#").Width(120);
columns.Template(t => { }).ClientTemplate(@"<input type='button' value='Approval Groups' class='btn btn-primary btn-xs' onclick='ShowApprovalGroup(" + "#: UserID #" + ")'/>");
columns.Template(t => { }).ClientTemplate(@"<input type='button' value='Tasks' class='btn btn-primary btn-xs' onclick='ShowUserTasks(" + "#: UserID #" + ")'/>");
//columns.Template(p => { }).HeaderTemplate("").ClientTemplate(@"
//<input type='button' value='Approval Groups' class='btn btn-primary btn-xs' onclick='ShowApprovalGroup(" + l => + ")'/>");
columns.Template(t => { }).HeaderTemplate("").ClientTemplate(@"
<a href='javascript: void(0)' class='abutton edit' onclick='editRow(this)' title='button edit'>button edit</a>
<a href='javascript: void(0)' class='abutton delete' onclick='deleteRow(this, " + "#: UserID #" + ")' title='button delete'>button delete</a>");
})
.ToolBar(toolbar => toolbar.Create().Text("Add New User"))
.Editable(editable => editable.Mode(GridEditMode.InLine))
.HtmlAttributes(new { style = "height: 500px;" })
.Scrollable()
.Resizable(resize => resize.Columns(true))
.Groupable()
.Sortable()
.Filterable()
.Events(e => e.Edit("onEdit"))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax().ServerOperation(false)
.Events(events => events.Error("error_handler"))
.Model(model =>
{
model.Id(l => l.UserID);
model.Field(p => p.UserID).Editable(false);
model.Field(l => l.LastLogin).Editable(false);
model.Field(l => l.OOO).Editable(false);
model.Field(l => l.OOOStartDate).Editable(false);
model.Field(l => l.OOOExpirationDate).Editable(false);
model.Field(l => l.DelegatedToFullName).Editable(false);
})
.PageSize(50)
.Read(read => read.Action("GetGridUserList", "Admin"))
.Create(update => update.Action("InsertUser", "Admin"))
.Update(update => update.Action("UpdateUser", "Admin"))
.Destroy(destroy => destroy.Action("DeleteUser", "Admin"))
)
)
@*@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.LoginModel>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(l => l.UserID).Visible(false);
columns.Bound(l => l.LoginID);
columns.Bound(l => l.FirstName);
columns.Bound(l => l.LastName);
columns.Bound(l => l.IsAdmin);
columns.Bound(l => l.LastLogin).Format("{0:MM/dd/yy hh:mm:ss}");
columns.Bound(l => l.OOO);
columns.Bound(l => l.OOOStartDate).Format("{0:MM/dd/yy hh:mm:ss}").Width("150px");
columns.Bound(l => l.OOOExpirationDate).Format("{0:MM/dd/yy hh:mm:ss}").Width("150px");
columns.Bound(l => l.DelegatedTo).Visible(false);
columns.Bound(l => l.DelegatedToFullName);
columns.Bound(p => p.OOOStatusWithUserID).ClientTemplate("#=buildButtons(OOOStatusWithUserID)#").Width(120);
})
.ToolBar(toolbar =>
{
toolbar.Create();
toolbar.Save();
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Pageable()
.Navigatable()
.Sortable()
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.PageSize(20)
.ServerOperation(false)
//.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.UserID))
.Read(read => read.Action("GetGridUserList", "Admin"))
.Create(update => update.Action("InsertUser", "Admin"))
.Update(update => update.Action("BatchUpdateUser", "Admin"))
.Destroy(destroy => destroy.Action("DeleteUser", "Admin"))
)
)*@
</div>
<div class="modal fade" id="OOODialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
@*<h4 class="modal-title" id="myModalLabel">Out Of Office for user:</h4>*@
<label style="color: #36940a; font-weight: bold; font-size: 16px; " id="currentUser"></label>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<div class="control-group">
<div class="controls">
<div class="controls">
<label for="CurrentUser">Delegate To:</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="control-group">
<div class="controls">
<div class="controls">
@(Html.Kendo().DropDownList()
.Name("DelegateTo")
.HtmlAttributes(new { style = "width: 250px" })
.DataTextField("FullName")
.DataValueField("UserID")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetAllUserList", "Admin");
});
})
)
</div>
</div>
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-sm-6">
<div class="control-group">
<div class="controls">
<label for="CurrentUser">Start Date:</label>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="control-group">
<div class="controls">
<div class="controls">
<label for="CurrentUser">End Date:</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="control-group">
<div class="controls">
@(Html.Kendo().DatePicker()
.Name("txtStartDate")
//.Value()
)
</div>
</div>
</div>
<div class="col-sm-6">
<div class="control-group">
<div class="controls">
@(Html.Kendo().DatePicker()
.Name("txtEndDate")
//.Value()
)
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="SaveOOOInfo">Save</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="UserApprovalGroupsDialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<input type="hidden" id="UserIDHidden" value="467" />
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
@*<h4 class="modal-title" id="myModalLabel">Out Of Office for user:</h4>*@
<label style="color: #36940a; font-weight: bold; font-size: 16px; " id="currentUser"></label>
</div>
<div class="modal-body">
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.UserSubRoles>()
.Name("SubRoleList")
.Columns(columns =>
{
columns.Bound(l => l.SubRoleID).Visible(false);
columns.Bound(l => l.RoleName);
columns.Bound(l => l.SubRoleName);
})
//.HtmlAttributes(new { style = "height: 500px;" })
.Scrollable()
.Resizable(resize => resize.Columns(true))
.Groupable()
.Sortable()
.Filterable()
.Events(e => e.Edit("onEdit"))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax().ServerOperation(false)
.Events(events => events.Error("error_handler"))
.PageSize(20)
.Read(read => read.Action("GetSubRoleListByUserId", "Admin").Data("GetUserID"))
.Create(update => update.Action("InsertUser", "Admin"))
.Update(update => update.Action("UpdateUser", "Admin"))
.Destroy(destroy => destroy.Action("DeleteUser", "Admin"))
)
)
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="ReAssignApprovalGroups" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Inactivate User</h4>
<label style="color: #36940a; font-weight: bold; font-size: 16px; " id="currentUser"></label>
<input type="hidden" id="DeletedUserIDHidden" value="467" />
</div>
<div class="modal-body">
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.UserSubRoles>()
.Name("SubRoleListReAssign")
.Columns(columns =>
{
columns.Bound(l => l.SubRoleID).Visible(false);
columns.Bound(l => l.RoleName);
columns.Bound(l => l.SubRoleName);
//columns.Command(command => command.Custom("Re-Assign").Click("ShowRoleUserSelector")).Width("100px");
columns.Template(t => { }).ClientTemplate(@"<input type='button' value='Re-Assign' class='btn btn-primary btn-xs' onclick='ShowRoleUserSelector(" + "#: SubRoleID #" + ")'/>");
})
//.HtmlAttributes(new { style = "height: 400px;" })
.Scrollable()
.Resizable(resize => resize.Columns(true))
.Groupable()
.Sortable()
.Filterable()
.Events(e => e.Edit("onEdit"))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax().ServerOperation(false)
.Events(events => events.Error("error_handler"))
.PageSize(20)
.Read(read => read.Action("GetSubRoleListByUserId", "Admin").Data("GetDeletedUserID"))
)
)
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-default" onclick="InactivateUser()">Submit Inactivation</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="UserAssignedTasksDialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<input type="hidden" id="TaskUserIDHidden" value="456" />
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
@*<h4 class="modal-title" id="myModalLabel">Out Of Office for user:</h4>*@
<label style="color: #36940a; font-weight: bold; font-size: 16px; " id="currentUser"></label>
</div>
<div class="modal-body">
@(Html.Kendo().Grid<Fab2ApprovalSystem.ViewModels.IssuesViewModel>()
.Name("UserTaskList")
.Columns(columns =>
{
//columns.Bound(l => l.IssueID);
columns.Bound(l => l.IssueID).Template(@<text> @Html.ActionLink(@item.IssueID.ToString(), null)</text>)
.ClientTemplate("<a href='/#=DocumentType#/Edit?IssueID=#=DocID#'>#=IssueID#</a>");
columns.Bound(l => l.DocumentType);
columns.Bound(l => l.SubDoc);
columns.Bound(l => l.Originator);
columns.Bound(l => l.Title);
columns.Bound(l => l.PendingApprovers).HtmlAttributes(new { style = "font-weight: bold; color: red;" });
//columns.Command(command => command.Custom("Re-Assign").Click("showReAssignRole")).Width("100px");
})
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
//.HtmlAttributes(new { style = "height: 700px;" })
.Scrollable()
.Groupable()
.Sortable()
.Filterable(filterable => filterable
.Extra(false)
.Operators(operators => operators
.ForString(str => str
.Clear()
.Contains("Contains")
.DoesNotContain("Does not contain")
.StartsWith("Starts with")
.EndsWith("Ends with")
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to ")
)
)
)
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(50)
.Read(read => read.Action("GetTaskListByUser", "Admin").Data("GetTaskListUserID")))
// .ClientRowTemplate(" <tr class=#:ItemStatus == 2? 'red':'white'# data-uid='#= uid #'>" +
// "<td> <a href='/#=DocumentType#/Edit?IssueID=#=DocID#'>#=IssueID#</a></td>" +
// "<td>#: DocumentType #</td>" +
// "<td>#: SubDoc #</td>" +
// "<td>#:Originator #</td>" +
// "<td>#: IssueDate #</td>" +
// "<td>#:Title #</td>" +
// "<td>#: LotNos #</td>" +
// "<td>#:PendingApprovers #</td>" +
// "<td>#:SubmitedDate #</td>" +
// "<td>#: CloseDate #</td> " +
// "<td>#: Item Status </td> " +
// "<td><button class='btn btn-warning btn-xs' id='Delegate' name='Refresh' onclick='showReAssignRole(&quot;#=PendingApprovers#&quot;,&quot;#=CloseDate#&quot;,&quot;#=DocID#&quot;, &quot;#=DocumentType#&quot;,&quot;#=SubmitedDate#&quot;);'>Delegate</buton></td>" +
//"</tr>"
//)
)
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="RoleReAssignPrompt" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<input type="hidden" value="" id="hiddenRoleId" />
<input type="hidden" value="" id="hiddenIssueId" />
<input type="hidden" value="" id="hiddenIssueType" />
<input type="hidden" value="" id="RoleReAssignPromptDeletedUserHidden" />
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
@*<h4 class="modal-title" id="myModalLabel">Out Of Office for user:</h4>*@
<label style="color: #36940a; font-weight: bold; font-size: 16px; " id="currentUser"></label>
</div>
<div class="modal-body">
@*@Html.DropDownList("selectedUserToReassign", new SelectList(ViewBag.AllActiveUsers, "UserID", "FullName"))*@
@(Html.Kendo().DropDownList()
.Name("selectedUserToReassign")
.BindTo(new SelectList(ViewBag.AllActiveUsers, "UserID", "FullName"))
.OptionLabel("Select User")
.HtmlAttributes(new { style = " font-size:10px" })
)
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-default" data-dismiss="modal" onclick="SubmitRoleAssignment()">Submit</button>
</div>
</div>
</div>
</div>
<script>
function error_handler(e) {
alert("Error during the operation");
if (e.errors) {
var message = "Errors:\n";
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
alert(message);
}
}
var userid = "";
function onEdit(e) {
$(e.container).find("td:last").html("<a href='javascript: void(0)' class='abutton update' onclick='updateRow()' title='button update'>button update</a> " +
"<a href='javascript: void(0)' class='abutton cancel' onclick='cancelRow()' title='button cancel'>button cancel</a>");
}
function cancelRow() {
grid = $("#userList").data("kendoGrid");
grid.cancelRow();
}
function editRow(element) {
grid = $("#userList").data("kendoGrid");
grid.editRow($(element).closest("tr"));
}
function updateRow() {
grid = $("#userList").data("kendoGrid");
grid.saveRow();
}
function deleteRow(element, userId) {
grid = $("#userList").data("kendoGrid");
console.log(userId);
$("#DeletedUserIDHidden").val(userId);
$("#SubRoleListReAssign").data("kendoGrid").dataSource.read();
$("#ReAssignApprovalGroups").modal('show');
//var ds = grid.dataSource;
//var dataItem = grid.dataItem($(element.target).closest("tr"));
//var rowViewIndex = $(element).closest("tr").index();
//var index = ((ds.page() - 1) * ds.pageSize()) + rowViewIndex;
//var myRowData = $("#userList").data().kendoGrid.dataSource.at(index);
//console.log(myRowData);
//grid.data.
//grid.removeRow($(element).closest("tr"));
}
function createRow() {
grid = $("#userList").data("kendoGrid");
grid.addRow();
}
function buildButtons(oooStatusWithUserID) {
var uid = oooStatusWithUserID.split('~')[0];
var oooStatus = oooStatusWithUserID.split('~')[1];
var userName = oooStatusWithUserID.split('~')[2];
var template = "";
if (oooStatus == '0') {
template = "<input type='button' value='Set OOO ' class='btn btn-primary btn-xs' id='" + uid + "-" + userName + "'" + "onclick='SetOOOStatus(this)'/>";
}
else
{
template = "<input type='button' value='Expire OOO' class='btn btn-warning btn-xs' id='" + uid + "-" + userName + "'" + "onclick='Expire(this)'/>";
}
return template;
}
function buildShowGroupsButton(UserID) {
var uid = oooStatusWithUserID.split('~')[0];
var template = "";
template = "<input type='button' value='Edit Approval Groups ' class='btn btn-primary btn-xs' id='" + UserID + "' " + "onclick='ShowApprovalGroup(this)'/>";
return template;
}
function SetOOOStatus(e) {
$("#txtStartDate").val('');
$("#txtEndDate").val('');
id = e.id;
userid = id.split('-')[0];
var userName = id.split('-')[1];
$('#currentUser').text("Out Of Office for user: " + userName);
$("#OOODialog").modal('show');
return false;
}
$('#SaveOOOInfo').on('click', function () {
var bfound = false;
//var currentDate = new Date();
if (userid == $("#DelegateTo").data("kendoDropDownList").value())
{
alert('The OOO person cannot be same as the delegate to person');
return false;
}
var fullDate = new Date()
//convert month to 2 digits
var twoDigitMonth = ((fullDate.getMonth().length + 1) === 1) ? (fullDate.getMonth() + 1) : '0' + (fullDate.getMonth() + 1);
var tempCurrentDate = twoDigitMonth + "/" + fullDate.getDate() + "/" + fullDate.getFullYear();
var arrCurrDate = tempCurrentDate.split('/');
var currentDate = new Date(arrCurrDate[2], arrCurrDate[0] - 1, arrCurrDate[1]);
if (!$("#txtStartDate").val() || !$("#txtEndDate").val()) {
alert('Start or the End Date cannot be blank');
return false;
}
var stDateEntered = $("#txtStartDate").val();
var arrStDate = stDateEntered.split('/');
var stDate = new Date(arrStDate[2], arrStDate[0] - 1, arrStDate[1]);
var endDateEntered = $("#txtEndDate").val();
var arrEndDate = endDateEntered.split('/');
var endDate = new Date(arrEndDate[2], arrEndDate[0] - 1, arrEndDate[1]);
if (stDate < currentDate) {
alert("Start Date should be greater than the or equal to Current Date ");
return false;
}
if (endDate <= stDate) {
alert("The End Date should be greater than the Start Date ");
return false;
}
$("#OOODialog").modal('hide');
var urlString = '/Admin/EnableOOOStatus';
$.ajax({
type: "Post",
url: urlString,
data: {
oooUserID: userid,
delegatedTo: $("#DelegateTo").data("kendoDropDownList").value(),
startDate: $("#txtStartDate").val(),
endDate: $("#txtEndDate").val(),
},
success: function (result) {
if (result == "3") {
alert('The user which you selected for Delegation is already a delegator for another user\n Please select a different user for Delgation')
}
else {
var grid = $("#userList").data("kendoGrid");
grid.dataSource.read();
}
},
error: function (result) {
alert("Failed " + result);
}
});
return false;
});
function Expire(e) {
id = e.id;
userid = id.split('-')[0];
var userName = id.split('-')[1];
if (confirm('Are you sure you want to expire the OOO setting for user: ' + userName))
{
var urlString = '/Admin/ExpireOOOStatus';
$.ajax({
type: "Post",
url: urlString,
data: {
oooUserID: userid
},
success: function (result) {
var grid = $("#userList").data("kendoGrid");
grid.dataSource.read();
},
error: function (result) {
alert("Failed " + result);
}
});
}
return false;
}
function ShowApprovalGroup(UserId) {
$("#UserIDHidden").val(UserId);
$("#SubRoleList").data("kendoGrid").dataSource.read();
$("#UserApprovalGroupsDialog").modal('show');
}
function ShowApprovalGroupReAssign(UserId) {
$("#DeletedUserIDHidden").val(UserId);
$("#SubRoleListReAssign").data("kendoGrid").dataSource.read();
$("#UserApprovalGroupsDialog").modal('show');
}
function GetUserID() {
var userId = $("#UserIDHidden").val();
return { userId : userId};
}
function GetDeletedUserID()
{
var userId = $("#DeletedUserIDHidden").val();
return { userId: userId };
}
function ShowUserTasks(UserId) {
$("#TaskUserIDHidden").val(UserId);
$("#UserTaskList").data("kendoGrid").dataSource.read();
$("#UserAssignedTasksDialog").modal('show');
}
function GetTaskListUserID() {
var userId = $("#TaskUserIDHidden").val();
return { userId: userId };
}
function ShowRoleUserSelector(SubRoleID) {
var userBeingDeleted = $("#DeletedUserIDHidden").val()
$("#hiddenRoleId").val(SubRoleID);
$("#RoleReAssignPromptDeletedUserHidden").val(userBeingDeleted)
$("#RoleReAssignPrompt").modal('show');
}
function SubmitRoleAssignment() {
var userToAssign = $("#selectedUserToReassign").data("kendoDropDownList").value();
var roleToAssign = $("#hiddenRoleId").val();
var userBeingDeleted = $("#RoleReAssignPromptDeletedUserHidden").val();
$.ajax({
url: "/Admin/ReplaceUserRoles",
type: "POST",
datatype: "json",
data: {
subRole: roleToAssign,
users: userToAssign
},
success: function (data) {
alert(data);
DeleteUserFromRole(roleToAssign, userBeingDeleted);
$("#RoleReAssignPrompt").modal('hide');
},
error: function (result) {
alert("Failed " + result);
}
});
}
function DeleteUserFromRole(subRoleId, userId) {
$.ajax({
url: "/Admin/DeleteUserRoles",
type: "POST",
datatype: "json",
data: {
subRole: subRoleId,
users: userId
},
success: function (data) {
$("#SubRoleListReAssign").data("kendoGrid").dataSource.read();
return;
},
error: function (result) {
alert("Failed " + result);
}
});
}
function InactivateUser() {
if (confirm("Are you sure you wish to de-activate this user?")) {
var userId = $("#DeletedUserIDHidden").val();
$.ajax({
url: "/Admin/DeleteUser",
type: "POST",
datatype: "json",
data: {
userId: userId
},
success: function (data) {
alert(data);
$("#ReAssignApprovalGroups").modal('hide');
$("#userList").data("kendoGrid").dataSource.read();
},
error: function (result) {
alert("Failed " + result);
}
});
}
else {
return;
}
}
</script>

View File

@ -0,0 +1,55 @@
@{
ViewBag.Title = "Job Scheduler Configuration";
Layout = "~/Views/Admin/_AdminLayout.cshtml";
}
<style>
.settingSection {
/*margin-left: 10px;*/
background-color: white;
padding: 10px;
border-radius: 20px;
margin-top: 10px;
border: 10px solid #87b3de;
}
</style>
<h2>Job Scheduler Configuration</h2>
<div class="container">
<div class="row">
<div id="TrainingReportNotification" class="settingSection col-sm-6">
@{Html.RenderAction("TrainingReportConfig", "Admin");}
</div>
<div id="TECNExpirationNotification" class="settingSection col-sm-6">
@{Html.RenderAction("TECNNotificationConfig", "Admin");}
</div>
</div>
</div>
<script>
//function settingSectionScroll(headerId, settingSection) {
// //var header = document.getElementById(headerId);
// var tableOffset = $("#TrainingReportNotificationTable").offset().top;
// var $header = $("#TrainingReportNotificationTable > thead").clone();
// //var headerWidth = document.getElementById(headerId).offsetWidth;
// var section = document.getElementById(settingSection);
// //var sticky = header.offsetTop;
// var $fixedHeader = $("#header-fixed").append($header);
// var offset = $(this).scrollTop();
// if (offset >= tableOffset && $fixedHeader.is(":hidden")) {
// // header.classList.add("sticky");
// //header.style.position = 'fixed';
// $("#header-fixed").append($header);
// $fixedHeader.show();
// } else {
// //header.classList.remove("sticky");
// //header.style.position = 'static';
// $fixedHeader.hide();
// }
//}
</script>

View File

@ -0,0 +1,13 @@
@*//@model IEnumerable<Fab2ApprovalSystem.Models.TrainingGroup>
//@using Fab2ApprovalSystem.Models.TrainingGroup;*@
@{
ViewBag.Title = "View";
Layout = "~/Views/Admin/_AdminLayout.cshtml";
}
<h2>Manage Training Groups</h2>
<div id="GroupsDisplay">
@{Html.RenderAction("TrainingGroups", "Admin");}
</div>

View File

@ -0,0 +1,104 @@
@{IEnumerable<Fab2ApprovalSystem.Models.LoginModel> allUsers = ViewBag.AllUsers;}
@{IEnumerable<Fab2ApprovalSystem.Models.LoginModel> TrainingReportUsers = ViewBag.CurrentReportUsers;}
<style>
#viewContainer {
height: 600px;
width: 100%;
}
#TECNNotificationControls {
background-color: white;
z-index: 1000;
width: inherit;
}
#TECNNoticationTable {
overflow-y: scroll;
position: relative;
height: 500px;
}
</style>
<div id="viewContainer">
<div id="TECNNotificationControls">
<h4>TECN Expiration Notifications</h4>
Add New User: @Html.DropDownList("TECNExpirationUserID", new SelectList(allUsers, "UserID", "FullName"))<input type="button" value="Add" id="TECNNotificationAddBtn" />
</div>
<div id="TECNNoticationTable">
<table class="table" id="TECNExpirationConfigTable">
<tr>
<th>Name</th>
<th>Actions</th>
</tr>
@foreach (var item in TrainingReportUsers)
{
<tr>
<td>@item.FullName</td>
<td><button type="button" class="btn btn-default" id="DeleteFromTECNExpirationGroup" onclick="DeleteFromTECNExpirationGroup('@item.UserID')">Delete</button></td>
</tr>
}
</table>
</div>
</div>
<script type="text/javascript">
$('#TECNNotificationAddBtn').on('click', function () {
var SelectedUser = document.getElementById('TECNExpirationUserID').value;
var sendInfo = {
userId: SelectedUser,
};
//alert(SelectedUser);
$.ajax({
type: "POST",
url: "/Admin/AddToTECNNotification",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(sendInfo),
dataType: "html",
success: function (r) {
alert(r);
RefreshTECNExpirationData();
}
});
})
function DeleteFromTECNExpirationGroup(userId) {
var sendInfo = {
userId: userId,
};
//alert(SelectedUser);
$.ajax({
type: "POST",
url: "/Admin/DeleteFromTECNNotification",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(sendInfo),
dataType: "html",
success: function (r) {
alert(r);
RefreshTECNExpirationData();
}
});
}
function RefreshTECNExpirationData() {
//alert(SelectedGroup);
var sendInfo = {
};
//alert("we get here")
$.ajax({
url: '@Url.Action("TECNNotificationConfig", "Admin")',
contentType: "application/json; charset=utf-8",
type: 'POST',
data: JSON.stringify(sendInfo),
//dataType: "html",
success: function(data) {
//alert('add success');
$("#TECNExpirationNotification").html(data);
}
});
}
</script>

View File

@ -0,0 +1,135 @@
@model IEnumerable<Fab2ApprovalSystem.Models.TrainingGroupMember>
@{IEnumerable<Fab2ApprovalSystem.Models.LoginModel> test = ViewBag.AllUsers;}
@*<script src="~/Scripts/jquery.min.js"></script>*@
<style>
tr:nth-child(even) {
background: #CCC
}
tr:nth-child(odd) {
background: #FFF
}
</style>
<p>
<input type="button" value="Add To Training Group" class="btn btn-success btn-xs" id="AddToGroupBtn" />
</p>
<div id="displayTable">
<table class="table">
<thead>
<tr>
<th class="filterableCol">
Name:
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.FullName)
</td>
<td>
<input type="button" class="btn btn-default" value="Delete" onclick="DeleteFromGroup('@item.UserID')" />
</td>
</tr>
}
</tbody>
</table>
</div>
<div class="modal fade" id="AddToGroup" tabindex="0" role="dialog" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog modal-lg" style="width:500px;">
<div class="modal-content">
<div class="modal-header" style="background-color: #fce0a3;">
<h3 class="modal-title">Add To Training Group</h3>
</div>
<div class="modal-body">
<p>New Group Name: </p>
@Html.DropDownList("UserID", new SelectList(test, "UserID", "FullName"))
</div>
<div class="modal-footer" style="background-color: #fce0a3; ">
<button type="button" class="btn btn-default" data-dismiss="modal" id="CloseAddToGroup">Save</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$('#displayTable').excelTableFilter();
$('#CloseAddToGroup').on('click', function () {
var SelectedUser = document.getElementById('UserID').value;
var SelectedGroup = @ViewBag.TrainingGroupId;
var sendInfo = {
userId: SelectedUser,
groupId: SelectedGroup
};
//alert(SelectedUser);
$.ajax({
type: "POST",
url: "/Admin/AddToGroup",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(sendInfo),
dataType: "json",
success: function (r) {
//var json = $.parseJSON(r);
alert('Success');
RefreshData();
},
error: function (req, status, error) {
alert(error);
}
});
$("#AddToGroup").modal('hide');
})
$('#AddToGroupBtn').on('click', function () {
$("#AddToGroup").modal('show');
return false;
})
function DeleteFromGroup(userId) {
var SelectedGroup = @ViewBag.TrainingGroupId;
var sendInfo = {
userId: userId,
groupId: SelectedGroup
};
$.ajax({
url: '@Url.Action("DeleteFromGroup", "Admin")',
contentType: "application/json; charset=utf-8",
type: 'POST',
data: JSON.stringify(sendInfo),
dataType: "json",
success: function() {
}
});
RefreshData();
}
function RefreshData() {
var SelectedGroup = @ViewBag.TrainingGroupId;
//alert(SelectedGroup);
var sendInfo = {
TrainingGroupID: SelectedGroup
};
$.ajax({
url: '@Url.Action("TrainingGroupPartial", "Admin")',
contentType: "application/json; charset=utf-8",
type: 'POST',
data: JSON.stringify(sendInfo),
//dataType: "json",
success: function(data) {
//alert('add success');
$("#DataDisplay").html(data);
}
});
}
</script>

View File

@ -0,0 +1,118 @@
@model IEnumerable<Fab2ApprovalSystem.Models.TrainingGroup>
<style>
tr:nth-child(even) {
background: #CCC
}
tr:nth-child(odd) {
background: #FFF
}
</style>
<p>
<input type="button" value="Add Training Group" class="btn btn-success btn-xs" id="AddTrainingGroup" />
</p>
<div id="displayTable">
<table class="table">
<thead>
<tr>
<th class="filterableCol">
Group Name:
</th>
<th>Actions:</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.TrainingGroupName)
</td>
<td>
<a href="~/Admin/ViewTrainingGroup?TrainingGroupID=@item.TrainingGroupID" class="btn btn-default">View/Edit Group</a>
@*<input type="button" class="btn btn-default" value="View/Edit Group" />*@
<input type="button" class="btn btn-default" value="Delete" onclick="DeleteGroup('@item.TrainingGroupID')" />
</td>
</tr>
}
</tbody>
</table>
</div>
<div class="modal fade" id="AddGroup" tabindex="0" role="dialog" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog modal-lg" style="width:500px;">
<div class="modal-content">
<div class="modal-header" style="background-color: #fce0a3;">
<h3 class="modal-title">Add Training Group</h3>
</div>
<div class="modal-body">
<p>New Group Name: </p>
<input type="text" id="GroupName" />
<input type="button" value="Save" onclick="SaveGroup()" />
</div>
<div class="modal-footer" style="background-color: #fce0a3; ">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$('#displayTable').excelTableFilter();
$(document).ready(function () {
//RefreshGroups();
});
function SaveGroup() {
groupName = document.getElementById('GroupName').value;
alert('test');
$.ajax({
type: "POST",
url: "/Admin/AddNewTrainingGroup",
contentType: "application/json; charset=utf-8",
data: '{"groupName":"' + groupName + '"}',
dataType: "json",
success: function () {
RefreshGroups();
},
error: function (req, status, error) {
alert(error);
}
});
$("#AddGroup").modal('hide');
}
$('#AddTrainingGroup').on('click', function () {
$("#AddGroup").modal('show');
return false;
})
function DeleteGroup(groupID) {
$.ajax({
type: "POST",
url: "/Admin/DeleteTrainingGroup",
contentType: "application/json; charset=utf-8",
data: '{"groupID":"' + groupID + '"}',
dataType: "json",
success: function () {
RefreshGroups();
},
error: function (req, status, error) {
alert(error);
}
});
}
function RefreshGroups() {
$.ajax({
url: '@Url.Action("TrainingGroups", "Admin")',
type: 'POST',
success: function(data) {
if (data) { // check if data is defined
$("#GroupsDisplay").html(data);
}
}
});
}
</script>

View File

@ -0,0 +1,119 @@
@{IEnumerable<Fab2ApprovalSystem.Models.LoginModel> allUsers = ViewBag.AllUsers;}
@{IEnumerable<Fab2ApprovalSystem.Models.LoginModel> TrainingReportUsers = ViewBag.CurrentReportUsers;}
@*<div class="titlebar col-sm-3" id="trainingNotificationTitle">
<div class="col-sm-1">
</div>
<div class="col-sm-1">
</div>
</div>*@
<style>
#viewContainer {
height:600px;
width:100%;
}
#TrainingReportControls{
background-color:white;
z-index:1000;
width:inherit;
}
#TrainingReportNotificationTable{
overflow-y:scroll;
position:relative;
height:500px;
}
</style>
<div id="viewContainer">
<div id="TrainingReportControls">
<h4>Training Report Notification</h4>
Add New User: @Html.DropDownList("TrainingReportUserID", new SelectList(allUsers, "UserID", "FullName"))<input type="button" value="Add" id="TrainingReportAddBtn" />
</div>
<div id="TrainingReportNotificationTable">
<table class="table">
<tr>
<th>Name</th>
<th>Actions</th>
</tr>
@foreach (var item in TrainingReportUsers)
{
<tr>
<td>@item.FullName</td>
<td><button type="button" class="btn btn-default" id="DeleteFromTrainingReportGroup" onclick="DeleteFromTrainingReportGroup('@item.UserID')">Delete</button></td>
</tr>
}
</table>
</div>
</div>
<script type="text/javascript">
$('#TrainingReportAddBtn').on('click', function () {
var SelectedUser = document.getElementById('TrainingReportUserID').value;
var sendInfo = {
userId: SelectedUser,
};
//alert(SelectedUser);
$.ajax({
type: "POST",
url: "/Admin/AddToTrainingReport",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(sendInfo),
dataType: "html",
success: function (r) {
alert(r);
RefreshTrainingReportData();
}
});
})
function DeleteFromTrainingReportGroup(userId) {
var sendInfo = {
userId: userId,
};
//alert(SelectedUser);
$.ajax({
type: "POST",
url: "/Admin/DeleteFromTrainingReport",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(sendInfo),
dataType: "html",
success: function (r) {
alert(r);
RefreshTrainingReportData();
}
});
}
function RefreshTrainingReportData() {
//alert(SelectedGroup);
var sendInfo = {
};
//alert("we get here")
$.ajax({
url: '@Url.Action("TrainingReportConfig", "Admin")',
contentType: "application/json; charset=utf-8",
type: 'POST',
data: JSON.stringify(sendInfo),
//dataType: "html",
success: function(data) {
//alert('add success');
$("#TrainingReportNotification").html(data);
}
});
}
</script>

View File

@ -0,0 +1,12 @@
@{
ViewBag.Title = "ViewTrainingGroup";
Layout = "~/Views/Admin/_AdminLayout.cshtml";
}
<script src="~/Scripts/excel-bootstrap-table-filter-bundle.js"></script>
<script src="~/Scripts/moment.js"></script>
<link rel="stylesheet" href="~/Content/excel-bootstrap-table-filter-style.css" />
<h2>View/Edit Training Group</h2>
<div id="DataDisplay">
@{Html.RenderAction("TrainingGroupPartial", "Admin", new { groupID = Convert.ToInt32(ViewBag.TrainingGroupId) });}
</div>

View File

@ -0,0 +1,69 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>@ViewBag.Title - Mesa Approval</title>
@Styles.Render("~/Content/kendo/css")
@Styles.Render("~/Content/css")
@*@Styles.Render("~/Content/jqw/css")*@
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/kendo")
@*<script src="~/Scripts/bootstrap.js"></script>
<script src="~/Scripts/respond.js"></script>*@
@Scripts.Render("~/bundles/bootstrap")
@*@Scripts.Render("~/Content/jqw/jq")*@
<script src="~/Scripts/excel-bootstrap-table-filter-bundle.js"></script>
<script src="~/Scripts/moment.js"></script>
<link rel="stylesheet" href="~/Content/excel-bootstrap-table-filter-style.css" />
</head>
<body class="navbar-inner">
<div class=" navbar navbar-inverse navbar-fixed-top">
<div >
<div class="navbar-header">
@if (Request.IsAuthenticated) {
@*@Html.ActionLink("Home", "Index", "Home", new { tabName = "MyTasks" }, new { @class = "navbar-brand" })*@
@Html.ActionLink("Home", "MyTasks", "Home", null, new { @class = "navbar-brand" })
}
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
@if ((bool)@Session[GlobalVars.IS_ADMIN])
{
<li>@Html.ActionLink("Admin", "Index", "Admin")</li>
}
</ul>
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
@(Html.Kendo().Menu()
.Name("menu")
.HtmlAttributes(new { style = "width:100%; font-size: 12px" })
.Items(menu =>
{
menu.Add().Text("Manage Users").Action("Index", "Admin");
menu.Add().Text("Manage Roles").Action("AssignRoles", "Admin");
menu.Add().Text("Manage Training Groups").Action("ManageTrainingGroups", "Admin");
menu.Add().Text("View All ECN Trainings").Action("ViewTrainings", "Training");
menu.Add().Text("Job Scheduler Configuration").Action("JobSchedulerConfiguration", "Admin");
}))
<div>
@RenderBody()
@*<hr />*@
<footer >
<p>&copy; @DateTime.Now.Year - Infineon Technologies</p>
</footer>
</div>
@RenderSection("scripts", required: false)
</body>
</html>