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,12 @@
@model IEnumerable<Fab2ApprovalSystem.Models.Training>
@{IEnumerable<Fab2ApprovalSystem.Models.TrainingGroup> trainingGroups = ViewBag.TrainingGroups;}
@{
ViewBag.Title = "Training Reports";
Layout = "~/Views/Home/_HomeLayout.cshtml";
}
<h2>Training Reports</h2>
<div id="DataDisplay">
@{Html.RenderAction("TrainingReportsView", "Training");}
</div>

View File

@ -0,0 +1,254 @@
@model IEnumerable<Fab2ApprovalSystem.Models.Training>
@{IEnumerable<Fab2ApprovalSystem.Models.TrainingGroup> trainingGroups = ViewBag.TrainingGroups;}
<style>
tr:nth-child(even) {
background: #CCC
}
tr:nth-child(odd) {
background: #FFF
}
#cover-spin {
position: fixed;
width: 100%;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: rgba(255,255,255,0.7);
z-index: 9999;
display: none;
}
@@-webkit-keyframes spin {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
@@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
#cover-spin::after {
content: '';
display: block;
position: absolute;
left: 48%;
top: 40%;
width: 40px;
height: 40px;
border-style: solid;
border-color: black;
border-top-color: transparent;
border-width: 4px;
border-radius: 50%;
-webkit-animation: spin .8s linear infinite;
animation: spin .8s linear infinite;
}
</style>
<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" />
<div id="cover-spin">
</div>
<button class="btn btn-default btn-primary" id="ResetFilters">Reset Filters</button>
<table class="table" id="displayTable">
<thead>
<tr>
<th class="filterableCol">
<div>ECN#</div>
</th>
<th class="filterableCol">
ECN Title
</th>
<th class="filterableCol" dateFormat="M/D/YYYY hh:mm:ss" isType="date">
Started Date
</th>
<th class="filterableCol" dateFormat="M/D/YYYY hh:mm:ss" isType="date">
Completed Date
</th>
<th>
Assigned Groups
<br />
@Html.DropDownList("GroupFilter", new SelectList(trainingGroups, "TrainingGroupID", "TrainingGroupName"), "- Select Group Filter -")
</th>
<th class="filterableCol">
Status
<br />
@*<select id="StatusFilter">
<option value="0">- Select an option -</option>
<option value="1">Complete</option>
<option value="2">In Progress</option>
<option value="3">Cancelled</option>
</select>*@
</th>
<th>
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.ECN)
</td>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.StartedDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.CompletedDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.ECNTrainingGroups)
</td>
@if (item.Deleted == true)
{
<td>Cancelled</td>
}
else
{
if (item.Status == true)
{
if (item.Deleted == true)
{
<td>Cancelled</td>
}
else
{
<td>Complete</td>
}
}
else
{
<td>In Progress</td>
}
}
<td>
<button class="btn btn-default btn-primary" id="ViewTraining" onclick="ViewTraining(@item.TrainingID)">View Training</button>
</td>
</tr>
}
</tbody>
</table>
<script type="text/javascript">
$('#displayTable').excelTableFilter();
$('#GroupFilter').on('change', function () {
$('#cover-spin').show(0);
var SelectedGroup = document.getElementById('GroupFilter').value;
var sendInfo = {
filterType: 1,
filterValue: SelectedGroup
};
//alert(SelectedUser);
$.ajax({
url: '@Url.Action("TrainingReportsView", "Training")',
contentType: "application/json; charset=utf-8",
type: 'POST',
data: JSON.stringify(sendInfo),
//dataType: "json",
success: function(data) {
//alert('add success');
$('#cover-spin').hide(0);
$("#DataDisplay").html(data);
}, error: function (jqXHR, textStatus, errorThrown) {
alert("There was an error while fetching the data. Please re-load the page. \n If continue to see this error please contact the system administrator");
$('#cover-spin').hide(0);
}
});
})
@*$('#StatusFilter').on('change', function () {
var SelectedStatus = document.getElementById('StatusFilter').value;
if (SelectedStatus != '0') {
var sendInfo = {
filterType: 2,
filterValue: SelectedStatus
};
$.ajax({
url: '@Url.Action("TrainingReportsView", "Training")',
contentType: "application/json; charset=utf-8",
type: 'POST',
data: JSON.stringify(sendInfo),
success: function(data) {
$("#DataDisplay").html(data);
}
});
}
})*@
function ViewTraining(trainingId) {
//var SelectedAssignment = document.getElementById('GroupFilter').value;
var sendInfo = {
trainingID: trainingId,
groupFilter: '@ViewBag.GroupFilter'
};
//alert(SelectedUser);
//alert('test')
$.ajax({
url: '@Url.Action("ViewTrainingAssignmentsReportView", "Training")',
contentType: "application/json; charset=utf-8",
type: 'POST',
data: JSON.stringify(sendInfo),
//dataType: "json",
success: function(data) {
//alert('add success');
$("#DataDisplay").html(data);
}
});
}
$('#ResetFilters').on('click', function () {
var SelectedGroup = document.getElementById('GroupFilter').value;
var sendInfo = {
filterType: 0,
filterValue: ''
};
//alert(SelectedUser);
$.ajax({
url: '@Url.Action("TrainingReportsView", "Training")',
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,282 @@
@model IEnumerable<Fab2ApprovalSystem.Models.TrainingDocAck>
@{
ViewBag.Title = "ViewMyTrainingAssignment";
Layout = "~/Views/Home/_HomeLayout.cshtml";
}
<h2>Training Assignment</h2>
@{if (ViewBag.IsCompleted == true)
{
<h5 style="color:red;">This assignment is completed.</h5>
} }
<a href="/Training/ViewMyTrainingAssignments" class="btn btn-primary">Back To My Training</a>
@{if (Model.Count() <= 0 && ViewBag.IsCompleted == false)
{
<button onclick="AssignmentReviewButton(@ViewBag.AssignmentID)" class="btn btn-primary">Confirm Training Review</button>
}
}
<style>
tr:nth-child(even) {
background: #CCC
}
tr:nth-child(odd) {
background: #FFF
}
#cover-spin {
position: fixed;
width: 100%;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: rgba(255,255,255,0.7);
z-index: 9998;
display: none;
}
#reviewMessage {
position: fixed;
width: 100%;
left: 0;
right: 0;
top: 0;
bottom: 0;
/*background-color: rgba(255,255,255,0.7);*/
z-index: 9999;
display: none;
}
@@-webkit-keyframes spin {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
@@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
#cover-spin::after {
content: '';
display: block;
position: absolute;
left: 48%;
top: 40%;
width: 40px;
height: 40px;
border-style: solid;
border-color: black;
border-top-color: transparent;
border-width: 4px;
border-radius: 50%;
-webkit-animation: spin .8s linear infinite;
animation: spin .8s linear infinite;
}
#reviewMessage p {
display: block;
position: absolute;
left: 28%;
top: 50%;
font-size: 40px;
}
</style>
<div id="cover-spin">
</div>
<div id="reviewMessage">
<p>Please review the downloaded document</p>
</div>
@{ if (Model.Count() > 0){
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.ECNNumber)
</th>
<th>
@Html.DisplayNameFor(model => model.DateReviewed)
</th>
<th>
@Html.DisplayNameFor(model => model.Reviewed)
</th>
<th>
@Html.DisplayNameFor(model => model.FileName)
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@{ViewBag.ECNNumber = item.ECNNumber;
}
@Html.ActionLink(item.ECNNumber.ToString(), "ReadOnly", "ECN", new { issueID = item.ECNNumber }, new { target = "_blank" })
</td>
<td>
@Html.DisplayFor(modelItem => item.DateReviewed)
</td>
@if (item.Reviewed == true)
{
<td>Reviewed</td>
}
else
{
<td>
Not Reviewed
</td>
}
@*<td>
@Html.DisplayFor(modelItem => item.Reviewed)
</td>*@
<td>
@*onclick="documentClick(@item.AttachmentID, @item.ECNNumber, @item.ID, @item.TrainingAssignmentID)">
@Html.DisplayFor(modelItem => item.FileName)*@
@if (ViewBag.IsCompleted == false)
{
<button onclick="documentClick(@item.AttachmentID, @item.ECNNumber, @item.ID, @item.TrainingAssignmentID)" class="btn btn-primary">@item.FileName</button>
}
</td>
<td></td>
</tr>
}
</table>
}}
<div>
@{Html.RenderAction("ECNTrainingView", "ECN", new { IssueID = Convert.ToInt32(ViewBag.ECNNumber) });}
</div>
<div class="modal fade" id="ConfirmReview" 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">Mark As Reviewed</h3>
</div>
<div class="modal-body">
<p>Do you want to mark the document as reviewed?</p>
<input type="button" class="btn" value="Yes" onclick="MarkAsReviewed()" />
</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">
var CurrAssignmentID = '';
var CurrId = '';
function documentClick(attachmentID, ecnNumber, trainingDockAckID, assignmentID) {
//window.open('http://messa016ec.ec.local:8021/ECN/DownloadFile?attachmentID=' + attachmentID + '&ecnNumber=' + ecnNumber, '_blank');
window.open('/ECN/DownloadFile?attachmentID=' + attachmentID + '&ecnNumber=' + ecnNumber, '_blank');
CurrAssignmentID = assignmentID;
CurrId = trainingDockAckID;
$('#cover-spin').show(0);
$('#reviewMessage').show(0);
setTimeout(AcknowledgeScreen, 60000);
//setTimeout(
// () => {
// $('#cover-spin').hide(0);
// $('#reviewMessage').hide(0);
// $("#ConfirmReview").modal('show');
// },
// 60 * 1000
//);
//MarkAsReviewed(assignmentID, trainingDockAckID)
}
function AcknowledgeScreen() {
$('#cover-spin').hide(0);
$('#reviewMessage').hide(0);
$("#ConfirmReview").modal('show');
}
function AssignmentReviewButton(AssignmentID) {
var sendInfo = {
trainingAssignmentID: AssignmentID,
};
$('#cover-spin').show(0);
$.ajax({
type: "POST",
url: "/Training/AcknowledgeReviewNoDocuments",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(sendInfo),
dataType: "json",
success: function (r) {
window.location.reload();
//window.location.reload();
//var json = $.parseJSON(r);
//alert('Success');
//RefreshDocs();
//RefreshDocs();
//RefreshData();
},
error: function (req, status, error) {
alert(error);
$('#cover-spin').hide(0);
}
});
//$("#ConfirmReview").modal('close');
//window.location.reload();
}
function MarkAsReviewed() {
console.log("Starting Review Timer");
//sleep(10000);
//alert(AttachmentId)
var sendInfo = {
trainingAssignmentID: CurrAssignmentID,
trainingDocAckID: CurrId
};
$('#cover-spin').show(0);
$.ajax({
type: "POST",
url: "/Training/AcknowledgeDocument",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(sendInfo),
dataType: "html",
success: function (r) {
window.location.reload();
//window.location.reload();
//var json = $.parseJSON(r);
//alert('Success');
//RefreshDocs();
//RefreshDocs();
//RefreshData();
},
error: function (req, status, error) {
alert(error);
$('#cover-spin').hide(0);
}
});
//$("#ConfirmReview").modal('close');
//console.log("Review Timer Finished");
}
</script>

View File

@ -0,0 +1,62 @@
@model IEnumerable<Fab2ApprovalSystem.ViewModels.ECNTrainingAssignments>
@{
ViewBag.Title = "View My Training Assignments";
Layout = "~/Views/Home/_HomeLayout.cshtml";
}
<h2>My Training Assignments</h2>
<style>
tr:nth-child(even){
background: #CCC
}
tr:nth-child(odd) {
background: #FFF
}
</style>
<table class="table">
<tr>
<th>
ECN#
</th>
<th>
Date Assigned
</th>
<th>
Date Completed
</th>
<th>
Status
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.ActionLink(item.ECN_ID.ToString(), "ReadOnly", "ECN", new { issueID = item.ECN_ID }, new { target = "_blank" })
@*@Html.DisplayFor(modelItem => item.ECN_ID)*@
</td>
<td>
@Html.DisplayFor(modelItem => item.DateAssigned)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateCompleted)
</td>
@if (item.Status)
{
<td>Completed</td>
}
else
{
<td>Not Completed</td>
}
<td>
@Html.ActionLink("View Documents", "ViewMyTrainingAssignment", new { assignmentID = item.TrainingAssignmentID, ECNNumber = item.ECN_ID})
</td>
</tr>
}
</table>

View File

@ -0,0 +1,315 @@
@model IEnumerable<Fab2ApprovalSystem.Models.TrainingAssignment>
@{
ViewBag.Title = "ViewTrainingAssignments";
Layout = "~/Views/Admin/_AdminLayout.cshtml";
}
<h2>View Training Assignments - ECN# @ViewBag.ECNNumber - @ViewBag.ECNTitle</h2>
@if (ViewBag.TrainingStatus == true)
{
<h4 style="color:green">Completed</h4>
}
else
{
<h4 style="color:red">In-Progress</h4>
}
<style>
tr:nth-child(even) {
background: #CCC
}
tr:nth-child(odd) {
background: #FFF
}
#cover-spin {
position: fixed;
width: 100%;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: rgba(255,255,255,0.7);
z-index: 9999;
display: none;
}
@@-webkit-keyframes spin {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
@@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
#cover-spin::after {
content: '';
display: block;
position: absolute;
left: 48%;
top: 40%;
width: 40px;
height: 40px;
border-style: solid;
border-color: black;
border-top-color: transparent;
border-width: 4px;
border-radius: 50%;
-webkit-animation: spin .8s linear infinite;
animation: spin .8s linear infinite;
}
</style>
<div id="cover-spin"></div>
@if (Session[GlobalVars.IS_ADMIN] != null)
{
<a href="/Training/ViewTrainings" class="btn btn-primary">Back To Trainings</a>
}
@Html.ActionLink("Go to ECN", "ReadOnly", "ECN", new { IssueID = Convert.ToInt32(ViewBag.ECNNumber) }, new { @class = "btn btn-primary" })
@if (Session[GlobalVars.IS_ADMIN] != null)
{
<button class="btn btn-primary" id="openAddUserBtn">Add User</button>
<button class="btn btn-primary" id="openAddGroupBtn">Add Group</button>
}
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.FullName)
</th>
<th>
@Html.DisplayNameFor(model => model.DateAssigned)
</th>
<th>
@Html.DisplayNameFor(model => model.DateCompleted)
</th>
<th>
@Html.DisplayNameFor(model => model.status)
</th>
@if (Session[GlobalVars.IS_ADMIN] != null)
{
<th>
</th>
<th>
</th>
}
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.FullName)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateAssigned)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateCompleted)
</td>
@if (item.status == true)
{
<td>Complete</td>
}
else
{
<td>Incomplete</td>
}
<td>
@if (Session[GlobalVars.IS_ADMIN] != null && item.status != true)
{
<button class="btn btn-primary" onclick="DeleteAssignment(@item.ID)">Delete</button>
}
</td>
<td>
@if (Session[GlobalVars.IS_ADMIN] != null && item.status != true)
{
<button id="ReminderButton" class="btn btn-primary" onclick="SendReminder(@item.UserID, @item.ID, @Convert.ToInt32(ViewBag.ECNNumber))">Remind</button>
}
</td>
</tr>
}
</table>
<div class="modal fade" id="AddUserForm" tabindex="0" role="dialog" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Manually add a user to an existing training</h4>
</div>
<input type="hidden" value="@ViewBag.TrainingId" id="txtTrainingId" />
<input type="hidden" value="@ViewBag.ECNNumber" id="txtEcnId" />
<div class="modal-body" style="background-color: #75adc6; font-size: 12px;">
Add New User: @Html.DropDownList("NewUserToAdd", new SelectList(ViewBag.AllUsers, "UserID", "FullName"))
</div>
<div class="modal-footer" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="btn btn-default" id="SaveAddUser">Add User</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="AddGroupForm" tabindex="0" role="dialog" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Manually add a group to an existing training</h4>
</div>
<input type="hidden" value="@ViewBag.TrainingId" id="txtTrainingId" />
<input type="hidden" value="@ViewBag.ECNNumber" id="txtEcnId" />
<div class="modal-body" style="background-color: #75adc6; font-size: 12px;">
Add New Group: @Html.DropDownList("NewGroupToAdd", new SelectList(ViewBag.AllGroups, "TrainingGroupID", "TrainingGroupName"))
</div>
<div class="modal-footer" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="btn btn-default" id="SaveAddGroup">Add Group</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script>
function DeleteAssignment(assignmentId) {
var sendInfo = {
assignmentID: assignmentId
};
$('#cover-spin').show(0);
$.ajax({
type: "POST",
url: "/Training/DeleteAssignment",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(sendInfo),
dataType: "json",
success: function (r) {
window.location.reload();
},
error: function (req, status, error) {
alert(error);
$('#cover-spin').hide(0);
}
});
}
function SendReminder(userId, assignmentId, ecnId) {
var sendInfo = {
userId: userId,
assignmentId: assignmentId,
ecnId: ecnId
};
$.ajax({
type: "POST",
url: "/Training/NotifyTrainee",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(sendInfo),
dataType: "json",
success: function (r) {
}
});
alert('Reminder Sent...');
}
$("#openAddUserBtn").on('click', function (e) {
ClearAddUserForm();
$("#AddUserForm").modal("show");
})
$("#openAddGroupBtn").on('click', function (e) {
ClearAddGroupForm();
$("#AddGroupForm").modal("show");
})
$('#SaveAddUser').on('click', function () {
$('#cover-spin').show(0);
var SelectedUser = document.getElementById('NewUserToAdd').value;
var ecnId = document.getElementById('txtEcnId').value;
var trainingId = document.getElementById('txtTrainingId').value;
if (SelectedUser != '') {
$.ajax({
url: "/Training/AddUserToTrainingAdHoc",
type: "POST",
datatype: "json",
data: {
trainingId: trainingId,
traineeId: SelectedUser,
ecnId: ecnId,
},
success: function (result) {
alert(result);
window.location.reload();
$("#AddUserForm").modal("hide");
$('#cover-spin').hide(0);
},
error: function (result) {
alert("Failed " + result);
$('#cover-spin').hide(0);
}
});
}
})
$('#SaveAddGroup').on('click', function () {
$('#cover-spin').show(0);
var SelectedGroup = document.getElementById('NewGroupToAdd').value;
var ecnId = document.getElementById('txtEcnId').value;
var trainingId = document.getElementById('txtTrainingId').value;
if (SelectedGroup != '') {
$.ajax({
url: "/Training/AddGroupToTrainingAdHoc",
type: "POST",
datatype: "json",
data: {
trainingId: trainingId,
groupId: SelectedGroup,
ecnId: ecnId,
},
success: function (result) {
alert(result);
window.location.reload();
$("#AddGroupForm").modal("hide");
$('#cover-spin').hide(0);
},
error: function (result) {
alert("Failed " + result);
$('#cover-spin').hide(0);
}
});
}
})
function ClearAddUserForm() {
document.getElementById('NewUserToAdd').value = '';
}
function ClearAddGroupForm() {
document.getElementById('NewGroupToAdd').value = '';
}
</script>

View File

@ -0,0 +1,191 @@
@model IEnumerable<Fab2ApprovalSystem.Models.TrainingAssignment>
@{IEnumerable<Fab2ApprovalSystem.Models.TrainingGroup> trainingGroups = ViewBag.TrainingGroups;}
<h2>View Training Assignments - ECN# @ViewBag.ECNNumber - @ViewBag.ECNTitle</h2>
<div id="buttons">
<button class="btn btn-default btn-primary" id="BackToTraining">Back To All Training</button>
@Html.ActionLink("Go to ECN", "ReadOnly", "ECN", new { IssueID = Convert.ToInt32(ViewBag.ECNNumber) }, new { @class = "btn btn-primary" })
<button class="btn btn-default btn-primary" id="ResetFilters">Reset Filters</button>
</div>
@if (ViewBag.TrainingStatus == true)
{
<h4 style="color:green">Completed - @ViewBag.PercentComplete</h4>
}
else
{
<h4 style="color:red">In-Progress - @ViewBag.PercentComplete</h4>
}
<style>
tr:nth-child(even) {
background: #CCC
}
tr:nth-child(odd) {
background: #FFF
}
</style>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.FullName)
</th>
<th>
@Html.DisplayNameFor(model => model.DateAssigned)
</th>
<th>
@Html.DisplayNameFor(model => model.DateCompleted)
</th>
<th>
Group Filter
<br />
@Html.DropDownList("GroupFilter", new SelectList(trainingGroups, "TrainingGroupID", "TrainingGroupName"), "- Select Group Filter -")
</th>
<th>
@Html.DisplayNameFor(model => model.status)
<br />
<select id="StatusFilter">
<option value="0">- Select an option -</option>
<option value="1">Complete</option>
<option value="2">Incomplete</option>
<option value="3">Cancelled</option>
</select>
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.FullName)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateAssigned)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateCompleted)
</td>
<td></td>
@if (item.status == true)
{
if (item.Deleted == true)
{
<td>Cancelled</td>
}
else
{
<td>Complete</td>
}
}
else
{
<td>Incomplete</td>
}
</tr>
}
</table>
<script>
$('#BackToTraining').on('click', function () {
//var SelectedGroup = document.getElementById('GroupFilter').value;
var sendInfo;
var groupFilter = '@ViewBag.GroupFilter';
if (groupFilter == '') {
sendInfo = {
filterType: 0,
filterValue: ''
};
}
else {
sendInfo = {
filterType: 1,
filterValue: groupFilter
};
}
//alert(SelectedUser);
$.ajax({
url: '@Url.Action("TrainingReportsView", "Training")',
contentType: "application/json; charset=utf-8",
type: 'POST',
data: JSON.stringify(sendInfo),
//dataType: "json",
success: function(data) {
//alert('add success');
$("#DataDisplay").html(data);
}
});
})
$('#StatusFilter').on('change', function () {
var SelectedStatus = document.getElementById('StatusFilter').value;
if (SelectedStatus != '0') {
var sendInfo = {
trainingID: @ViewBag.trainingID,
statusFilter: SelectedStatus,
groupFilter: '@ViewBag.GroupFilter'
};
$.ajax({
url: '@Url.Action("ViewTrainingAssignmentsReportView", "Training")',
contentType: "application/json; charset=utf-8",
type: 'POST',
data: JSON.stringify(sendInfo),
success: function(data) {
$("#DataDisplay").html(data);
}
});
}
})
$('#GroupFilter').on('change', function () {
var SelectedGroup = document.getElementById('GroupFilter').value;
var SelectedStatus = document.getElementById('StatusFilter').value;
if (SelectedGroup != '0') {
var sendInfo = {
trainingID: @ViewBag.trainingID,
statusFilter: SelectedStatus,
groupFilter: SelectedGroup
};
$.ajax({
url: '@Url.Action("ViewTrainingAssignmentsReportView", "Training")',
contentType: "application/json; charset=utf-8",
type: 'POST',
data: JSON.stringify(sendInfo),
success: function(data) {
$("#DataDisplay").html(data);
}
});
}
})
$('#ResetFilters').on('click', function () {
var sendInfo = {
trainingID: @ViewBag.trainingID,
statusFilter: ""
};
//alert(SelectedUser);
$.ajax({
url: '@Url.Action("ViewTrainingAssignmentsReportView", "Training")',
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,44 @@
@model IEnumerable<Fab2ApprovalSystem.Models.TrainingDocAck>
<table class="table" id="fileTable">
<tr>
<th>
@Html.DisplayNameFor(model => model.FileName)
</th>
<th>
@Html.DisplayNameFor(model => model.Reviewed)
</th>
<th>
</th>
<th></th>
</tr>
@foreach (var item in Model) {
int i = 0;
<tr>
<td class="FileName">
<a href="#" onclick="MarkAsReviewed()" data-id="@item.FileName">@item.FileName</a>
</td>
@if (item.Reviewed == true)
{
<td>Complete</td>
}
else
{
<td>Incomplete</td>
}
</tr>
}
</table>
<script type="text/javascript">
$('#fileTable').on('click', '.FileName', function (event) {
var item = $(event.target).parent()
var isItemCompleted = item.hasClass('completed')
var itemId = item.attr('data-id')
alert('clicked item ' + itemId + ', which has completed currently set to ' + isItemCompleted)
})
</script>

View File

@ -0,0 +1,107 @@
@model IEnumerable<Fab2ApprovalSystem.Models.TrainingDocAck>
<table class="table" id="fileTable">
<tr>
<th>
@Html.DisplayNameFor(model => model.FileName)
</th>
<th>
@Html.DisplayNameFor(model => model.Reviewed)
</th>
<th>
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
int i = 0;
<tr>
<td class="FileName">
<a href="@item.FileName.ToString()" target="_blank" onclick="MarkAsReviewed(@item.TrainingAssignmentID, @item.ID)">@item.FileName</a>
@Html.ActionLink(item.FileName,"DownloadFile", item.AttachmentID)
</td>
@if (item.Reviewed == true)
{
<td>Complete</td>
}
else
{
<td>Incomplete</td>
}
</tr>
}
</table>
<script type="text/javascript">
//$('.FileName').on('click', '.FileName', function (event) {
// var item = $(event.target).parent()
// alert(item)
// var isItemCompleted = item.hasClass('completed')
// var itemId = item.attr('attachment-id')
// alert('clicked item ' + itemId + ', which has completed currently set to ' + isItemCompleted)
//})
function MarkAsReviewed(AssignmentID, ID) {
console.log("Starting Review Timer");
//sleep(10000);
//alert(AttachmentId)
var sendInfo = {
trainingAssignmentID: AssignmentID,
trainingDocAckID: ID
};
$.ajax({
type: "POST",
url: "/Training/AcknowledgeDocument",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(sendInfo),
dataType: "json",
success: function (r) {
//var json = $.parseJSON(r);
//alert('Success');
RefreshDocs();
//RefreshDocs();
//RefreshData();
},
error: function (req, status, error) {
alert(error);
}
});
console.log("Review Timer Finished");
}
function sleep(milliseconds) {
const date = Date.now();
let currentDate = null;
do {
currentDate = Date.now();
} while (currentDate - date < milliseconds);
}
function RefreshDocs() {
var trainingAssignmentID = @ViewBag.trainingAssignmentId;
//alert(SelectedGroup);
var sendInfo = {
trainingAssignmentId: trainingAssignmentID
};
$.ajax({
url: '@Url.Action("ViewTrainingDocsPartial", "Training")',
contentType: "application/json; charset=utf-8",
type: 'POST',
data: JSON.stringify(sendInfo),
//dataType: "json",
success: function(data) {
//alert('add success');
$("#docsDisplay").html(data);
}
});
}
</script>

View File

@ -0,0 +1,103 @@
@model IEnumerable<Fab2ApprovalSystem.Models.TrainingAssignment>
<input type="hidden" value="@ViewBag.ECNNumber" id="ECNNumber"/>
<table class="table">
<tr>
<th>
Name
</th>
<th>
Date Assigned
</th>
<th>
Date Completed
</th>
<th>
Status
</th>
<th></th>
</tr>
@foreach (var item in Model) {
if (item.UserID.ToString() == Session[GlobalVars.SESSION_USERID].ToString() || Session[GlobalVars.IS_ADMIN] != null)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.FullName)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateAssigned)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateCompleted)
</td>
@if (item.status == true)
{
<td>Acknowledged</td>
}
else
{
<td>Not Acknowledged</td>
}
<td>
<button type="button" class="btn btn-default" id="CompleteTraining" onclick="CompleteTraining(@item.ID)">Complete Training</button>
</td>
</tr>
}
}
</table>
@foreach (var item in Model)
{
<div class="modal fade" id="DocumentWin" 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">
<h4 class="modal-title" id="myModalLabel">Review Affected Documents - </h4>
</div>
<div class="modal-body" id="docsDisplay">
@{Html.RenderAction("ViewTrainingDocsPartial", "Training", new { trainingAssignmentId = item.ID});}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
}
<script type="text/javascript">
function CompleteTraining(AssignmentID) {
$("#DocumentWin").modal('show');
}
$('#CompleteTraining').on('click', function () {
$("#DocumentWin").modal('show');
//GetDocuments();
return false;
})
function GetDocuments() {
var ecnNumber = document.getElementById('ECNNumber').value;
var sendInfo = {
ecnNumber: ecnNumber
};
$.ajax({
type: "POST",
url: "/ECN/Attachment_Read",
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);
}
});
}
</script>

View File

@ -0,0 +1,284 @@
@model IEnumerable<Fab2ApprovalSystem.Models.Training>
@{
ViewBag.Title = "View Trainings";
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 Trainings</h2>
<style>
tr:nth-child(even) {
background: #CCC
}
tr:nth-child(odd) {
background: #FFF
}
#cover-spin {
position: fixed;
width: 100%;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: rgba(255,255,255,0.7);
z-index: 9999;
display: none;
}
@@-webkit-keyframes spin {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
@@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
#cover-spin::after {
content: '';
display: block;
position: absolute;
left: 48%;
top: 40%;
width: 40px;
height: 40px;
border-style: solid;
border-color: black;
border-top-color: transparent;
border-width: 4px;
border-radius: 50%;
-webkit-animation: spin .8s linear infinite;
animation: spin .8s linear infinite;
}
</style>
<div id="cover-spin">
</div>
<button id="ShowManualExecutionForm">Manually Execute an ECN Training</button>
<div id="displayTable">
<table class="table">
<thead>
<tr>
<th class="filterableCol">
ECN#
</th>
<th class="filterableCol">
ECN Title
</th>
<th class="filterableCol" dateFormat="M/D/YYYY hh:mm:ss" isType="date">
Started Date
</th>
<th class="filterableCol" dateFormat="M/D/YYYY hh:mm:ss" isType="date">
Completed Date
</th>
<th>
Assigned Groups
<br />
@Html.DropDownList("GroupFilter", new SelectList(ViewBag.TrainingGroups, "TrainingGroupID", "TrainingGroupName"), "- Select Group Filter -")
</th>
<th class="filterableCol">
Status
</th>
<th>
</th>
<th>
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
if (item.Deleted != true)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.ECN)
</td>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.StartedDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.CompletedDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.ECNTrainingGroups)
</td>
@if (item.Status == true)
{
<td>Complete</td>
}
else
{
<td>In Progress</td>
}
<td>
@Html.ActionLink("View", "ViewTrainingAssignments", new { trainingID = item.TrainingID }, new { @class = "btn btn-primary" })
</td>
@if ((bool)Session[GlobalVars.IS_ADMIN] == true)
{
<td>
@Html.ActionLink("Delete", "DeleteTrainingByID", new { trainingId = item.TrainingID }, new { @class = "btn btn-primary" })
</td>
}
</tr>
}
}
</tbody>
</table>
</div>
<div class="modal fade" id="ManualECNTrainingExecuteForm" tabindex="0" role="dialog" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Manually Execute a Training - Use Sparingly as this will delete any existing training and start a new one.</h4>
</div>
<div class="modal-body" id="CAFindingsAttachmentContainer" style="background-color: #75adc6; font-size: 12px;">
<label for="ecnNumberToExecute">ECN#: </label>
<input type="text" id="ecnNumberToExecute" />
<button type="button" class="btn btn-default" id="CheckECN">Check ECN</button>
<label for="CheckECN" id="ECNCheckMessage"></label>
<div id="TrainingGroupOptions" >
@(Html.Kendo().MultiSelect()
.Name("TrainingGroupIDs")
.BindTo(new SelectList(ViewBag.AllGroups, "TrainingGroupID", "TrainingGroupName"))
.HtmlAttributes(new { style = "font-size:10px" })
.Value(ViewBag.Nothing)
)
</div>
</div>
<div class="modal-footer" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="btn btn-default" id="ExecuteManualTraining">Execute</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script>
$('#displayTable').excelTableFilter();
$('#GroupFilter').on('change', function () {
$('#cover-spin').show(0);
var SelectedGroup = $('#GroupFilter').val();
var url = '@Html.Raw(Url.Action("ViewTrainings", "Training", new { filterType = 1, filterValue = "Group" }))';
url = url.replace('Group', SelectedGroup);
window.location.href = url;
$('#cover-spin').hide(0);
})
$("#ShowManualExecutionForm").on('click', function (e) {
ClearECNTrainingExecuteForm();
$("#ManualECNTrainingExecuteForm").modal("show");
})
$("#ExecuteManualTraining").on('click', function () {
$('#cover-spin').show(0);
var ecnId = $("#ecnNumberToExecute").val();
var trainingGroupIds = $("#TrainingGroupIDs").data("kendoMultiSelect").value();
trainingGroupIds = trainingGroupIds;
console.log(trainingGroupIds);
//trainingGroupIds = trainingGroupIds.join();
if (trainingGroupIds == '') {
$('#ECNCheckMessage').text("Please select training groups to assign to.");
$('#ECNCheckMessage').css("color", "red");
return;
}
//alert(trainingGroupIds);
if (ecnId != '' || ecnId != null) {
if (confirm("Are you sure you want to execute this training?")) {
var sendData = {
ecnId: ecnId,
trainingGroupsIn: trainingGroupIds
}
$.ajax({
url: "/Training/ManuallyExecuteECNTraining",
type: "POST",
datatype: "json",
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(sendData),
success: function (data) {
alert(data);
$("#ManualECNTrainingExecuteForm").modal("hide");
$('#cover-spin').hide(0);
},
error: function (result) {
alert("Failed " + result);
$('#cover-spin').hide(0);
}
});
}
}
else {
alert('No ECN ID entered');
$('#cover-spin').hide(0);
}
})
$("#CheckECN").on('click', function () {
$('#ECNCheckMessage').text("");
var ecnId = $("#ecnNumberToExecute").val();
if (ecnId != '') {
$.ajax({
url: "/Training/CheckECN",
type: "POST",
datatype: "json",
data: {
ecnId: ecnId
},
success: function (result) {
$(result).each(function (i, val) {
console.log(val);
});
$("#TrainingGroupIDs").data("kendoMultiSelect").value(result)
$('#ECNCheckMessage').text("ECN Found.");
$('#ECNCheckMessage').css("color", "green");
if (result.indexOf("ECN not yet approved.") > 0) {
$('#ECNCheckMessage').text("ECN found, but not yet approved. Please approve before continuing.");
$('#ECNCheckMessage').css("color", "red");
}
},
error: function (result) {
$('#ECNCheckMessage').text("Error Getting ECN");
$('#ECNCheckMessage').css("color", "red");
}
});
}
else {
$('#ECNCheckMessage').text("Please enter an ECN number...");
$('#ECNCheckMessage').css("color", "red");
}
})
function ClearECNTrainingExecuteForm() {
$("#ecnNumberToExecute").val('');
}
</script>